• Some help with login/logon and shell javascript

    From alterego@VERT/ALTERANT to Digital Man on Tue May 26 17:14:10 2020
    Howdy,ããCan somebody (DM?) give me some guidance here - something is not working as I expect.ããI've writing my own "shell" for SBBS, which is to handle the user before login, and after. So I'm using the same javascript to handle login.js and the users shell "ansitex". (It is aware if the user is "logged in" or not - and I'm using it to leverage a consistent experience.)ããDuring login, things work well - notice the "INIT: [undefined]" is the first line of my javascript:ããlog(LOG_DEBUG,'INIT: ['+ansitex+']');ãvar ansitex;ããif (! ansitex) {ãã // Load many SBBS definitionsã load('sbbsdefs.js');ã // Load text.dat definitionsã load('text.js');ã // Key definitionsã load('key_defs.js');ã // Enable to manipulate the ANSI terminalã ansi = load({},'ansiterm_lib.js');ã login = load({},'ansitex/control/login.js');ãã // Ansitex specific includesã load('ansitex/load/defs.js');ã load('ansitex/load/funcs.js');ã ansitex = true;ã}ãã(I didnt have the test for ansitex originally, I thought it might be able to bypass the load statements when ansitex.js runs - but it appears that ansitex value is not retained (which I didnt expect that it would be actually))ãã5/26 16:50:25 term Node 1 auto-detected terminal type: 80x25 ANSIã5/26 16:50:26 term Node 1 terminal type: 80x25 synctermã5/26 16:50:26 term Node 1 INIT: [undefined]ã5/26 16:50:26 term Node 1 Loaded control/login.jsã5/26 16:50:26 term Node 1 ansiterm.sending: [?25lããWhen the user supplies their login details, it calls:ããif (bbs.login(fo.frame_fields[0].fvalue,null,fo.frame_fields[1].fvalue)) {ã log(LOG_DEBUG,' - User:'+JSON.stringify(bbs.user));ã bbs.logon();ã log(LOG_DEBUG,' - EXIT:');ã exit();ã}ããto which logon.js takes over (this is the stock SBBS logon.js) logon.js complains about:ãã5/26 16:56:00 term Node 1 <Test> !JavaScript /opt/sbbs/exec/logon.js line 12: TypeError: load is not a functionããthen after logon.js has completed, login.js exits and the user shell takes over - which is ansitex.js (the same file as login.js) - you can see the EXIT: debug statement, shortly after starting again with the INIT debug line.ãã5/26 16:50:37 term Node 1 <Test> - User:undefinedã5/26 16:50:37 term Node 1 <Test> (0003) Test Logon 98 - 7ã5/26 16:50:38 term Node 1 <Test> - EXIT:ã5/26 16:50:38 term Node 1 <Test> Executing external: ?ansitexã5/26 16:50:38 term Node 1 <Test> INIT: [undefined]ã5/26 16:50:38 term Node 1 <Test> !JavaScript /opt/sbbs/mods/ansitex.js line 7: TypeError: load is not a functionã5/26 16:50:38 term Node 1 <Test> disconnecting clientããSo why the errors about "load is not a function"? If I use the standard synchronet login.js, then ansitex.js loads fine as the users shell.ããIf I dont call bbs.logon(), then I get an error after bbs.login()ãã5/26 17:00:33 term Node 1 <Test> - EXIT:ã5/26 17:00:33 term Node 1 <Test> !ERROR 0 (Success) in answer.cpp line 488 (answer) checking "User not logged on" access=0ããDoes logon.js need to do something specific?ããThanks...ãã...ëîåïãã... BEWARE - Tagline Thief is in the area...ãã---ã þ Synchronet þ Alterant | an SBBS in Docker on Pi!ã
  • From alterego@VERT/ALTERANT to Digital Man on Tue May 26 23:48:51 2020
    Re: Some help with login/logon and shell javascriptã By: alterego to Digital Man on Tue May 26 2020 05:14 pmãã al> 5/26 16:56:00 term Node 1 <Test> !JavaScript /opt/sbbs/exec/logon.js lineã al> 12: TypeError: load is not a functionããSo I worked it out.ããIn one of my include libraries I was redefining load - argh! Took a bit to figure out, but I got there in the end...ããAll good now :)ãã...ëîåïãã... To my embarrassment, I was born in bed with a lady!ãã---ã þ Synchronet þ Alterant | an SBBS in Docker on Pi!ã
  • From alterego@VERT/ALTERANT to Digital Man on Wed May 27 08:26:59 2020
    Re: Some help with login/logon and shell javascriptã By: alterego to Digital Man on Tue May 26 2020 05:14 pmããHowdy DM,ããI havent figure this one out yet - if you could give me some advice.ãã al> If I dont call bbs.logon(), then I get an error after bbs.login()ã al> 5/26 17:00:33 term Node 1 <Test> - EXIT:ã al> 5/26 17:00:33 term Node 1 <Test> !ERROR 0 (Success) in answer.cpp line 488ã al> (answer) checking "User not logged on" access=0ããIn my login.js, if I dont call bbs.logon() before exiting, I get the above error and it terminates the session.ããIt seems Error 0 (Success) is not an error?ããAnd to validate, if I create a logon.js with only:ãã// ANSItex Logon Shellãconsole.print('LOGON...');ããI dont get the error...ããMust you call a logon.js via bbs.logon()?ãã...ëîåïãã... You've got to miss them to score sometimes.ãã---ã þ Synchronet þ Alterant | an SBBS in Docker on Pi!ã
  • From Digital Man@VERT to alterego on Tue May 26 16:28:00 2020
    Re: Some help with login/logon and shell javascriptã By: alterego to Digital Man on Wed May 27 2020 08:26 amãã > Re: Some help with login/logon and shell javascriptã > By: alterego to Digital Man on Tue May 26 2020 05:14 pmã >ã > Howdy DM,ã >ã > I havent figure this one out yet - if you could give me some advice.ã >ã > al> If I dont call bbs.logon(), then I get an error after bbs.login()ã > al> 5/26 17:00:33 term Node 1 <Test> - EXIT:ã > al> 5/26 17:00:33 term Node 1 <Test> !ERROR 0 (Success) in answer.cpp lineã > al> 488 (answer) checking "User not logged on" access=0ã >ã > In my login.js, if I dont call bbs.logon() before exiting, I get the aboveã > error and it terminates the session.ã >ã > It seems Error 0 (Success) is not an error?ããIt's an error in this case. Something needs to set the SS_USERON flag in sbbs_t::sys_status. This is normally done via sbbs_t::logon() (JS bbs.logon()).ãã > And to validate, if I create a logon.js with only:ã >ã > // ANSItex Logon Shellã > console.print('LOGON...');ã >ã > I dont get the error...ã >ã > Must you call a logon.js via bbs.logon()?ããNo. I'm guessing your call to bbs.logon() is failing before it can set SS_USERON, so your log output should give the details why.ããã digital manããSynchronet/BBS Terminology Definition #45:ãJS = JavaScriptãNorco, CA WX: 87.6øF, 38.0% humidity, 15 mph E wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From alterego@VERT/ALTERANT to Digital Man on Wed May 27 09:58:01 2020
    Re: Some help with login/logon and shell javascriptã By: Digital Man to alterego on Tue May 26 2020 04:28 pmãã > al>> 5/26 17:00:33 term Node 1 <Test> - EXIT:ã > al>> 5/26 17:00:33 term Node 1 <Test> !ERROR 0 (Success) in answer.cppã > al>> line 488 (answer) checking "User not logged on" access=0ãã DM> No. I'm guessing your call to bbs.logon() is failing before it can setã DM> SS_USERON, so your log output should give the details why.ããNot sure that I follow (and the above is the only thing in the error log):ããHere is my call:ãif (bbs.login(fo.frame_fields[0].fvalue,null,fo.frame_fields[1].fvalue)) {ã log(LOG_DEBUG,' - User:'+JSON.stringify(bbs.user)); ã bbs.logon();ã log(LOG_DEBUG,' - EXIT:');ã exit();ã}ããIf I comment out bbs.logon(), I get the error message. If I call it, and it only does:ãã// ANSItex Logon Shellãconsole.print('LOGON...');ãã(only 2 lines)ããI dont get the error message.ããI also made logon.js a zero byte file, and the same result. Success if I call bbs.logon(), failure if I dont call it.ããShould I be setting SS_USERON somewhere before exiting if I dont want to call logon.js? How?ãã(Oh, and bbs.user is undefined until I exit.)ãã...ëîåïãã... The flush toilet is the basis of Western civilisation.ãã---ã þ Synchronet þ Alterant | an SBBS in Docker on Pi!ã
  • From alterego@VERT/ALTERANT to Digital Man on Wed May 27 10:47:41 2020
    Re: Some help with login/logon and shell javascriptã By: alterego to Digital Man on Wed May 27 2020 09:58 amãã al> log(LOG_DEBUG,' - User:'+JSON.stringify(bbs.user)); ã al> (Oh, and bbs.user is undefined until I exit.)ããOh, I realised this just after I posted it. Its user :) <face plant>ããBut my I still need help with my question about bbs.logon() :)ãã...ëîåïãã... Spaceballs: The Taglineãã---ã þ Synchronet þ Alterant | an SBBS in Docker on Pi!ã
  • From Digital Man@VERT to alterego on Tue May 26 18:31:00 2020
    Re: Some help with login/logon and shell javascriptã By: alterego to Digital Man on Wed May 27 2020 09:58 amãã > Re: Some help with login/logon and shell javascriptã > By: Digital Man to alterego on Tue May 26 2020 04:28 pmã >ã > > al>> 5/26 17:00:33 term Node 1 <Test> - EXIT:ã > > al>> 5/26 17:00:33 term Node 1 <Test> !ERROR 0 (Success) in answer.cppã > > al>> line 488 (answer) checking "User not logged on" access=0ã >ã > DM> No. I'm guessing your call to bbs.logon() is failing before it can setã > DM> SS_USERON, so your log output should give the details why.ã >ã > Not sure that I follow (and the above is the only thing in the error log):ã >ã > Here is my call:ã > if (bbs.login(fo.frame_fields[0].fvalue,null,fo.frame_fields[1].fvalue)) {ã > log(LOG_DEBUG,' - User:'+JSON.stringify(bbs.user));ã > bbs.logon();ã > log(LOG_DEBUG,' - EXIT:');ã > exit();ã > }ã >ã > If I comment out bbs.logon(), I get the error message.ããYou must call bbs.logon().ãã > If I call it, and it only does:ã >ã > // ANSItex Logon Shellã > console.print('LOGON...');ã >ã > (only 2 lines)ããbbs.logon() does a lot more than just call your logon module. See sbbs_t::logon() in src/sbbs3/logon.cpp if you're curious.ãã > I dont get the error message.ããYour logon module is not part of the solution or the problem.ãã > I also made logon.js a zero byte file, and the same result. Success if Iã > call bbs.logon(), failure if I dont call it.ããCorrect.ãã > Should I be setting SS_USERON somewhere before exiting if I dont want toã > call logon.js?ããNo. Just call bbs.logon().ãã digital manããSynchronet "Real Fact" #53:ãSynchronet Blackjack was the first multi-node/multi-user game for Synchronet.ãNorco, CA WX: 83.0øF, 31.0% humidity, 12 mph ENE wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From alterego@VERT/ALTERANT to Digital Man on Wed May 27 11:35:37 2020
    Re: Some help with login/logon and shell javascriptã By: Digital Man to alterego on Tue May 26 2020 06:31 pmãã DM> You must call bbs.logon().ã DM> bbs.logon() does a lot more than just call your logon module. Seeã DM> sbbs_t::logon() in src/sbbs3/logon.cpp if you're curious.ãã'nuff said - got it.ããThanks...ãã...ëîåïãã... The things most people want to know are usually none of their business.ãã---ã þ Synchronet þ Alterant | an SBBS in Docker on Pi!ã
  • From Digital Man@VERT to alterego on Tue May 26 18:51:01 2020
    Re: Some help with login/logon and shell javascriptã By: alterego to Digital Man on Wed May 27 2020 11:35 amãã > Re: Some help with login/logon and shell javascriptã > By: Digital Man to alterego on Tue May 26 2020 06:31 pmã >ã > DM> You must call bbs.logon().ã > DM> bbs.logon() does a lot more than just call your logon module. Seeã > DM> sbbs_t::logon() in src/sbbs3/logon.cpp if you're curious.ã >ã > 'nuff said - got it.ã >ã > Thanks...ããNo problem. :-)ãã digital manããSling Blade quote #24:ãKarl: Kaiser blade. I hit my mother upside the head with it. Mmm... Killed her.ãNorco, CA WX: 82.6øF, 29.0% humidity, 11 mph E wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã