• 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

    5/26 16:56:00 term Node 1 <Test> !JavaScript /opt/sbbs/exec/logon.js line 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.

    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

    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.

    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

    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

    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

    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.

    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

    log(LOG_DEBUG,' - User:'+JSON.stringify(bbs.user));
    (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

    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 al>> line 488 (answer) checking "User not logged on" access=0

    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.

    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

    You must call bbs.logon().
    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.

    '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

    You must call bbs.logon().
    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.

    '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