Apam wrote to All <=-
I'm mucking around in JS, and am creating a gemini service for
synchronet. It serves files in /sbbs/text/gemini/ (not exactly hard
coded, i'm using system.text_dir + "gemini".)
Hi
I'm mucking around in JS, and am creating a gemini service for synchronet. It serves files in /sbbs/text/gemini/ (not exactly hard coded, i'm using system.text_dir + "gemini".)
First question, is it possible in synchronet javascript to determine the mime-type of a file?
At present I'm just using a switch statement based on the extension - is this the best way to do things?
The second question, I'd like to add cgi type interface, which would load javascript files from the gemini root. I'm unsure how to execute another javascript file from within a service javascript file (or at all).
On Mon May 23 11:49:00 2022, Digital Man wrote to Apam <=-
First question, is it possible in synchronet javascript to determine the mime-type of a file?
You could load ctrl/mime_types.ini using the File class and compare the extension.
The second question, I'd like to add cgi type interface, which would load javascript files from the gemini root. I'm unsure how to execute another javascript file from within a service javascript file (or at all).
load(), require() and js.exec() are used to execute a JS file from a JS file.
On Mon May 23 11:49:00 2022, Digital Man wrote to Apam <=-
load(), require() and js.exec() are used to execute a JS file from a JS file.
On Mon May 23 11:49:00 2022, Digital Man wrote to Apam <=-
load(), require() and js.exec() are used to execute a JS file from a JS file.
I think I need to use js.exec.apply() so I can pass the query argument.. but can't seem to find any information on it..
I see it's used in install-xtrn
var result = js.exec.apply(null
,[js_file, item.startup_dir, {}].concat(js_args));
but unsure what that first null is.
js.exec() is a function, so: https://developer.mozilla.org/en-US/docs/Web/JavaS
Sysop: | Xerxes |
---|---|
Location: | Azle, Texas |
Users: | 131 |
Nodes: | 10 (0 / 10) |
Uptime: | 94:56:04 |
Calls: | 3,190 |
Calls today: | 1 |
Files: | 195 |
U/L today: |
0 files (0K bytes) |
D/L today: |
0 files (0K bytes) |
Messages: | 366,148 |
Posted today: | 0 |