Fixes for viewdata, tested with proper viewdata client
This commit is contained in:
parent
424e4a8f64
commit
b14cd82329
@ -23,8 +23,6 @@ function sqrllogin() {
|
||||
var complete = false;
|
||||
var cancel = false;
|
||||
|
||||
fo.render();
|
||||
|
||||
log(LOG_DEBUG,'OPTIONS: '+JSON.stringify(loadOptions('sqrl')));
|
||||
sqrl = loadOptions('sqrl');
|
||||
http = new HTTPRequest();
|
||||
|
@ -14,6 +14,13 @@ var VIEWDATA_COFF = "\x14";
|
||||
var VIEWDATA_CON = "\x11";
|
||||
var VIEWDATA_RIGHT = "\x09";
|
||||
var VIEWDATA_LEFT = "\x08";
|
||||
var VIEWDATA_MOSIAC_RED = ascii(27)+ascii(0x51);
|
||||
var VIEWDATA_MOSIAC_GREEN = ascii(27)+ascii(0x52);
|
||||
var VIEWDATA_MOSIAC_YELLOW = ascii(27)+ascii(0x53);
|
||||
var VIEWDATA_MOSIAC_BLUE = ascii(27)+ascii(0x54);
|
||||
var VIEWDATA_MOSIAC_MAGENTA = ascii(27)+ascii(0x55);
|
||||
var VIEWDATA_MOSIAC_CYAN = ascii(27)+ascii(0x56);
|
||||
var VIEWDATA_MOSIAC_WHITE = ascii(27)+ascii(0x57);
|
||||
|
||||
var VIEWDATA_MSG_SENDORNOT = ascii(27)+'BKEY 1 TO SEND, 2 NOT TO SEND';
|
||||
var VIEWDATA_MSG_LOGON = ascii(27)+'BKEY 1 TO LOGON, 2 TO RETURN';
|
||||
@ -405,13 +412,13 @@ function VIEWDATAFrame() {
|
||||
};
|
||||
|
||||
this.qrcode = function(qr,subframe) {
|
||||
var offset = 18/2; // @todo For some reason RIGHT movements results in 2 spaces
|
||||
var offset = 18;
|
||||
// Render the body
|
||||
var qrcode = VIEWDATA_HOME+VIEWDATA_DOWN.repeat(5)+VIEWDATA_RIGHT.repeat(offset);
|
||||
var qrcode = VIEWDATA_HOME+VIEWDATA_DOWN.repeat(5);
|
||||
//var line = '';
|
||||
|
||||
for (var x = -1; x < qr.size; x=x+3) {
|
||||
var line = VIEWDATA_RIGHT.repeat(offset)+ascii(0x97);
|
||||
var line = VIEWDATA_RIGHT.repeat(offset ? offset-1 : 0)+VIEWDATA_MOSIAC_WHITE;
|
||||
|
||||
for (var y = -1; y < qr.size; y=y+2) {
|
||||
var char = 0;
|
||||
@ -440,7 +447,9 @@ function VIEWDATAFrame() {
|
||||
if (y%2)
|
||||
line += ascii(0x35);
|
||||
|
||||
qrcode += line+' '.repeat(VIEWDATA_FRAME_WIDTH-Math.ceil(qr.size/2)-2-offset*2-(y%2 ? 0 : 1))+VIEWDATA_RIGHT.repeat(offset);
|
||||
repeat_count = VIEWDATA_FRAME_WIDTH-Math.ceil(qr.size/2)-offset-(offset ? 1 : 2)-(y%2 == 1 ? 0 : 1);
|
||||
|
||||
qrcode += line+' '.repeat(repeat_count > 0 ? repeat_count : 0);
|
||||
}
|
||||
|
||||
log(LOG_DEBUG,'WIDTH:'+VIEWDATA_FRAME_WIDTH);
|
||||
@ -451,7 +460,8 @@ function VIEWDATAFrame() {
|
||||
|
||||
// Render the bottom
|
||||
if (x%3) {
|
||||
line = VIEWDATA_RIGHT.repeat(offset)+ascii(0x97);
|
||||
line = VIEWDATA_RIGHT.repeat(offset ? offset-1 : 0)+VIEWDATA_MOSIAC_WHITE;
|
||||
|
||||
for (var y = 0; y < qr.size; y=y+2) {
|
||||
line += ascii(0x23);
|
||||
}
|
||||
@ -461,10 +471,10 @@ function VIEWDATAFrame() {
|
||||
line += ascii(0x21);
|
||||
}
|
||||
|
||||
qrcode += line+' '.repeat(VIEWDATA_FRAME_WIDTH-Math.ceil(qr.size/2)-2-offset-(y%2 ? 0 : 1));
|
||||
qrcode += line+' '.repeat(repeat_count > 0 ? repeat_count : 0);
|
||||
}
|
||||
|
||||
write_raw(qrcode+VIEWDATA_DOWN);
|
||||
write_raw(qrcode);
|
||||
};
|
||||
|
||||
this.save=function() {
|
||||
|
24
main.js
24
main.js
@ -37,7 +37,8 @@ while(bbs.online) {
|
||||
var timeout = false; // Track our inactivity timeout
|
||||
var timer = time();
|
||||
var control = []; // Methods that need to process input
|
||||
var extendedkey = ''; // Current Extended Key being captured
|
||||
var extendedkey = ''; // Current Extended Key being captured
|
||||
var viewdata = (client.socket.local_port !== 516);
|
||||
|
||||
while (action != ACTION_TERMINATE && action !=ACTION_EXIT) {
|
||||
bbs.nodesync(); // @todo Stop the display of telegrams
|
||||
@ -180,6 +181,10 @@ while(bbs.online) {
|
||||
|
||||
break;
|
||||
|
||||
case '_':
|
||||
if (! viewdata)
|
||||
break;
|
||||
|
||||
case '#':
|
||||
log(LOG_DEBUG,'- false: Key ['+read+'] ['+pageStr(fo)+']');
|
||||
if (fo.index !== 'z') {
|
||||
@ -322,7 +327,7 @@ while(bbs.online) {
|
||||
}
|
||||
}
|
||||
|
||||
if (read == '#' || read == '\r') {
|
||||
if ((vewdata && read=='_') || (! viewdata && read == '#') || read == '\r') {
|
||||
// Nothing typed between * and #
|
||||
// *# means go back
|
||||
if (cmd == '') {
|
||||
@ -389,6 +394,9 @@ while(bbs.online) {
|
||||
|
||||
switch (read) {
|
||||
// End of field entry.
|
||||
case '_':
|
||||
if (! viewdata) break;
|
||||
|
||||
case '#':
|
||||
case '\r':
|
||||
log(LOG_DEBUG,'- MODE_FIELD:FRAME_TYPE_RESPONSE: # ['+read+']');
|
||||
@ -649,7 +657,7 @@ while(bbs.online) {
|
||||
case MODE_RFERROR:
|
||||
fo.cursorOff();
|
||||
|
||||
if (read == '#') {
|
||||
if ((viewdata && read == '_') || (! viewdata && read == '#')) {
|
||||
/*
|
||||
if ($x = $this->fo->route(2) AND $x !== '*' AND is_numeric($x)) {
|
||||
$next_page = ['frame'=>$x];
|
||||
@ -728,7 +736,7 @@ while(bbs.online) {
|
||||
// If we are editing a specific frame, attempt to load it
|
||||
if (fe) {
|
||||
current = fo;
|
||||
fo = (client.socket.local_port !== 516) ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
fo.load(pageStr(fe));
|
||||
|
||||
// If the frame doesnt exist, check that the parent frame exists in case we are creating a new one
|
||||
@ -737,7 +745,7 @@ while(bbs.online) {
|
||||
|
||||
// We can always create an 'a' frame
|
||||
if (fe.index !== 'a') {
|
||||
fo = (client.socket.local_port !== 516) ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
fo.load(pageStr({frame: fe.frame, index: String.fromCharCode(fe.index.charCodeAt(0)-1)}));
|
||||
|
||||
log(LOG_DEBUG,'- ACTION_EDIT: check index: '+JSON.stringify(fo)+' ('+String.fromCharCode(fe.index.charCodeAt(0)-1)+')');
|
||||
@ -751,7 +759,7 @@ while(bbs.online) {
|
||||
}
|
||||
|
||||
// New frame
|
||||
fo = (client.socket.local_port !== 516) ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
fo.frame = fe.frame;
|
||||
fo.index = fe.index;
|
||||
fo.cost = 0;
|
||||
@ -790,7 +798,7 @@ while(bbs.online) {
|
||||
|
||||
if (next_page !== null) {
|
||||
current = fo;
|
||||
fo = (client.socket.local_port !== 516) ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
fo.load(pageStr(next_page));
|
||||
|
||||
if (fo.page == null) {
|
||||
@ -798,7 +806,7 @@ while(bbs.online) {
|
||||
|
||||
// In case the frame doesnt exist
|
||||
if (fo == null)
|
||||
fo = (client.socket.local_port !== 516) ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame();
|
||||
|
||||
// sendbaseline ERR_PAGE
|
||||
fo.sendBaseline('ERR_ROUTE',false);
|
||||
|
Loading…
Reference in New Issue
Block a user