From: Matteo Nastasi Date: Sun, 13 Sep 2026 10:37:13 +0000 (+0200) Subject: custom.js is optional, and the page no longer demands it X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=225e0fbe4b55801315dcb945eb6e75d5b702b1c0;p=brisk.git custom.js is optional, and the page no longer demands it index.php always loaded it, but custom.js holds the customisations of the single site and may not be distributed: whoever installs from scratch got a 404 on every page load, on both branches of the layout. The tag is now emitted only if the file is really there. The hook it uses (custom_bedge) was already guarded on the javascript side, so without the file the room behaves exactly as it always has. Same approach as cookie_law.* and brisk_donate.txt: what belongs to a single installation must not break the others. Checked in the container: with the file the page references it and downloads it (200), without the file the page is served complete, does not name it and nginx logs no 404. Both occurrences were tried, the one on the entry page and the one in the room. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_014M1jiEq9cHdE5SE5j6vFuE --- diff --git a/web/index.php b/web/index.php index b87af37..40a7204 100644 --- a/web/index.php +++ b/web/index.php @@ -359,6 +359,15 @@ function index_main(&$brisk, $transp_type, $header, &$header_out, $remote_addr_f GLOBAL $G_with_poll; GLOBAL $G_lang, $G_lng, $mlang_room; GLOBAL $BRISK_SHOWHTML, $BRISK_DEBUG, $_SERVER, $_COOKIE; + GLOBAL $G_base; + + /* custom.js is optional: it holds the customisations of the single site + and may not be distributed. The hook it uses (custom_bedge) is already + guarded in room.js, but without this check the browser would ask for a + file that does not exist on every page. */ + $custom_js = (file_exists($G_base."custom.js") ? + sprintf('', + BSK_BUSTING) : ""); $transp_port = ((array_key_exists("X-Forwarded-Proto", $header) && $header["X-Forwarded-Proto"] == "https") ? 443 : 80); @@ -1044,7 +1053,7 @@ supported by:
- + @@ -1218,7 +1227,7 @@ cookie_law(null); - +