https://gitlab.synchro.net/main/sbbs/-/commit/75350cfe909f76aab650a485
Modified Files:
exec/archive.js inventory_archives.js exec/load/filecontents_lib.js exec/tests/filecontents_test.js exec/webfileindex.ssjs
Log Message:
filecontents: load the library into its own scope
A script's top-level declarations land on the global object, so loading this with a bare load() put about twenty filecontents_* names there on every web request and every archive view. load({}, ...) keeps them on the returned
object instead, which is how the other multi-consumer libraries here are loaded, and lets the internals drop the prefix.
This is hygiene, not protection. Scoping the library does not stop a consumer from shadowing a global that the library reads: the scope object is prepended to the chain rather than substituted for it, so a free name still resolves outward to the global, where a caller's top-level function has replaced it. Reading metadata through the File object is what addresses that, and stays necessary.
Internal read() and write() become read_store() and write_store(), the originals having shadowed the Synchronet globals of those names inside the library's own scope.
#1247
Co-Authored-By: Claude Opus 5 (1M context) <
noreply@anthropic.com>
--- SBBSecho 3.37-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)