• First World Problems.

    From Accession@VERT/PHARCYDE to Digital Man on Thu Mar 3 12:01:00 2016
    Hello Digital Man,

    What would the *correct* way be to run nano from a javascript?

    I've tried..

    system.exec("/usr/bin/nano");
    bbs.exec("/usr/bin/nano",mode=EX_NATIVE);

    ..and neither of them seem to work. Synchronet runs as root so permissions are not an issue.

    If it isn't possible, or shouldn't be done, then I was wondering if some kind of stacking could be done in the "External Editor" section. Say if you used the same internal code for two External Editor entries, it would run the first one, then the second?

    I'm trying to run a javascript (which tinkers with /sbbs/node?/MSGTMP) before nano loads, but during the same process. And while the script seems to work fine when NOT trying to load nano in it (it rewrites MSGTMP and posts the reply, but without nano able to load, the reply is unable to be edited), and nano will load from the External Editors menu by itself, I'd like to do both in one shot if at all possible.

    Regards,
    Nick

    --- GoldED+/LNX 1.1.5-b20160201
    þ Synchronet þ thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin)
  • From Digital Man@VERT to Accession on Thu Mar 3 13:21:00 2016
    Re: First World Problems.
    By: Accession to Digital Man on Thu Mar 03 2016 05:01 pm

    Hello Digital Man,

    What would the *correct* way be to run nano from a javascript?

    I've tried..

    system.exec("/usr/bin/nano");
    bbs.exec("/usr/bin/nano",mode=EX_NATIVE);

    ..and neither of them seem to work. Synchronet runs as root so permissions are not an issue.

    Both of these will execute "/usr/bin/nano". But if you want the input/output to be intercepted and sent to the remote user, you'll need use either bbs.exec() with the EX_INR and EX_OUTR flags set (for input and output redirection), like so:
    bbs.exec("/usr/bin/nano", EX_NATIVE|EX_INR|EX_OUTR);

    But the best way to run an external editor is to configure it as an external editor (in SCFG) and run it from JS with console.editfile(filename);

    digital man

    Synchronet "Real Fact" #78:
    172 Synchronet Match Maker registrations were sold (@$69) between 1995 and 1996.
    Norco, CA WX: 63.5øF, 70.0% humidity, 4 mph E wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Accession@VERT/PHARCYDE to Digital Man on Fri Mar 4 11:27:00 2016
    Hello Digital,

    On 03 Mar 16 18:21, Digital Man wrote to Accession:

    system.exec("/usr/bin/nano");
    bbs.exec("/usr/bin/nano",mode=EX_NATIVE);

    ..and neither of them seem to work. Synchronet runs as root so
    permissions are not an issue.

    Both of these will execute "/usr/bin/nano". But if you want the input/output to be intercepted and sent to the remote user, you'll
    need use either bbs.exec() with the EX_INR and EX_OUTR flags set (for input and output redirection), like
    so:
    bbs.exec("/usr/bin/nano", EX_NATIVE|EX_INR|EX_OUTR);

    This worked! And oddly enough worked awesome at that!

    But the best way to run an external editor is to configure it as an external editor (in SCFG) and run it from JS with console.editfile(filename);

    Not sure I understand what you mean here. By "run it from JS" you mean nano?

    I suppose I should explain what is going on. I asked Nightfox if he could rip out the function in SlyEdit that reformats MSGTMP with quoted initials, so I could offer up nano as a message editor as well (and possibly even vim in the future), since they can be used in "restricted" mode where nothing on the disk can be altered except the file loaded, ie: MSGTMP.

    So after all of that is done, and a new formatted MSGTMP is created, the JS runs nano, where you can edit and save, and then the JS posts the message and exits back to the BBS.

    So if there's a better way than the first option above you gave, by all means explain it to me in laman's terms and I'll give that a shot as well. :)

    Regards,
    Nick

    --- GoldED+/LNX 1.1.5-b20160201
    þ Synchronet þ thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin)
  • From Digital Man@VERT to Accession on Sat Mar 5 14:35:00 2016
    Re: Re: First World Problems.
    By: Accession to Digital Man on Fri Mar 04 2016 04:27 pm

    Hello Digital,

    On 03 Mar 16 18:21, Digital Man wrote to Accession:

    system.exec("/usr/bin/nano");
    bbs.exec("/usr/bin/nano",mode=EX_NATIVE);

    ..and neither of them seem to work. Synchronet runs as root so
    permissions are not an issue.

    Both of these will execute "/usr/bin/nano". But if you want the input/output to be intercepted and sent to the remote user, you'll
    need use either bbs.exec() with the EX_INR and EX_OUTR flags set (for input and output redirection), like
    so:
    bbs.exec("/usr/bin/nano", EX_NATIVE|EX_INR|EX_OUTR);

    This worked! And oddly enough worked awesome at that!

    But the best way to run an external editor is to configure it as an external editor (in SCFG) and run it from JS with console.editfile(filename);

    Not sure I understand what you mean here. By "run it from JS" you mean nano?

    The editor. The console.editfile() method uses whatever editor the user has selected as their preferred editor to edit the filename passed.

    I suppose I should explain what is going on. I asked Nightfox if he could rip out the function in SlyEdit that reformats MSGTMP with quoted initials, so I could offer up nano as a message editor as well (and possibly even vim in the future), since they can be used in "restricted" mode where nothing on the disk can be altered except the file loaded, ie: MSGTMP.

    So after all of that is done, and a new formatted MSGTMP is created, the JS runs nano, where you can edit and save, and then the JS posts the message and exits back to the BBS.

    So if there's a better way than the first option above you gave, by all means explain it to me in laman's terms and I'll give that a shot as well.

    It sounds like you want to use SlyEdit as a quoter, but not an editor? There's really no built-in method in Synchronet to do that (support external "quoters"). If you just want to use nano as an editor and don't need anything from SlyEdit, the proper way would be to configure nano in SCFG->External Programs->External Editors.

    digital man

    Synchronet "Real Fact" #35:
    Synchronet's Windows DLLs are built with Microsoft Visual Studio/C++.
    Norco, CA WX: 59.6øF, 84.0% humidity, 3 mph ESE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Accession@VERT/PHARCYDE to Digital Man on Sun Mar 6 01:10:00 2016
    Hello Digital Man,

    Not sure I understand what you mean here. By "run it from JS" you mean
    nano?

    The editor. The console.editfile() method uses whatever editor the user has selected as their preferred editor to edit the filename passed.

    Even when nano itself is not configured in External Editors? I don't see how the JS could know that the user is actually selecting nano as their editor. See below..

    I suppose I should explain what is going on. I asked Nightfox if he
    could rip out the function in SlyEdit that reformats MSGTMP with
    quoted initials, so I could offer up nano as a message editor as well
    (and possibly even vim in the future), since they can be used in
    "restricted" mode where nothing on the disk can be altered except the
    file loaded, ie: MSGTMP.

    So after all of that is done, and a new formatted MSGTMP is created,
    the JS runs nano, where you can edit and save, and then the JS posts
    the message and exits back to the BBS.

    So if there's a better way than the first option above you gave, by
    all means explain it to me in laman's terms and I'll give that a shot
    as well.

    It sounds like you want to use SlyEdit as a quoter, but not an editor?

    Something like that. Basically only the function of SlyEdit that retreives the name in the TO field for initials, and quote/reformat/rewrap function of SlyEdit is being used here, so "SlyEdit" as a whole is not being used, correct.

    There's really no built-in method in Synchronet to do that (support external "quoters"). If you just want to use nano as an editor and don't need anything from SlyEdit, the proper way would be to configure nano in SCFG->External Programs->External Editors.

    Understood. What we've done here is basically strip those mentioned functions out of SlyEdit, and along with some added error checking as well as checking to make sure QUOTES.TXT is present (if not, edit the message as "new"), and check for modifications to MSGTMP (if not, abort the message), and then nano is ran from the script using bbs.exec().

    So basically I think we've gotten it to the point where you can run ?msgQuoteWrap.js "/usr/bin/nano [-opts]" %f from the command line in External Editors, the script takes care of the options and editor you choose,aand away you go!

    With this being said, vi(m) also seems to work, although it seems some of the backspace/delete stuff may have to be tinkered with on my end, but that's minimal.

    Regards,
    Nick

    ---
    þ Synchronet þ thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin)
  • From Nightfox@VERT/DIGDIST to Accession on Sun Mar 6 11:55:00 2016
    Re: Re: First World Problems.
    By: Accession to Digital Man on Sun Mar 06 2016 06:10:09

    The editor. The console.editfile() method uses whatever editor the
    user has selected as their preferred editor to edit the filename
    passed.

    Even when nano itself is not configured in External Editors? I don't see how the JS could know that the user is actually selecting nano as their editor.

    For console.editfile(), the editor would need to be configured in External Editors. So to do that with Nano, Nano would need to be set up in External Editors and the user would have had to select it as their editor. console.editfile() is simply a function that tells Synchronet to let the user edit a file with whatever editor they've chosen.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From Accession@VERT/PHARCYDE to Nightfox on Sun Mar 6 16:22:00 2016
    Hello Nightfox,

    On 06 Mar 16 16:55, Nightfox wrote to Accession:

    Even when nano itself is not configured in External Editors? I
    don't see how the JS could know that the user is actually
    selecting nano as their editor.

    For console.editfile(), the editor would need to be configured in
    External Editors. So to do that with Nano, Nano would need to be set
    up in External Editors and the user would have had to select it as
    their editor. console.editfile() is simply a function that tells Synchronet to let the user edit a file with whatever editor they've chosen.

    Ah okay. So in our case this isn't an option. Seems the way we're doing it may be the easiest and best suitable for what I'm trying to accomplish.

    Regards,
    Nick

    --- GoldED+/LNX 1.1.5-b20160201
    þ Synchronet þ thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin)
  • From Digital Man@VERT to Accession on Sun Mar 6 15:29:00 2016
    Re: Re: First World Problems.
    By: Accession to Digital Man on Sun Mar 06 2016 06:10 am

    Hello Digital Man,

    Not sure I understand what you mean here. By "run it from JS" you mean
    nano?

    The editor. The console.editfile() method uses whatever editor the user has selected as their preferred editor to edit the filename passed.

    Even when nano itself is not configured in External Editors? I don't see how the JS could know that the user is actually selecting nano as their editor. See below..

    No, nano would have to be configured as an external editor in SCFG.

    digital man

    Synchronet "Real Fact" #58:
    Synchronet apparel and merchandise can be purchased at cafepress.com/synchronet Norco, CA WX: 54.8øF, 73.0% humidity, 3 mph ESE wind, 0.20 inches rain/24hrs

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