• Saving data in custom module

    From Sam Alexander@VERT/BAUDOT to All on Friday, March 25, 2022 15:13:06
    I'm probably overlooking this in the docs, but if I'm building a custom module how can I save data back to the Synchronet database or elsewhere? I'm still really foggy in how Sync saves data to the file system. I'm playing with some ideas for custom modules which will need to save data back, just not sure how
    to do this.

    Appriciate the input.

    ---
    ■ Synchronet ■ Camping on the Internet at Camp Baudot BBS - campbaudot.com
  • From echicken@VERT/ECBBS to Sam Alexander on Friday, March 25, 2022 16:32:44
    Re: Saving data in custom module
    By: Sam Alexander to All on Fri Mar 25 2022 15:13:06

    I'm probably overlooking this in the docs, but if I'm building a custom module how can I save data back to the Synchronet database or elsewhere? I'm still really foggy in how Sync saves data to the file system. I'm playing with some ideas for custom modules which will need to save data back, just not sure how to do this.

    There are a lot of different ways. Synchronet and its modules don't store all of their data in any one place following any one format.

    The exec/load/userprops.js library lets you set per-user keys and values arbitrarily.

    The built-in File class lets you do typical file IO stuff. It's documented in jsobjs.html* and there are many usage examples in exec/. Create your own file wherever you like and put whatever you want in it. You can use it with ini files and with JSON.parse/JSON.stringify if you like.

    There's the JSON-DB service, which lets you share a JS object among multiple clients including remote BBSs. Has a subscription feature so it'll push real-time updates to clients.

    The user, message, and file databases can all be interacted with from JS. See the User class, the MsgBase class, the FileBase class in jsobjs.html*.

    * https://synchro.net/docs/jsobjs.html

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    ---
    ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com
  • From Nightfox@VERT/DIGDIST to Sam Alexander on Friday, March 25, 2022 09:28:51
    Re: Saving data in custom module
    By: Sam Alexander to All on Fri Mar 25 2022 03:13 pm

    I'm probably overlooking this in the docs, but if I'm building a custom module how can I save data back to the Synchronet database or elsewhere? I'm still really foggy in how Sync saves data to the file system. I'm playing with some ideas for custom modules which will need to save data back, just not sure how to do this.

    I don't know of a general "Synchronet database" for generic data, but its JavaScript has a File class that you could use to write data to a file on the drive:
    http://www.synchro.net/docs/jsobjs.html#File_class

    Nightfox

    ---
    ■ Synchronet ■ Digital Distortion: digitaldistortionbbs.com
  • From Andre@VERT/RDOMENTR to echicken on Friday, March 25, 2022 14:17:56
    Re: Saving data in custom module
    By: echicken to Sam Alexander on Fri Mar 25 2022 04:32 pm

    There are a lot of different ways. Synchronet and its modules don't store all of their data in any one place following any one format.

    Lemme go quick make a gitlab issue for "Windows Registry style of data storage."


    - Andre

    ---
    ■ Synchronet ■ Radio Mentor BBS - bbs.radiomentor.org
  • From Nightfox@VERT/DIGDIST to Andre on Friday, March 25, 2022 13:46:11
    Re: Saving data in custom module
    By: Andre to echicken on Fri Mar 25 2022 02:17 pm

    There are a lot of different ways. Synchronet and its modules don't
    store all of their data in any one place following any one format.

    Lemme go quick make a gitlab issue for "Windows Registry style of data storage."

    https://youtu.be/31g0YE61PLQ

    Nightfox

    ---
    ■ Synchronet ■ Digital Distortion: digitaldistortionbbs.com
  • From Ragnarok@VERT/DOCKSUD to Andre on Wednesday, March 30, 2022 19:15:25
    El 25/3/22 a las 16:17, Andre escribi¢:
    Re: Saving data in custom module
    By: echicken to Sam Alexander on Fri Mar 25 2022 04:32 pm

    ec> There are a lot of different ways. Synchronet and its modules don't store
    ec> all of their data in any one place following any one format.

    Lemme go quick make a gitlab issue for "Windows Registry style of data storage."


    you can use ini style files too and your future module can be more
    portable, windows registry sucks

    ---
    þ Synchronet þ Dock Sud BBS TLD 24 HS - bbs.docksud.com.ar