Auto space QR render and more fixes for viewdata frames

This commit is contained in:
Deon George 2020-08-17 20:18:51 +10:00
parent 4696594190
commit f05c11d5a2
2 changed files with 11 additions and 13 deletions

View File

@ -411,11 +411,10 @@ function VIEWDATAFrame() {
return output; return output;
}; };
this.qrcode = function(qr,subframe) { this.qrcode = function(qr) {
var offset = 18;
// Render the body // Render the body
var qrcode = VIEWDATA_HOME+VIEWDATA_DOWN.repeat(5); var qrcode = VIEWDATA_HOME+VIEWDATA_DOWN.repeat(5);
//var line = ''; var offset = VIEWDATA_FRAME_WIDTH-Math.ceil(qr.size/2)-1;
for (var x = -1; x < qr.size; x=x+3) { for (var x = -1; x < qr.size; x=x+3) {
var line = VIEWDATA_RIGHT.repeat(offset ? offset-1 : 0)+VIEWDATA_MOSIAC_WHITE; var line = VIEWDATA_RIGHT.repeat(offset ? offset-1 : 0)+VIEWDATA_MOSIAC_WHITE;

19
main.js
View File

@ -38,7 +38,7 @@ while(bbs.online) {
var timer = time(); var timer = time();
var control = []; // Methods that need to process input 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); var viewdata = (client.socket.local_port == 516);
while (action != ACTION_TERMINATE && action !=ACTION_EXIT) { while (action != ACTION_TERMINATE && action !=ACTION_EXIT) {
bbs.nodesync(); // @todo Stop the display of telegrams bbs.nodesync(); // @todo Stop the display of telegrams
@ -182,9 +182,7 @@ while(bbs.online) {
break; break;
case '_': case '_':
if (! viewdata) if (! viewdata) break;
break;
case '#': case '#':
log(LOG_DEBUG,'- false: Key ['+read+'] ['+pageStr(fo)+']'); log(LOG_DEBUG,'- false: Key ['+read+'] ['+pageStr(fo)+']');
if (fo.index !== 'z') { if (fo.index !== 'z') {
@ -371,6 +369,8 @@ while(bbs.online) {
// Login frame. // Login frame.
case FRAME_TYPE_LOGIN: case FRAME_TYPE_LOGIN:
switch (read) { switch (read) {
case '_':
if (! viewdata) break;
case '#': case '#':
case '\r': case '\r':
log(LOG_DEBUG,'- MODE_FIELD:FRAME_TYPE_LOGIN: ['+read+'] A'); log(LOG_DEBUG,'- MODE_FIELD:FRAME_TYPE_LOGIN: ['+read+'] A');
@ -396,7 +396,6 @@ while(bbs.online) {
// End of field entry. // End of field entry.
case '_': case '_':
if (! viewdata) break; if (! viewdata) break;
case '#': case '#':
case '\r': case '\r':
log(LOG_DEBUG,'- MODE_FIELD:FRAME_TYPE_RESPONSE: # ['+read+']'); log(LOG_DEBUG,'- MODE_FIELD:FRAME_TYPE_RESPONSE: # ['+read+']');
@ -736,7 +735,7 @@ while(bbs.online) {
// If we are editing a specific frame, attempt to load it // If we are editing a specific frame, attempt to load it
if (fe) { if (fe) {
current = fo; current = fo;
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame(); fo = viewdata ? new VIEWDATAFrame() : new ANSIFrame();
fo.load(pageStr(fe)); fo.load(pageStr(fe));
// If the frame doesnt exist, check that the parent frame exists in case we are creating a new one // If the frame doesnt exist, check that the parent frame exists in case we are creating a new one
@ -745,7 +744,7 @@ while(bbs.online) {
// We can always create an 'a' frame // We can always create an 'a' frame
if (fe.index !== 'a') { if (fe.index !== 'a') {
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame(); fo = viewdata ? new VIEWDATAFrame() : new ANSIFrame();
fo.load(pageStr({frame: fe.frame, index: String.fromCharCode(fe.index.charCodeAt(0)-1)})); 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)+')'); log(LOG_DEBUG,'- ACTION_EDIT: check index: '+JSON.stringify(fo)+' ('+String.fromCharCode(fe.index.charCodeAt(0)-1)+')');
@ -759,7 +758,7 @@ while(bbs.online) {
} }
// New frame // New frame
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame(); fo = viewdata ? new VIEWDATAFrame() : new ANSIFrame();
fo.frame = fe.frame; fo.frame = fe.frame;
fo.index = fe.index; fo.index = fe.index;
fo.cost = 0; fo.cost = 0;
@ -798,7 +797,7 @@ while(bbs.online) {
if (next_page !== null) { if (next_page !== null) {
current = fo; current = fo;
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame(); fo = viewdata ? new VIEWDATAFrame() : new ANSIFrame();
fo.load(pageStr(next_page)); fo.load(pageStr(next_page));
if (fo.page == null) { if (fo.page == null) {
@ -806,7 +805,7 @@ while(bbs.online) {
// In case the frame doesnt exist // In case the frame doesnt exist
if (fo == null) if (fo == null)
fo = viewdata ? new ANSIFrame() : new VIEWDATAFrame(); fo = viewdata ? new VIEWDATAFrame() : new ANSIFrame();
// sendbaseline ERR_PAGE // sendbaseline ERR_PAGE
fo.sendBaseline('ERR_ROUTE',false); fo.sendBaseline('ERR_ROUTE',false);