Skip to content

Commit fd0505b

Browse files
authored
Merge pull request #1801 from IrAlfred/fix-assets-path-web-relative
fix(other): fix asset download links when Cypht is installed outside web root
2 parents 694ddc9 + 4acec96 commit fd0505b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/config_gen.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,15 @@ function create_production_site($assets, $settings, $hashes) {
372372
copy('site.js', 'site/site.js');
373373
append_bootstrap_icons_files();
374374

375+
// Copy main assets directory
376+
if (is_readable('assets/')) {
377+
printf("copying assets directory...\n");
378+
copy_recursive('assets');
379+
}
380+
375381
$index_file = file_get_contents('index.php');
376382
$index_file = preg_replace("/APP_PATH', ''/", "APP_PATH', '".APP_PATH."'", $index_file);
383+
$index_file = preg_replace("/ASSETS_PATH', APP_PATH\.'assets\/'/", "ASSETS_PATH', WEB_ROOT.'assets/'", $index_file);
377384
$index_file = preg_replace("/CACHE_ID', ''/", "CACHE_ID', '".urlencode(Hm_Crypt::unique_id(32))."'", $index_file);
378385
$index_file = preg_replace("/SITE_ID', ''/", "SITE_ID', '".urlencode(Hm_Crypt::unique_id(64))."'", $index_file);
379386
$index_file = preg_replace("/DEBUG_MODE', true/", "DEBUG_MODE', false", $index_file);

0 commit comments

Comments
 (0)