Subj : Couple of JS Questions
To   : Apam
From : Digital Man
Date : Mon May 23 2022 11:49 am

 Re: Couple of JS Questions
 By: Apam to All on Mon May 23 2022 07:34 pm

> 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?

You could load ctrl/mime_types.ini using the File class and compare the extension.

> At present I'm just using a switch statement based on the extension - is
> this the best way to do things?

Ideally, you'd use the same mime_types.ini file used by the web server.

> 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.
--
                                           digital man (rob)

Synchronet/BBS Terminology Definition #90:
UTF-8 = 8-bit Unicode Transformation Format
Norco, CA WX: 66.8�F, 69.0% humidity, 8 mph SSE wind, 0.00 inches rain/24hrs

---
� Synchronet � Vertrauen � Home of Synchronet � [vert/cvs/bbs].synchro.net