fix bf0app dynamic OpenISP tellyscript

This commit is contained in:
zefie
2025-02-21 16:44:58 -05:00
parent 67375ce72f
commit 96015288fa
8 changed files with 1640 additions and 22 deletions

View File

@@ -108,7 +108,8 @@ if (session_data.data_store.wtvsec_login) {
case "bf0app":
prereg_contype = "text/tellyscript";
// if wtv-open-access: true then client expects OpenISP
if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app_OISP.tok", true);
//if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app_OISP.tok", true);
if (session_data.get("wtv-open-access")) template_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app.openisp.template.txt", true);
else template_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app.prereg.template.txt", true);
break;

View File

@@ -44,7 +44,10 @@ const reservedKeywords = new Set([
'setusername', 'setpassword', 'setpapmode', 'startppp', 'getpppresult', 'ticks',
'getpreregnumber', 'getserialnumber', 'getsecret', 'getphonesettings', 'setstatus',
'sprintf', 'setconnectionstats', 'setforcehook', 'waitfor', 'setnameservice',
'getline'
'getline', 'connectingwithvideoad', 'version', 'alert', 'system_getboxfeatureflags',
'parsesystemtime', 'getdatetimelocal', 'getdayofweek', 'gethour', 'getminute',
'getmonth', 'getyear', 'getconnectretrycount', 'dialerror', 'setfullpopnumber',
'setconnectretrycount', 'setani', 'setlocalpopcount', 'computefcs'
]);
@@ -931,6 +934,7 @@ class WTVTellyScriptMinifier {
[/^\d+/, 'NUMBER'],
// String literals (supports escaped quotes)
[/^"([^"\\]|\\.)*"/, 'STRING'],
[/^'([^'\\]|\\.)*'/, 'STRING'],
// Punctuation (parentheses, braces, commas, semicolons, etc.)
[/^[{};,\[\]\(\)]/, 'PUNCTUATION'],
// Operators (covers common operators; adjust as needed)
@@ -969,8 +973,8 @@ class WTVTellyScriptMinifier {
const token = tokens[i];
if (token.type === 'WHITESPACE') {
//token.value = token.value.replaceAll("\r", " ");
if (token.value.indexOf("\n") !== -1) output += token.value.replaceAll("\n\n\n", "\n\n");
token.value = token.value.replaceAll("\r", "\n");
if (token.value.indexOf("\n") !== -1) output += token.value.replaceAll("\n\n", "\n");
else output += " ";
} else {
output += token.value;
@@ -1064,6 +1068,7 @@ class WTVTellyScript {
minify() {
let minifier = new WTVTellyScriptMinifier();
this.raw_data = minifier.minify(this);
this.raw_data = this.raw_data.replaceAll("\n\n\n", "\n");
this.tokenize();
this.pack();
}
@@ -1291,7 +1296,7 @@ class WTVTellyScript {
this.packed_header = {
magic: (this.tellyscript_type === TellyScriptType.DIALSCRIPT) ? "VKAT" : "ANDY",
version_major: (this.packed_header && this.packed_header.version_major) ? this.packed_header.version_major : 1,
version_minor: (this.packed_header && this.packed_header.version_minor) ? this.packed_header.version_minor : 1,
version_minor: (this.packed_header && this.packed_header.version_minor) ? this.packed_header.version_minor : 3,
script_id: script_id,
script_mod: Math.floor(Date.now() / 1000),
compressed_data_length: compressed_data.length,