• Couple of JS Questions

    From Apam@VERT/POSITRON to All on Mon May 23 19:34:28 2022
    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).ããAndrewãã---ã þ Synchronet þ The Positronic Brainã
  • From poindexter FORTRAN@VERT/REALITY to Apam on Mon May 23 06:36:00 2022
    Apam wrote to All <=-ãã Ap> I'm mucking around in JS, and am creating a gemini service forã Ap> synchronet. It serves files in /sbbs/text/gemini/ (not exactly hardã Ap> coded, i'm using system.text_dir + "gemini".)ãã <ears perked in Apam's direction>ããããã... Are there sections? Consider transitionsã--- MultiMail/DOS v0.52ã þ Synchronet þ .: realitycheckbbs.org :: scientia potentia est :.ã
  • From Digital Man@VERT to Apam on Mon May 23 11:49:04 2022
    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ã
  • From Apam@VERT/POSITRON to Digital Man on Tue May 24 09:54:00 2022
    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.ã ãGreat. That's what I'm now doing.ãã > > 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.ããThanks! I've not done this yet, but will soon.ããIf anyone is interested in looking at it, I put it up here:ããhttps://github.com/apamment/geminiservããAndrewãã--ãAndrew Pamment (apam)ãã=== TitanMail/linux v1.1.5ãã---ã þ Synchronet þ The Positronic Brainã
  • From Apam@VERT/POSITRON to Digital Man on Tue May 24 10:18:00 2022
    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.ããAndrewãã--ãAndrew Pamment (apam)ãã=== TitanMail/linux v1.1.5ãã---ã þ Synchronet þ The Positronic Brainã
  • From Digital Man@VERT to Apam on Mon May 23 22:00:05 2022
    Re: Couple of JS Questionsã By: Apam to Digital Man on Tue May 24 2022 10:18 amãã > -=> 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/JavaScript/Reference/Global_Objects/Function/applyã-- ã digital man (rob)ããRush quote #19:ãRebel without a conscience, martyr without a causeãNorco, CA WX: 57.6øF, 87.0% humidity, 2 mph SE wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Apam@VERT/POSITRON to Digital Man on Wed May 25 08:16:36 2022
    Re: Couple of JS Questionsã By: Digital Man to Apam on Mon May 23 2022 10:00 pmãã DM> js.exec() is a function, so:ã DM> https://developer.mozilla.org/en-US/docs/Web/JavaSããThanks! I feel like such a newbie lol I had assumed it was a synchronet command and was going through the synchronet javascript stuff on the wiki.ããAndrewãã---ã þ Synchronet þ The Positronic Brainã
  • From nolageek@VERT/CAPSHRIL to Digital Man on Tue Jun 14 23:57:31 2022
    Re: Couple of JS Questionsã By: Digital Man to Apam on Mon May 23 2022 10:00 pmããI'm working on a mod to turn on a light when I have active nodes - however sometimes the light will stay on after someone logs off, even when no one else is logged in - but there is a active connection by a bot, scanner, or network call of some kind. I'm currently using server.clients to get this number but it's leaving the light on (and not in a good Motel 6 kind of way)ããIs there a better way to get the number of actual nodes with a user actually logged in?ã ã|01> |15n|03ola|15g|03eek |10<|02phenom|10>|07 ã|05> |12C|04APiT0L |12S|04HRiLL|07ãã---ã þ Synchronet þ Capitol Shrill BBS - Washington, DC - capitolshrill.comã
  • From Digital Man@VERT to nolageek on Tue Jun 14 22:59:19 2022
    Re: Getting number of active nodesã By: nolageek to Digital Man on Tue Jun 14 2022 11:57 pmãã > Re: Couple of JS Questionsã > By: Digital Man to Apam on Mon May 23 2022 10:00 pmã >ã > I'm working on a mod to turn on a light when I have active nodes - howeverã > sometimes the light will stay on after someone logs off, even when no oneã > else is logged in - but there is a active connection by a bot, scanner, orã > network call of some kind. I'm currently using server.clients to get thisã > number but it's leaving the light on (and not in a good Motel 6 kind of way)ã >ã > Is there a better way to get the number of actual nodes with a user actuallyã > logged in?ããIterate through the system.node_list array and count up how many have a status property value of NODE_INUSE (defined in load/nodedefs.js). Or just simply set/return true if *any* of them are in-use (you don't need the actual total).ããThat should leave the light on for ya only when there's an actual rent-paying customer. :-)ã-- ã digital man (rob)ããRush quote #70:ãHe's got a problem with his power, with weapons on patrol .. New World ManãNorco, CA WX: 66.4øF, 78.0% humidity, 1 mph SE wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã