diff --git a/load/defs.js b/load/defs.js index efd00cd..705789b 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=== 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..4c50fb1 100644 --- a/load/msgbases.js +++ b/load/msgbases.js @@ -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..2ed09cd 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 @@ -920,7 +918,7 @@ function Page(debug) { this.name = page; // Load a page from disk first if it exists - if (FRAMES_MSG_FILES && this.import(FRAMES_HOME+page.toString(),SESSION_EXT)) + if (false && FRAMES_MSG_FILES && this.import(FRAMES_HOME+page.toString(),SESSION_EXT)) return true; // Fall back to loading from msgbase @@ -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+']'); @@ -1307,7 +1305,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()+']');