diff --git a/load/defs.js b/load/defs.js index efd00cd..2df1685 100644 --- a/load/defs.js +++ b/load/defs.js @@ -15,6 +15,7 @@ const FRAMES_HOME = ANSITEX_HOME+'/text/'; 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]*$/; diff --git a/load/msgbases.js b/load/msgbases.js index 98c210d..35a362f 100644 --- a/load/msgbases.js +++ b/load/msgbases.js @@ -163,7 +163,7 @@ function MsgArea() { var headers = msgbase.get_all_msg_headers(false,false) || []; for (var i in headers) { - if ((! (headers[i].attr&MSG_DELETE)) && headers[i].tags && ((! regex) || regex.test(headers[i].tags))) + if ((! (headers[i].attr&MSG_DELETE)) && (headers[i].from === 'SYSTEM') && ((! regex) || regex.test(headers[i].to))) frames.push(headers[i]); } @@ -426,10 +426,13 @@ function MsgArea() { var raw = msgbase.get_msg_body(false,id,false,false,true,true); // Our messages are terminated with \r=== EOF - if (! /^(.*)\r=== EOF/.test(raw)) + var regex = new RegExp('^(.*)'+FRAMES_EOF_MARKER); + if (! regex.test(raw)) return undefined; - var content = JSON.parse(LZString.decompressFromBase64(raw.replace(/\r=== EOF[.\s\S]*$/,''))); + var regex = new RegExp(FRAMES_EOF_MARKER+'[.\\s\\S]*$'); + + var content = JSON.parse(LZString.decompressFromBase64(raw.replace(regex,''))); msgbase.close(); } else { diff --git a/load/page.js b/load/page.js index 384f5b0..becefd1 100644 --- a/load/page.js +++ b/load/page.js @@ -110,8 +110,6 @@ require('sbbsdefs.js','SS_USERON'); // Need for our ANSI colors eg: BG_* * - load - Load the frame from the msgbase */ function Page(debug) { - const EOF_MARKER = "\r=== EOF"; - this.__window__ = { layout: undefined, // Window - Full page content header: undefined, // Window - Page Title @@ -1043,7 +1041,7 @@ function Page(debug) { return a.number < b.number else return (a.when_imported_time < b.when_imported_time); }) - .filter(function(item) { return item.tags === page; }).pop(); + .filter(function(item) { return (item.from === 'SYSTEM') && (item.to === page); }).pop(); if (msg === undefined) { log(LOG_DEBUG,'|- Frame not found: ['+page.toString()+'] in ['+FRAMES_MSG_BASE+']'); @@ -1058,6 +1056,7 @@ function Page(debug) { return false; contents.content = contents.content[SESSION_EXT]; + log(LOG_DEBUG,'|/ Content:'+contents.content); return this.preload(contents,SESSION_EXT); } @@ -1307,7 +1306,7 @@ function Page(debug) { 'content': p.raw, }; - var body = LZString.compressToBase64(JSON.stringify(page))+EOF_MARKER; + var body = LZString.compressToBase64(JSON.stringify(page))+FRAMES_EOF_MARKER; if (! msgbase.save_msg(hdr,body)) { log(LOG_ERROR,' ! Error saving frame: ['+this.name.toString()+']');