From f7a581fa30492009145e521e174623d422f67f84 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 3 Dec 2024 21:36:03 +1100 Subject: [PATCH] Work on v2 frame files --- load/defs.js | 14 +-- load/page.js | 204 ++++++++++++++++++++++++++++----------- load/session/ansitex.js | 2 +- load/session/viewdata.js | 2 +- load/windows.js | 10 +- main.js | 2 + text/980a | 1 + text/998a | 1 + text/99a | 1 + text/99b | 1 + text/tex/980a | 1 - text/tex/998a | 1 - text/tex/99a | 1 - text/tex/99b | 1 - text/vtx/980a | 1 - text/vtx/998a | 1 - text/vtx/99a | 1 - text/vtx/99b | 1 - tools/frame_get.js | 31 ++++++ tools/frames_check.js | 144 --------------------------- 20 files changed, 200 insertions(+), 221 deletions(-) create mode 100644 text/980a create mode 100644 text/998a create mode 100644 text/99a create mode 100644 text/99b delete mode 100644 text/tex/980a delete mode 100644 text/tex/998a delete mode 100644 text/tex/99a delete mode 100644 text/tex/99b delete mode 100644 text/vtx/980a delete mode 100644 text/vtx/998a delete mode 100644 text/vtx/99a delete mode 100644 text/vtx/99b create mode 100644 tools/frame_get.js delete mode 100644 tools/frames_check.js diff --git a/load/defs.js b/load/defs.js index fef34fb..efd00cd 100644 --- a/load/defs.js +++ b/load/defs.js @@ -62,19 +62,19 @@ const MODE_RFERROR = 6; // @todo Change these to bits /* Information Frame, requires no response after viewed */ -const FRAME_TYPE_INFO = 'i'; +const FRAME_TYPE_INFO = 0; //'i'; /* Terminate Frame, contents displayed and then carrier dropped */ -const FRAME_TYPE_TERMINATE = 't'; +const FRAME_TYPE_TERMINATE = 15; //'t'; /** * Frame the calls an External Method * Contents indicate the method to be called with arguments */ -const FRAME_TYPE_EXTERNAL = 'x'; +const FRAME_TYPE_EXTERNAL = 13; //'x'; /** * Frame calls a door * Contents indicate the name of the door */ -const FRAME_TYPE_DOOR = 'X'; +const FRAME_TYPE_DOOR = 11; //'X'; /** * Frame renders a BBS from sbbslist * Contents can be: @@ -86,13 +86,13 @@ const FRAME_TYPE_BBS = 'b'; * Response frame, input fields are embedded in the frame and after input the * response will be submitted to the Service Provider, or to a method */ -const FRAME_TYPE_RESPONSE = 'r'; +const FRAME_TYPE_RESPONSE = 1; //'r'; /* Login frame, enables the user to authenticate to the system, or to a CUG */ -const FRAME_TYPE_LOGIN = 'l'; +const FRAME_TYPE_LOGIN = 12; //'l'; /* Mail template frames - mail templates will have the user's stats for the area passed to render() */ const FRAME_TYPE_MAIL_TEMPLATE = 'm'; /* Frame is a message */ -const FRAME_TYPE_MESSAGE = 'M'; +const FRAME_TYPE_MESSAGE = 2; // 'M'; /* Disable *# going backwards for the following frames */ const FRAMES_NO_HISTORY = ['980a','98b','981a','982a','983a','998a']; diff --git a/load/page.js b/load/page.js index 78627b3..0526ccd 100644 --- a/load/page.js +++ b/load/page.js @@ -123,14 +123,15 @@ function Page(debug) { this.__properties__ = { name: new PageObject, - type: undefined, // Frame type + //type: undefined, // Frame type (deprecated, see attrs) + attrs: 0, // (Type 0, CUG 0 (public), Hidden=false) input_fields: [], // Array of our input fields dynamic_fields: [], // Array of our dynamic fields - isAccessible: undefined, // Is this page visible to all users + //isAccessible: undefined, // Is this page visible to all users (deprecated, see attrs) // If FALSE, only the SP can view/edit the frame - isPublic: undefined, // Is this page visible to public (not CUG) users + //isPublic: undefined, // Is this page visible to public (not CUG) users (deprecated, see attrs) // If FALSE user must be a member of the CUG to view the frame // All users, including unauthenticated, are members of 'system' (owner = 0) // Frame's owned by the system where: @@ -197,57 +198,89 @@ function Page(debug) { } } - // @todo change this to Object.defineProperty() - see page.js /** * Determine if this frame is accessible to the current user */ - Page.prototype.__defineGetter__('accessible',function() { - log(LOG_DEBUG,'- Checking if user ['+user.number+'] can access frame: '+this.name.toString()); - log(LOG_DEBUG,'|* Frame Owner: '+JSON.stringify(this.pageowner)+', System Frame: '+(this.pageowner === SYSTEM_OWNER)); - log(LOG_DEBUG,'|* Accessible: '+JSON.stringify(this.__properties__.isAccessible)); - log(LOG_DEBUG,'|* Public: '+JSON.stringify(this.__properties__.isPublic)); - log(LOG_DEBUG,'|* Member: '+JSON.stringify(this.isMember)); + Object.defineProperty(this,'accessible',{ + get: function() { + log(LOG_DEBUG,'- Checking if user ['+user.number+'] can access frame: '+this.name.toString()); + log(LOG_DEBUG,'|* Frame Owner: '+this.owner+', System Frame: '+this.isSystemPage); + log(LOG_DEBUG,'|* Accessible: '+this.isAccessible); + log(LOG_DEBUG,'|* Public: '+this.isPublic); + log(LOG_DEBUG,'|* Member: '+this.isMember); - // user.number 0 is unidentified user. - if (user.number) { - return ( - (this.__properties__.isAccessible && this.pageowner === SYSTEM_OWNER && ! this.__properties__.isPublic) || - (this.__properties__.isAccessible && this.__properties__.isPublic) || - (this.__properties__.isAccessible && ! this.__properties__.isPublic && this.isMember) || - (pageEditor(this.name.frame)) - ); + // user.number 0 is unidentified user. + if (user.number) { + return ( + (this.isAccessible && this.isSystemPage && ! this.isPublic) || + (this.isAccessible && this.isPublic) || + (this.isAccessible && ! this.isPublic && this.isMember) || + (pageEditor(this.name.frame)) + ); - } else { - return this.__properties__.isAccessible && (this.pageowner === SYSTEM_OWNER) && this.__properties__.isPublic; + } else { + return this.isAccessible && this.isSystemPage && this.isPublic; + } } }); - Page.prototype.__defineGetter__('cost',function() { - return Number(this.__properties__.cost); + // The page attributes, which determine accessible, public, cug and frame type + Object.defineProperty(this,'attrs',{ + get: function() { + return this.__properties__.attrs; + }, + + /* Frame attributes are bit items, bits: + * 1-4 TYPE + * 5-7 CUG + * 8 accessible + */ + set: function(int) { + if (int === undefined) + int = 0; + + this.__properties__.attrs = int; + } }); - Page.prototype.__defineSetter__('cost',function(int) { - if (typeof int !== 'number') - throw new Error('Cost must be a number'); - this.__properties__.cost = int; + Object.defineProperty(this,'cost',{ + get: function() { + return Number(this.__properties__.cost); + }, - if ((''+int).length > FRAME_COST_LENGTH-1-FRAME_ATTR_LENGTH) - throw new Error('Cost too large'); + set: function(int) { + if (int === undefined) + int = 0; - // Populate the cost window - switch (SESSION_EXT) { - case 'tex': - this.__window__.cost.__properties__.content = rawtoattrs(ESC+'[1;32m'+padright(int,FRAME_COST_LENGTH-1-FRAME_ATTR_LENGTH,' ')+FRAME_COSTUNIT).content; + if (typeof int !== 'number') + throw new Error('Cost must be a number'); - break; + this.__properties__.cost = int; - case 'vtx': - this.__window__.cost.__properties__.content = rawtoattrs(VIEWDATA_BIN_GREEN+padright(int,FRAME_COST_LENGTH-1-FRAME_ATTR_LENGTH,' ')+FRAME_COSTUNIT).content; + if ((''+int).length > FRAME_COST_LENGTH-1-FRAME_ATTR_LENGTH) + throw new Error('Cost too large'); - break; + // Populate the cost window + switch (SESSION_EXT) { + case 'tex': + this.__window__.cost.__properties__.content = rawtoattrs(ESC+'[1;32m'+padright(int,FRAME_COST_LENGTH-1-FRAME_ATTR_LENGTH,' ')+FRAME_COSTUNIT).content; - default: - throw new Error(SESSION_EXT+' type not implemented'); + break; + + case 'vtx': + this.__window__.cost.__properties__.content = rawtoattrs(VIEWDATA_BIN_GREEN+padright(int,FRAME_COST_LENGTH-1-FRAME_ATTR_LENGTH,' ')+FRAME_COSTUNIT).content; + + break; + + default: + throw new Error(SESSION_EXT+' type not implemented'); + } + } + }); + + Object.defineProperty(this,'cug',{ + get: function() { + return ((this.__properties__.attrs >> 4) & 0x7); } }); @@ -273,26 +306,34 @@ function Page(debug) { this.__properties__.input_fields = array; }); - Page.prototype.__defineSetter__('isAccessible',function(bool) { - if (typeof bool !== 'boolean') - throw new Error('isAccessible must be a boolean'); - - this.__properties__.isAccessible = bool; + Object.defineProperty(this,'isAccessible',{ + get: function() { + return (this.__properties__.attrs >> 7 !== 1); + } }); /** * Check if the user is already a member of the CUG */ - Page.prototype.__defineGetter__('isMember',function() { - // @todo Implement CUGs, this would be "=== SERVICE_PROVIDER" and user is a member of SERVICE_PROVIDER - return user.number && (this.pageowner === SYSTEM_OWNER); + Object.defineProperty(this,'isMember',{ + get: function() { + // @todo Implement CUGs, this would be "=== SERVICE_PROVIDER" and user is a member of SERVICE_PROVIDER + return (user.number > 0) && this.isSystemPage; + } }); - Page.prototype.__defineSetter__('isPublic',function(bool) { - if (typeof bool !== 'boolean') - throw new Error('isPublic must be a boolean'); + // Is the page public or CUG + Object.defineProperty(this,'isPublic',{ + get: function() { + return (this.cug === 0); + } + }); - this.__properties__.isPublic = bool; + // Is this a system page + Object.defineProperty(this,'isSystemPage',{ + get: function() { + return (this.owner === SYSTEM_OWNER); + } }); // Key Array @@ -337,12 +378,20 @@ function Page(debug) { } }); + // Display who owns the page + Object.defineProperty(this,'owner',{ + get: function() { + return pageOwner(this.__properties__.name.frame).prefix; + }, + }); + Page.prototype.__defineGetter__('pagenext',function() { return this.__properties__.name.next; }); /** * Determine who the owner of a page is + * @deprecated use owner */ Page.prototype.__defineGetter__('pageowner',function() { return pageOwner(this.__properties__.name.frame).prefix; @@ -386,6 +435,12 @@ function Page(debug) { this.__window__.header.visible = bool; }); + Object.defineProperty(this,'type',{ + get: function() { + return this.__properties__.attrs & 0xf; + }, + }); + Page.prototype.__defineGetter__('type',function() { return this.__properties__.type; }); @@ -839,8 +894,10 @@ function Page(debug) { if (!(page instanceof PageObject)) throw new Error('page must be a PageObject'); + this.name = page; + // Load a page from disk first if it exists - if (FRAMES_MSG_FILES && this.import(FRAMES_HOME+SESSION_EXT+'/'+page.toString(),SESSION_EXT)) + if (FRAMES_MSG_FILES && this.import(FRAMES_HOME+page.toString(),SESSION_EXT)) return true; // Fall back to loading from msgbase @@ -1192,9 +1249,34 @@ function Page(debug) { break; case 2: + // Load the page content + var content_file = FRAMES_HOME+SESSION_EXT+'/'+this.name.toString()+'.'+CONTENT_EXT; + log(LOG_DEBUG,'|-- Importing frame content: ['+content_file+']'); + + var f = new File(content_file); + if (! f.exists || ! f.open('rb',true)) { + log(LOG_ERROR,'|? File doesnt exist: ['+content_file+']'); + this.get(new PageObject(FRAME_SYSTEM_ERROR)); + break; + } + + this.__properties__.raw = f.read(); + f.close(); + + var page = rawtoattrs(this.__properties__.raw,this.width,this.__window__.body.y,this.__window__.body.x); + + this.__window__.body.__properties__.content = page.content; + this.dynamic_fields = page.dynamic_fields; + + // Our fields are sorted in x descending order + if (page.input_fields.length) + this.input_fields = page.input_fields.sort(function(a,b) { return a.x < b.x ? 1 : -1; }); + // Work out frame type - writeln(JSON.stringify(contents)); - exit(2); + this.attrs = contents.attrs; + this.cost = contents.cost; + this.key = contents.key; + break; default: @@ -1354,11 +1436,19 @@ function PageObject(frame,index) { this.__properties__.frame = frame.frame.toString(); this.index = frame.index; - } else { - this.__properties__.frame = frame; + } else if ((frame !== undefined) && (index === undefined)) { + if (/^\d+[a-z]$/.test(frame)) { + var split = frame.split(/(\d+)/); + this.__properties__.frame = split[1]; + this.index = split[2]; - if (index) - this.index = index; + } else { + this.__properties__.frame = frame; + } + + } else if ((frame !== undefined) && (index !== undefined)) { + this.__properties__.frame = frame; + this.index = index; } } diff --git a/load/session/ansitex.js b/load/session/ansitex.js index 0b22e4e..83621e4 100644 --- a/load/session/ansitex.js +++ b/load/session/ansitex.js @@ -1,5 +1,5 @@ const SESSION_ANSITEX = (1<<1); -var SESSION_EXT = 'tex'; +var CONTENT_EXT = 'ans'; var FRAME_WIDTH = 80; var FRAME_HEIGHT = 22; diff --git a/load/session/viewdata.js b/load/session/viewdata.js index 5c94375..4c9895d 100644 --- a/load/session/viewdata.js +++ b/load/session/viewdata.js @@ -1,5 +1,5 @@ const SESSION_VIEWDATA = (1<<2); -var SESSION_EXT = 'vtx'; +var CONTENT_EXT = 'bin'; var FRAME_WIDTH = 40; var FRAME_HEIGHT = 22; diff --git a/load/windows.js b/load/windows.js index 6a56e4b..27edfb3 100644 --- a/load/windows.js +++ b/load/windows.js @@ -944,13 +944,15 @@ function Char(ch,attr) { ansi.push(r); } - if (false && debug) + if (debug) writeln(' - ansi:'+ansi); return ansi.length ? (debug ? '': '\x1b')+'['+ansi.join(';')+'m' : undefined; case 'vtx': - log(LOG_DEBUG,'+ last:'+last+', attr ('+this.attr+')'); + if (debug) + log(LOG_DEBUG,'+ last:'+last+', attr ('+this.attr+')'); + switch (this.attr) { // \x08 case BLINK: @@ -1039,7 +1041,9 @@ function Char(ch,attr) { } } - log(LOG_DEBUG,'= result:'+r.charCodeAt(0)+', ('+r+')'); + if (debug) + log(LOG_DEBUG,'= result:'+r.charCodeAt(0)+', ('+r+')'); + return ESC+r; default: diff --git a/main.js b/main.js index 4ed2ab3..e16fc7b 100644 --- a/main.js +++ b/main.js @@ -42,11 +42,13 @@ bbs.replace_text(826,''); // LoggingOn switch (client.socket.local_port) { case 516: + var SESSION_EXT = 'vtx'; require(ANSITEX_HOME+'/load/session/viewdata.js','SESSION_VIEWDATA'); break; // Assume ANSItex default: + var SESSION_EXT = 'tex'; require(ANSITEX_HOME+'/load/session/ansitex.js','SESSION_ANSITEX'); } diff --git a/text/980a b/text/980a new file mode 100644 index 0000000..c229ab1 --- /dev/null +++ b/text/980a @@ -0,0 +1 @@ +{"version":2,"key":[0,0,null,null,null,null,null,null,null,null]} diff --git a/text/998a b/text/998a new file mode 100644 index 0000000..8d27527 --- /dev/null +++ b/text/998a @@ -0,0 +1 @@ +{"version":2,"key":[0,null,null,null,null,null,null,null,null,null]} diff --git a/text/99a b/text/99a new file mode 100644 index 0000000..8d27527 --- /dev/null +++ b/text/99a @@ -0,0 +1 @@ +{"version":2,"key":[0,null,null,null,null,null,null,null,null,null]} diff --git a/text/99b b/text/99b new file mode 100644 index 0000000..93f23dc --- /dev/null +++ b/text/99b @@ -0,0 +1 @@ +{"version":2,"attrs":"15","key":[null,null,null,null,null,null,null,null,null,null]} diff --git a/text/tex/980a b/text/tex/980a deleted file mode 100644 index ede1733..0000000 --- a/text/tex/980a +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"frame":"980","index":"a","owner":9,"cost":0,"content":"G1swbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMzFt2sQbWzFt3BtbMDszMm3axBtbMW3cG1swOzM0bdrEG1sxbdwbWzA7MzZtIBtbMTszM23fG1swbSAbWzMwOzQ3bdrC3NrE3Nog3CAbWzM3OzQwbQ0KIBtbMW3aIL/Cv7Pav9q/2sK/wr8bWzBtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzE7MzFtsxtbMDszMW3f2xtbMTszMm2zG1swOzM2bSAbWzMybdsbWzE7MzRtLlwbWzA7MzRt3BtbMzNt3htbMW3bG1swbSAbWzMwOzQ3bSCzIMNf3Nrf3CAbWzM3OzQwbQ0KILOzs8PZs7Mgs7OzILPD2SAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1sxOzMwbcTExMTExMTExMTExBtbMDszMDs0N23c3Nzc3Nzc3NzcG1szNzs0MG0NCiAbWzE7MzBtwMHZwdnAwNnA2cAg2cHZG1swbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzE7MzBtbm9kZTobWzBtIBtbMTszMm0bWG5vZGVpZDstMTEbXBtbMzRtDQobWzBtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzE7MzBtZGF0ZTobWzA7MzJtIBtbMW0bWERBVEU6JVktJWItJWQ7LTExG1wbWzBtDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMTszMG10aW1lOiAbWzMybRtYVElNRTstMTEbXBtbMG0NCg0KIBtbMW1XZWxjb21lLCB5b3UgaGF2ZSBjb25uZWN0ZWQgdG8gG1szMW1BG1szMm1OG1szNG1TG1szM21JG1swOzMwOzQ3bXRleBtbMTszNzs0MG0gYSBCQlMgdGhhdCBpcyBiYXNlZCBvbiB0aGUbWzBtDQogG1sxbTE5ODAncyBWaWRlb3RleCBzZXJ2aWNlLCBidXQgdXNpbmcgQU5TSS4bWzBtDQoNCiAbWzFtRGVwZW5kaW5nIG9uIHdoaWNoIGNvdW50cnkgeW91IGxpdmUgaW4gdGhlIFZpZGVvdGV4IHNlcnZpY2Ugd2FzIGNhbGxlZBtbMG0NCiAbWzFtVmlhdGVsIChBVSksIFByZXN0ZWwgKFVLKSwgTWluaXRleCAoRlIpLCBUZWxpZG9uIChDQSksIEliZXJ0ZXggKFNQKSwgZXRjG1swbQ0KG1sxbQ0KG1swbSAbWzFtSWYgeW91IGdvdCBoZXJlIGJ5IG1pc3Rha2UsIHlvdSBzaG91bGQgZGlzY29ubmVjdCBub3csIG90aGVyd2lzZSwgeW91IGNhbhtbMG0NChtbMW0gcHJlc3MbWzBtIBtbMTs1OzMybTAbWzA7MW0gdG8gZ2V0IHRvIHRoZSBsb2dpbiBzY3JlZW4uG1swbQ0KG1sxbQ0KG1swbQ0K","isPublic":1,"isAccessible":1,"type":"i","key":[0,982,null,null,null,null,null,null,null,null],"date":"2020-07-05T12:57:03.790Z"} diff --git a/text/tex/998a b/text/tex/998a deleted file mode 100644 index f40aa03..0000000 --- a/text/tex/998a +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"frame":998,"index":"a","owner":9,"cost":0,"content":"G1swbRtbMzFt2sQbWzFt3BtbMDszMm3axBtbMW3cG1swOzM0bdrEG1sxbdwbWzA7MzZtIBtbMTszM23fG1swbSAbWzMwOzQ3bdrC3NrE3Nog3CAbWzM3OzQwbQ0KG1sxOzMxbbMbWzA7MzFt39sbWzE7MzJtsxtbMDszNm0gG1szMm3bG1sxOzM0bS5cG1swOzM0bdwbWzMzbd4bWzFt2xtbMG0gG1szMDs0N20gsyDDX9za39wgG1szNzs0MG0NChtbMTszMG3ExMTExMTExMTExMQbWzA7MzA7NDdt3Nzc3Nzc3Nzc3BtbMzc7NDBtDQoNChtbMW1IbW0sIGEgc3lzdGVtIBtbMzFtRVJST1IbWzM3bSBvY2N1cnJlZC4bWzBtDQobWzFtTm9kZSAgOiAbWzMxbRtYbm9kZWlkOzgbXBtbMG0NChtbMW1TeXN0ZW06IBtbMzFtG1hCQlM7MTAbXBtbMG0NCg0KG1sxbUlmIHRoaXMga2VlcHMgaGFwcGVuaW5nLCB5b3UgbWF5IG5lZWQgdG8gdGVsbCB0aGUgc3lzdGVtIGFkbWluaXN0cmF0b3IbWzBtDQobWzFtdmlhIHBhZ2UgG1szMm0qMDgbWzBtDQoNChtbMW1UbyB0cnkgYWdhaW4sIHBsZWFzZSBwcmVzcyAbWzMybTAbWzBtDQo=","isPublic":1,"isAccessible":1,"type":"i","key":[0,null,null,null,null,null,null,null,null,null],"date":"2021-02-18T00:52:54.117Z"} diff --git a/text/tex/99a b/text/tex/99a deleted file mode 100644 index 5b5735e..0000000 --- a/text/tex/99a +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"frame":99,"index":"a","owner":9,"cost":0,"content":"G1swbSAgICAgICAgG1sxbdq/G1swbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1szMW3axBtbMW3cG1swOzMybdrEG1sxbdwbWzA7MzRt2sQbWzFt3BtbMDszNm0gG1sxOzMzbd8bWzBtIBtbMzA7NDdt2sLc2sTc2iDcIBtbMzc7NDBtDQogG1sxbcK/2r/av9q0w7+/2sK/G1swbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMTszMW2zG1swOzMxbd/bG1sxOzMybbMbWzA7MzZtIBtbMzJt2xtbMTszNG0uXBtbMDszNG3cG1szM23eG1sxbdsbWzBtIBtbMzA7NDdtILMgw1/c2t/cIBtbMzc7NDBtDQogs7Ozs7Ozs7Ozs7Ozw9kgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzE7MzBtxMTExMTExMTExMTEG1swOzMwOzQ3bdzc3Nzc3Nzc3NwbWzM3OzQwbQ0KIBtbMTszMG3BtMDZwNnA2cDZwLTB2RtbMG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMTszMG1ub2RlOhtbMG0gG1sxOzMybRtYbm9kZWlkOy0xMRtcG1swbQ0KIBtbMTszMG3E2RtbMzFtICAgICAgICAbWzMwbcTZG1swbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzE7MzBtZGF0ZTobWzBtIBtbMTszMm0bWERBVEU6JVktJWItJWQ7LTExG1wbWzBtDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMTszMG10aW1lOhtbMG0gG1sxOzMybRtYVElNRTstMTEbXBtbMG0NCg0KIFlvdSBhcmUgYWJvdXQgdG8gZGlzY29ubmVjdCBmcm9tIBtbMTszMW1BG1szMm1OG1szNG1TG1szM21JG1swOzMwOzQ3bXRleBtbMzc7NDBtIBtbMW0bWFJFQUxOQU1FOzIwG1wbWzBtDQoNCiBJZiB5b3Ugd2FudGVkIHRvIHN0YXkgb25saW5lLCB5b3UgY2FuIHByZXNzIBtbMTszMm0qMCMbWzBtIHRvIGdldCBiYWNrIHRvIHRoZSBtYWluIG1lbnUNCg0KIE90aGVyd2lzZSBwcmVzcyAbWzE7NTszMm0jG1swOzE7MzNtIBtbMG10byBkaXNjb25uZWN0IG5vdy4NCg0KDQoNCg0KDQoNCg0KDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMTs1OzMybSowIxtbMDsxbSB0byBnZXQgYmFjayB0byB0aGUgTWFpbiBNZW51G1swbQ0K","isPublic":1,"isAccessible":1,"type":"i","key":[0,null,null,null,null,null,null,null,null,null],"date":"2020-07-15T12:15:47.742Z"} diff --git a/text/tex/99b b/text/tex/99b deleted file mode 100644 index 6f81d01..0000000 --- a/text/tex/99b +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"frame":99,"index":"b","owner":9,"cost":0,"content":"G1swbSAgICAgICAgG1sxbdq/G1swbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1szMW3axBtbMW3cG1swOzMybdrEG1sxbdwbWzA7MzRt2sQbWzFt3BtbMDszNm0gG1sxOzMzbd8bWzBtIBtbMzA7NDdt2sLc2sTc2iDcIBtbMzc7NDBtDQogG1sxbcK/2r/av9q0w7+/2sK/G1swbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMTszMW2zG1swOzMxbd/bG1sxOzMybbMbWzA7MzZtIBtbMzJt2xtbMTszNG0uXBtbMDszNG3cG1szM23eG1sxbdsbWzBtIBtbMzA7NDdtILMgw1/c2t/cIBtbMzc7NDBtDQogs7Ozs7Ozs7Ozs7Ozw9kgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzE7MzBtxMTExMTExMTExMTEG1swOzMwOzQ3bdzc3Nzc3Nzc3NwbWzM3OzQwbQ0KIBtbMTszMG3BtMDZwNnA2cDZwLTB2RtbMG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMTszMG1ub2RlOhtbMG0gG1sxOzMybRtYbm9kZWlkOy0xMRtcG1swbSAgG1sxOzMwbcTZG1szMW0gICAgICAgIBtbMzBtxNkbWzBtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMTszMG1kYXRlOhtbMG0gG1sxOzMybRtYREFURTolWS0lYi0lZDstMTEbXBtbMG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzE7MzBtdGltZTobWzBtIBtbMTszMm0bWFRJTUU7LTExG1wbWzBtDQoNCiBUaGFua3MgZm9yIHZpc2l0aW5nIBtbMTszMW1BG1szMm1OG1szNG1TG1szM21JG1swOzMwOzQ3bXRleBtbMzc7NDBtIBtbMW0bWFJFQUxOQU1FOzIwG1wbWzBtDQoNCiBIb3BlIHRvIHNlZSB5b3UgYWdhaW4uLi4NCg==","isPublic":1,"isAccessible":1,"type":"t","key":[1,null,null,null,null,null,null,null,null,null],"date":"2020-07-08T01:48:01.797Z"} diff --git a/text/vtx/980a b/text/vtx/980a deleted file mode 100644 index 633fc9c..0000000 --- a/text/vtx/980a +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"frame":"980","index":"a","owner":9,"cost":0,"content":"ESxsEnxsFHwsEywXN2t/IzM3ayM1ICAgICAgICAgICAgICAgICAgIBF/axJ/ahQvfBN/FzVobyA8PSQsNSAgICAgICAgICAgICAgICAgICARLy4SLyoULC8TLxd1cHpwcXV6cDUgICAgICAgICAgICAgICAgICAgIFZpZGVvdGV4ICAgICAgICAgICAgICAgICAgICAgIA1XZWxjb21lICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlbGNvbWUsIHlvdSBoYXZlIGNvbm5lY3RlZCB0byAgICAgICAgIAFBAk4DUwRJB3RleCBhIEJCUyB0aGF0IGlzIGJhc2VkIG9uIHRoZSAgMTk4MCdzIFZpZGVvdGV4IHNlcnZpY2UuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZXBlbmRpbmcgb24gd2hpY2ggY291bnRyeSB5b3UgbGl2ZSBpbiAgdGhlIFZpZGVvdGV4IHNlcnZpY2Ugd2FzIGNhbGxlZCBWaWF0ZWwgIChBVSksIFByZXN0ZWwgKFVLKSwgTWluaXRlbCAoRlIpLCAgICAgICBUZWxpZG9uIChDQSksIEliZXJ0ZXggKFNQKSwgZXRjICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElmIHlvdSBnb3QgaGVyZSBieSBtaXN0YWtlLCB5b3Ugc2hvdWxkICBkaXNjb25uZWN0IG5vdywgb3RoZXJ3aXNlIHlvdSBjYW4gICAgICAgcHJlc3MCMAd0byBnZXQgdG8gdGhlIGxvZ2luIHNjcmVlbi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUbyBsb2dpbiB1c2luZyBTUVJMLCBwcmVzcwIx","isPublic":1,"isAccessible":1,"type":"i","key":[0,982,null,null,null,null,null,null,null,null],"date":"2020-07-05T12:57:03.790Z"} diff --git a/text/vtx/998a b/text/vtx/998a deleted file mode 100644 index cac3659..0000000 --- a/text/vtx/998a +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"frame":998,"index":"a","owner":9,"cost":0,"content":"ICARLGwSfGwUfCwTLBc3a38jMzdrIzUgICAgICACMDAwMTAwMDEwMSAgEX9rEn9qFC98E38XNWhvIDw9JCw1ByAgICAgICAgICAgICAgICAgIBEvLhIvKhQsLxMvF3VwenBxdXpwNSAgICAgICAgICAgICAgICAgICAgVmlkZW90ZXggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIbW0sIGFuAQ1FcnJvcgwHb2NjdXJyZWQuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElmIHRoaXMga2VlcHMgaGFwcGVuaW5nLCB5b3UgbWF5IGxpa2UgICB0byB0ZWxsIHRoZSBzeXN0ZW0gYWRtaW5pc3RyYXRvciB2aWEgICAgcGFnZQIqMDggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUHJlc3MCMAd0byByZXR1cm4gdG8gdGhlIG1haW4gbWVudS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA==","isPublic":1,"isAccessible":1,"type":"i","key":[0,null,null,null,null,null,null,null,null,null],"frame_fields": [],"date":"2020-08-09T11:42:40.643Z"} diff --git a/text/vtx/99a b/text/vtx/99a deleted file mode 100644 index a59bb26..0000000 --- a/text/vtx/99a +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"frame":99,"index":"a","owner":9,"cost":0,"content":"Fzcrby8/Py9vICAgICAgICAgIBEsbBJ8bBR8LBMsFzdrfyMzN2sjNRc1amogJTVzeiAgICAgICAgICARf2sSf2oUL3wTfxc1aG8gPD0kLDUXdXJ6c3F1c3ogICAgICAgICAgES8uEi8qFCwvEy8XdXB6cHF1enA1ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZGVvdGV4ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWW91IGFyZSBhYm91dCB0bwFkaXNjb25uZWN0B2Zyb20gICAgICAgAUECTgRTA0kHdGV4LiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVG8gaGVhZCBiYWNrIHRvIHRoZSBtYWluIG1lbnUsIHBsZWFzZSAgIHVzZQIqMF8HICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT3RoZXJ3aXNlIHRvIGRpc2Nvbm5lY3QgcHJlc3MCXyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA1UaGFua3MgZm9yIGNhbGxpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA==","isPublic":1,"isAccessible":1,"type":"i","key":[0,null,null,null,null,null,null,null,null,null],"date":"2020-07-15T12:15:47.742Z"} diff --git a/text/vtx/99b b/text/vtx/99b deleted file mode 100644 index a591d03..0000000 --- a/text/vtx/99b +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"frame":99,"index":"b","owner":9,"cost":0,"content":"Fzcrby8/Py9vICAgICAgICAgIBEsbBJ8bBR8LBMsFzdrfyMzN2sjNRc1amogJTVzeiAgICAgICAgICARf2sSf2oUL3wTfxc1aG8gPD0kLDUXdXJ6c3F1c3ogICAgICAgICAgES8uEi8qFCwvEy8XdXB6cHF1enA1ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZGVvdGV4ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICANVGhhbmtzIGZvciBjYWxsaW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSG9wZSB0byBzZWUgeW91IGFnYWluLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAo=","isPublic":1,"isAccessible":1,"type":"t","key":[1,null,null,null,null,null,null,null,null,null],"date":"2020-07-08T01:48:01.797Z"} diff --git a/tools/frame_get.js b/tools/frame_get.js new file mode 100644 index 0000000..694c0cd --- /dev/null +++ b/tools/frame_get.js @@ -0,0 +1,31 @@ +load('ansitex/load/page.js'); +load('ansitex/load/funcs.js'); +load('ansitex/load/session/ansitex.js'); +load('lz-string.js'); + +if (argv.length !== 1) { + writeln('ERROR: Need a frame ID'); + exit(1); + +} else { + writeln('Showing frames:'+argv[0]); +} + +const SESSION_EXT = 'tex'; + +var p = new Page(); +var po = new PageObject(argv[0]); + +if (p.get(po)) { + writeln('Page : '+p.name); + writeln('- Cost : '+p.cost); + writeln('- Owner : '+p.owner); + writeln('- Key : '+p.key); + writeln('- Type : '+p.type); + writeln('- CUG : '+p.cug); + writeln('- isPublic: '+p.isPublic); + writeln('- isAccess: '+p.accessible); + +} else { + writeln('Failed to load:'+argv[0]); +} diff --git a/tools/frames_check.js b/tools/frames_check.js deleted file mode 100644 index 8aa7817..0000000 --- a/tools/frames_check.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - * This will go through our videotex and ansitex frames and check for inconsistencies. - * - * We'll check for: - * + Mismatched metadata items - * + Out of sync content - */ - -load('ansitex/load/funcs.js'); -// Our page handler -load('ansitex/load/page.js'); - -/* parse command arguments */ -if (argv.length !== 1) { - writeln('! ERROR: Need only 1 argument'); - exit(1); -} - -//const vtx_ext = 'tex'; -const vtx_src = 'bin'; -const tex_src = 'ans'; - -const page = argv.shift(); -const vtx_srcname = page+'.'+vtx_src; -const tex_srcname = page+'.'+tex_src; -var errors = false; - -PAGE_FILE_PREFX = /^[0-9]+[a-z]$/; - -if (! PAGE_FILE_PREFX.test(page)) { - writeln('PAGE is not a frame: '+page); - exit(2); -} - -writeln('Comparing Frame: '+page); - -// Load frame -require(ANSITEX_HOME+'/load/session/viewdata.js','SESSION_VIEWDATA'); -vtx = new Page(); -if (! vtx.import(FRAMES_HOME+SESSION_EXT+'/'+page)) { - writeln('- ! ERROR: VTX File doesnt exist? :'+page); - errors = true; - -} else { - // Check content between TEX/ANS & VTX/BIN - vtx_srcfile = new File(FRAMES_HOME+SESSION_EXT+'/'+vtx_srcname); - - if (! vtx_srcfile.exists || ! vtx_srcfile.open('r')) { - writeln('- ! ERROR: VTX SRC File doesnt exist? :'+vtx_srcname); - errors = true; - - } else { - writeln('- LOADING: VTX Source :'+vtx_srcname); - - var x = md5_calc(vtx.raw); - var y = md5_calc(vtx_srcfile.read()); - - // Check Content - if (x !== y) { - writeln(' - Page Content :'+x); - writeln(' - Source Content :'+y); - writeln('- ! WARNING: Content Differs.'); - errors = true; - - } else { - writeln('= Source matches.'); - } - } -} - -require(ANSITEX_HOME+'/load/session/ansitex.js','SESSION_ANSITEX'); -tex = new Page(); -if (! tex.import(FRAMES_HOME+SESSION_EXT+'/'+page)) { - writeln('- ! ERROR: TEX File doesnt exist? :'+page); - errors = true; - -} else { - // Check content between TEX/ANS & VTX/BIN - tex_srcfile = new File(FRAMES_HOME+SESSION_EXT+'/'+tex_srcname); - if (! tex_srcfile.exists || ! tex_srcfile.open('r')) { - writeln('- ! ERROR: TEX SRC File doesnt exist? :'+tex_srcname); - errors = true; - - } else { - writeln('- LOADING: TEX Source :'+tex_srcname); - - var x = md5_calc(tex.raw); - var y = md5_calc(tex_srcfile.read()); - - if (x !== y) { - // Check Content - writeln(' - Page Content :'+x); - writeln(' - Source Content :'+y); - writeln('- ! WARNING: Content Differs.'); - errors = true; - - } else { - writeln('= Source matches.'); - } - } -} - -// Checking keys -if (vtx.raw && tex.raw) { - writeln('- Checking Page: '); - - if (vtx.name.toString() !== tex.name.toString()) { - writeln(' - ! VTX: '+vtx.name.toString()); - writeln(' - ! TEX: '+tex.name.toString()); - - } else { - writeln(' = PAGE: '+vtx.name.toString()); - } - - for each (var k in ['key','cost','type']) { - writeln('- Checking KEY: '+k); - - if (JSON.stringify(vtx[k]) !== JSON.stringify(tex[k])) { - writeln(' - ! VTX: '+vtx[k]); - writeln(' - ! TEX: '+tex[k]); - errors = true; - } else { - writeln(' = KEY: '+vtx[k]); - } - } - - for each (var k in ['isAccessible','isPublic']) { - writeln('- Checking Property: '+k); - - if (JSON.stringify(vtx.__properties__[k]) !== JSON.stringify(tex.__properties__[k])) { - writeln(' - ! VTX: '+vtx.__properties__[k]); - writeln(' - ! TEX: '+tex.__properties__[k]); - errors = true; - - } else { - writeln(' = KEY: '+vtx.__properties__[k]); - } - } -} - -if (errors) - exit(1); -else - writeln('= OK');