Some sample frames, minor render fixes
This commit is contained in:
@@ -21,7 +21,8 @@ while(bbs.online) {
|
||||
while (action != ACTION_TERMINATE) {
|
||||
bbs.nodesync(false); // @todo Stop the display of telegrams
|
||||
read = console.inkey(K_NONE,inkey_timeout);
|
||||
inkey_timeout = 60000; // Set our key timeout to 60s
|
||||
system.node_list[bbs.node_num-1].action=0xff; // to ensure our node status is updated correctly
|
||||
inkey_timeout = 60000; // Set our key timeout to 60s
|
||||
log(LOG_DEBUG,'READ: ['+read+']');
|
||||
|
||||
log(LOG_DEBUG,'MODE START: ['+read+']');
|
||||
@@ -55,6 +56,16 @@ while(bbs.online) {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '#':
|
||||
if (frame.index !== 'z') {
|
||||
next_page = { frame: fo.frame, index: String.fromCharCode(fo.index.charCodeAt(0)+1) };
|
||||
action = ACTION_GOTO;
|
||||
} else {
|
||||
sendBaseline(ERR_ROUTE,false);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
bbs.hangup();
|
||||
exit();
|
||||
|
@@ -25,7 +25,7 @@ frame.owner = base64_encode(owner.replace(/\\1/g,"\1"));
|
||||
frame.content = base64_encode(f.read());
|
||||
|
||||
if (key) {
|
||||
frame.key = key.split(':').map(function(t){return parseInt(t)});
|
||||
frame.key = key.split(',').map(function(t){return parseInt(t)});
|
||||
|
||||
if (frame.key.length != 10) {
|
||||
log(LOG_ERROR,'Must specify 10 keys with -k');
|
||||
|
@@ -19,8 +19,8 @@ var FRAME_PAGENUM =12; /* Size of page number (length with a-z)
|
||||
var FRAME_COST =9; /* Size of cost (length without unit)*/
|
||||
var FRAME_COSTUNIT ='c'; /* Unit of cost */
|
||||
|
||||
var ERR_NOT_IMPLEMENTED = '\1RNOT IMPLEMENTED';
|
||||
var ERR_ROUTE = '\1WMISTAKE? \1GTRY AGAIN OR TELL US ON *08';
|
||||
var ERR_NOT_IMPLEMENTED = '\1RNOT IMPLEMENTED YET?';
|
||||
var ERR_ROUTE = '\1n\1h\1WMISTAKE? \1GTRY AGAIN OR TELL US ON *08';
|
||||
|
||||
// Our frame object
|
||||
function Frame(frame,index) {
|
||||
@@ -41,7 +41,7 @@ function Frame(frame,index) {
|
||||
this.render=function() {
|
||||
owner = base64_decode(this.owner);
|
||||
|
||||
return owner+' '.repeat(FRAME_HEADER-console.strlen(owner))+' '+
|
||||
return owner+' '.repeat(FRAME_HEADER-console.strlen(owner))+'\1n '+
|
||||
'\1W\1H'+this.page+' '.repeat(FRAME_PAGENUM-this.page.length)+' '+
|
||||
'\1G\1H'+' '.repeat(FRAME_COST-this.cost.toString().length)+this.cost+FRAME_COSTUNIT+
|
||||
(console.screen_columns > 80 ? '\n\r' : '') +
|
||||
|
201
mods/logon.js
Normal file
201
mods/logon.js
Normal file
@@ -0,0 +1,201 @@
|
||||
// logon.js
|
||||
|
||||
// Synchronet v3.1 Default Logon Module
|
||||
|
||||
// $Id: logon.js,v 1.52 2019/08/16 04:15:31 rswindell Exp $
|
||||
|
||||
// @format.tab-size 4, @format.use-tabs true
|
||||
|
||||
require("sbbsdefs.js", 'SS_RLOGIN');
|
||||
require("nodedefs.js", 'NODE_QUIET');
|
||||
if (user.command_shell == 'ansitex') {
|
||||
system.settings |= SYS_NOSYSINFO;
|
||||
exit();
|
||||
}
|
||||
|
||||
if(!bbs.mods.avatar_lib)
|
||||
bbs.mods.avatar_lib = load({}, 'avatar_lib.js');
|
||||
if(!bbs.mods.logonlist_lib)
|
||||
bbs.mods.logonlist_lib = load({}, 'logonlist_lib.js');
|
||||
load("fonts.js", "preload", "default");
|
||||
if(!bbs.mods.userprops)
|
||||
bbs.mods.userprops = load({}, "userprops.js");
|
||||
var options = load("modopts.js", "logon");
|
||||
if(!options)
|
||||
options = {};
|
||||
if(options.show_avatar === undefined)
|
||||
options.show_avatar = true;
|
||||
if(options.draw_avatar_right === undefined)
|
||||
options.draw_avatar_right = true;
|
||||
|
||||
if(user.settings & USER_ICE_COLOR) {
|
||||
var cterm = load({}, "cterm_lib.js");
|
||||
cterm.bright_background(true);
|
||||
}
|
||||
|
||||
if(options.email_validation == true) {
|
||||
load({}, "emailval.js");
|
||||
if(!bbs.online)
|
||||
exit();
|
||||
}
|
||||
|
||||
// Check if we're being asked to auto-run an external (web interface external programs section uses this)
|
||||
if ((options.rlogin_auto_xtrn) && (bbs.sys_status & SS_RLOGIN) && (console.terminal.indexOf("xtrn=") === 0)) {
|
||||
var external_code = console.terminal.substring(5);
|
||||
if (!bbs.exec_xtrn(external_code)) {
|
||||
alert(log(LOG_ERR,"!ERROR Unable to launch external: '" + external_code + "'"));
|
||||
}
|
||||
bbs.hangup();
|
||||
exit();
|
||||
}
|
||||
//Disable spinning cursor at pause prompts
|
||||
//bbs.node_settings|=NM_NOPAUSESPIN
|
||||
|
||||
if(user.security.restrictions&UFLAG_G) {
|
||||
while(bbs.online) {
|
||||
printf("\1y\1hFor our records, please enter your full name: \1w");
|
||||
name=console.getstr(LEN_NAME,K_UPRLWR);
|
||||
if(!name || !name.length)
|
||||
continue;
|
||||
bbs.log_str("Guest: " + name);
|
||||
user.name = name;
|
||||
break;
|
||||
}
|
||||
|
||||
while(bbs.online) {
|
||||
printf("\1y\1hPlease enter your e-mail address: \1w");
|
||||
email=console.getstr(LEN_NETMAIL);
|
||||
if(!email || !email.length)
|
||||
continue;
|
||||
if(bbs.trashcan("email", email)) {
|
||||
bbs.hangup();
|
||||
exit();
|
||||
}
|
||||
bbs.log_str(" " + email);
|
||||
user.netmail=email;
|
||||
user.settings|=USER_NETMAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
while(bbs.online) {
|
||||
printf("\1y\1hPlease enter your location (City, State): \1w");
|
||||
location=console.getstr(LEN_LOCATION,K_UPRLWR);
|
||||
if(!location || !location.length)
|
||||
continue;
|
||||
if(bbs.trashcan("location", location)) {
|
||||
bbs.hangup();
|
||||
exit();
|
||||
}
|
||||
bbs.log_str(" " + location);
|
||||
user.location=location;
|
||||
break;
|
||||
}
|
||||
|
||||
if(bbs.online)
|
||||
bbs.log_str("\r\n");
|
||||
while(bbs.online) {
|
||||
printf("\1y\1hWhere did you hear about this BBS?\r\n: \1w");
|
||||
ref=console.getstr(70);
|
||||
if(!ref || !ref.length)
|
||||
continue;
|
||||
bbs.log_str(ref + "\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Force split-screen chat on ANSI users
|
||||
if(console.term_supports(USER_ANSI))
|
||||
user.chat_settings|=CHAT_SPLITP;
|
||||
|
||||
// Inactivity exemption
|
||||
if(user.security.exemptions&UFLAG_H)
|
||||
console.status|=CON_NO_INACT;
|
||||
|
||||
/******************************
|
||||
* Replaces the 2.1 Logon stuff
|
||||
******************************/
|
||||
|
||||
if(options.fast_logon !== true || !(bbs.sys_status&SS_FASTLOGON)
|
||||
|| !user.compare_ars(options.fast_logon_requirements)) {
|
||||
|
||||
// Logon screens
|
||||
|
||||
// Print successively numbered logon screens (logon, logon1, logon2, etc.)
|
||||
var highest_printed_logon_screen=-1;
|
||||
for(var i=0;;i++) {
|
||||
var fname="logon";
|
||||
if(i)
|
||||
fname+=i;
|
||||
if(!bbs.menu_exists(fname)) {
|
||||
if(i>1)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
bbs.menu(fname);
|
||||
highest_printed_logon_screen = i;
|
||||
}
|
||||
|
||||
// Print logon screens based on security level
|
||||
if(user.security.level > highest_printed_logon_screen
|
||||
&& bbs.menu_exists("logon" + user.security.level))
|
||||
bbs.menu("logon" + user.security.level);
|
||||
|
||||
// Print one of text/menu/random*.*, picked at random
|
||||
// e.g. random1.asc, random2.asc, random3.asc, etc.
|
||||
var random_list = directory(system.text_dir + "menu/random*.*");
|
||||
if(random_list.length)
|
||||
bbs.menu(file_getname(random_list[random(random_list.length)]).slice(0,-4));
|
||||
|
||||
console.clear(LIGHTGRAY);
|
||||
bbs.user_event(EVENT_LOGON);
|
||||
}
|
||||
|
||||
if(user.security.level==99 /* Sysop logging on */
|
||||
&& !system.matchuser("guest") /* Guest account does not yet exist */
|
||||
&& bbs.mods.userprops.get("logon", "makeguest", true) /* Sysop has not asked to stop this question */
|
||||
) {
|
||||
if(console.yesno("Create Guest/Anonymous user account (highly recommended)"))
|
||||
load("makeguest.js");
|
||||
else if(!console.yesno("Ask again later"))
|
||||
bbs.mods.userprops.set("logon", "makeguest", false);
|
||||
console.crlf();
|
||||
}
|
||||
|
||||
// Last few callers
|
||||
console.aborted=false;
|
||||
console.clear(LIGHTGRAY);
|
||||
bbs.exec("?logonlist -l");
|
||||
if(bbs.node_status != NODE_QUIET && ((system.settings&SYS_SYSSTAT) || !user.is_sysop))
|
||||
bbs.mods.logonlist_lib.add();
|
||||
|
||||
// Auto-message
|
||||
auto_msg=system.data_dir + "msgs/auto.msg"
|
||||
if(file_size(auto_msg)>0) {
|
||||
console.printfile(auto_msg,P_NOATCODES|P_WORDWRAP);
|
||||
}
|
||||
console.crlf();
|
||||
|
||||
if(options.show_avatar && console.term_supports(USER_ANSI)) {
|
||||
if(options.draw_avatar_above || options.draw_avatar_right)
|
||||
bbs.mods.avatar_lib.draw(user.number, /* name: */null, /* netaddr: */null, options.draw_avatar_above, options.draw_avatar_right);
|
||||
else
|
||||
bbs.mods.avatar_lib.show(user.number);
|
||||
console.attributes = 7; // Clear the background attribute
|
||||
}
|
||||
|
||||
// Set rlogin_xtrn_menu=true in [logon] section of ctrl/modopts.ini
|
||||
// if you want your RLogin server to act as a door game server only
|
||||
if(options.rlogin_xtrn_menu
|
||||
&& bbs.sys_status&SS_RLOGIN) {
|
||||
bbs.xtrn_sec();
|
||||
bbs.hangup();
|
||||
} else if(!(user.security.restrictions&UFLAG_G)
|
||||
&& console.term_supports(USER_ANSI)
|
||||
&& options.set_avatar == true) {
|
||||
var avatar = bbs.mods.avatar_lib.read(user.number);
|
||||
if(!avatar || (!avatar.data && !avatar.disabled)) {
|
||||
alert("You have not selected an avatar.");
|
||||
if(console.yesno("Select avatar now"))
|
||||
load("avatar_chooser.js");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user