Work on v2 frame files

This commit is contained in:
Deon George 2024-12-03 21:36:03 +11:00
parent 991a31e957
commit f7a581fa30
20 changed files with 200 additions and 221 deletions

View File

@ -62,19 +62,19 @@ const MODE_RFERROR = 6;
// @todo Change these to bits // @todo Change these to bits
/* Information Frame, requires no response after viewed */ /* 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 */ /* 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 * Frame the calls an External Method
* Contents indicate the method to be called with arguments * Contents indicate the method to be called with arguments
*/ */
const FRAME_TYPE_EXTERNAL = 'x'; const FRAME_TYPE_EXTERNAL = 13; //'x';
/** /**
* Frame calls a door * Frame calls a door
* Contents indicate the name of the 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 * Frame renders a BBS from sbbslist
* Contents can be: * 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 frame, input fields are embedded in the frame and after input the
* response will be submitted to the Service Provider, or to a method * 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 */ /* 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() */ /* Mail template frames - mail templates will have the user's stats for the area passed to render() */
const FRAME_TYPE_MAIL_TEMPLATE = 'm'; const FRAME_TYPE_MAIL_TEMPLATE = 'm';
/* Frame is a message */ /* Frame is a message */
const FRAME_TYPE_MESSAGE = 'M'; const FRAME_TYPE_MESSAGE = 2; // 'M';
/* Disable *# going backwards for the following frames */ /* Disable *# going backwards for the following frames */
const FRAMES_NO_HISTORY = ['980a','98b','981a','982a','983a','998a']; const FRAMES_NO_HISTORY = ['980a','98b','981a','982a','983a','998a'];

View File

@ -123,14 +123,15 @@ function Page(debug) {
this.__properties__ = { this.__properties__ = {
name: new PageObject, 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 input_fields: [], // Array of our input fields
dynamic_fields: [], // Array of our dynamic 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 // 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 // If FALSE user must be a member of the CUG to view the frame
// All users, including unauthenticated, are members of 'system' (owner = 0) // All users, including unauthenticated, are members of 'system' (owner = 0)
// Frame's owned by the system where: // 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 * Determine if this frame is accessible to the current user
*/ */
Page.prototype.__defineGetter__('accessible',function() { Object.defineProperty(this,'accessible',{
log(LOG_DEBUG,'- Checking if user ['+user.number+'] can access frame: '+this.name.toString()); get: function() {
log(LOG_DEBUG,'|* Frame Owner: '+JSON.stringify(this.pageowner)+', System Frame: '+(this.pageowner === SYSTEM_OWNER)); log(LOG_DEBUG,'- Checking if user ['+user.number+'] can access frame: '+this.name.toString());
log(LOG_DEBUG,'|* Accessible: '+JSON.stringify(this.__properties__.isAccessible)); log(LOG_DEBUG,'|* Frame Owner: '+this.owner+', System Frame: '+this.isSystemPage);
log(LOG_DEBUG,'|* Public: '+JSON.stringify(this.__properties__.isPublic)); log(LOG_DEBUG,'|* Accessible: '+this.isAccessible);
log(LOG_DEBUG,'|* Member: '+JSON.stringify(this.isMember)); log(LOG_DEBUG,'|* Public: '+this.isPublic);
log(LOG_DEBUG,'|* Member: '+this.isMember);
// user.number 0 is unidentified user. // user.number 0 is unidentified user.
if (user.number) { if (user.number) {
return ( return (
(this.__properties__.isAccessible && this.pageowner === SYSTEM_OWNER && ! this.__properties__.isPublic) || (this.isAccessible && this.isSystemPage && ! this.isPublic) ||
(this.__properties__.isAccessible && this.__properties__.isPublic) || (this.isAccessible && this.isPublic) ||
(this.__properties__.isAccessible && ! this.__properties__.isPublic && this.isMember) || (this.isAccessible && ! this.isPublic && this.isMember) ||
(pageEditor(this.name.frame)) (pageEditor(this.name.frame))
); );
} else { } else {
return this.__properties__.isAccessible && (this.pageowner === SYSTEM_OWNER) && this.__properties__.isPublic; return this.isAccessible && this.isSystemPage && this.isPublic;
}
} }
}); });
Page.prototype.__defineGetter__('cost',function() { // The page attributes, which determine accessible, public, cug and frame type
return Number(this.__properties__.cost); 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) set: function(int) {
throw new Error('Cost too large'); if (int === undefined)
int = 0;
// Populate the cost window if (typeof int !== 'number')
switch (SESSION_EXT) { throw new Error('Cost must be a number');
case 'tex':
this.__window__.cost.__properties__.content = rawtoattrs(ESC+'[1;32m'+padright(int,FRAME_COST_LENGTH-1-FRAME_ATTR_LENGTH,' ')+FRAME_COSTUNIT).content;
break; this.__properties__.cost = int;
case 'vtx': if ((''+int).length > FRAME_COST_LENGTH-1-FRAME_ATTR_LENGTH)
this.__window__.cost.__properties__.content = rawtoattrs(VIEWDATA_BIN_GREEN+padright(int,FRAME_COST_LENGTH-1-FRAME_ATTR_LENGTH,' ')+FRAME_COSTUNIT).content; 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: break;
throw new Error(SESSION_EXT+' type not implemented');
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; this.__properties__.input_fields = array;
}); });
Page.prototype.__defineSetter__('isAccessible',function(bool) { Object.defineProperty(this,'isAccessible',{
if (typeof bool !== 'boolean') get: function() {
throw new Error('isAccessible must be a boolean'); return (this.__properties__.attrs >> 7 !== 1);
}
this.__properties__.isAccessible = bool;
}); });
/** /**
* Check if the user is already a member of the CUG * Check if the user is already a member of the CUG
*/ */
Page.prototype.__defineGetter__('isMember',function() { Object.defineProperty(this,'isMember',{
// @todo Implement CUGs, this would be "=== SERVICE_PROVIDER" and user is a member of SERVICE_PROVIDER get: function() {
return user.number && (this.pageowner === SYSTEM_OWNER); // @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) { // Is the page public or CUG
if (typeof bool !== 'boolean') Object.defineProperty(this,'isPublic',{
throw new Error('isPublic must be a boolean'); 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 // 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() { Page.prototype.__defineGetter__('pagenext',function() {
return this.__properties__.name.next; return this.__properties__.name.next;
}); });
/** /**
* Determine who the owner of a page is * Determine who the owner of a page is
* @deprecated use owner
*/ */
Page.prototype.__defineGetter__('pageowner',function() { Page.prototype.__defineGetter__('pageowner',function() {
return pageOwner(this.__properties__.name.frame).prefix; return pageOwner(this.__properties__.name.frame).prefix;
@ -386,6 +435,12 @@ function Page(debug) {
this.__window__.header.visible = bool; this.__window__.header.visible = bool;
}); });
Object.defineProperty(this,'type',{
get: function() {
return this.__properties__.attrs & 0xf;
},
});
Page.prototype.__defineGetter__('type',function() { Page.prototype.__defineGetter__('type',function() {
return this.__properties__.type; return this.__properties__.type;
}); });
@ -839,8 +894,10 @@ function Page(debug) {
if (!(page instanceof PageObject)) if (!(page instanceof PageObject))
throw new Error('page must be a PageObject'); throw new Error('page must be a PageObject');
this.name = page;
// Load a page from disk first if it exists // 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; return true;
// Fall back to loading from msgbase // Fall back to loading from msgbase
@ -1192,9 +1249,34 @@ function Page(debug) {
break; break;
case 2: 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 // Work out frame type
writeln(JSON.stringify(contents)); this.attrs = contents.attrs;
exit(2); this.cost = contents.cost;
this.key = contents.key;
break; break;
default: default:
@ -1354,11 +1436,19 @@ function PageObject(frame,index) {
this.__properties__.frame = frame.frame.toString(); this.__properties__.frame = frame.frame.toString();
this.index = frame.index; this.index = frame.index;
} else { } else if ((frame !== undefined) && (index === undefined)) {
this.__properties__.frame = frame; if (/^\d+[a-z]$/.test(frame)) {
var split = frame.split(/(\d+)/);
this.__properties__.frame = split[1];
this.index = split[2];
if (index) } else {
this.index = index; this.__properties__.frame = frame;
}
} else if ((frame !== undefined) && (index !== undefined)) {
this.__properties__.frame = frame;
this.index = index;
} }
} }

View File

@ -1,5 +1,5 @@
const SESSION_ANSITEX = (1<<1); const SESSION_ANSITEX = (1<<1);
var SESSION_EXT = 'tex'; var CONTENT_EXT = 'ans';
var FRAME_WIDTH = 80; var FRAME_WIDTH = 80;
var FRAME_HEIGHT = 22; var FRAME_HEIGHT = 22;

View File

@ -1,5 +1,5 @@
const SESSION_VIEWDATA = (1<<2); const SESSION_VIEWDATA = (1<<2);
var SESSION_EXT = 'vtx'; var CONTENT_EXT = 'bin';
var FRAME_WIDTH = 40; var FRAME_WIDTH = 40;
var FRAME_HEIGHT = 22; var FRAME_HEIGHT = 22;

View File

@ -944,13 +944,15 @@ function Char(ch,attr) {
ansi.push(r); ansi.push(r);
} }
if (false && debug) if (debug)
writeln(' - ansi:'+ansi); writeln(' - ansi:'+ansi);
return ansi.length ? (debug ? '': '\x1b')+'['+ansi.join(';')+'m' : undefined; return ansi.length ? (debug ? '': '\x1b')+'['+ansi.join(';')+'m' : undefined;
case 'vtx': case 'vtx':
log(LOG_DEBUG,'+ last:'+last+', attr ('+this.attr+')'); if (debug)
log(LOG_DEBUG,'+ last:'+last+', attr ('+this.attr+')');
switch (this.attr) { switch (this.attr) {
// \x08 // \x08
case BLINK: 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; return ESC+r;
default: default:

View File

@ -42,11 +42,13 @@ bbs.replace_text(826,''); // LoggingOn
switch (client.socket.local_port) { switch (client.socket.local_port) {
case 516: case 516:
var SESSION_EXT = 'vtx';
require(ANSITEX_HOME+'/load/session/viewdata.js','SESSION_VIEWDATA'); require(ANSITEX_HOME+'/load/session/viewdata.js','SESSION_VIEWDATA');
break; break;
// Assume ANSItex // Assume ANSItex
default: default:
var SESSION_EXT = 'tex';
require(ANSITEX_HOME+'/load/session/ansitex.js','SESSION_ANSITEX'); require(ANSITEX_HOME+'/load/session/ansitex.js','SESSION_ANSITEX');
} }

1
text/980a Normal file
View File

@ -0,0 +1 @@
{"version":2,"key":[0,0,null,null,null,null,null,null,null,null]}

1
text/998a Normal file
View File

@ -0,0 +1 @@
{"version":2,"key":[0,null,null,null,null,null,null,null,null,null]}

1
text/99a Normal file
View File

@ -0,0 +1 @@
{"version":2,"key":[0,null,null,null,null,null,null,null,null,null]}

1
text/99b Normal file
View File

@ -0,0 +1 @@
{"version":2,"attrs":"15","key":[null,null,null,null,null,null,null,null,null,null]}

View File

@ -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"}

View File

@ -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"}

View File

@ -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"}

View File

@ -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"}

View File

@ -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"}

View File

@ -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"}

View File

@ -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"}

View File

@ -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"}

31
tools/frame_get.js Normal file
View File

@ -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]);
}

View File

@ -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');