sbbs/load/defs.js

162 lines
5.1 KiB
JavaScript
Raw Normal View History

require('smbdefs.js','MSG_DELETE');
require('sbbsdefs.js','SUB_FIDO');
load('string.js');
load('lz-string.js');
2019-10-03 04:08:48 +00:00
/**
* ANSItex definitions
*/
/* Our home on disk */
const ANSITEX_HOME = system.mods_dir+'ansitex';
/* Frames location */
const FRAMES_HOME = ANSITEX_HOME+'/text/';
/* Load frames from msgbase */
const FRAMES_MSG_BASE = 'vtx_data';
/* Load frames from files */
const FRAMES_MSG_FILES = true;
const FRAMES_EOF_MARKER = "\r\n=== EOF";
const PAGE_LENGTH = 4; // The size of our page tag as stored in the msgbase for echomail/netmail
const NUMERIC_REGEX = /^[0-9]*$/;
/* Unit of cost */
const FRAME_COSTUNIT = 'c';
/** ACTIONS **/
/* Exit the script */
const ACTION_EXIT = 99;
/* Reload the current frame */
const ACTION_RELOAD = 1;
/* Goto a specific frame */
const ACTION_GOTO = 2;
/* Goto previous frame */
const ACTION_BACKUP = 3;
/* Goto next frame */
const ACTION_NEXT = 4;
/* Terminate the session */
const ACTION_TERMINATE = 5;
/* Submit form contents */
const ACTION_SUBMITRF = 6;
/* Star command entry */
const ACTION_STAR = 7;
/* Edit a frame */
const ACTION_EDIT = 8;
/** MODES **/
/* Typing * command on baseline */
const MODE_BL = 1;
/* Field Input */
const MODE_FIELD = 2;
/* Asking if form should be submitted */
const MODE_SUBMITRF = 3;
/* Response frame not sent */
const MODE_RFNOTSENT = 4;
/* Response frame sent */
const MODE_RFSENT = 5;
/* Response frame error */
const MODE_RFERROR = 6;
/** FRAME TYPES **/
// @todo Change these to bits
/* Information Frame, requires no response after viewed */
2024-12-03 10:36:03 +00:00
const FRAME_TYPE_INFO = 0; //'i';
/* Terminate Frame, contents displayed and then carrier dropped */
2024-12-03 10:36:03 +00:00
const FRAME_TYPE_TERMINATE = 15; //'t';
/**
* Frame the calls an External Method
* Contents indicate the method to be called with arguments
*/
2024-12-03 10:36:03 +00:00
const FRAME_TYPE_EXTERNAL = 13; //'x';
/**
* Frame calls a door
* Contents indicate the name of the door
*/
2024-12-03 10:36:03 +00:00
const FRAME_TYPE_DOOR = 11; //'X';
/**
* Frame renders a BBS from sbbslist
* Contents can be:
* + preview(bbs) - to show the BBS preview display
* + telnet(bbs) - to telgate to the BBS
*/
const FRAME_TYPE_BBS = 'b';
/**
* Response frame, input fields are embedded in the frame and after input the
* response will be submitted to the Service Provider, or to a method
*/
2024-12-03 10:36:03 +00:00
const FRAME_TYPE_RESPONSE = 1; //'r';
/* Login frame, enables the user to authenticate to the system, or to a CUG */
2024-12-03 10:36:03 +00:00
const FRAME_TYPE_LOGIN = 12; //'l';
/* Mail template frames - mail templates will have the user's stats for the area passed to render() */
const FRAME_TYPE_MAIL_TEMPLATE = 'm';
/* Frame is a message */
2024-12-03 10:36:03 +00:00
const FRAME_TYPE_MESSAGE = 2; // 'M';
/* Disable *# going backwards for the following frames */
const FRAMES_NO_HISTORY = ['980a','98b','981a','982a','983a','998a'];
/* Frames prefixed with this are owned by the system */
const SYSTEM_OWNER = 9;
// @todo can we get this from the message base?
const SYSTEM_ZONE = 516;
/* Time to wait for a key press */
const INACTIVE_TIMEOUT = 100000;
/* Idle time for un-authenticated users */
const INACTIVE_NOLOGIN = 30000;
/* Idle time for authenticated users */
const INACTIVE_LOGIN = 5*60000;
/* Home Frame */
const FRAME_HOME = {frame: '1',index: 'a'};
/* Login Frame */
const FRAME_LOGIN = {frame: '98',index: 'a'};
/* Registration Frame */
const FRAME_REGISTER = {frame: '981',index: 'a'};
/* SQRL Login */
const FRAME_SQRL = {frame: '982',index: 'a'};
/* Login Failed */
const FRAME_LOGIN_FAILED = {frame: '983',index: 'a'};
/* Home page after authentication */
const FRAME_HOME_AUTH = {frame: '98',index: 'b'};
/* Home page for initial connection */
const FRAME_HOME_CONNECT = {frame: '980',index: 'a'};
const FRAME_SYSTEM_ERROR = {frame: '998',index: 'a'};
2020-11-01 10:55:32 +00:00
/* Attributes saved/loaded from files */
const FRAME_SAVE_ATTRS = [
'content', // raw source content of a frame (as stored in vtx/tex files)
'cost', // integer, frame cost
'date', // date, date frame created
'dynamic_fields', // array of fields // @todo deprecate and work these out when loading and parsing a frame
'frame', // Page ID,
'index', // Page index,
'input_fields', // array of fields // @todo deprecate and work these out when loading and parsing a frame
'isAccessible', // boolean // @todo deprecate and merge into 'state'
'isPublic', // boolean // @todo deprecate and merge into 'state'
'key', // array, representing our key actions (0-9)
'state', // integer, representing type, accessible and public status
'type', // frame type // @todo deprecate and merge into 'state'
'version', // frame version (1)
'window' // processed frame data
];
/* The page that has our echomail area reading template */
const MAIL_TEMPLATE_FRAME = {frame: '199',index: 'a'};
/* The page that has our echomail area summary template */
const MAIL_TEMPLATE_AREA_SUMMARY = {frame: '198',index: 'a'};
// The maximum size (length) of embedded dynamic fields in frames
const DYNAMIC_FIELD_SIZE_MAX = 50;
2022-12-09 06:19:33 +00:00
/** ESCAPE CODES **/
const ESC = '\x1b';
const FIELD_PASSWORD_MASK = '*';
const FIELD_TEXT = 't';
const FIELD_PASSWORD = 'p';