scp81 passthru, proactive decoders, ADM badge, file manager layout (v2.2.1)
SCP81: - New listener mode "passthru": no local listener - the card's BIP channels connect straight to a configured external platform (host/port required), which terminates TLS and runs the dialog. The status API reports mode/target (_SCP81_MODE/_SCP81_TARGET) and clears them on stop. PWA mode select, hint, Start validation; TLS PSK stays the default. Proactive command decoding (Phone tab log): - SEND SHORT MESSAGE (0x13) is now decoded: alpha, address (TON/NPI + number), 3GPP-SMS TPDU (type, TP-MR, TP-DA, TP-PID 0x7F flagged as SIM data download, TP-DCS, TP-VP, TP-UDL), UDH concatenation IEs, and the TP-UD as text (GSM-7 with a septet unpacker, UCS2, 8-bit) or as a TS 31.115 secured packet for PID 0x7F; malformed TPDUs fall back to the raw hex line. - PROVIDE LOCAL INFORMATION qualifier names completed per TS 102 223 V18.3.0: ESN (07), MEID (0B), Supported RATs (1A); 05 relabelled "Reserved for GSM (Timing Advance)". Fixed in the server dict and both frontend tables. Header: - Compact ADM badge next to the card indicator: "ADM ✓" green when pySim's adm_verified is set, "ADM ✗" red otherwise, hidden without a card session or when the server is down; updated ahead of the card state-key early return so it never disturbs the connect/reset flow. File manager: - Sort pills (FID/Name), Probe all files button and progress line are pinned above the tree instead of scrolling with it; the tree box cap grows from 420px to 65vh. SW cache otaman-v165; help EN/RU updated; tests 234 Python + 361 frontend.
This commit is contained in:
@@ -23,29 +23,52 @@ function extractFunc(src, name) {
|
||||
|
||||
let code = 'var _pysimCardStateKey = null;\nvar _pysimCardSession = null;\n'
|
||||
+ 'var _pysimServerAvailable = null;\nvar _pysimCardEquipped = false;\n'
|
||||
+ 'var _pysimProactiveSeq = null;\nvar _pysimStkSig = null;\n';
|
||||
+ 'var _pysimProactiveSeq = null;\nvar _pysimStkSig = null;\nvar _pysimAdmVerified = null;\n';
|
||||
code += extractFunc(html, 'pysimCardStateUpdate') + '\n';
|
||||
code += extractFunc(html, 'pysimAvailabilityState') + '\n';
|
||||
code += extractFunc(html, 'pysimControlDisabled') + '\n';
|
||||
code += extractFunc(html, 'pysimProactiveSeqChanged') + '\n';
|
||||
code += extractFunc(html, 'pysimStkStatusChanged') + '\n';
|
||||
code += extractFunc(html, 'pysimUpdateAdmIndicator') + '\n';
|
||||
code += extractFunc(html, 'pysimSetServerAvailable') + '\n';
|
||||
code += '\nglobalThis.esc = s => s;\n';
|
||||
code += 'globalThis.t = s => s;\n';
|
||||
eval(code);
|
||||
|
||||
function fakeIndicator() {
|
||||
const classes = new Set();
|
||||
const el = {
|
||||
classes, textContent: '', title: null,
|
||||
classList: {
|
||||
add: (...c) => c.forEach(x => classes.add(x)),
|
||||
remove: (...c) => c.forEach(x => classes.delete(x)),
|
||||
contains: c => classes.has(c),
|
||||
},
|
||||
setAttribute: (k, v) => { if (k === 'title') el.title = v; },
|
||||
removeAttribute: (k) => { if (k === 'title') el.title = null; },
|
||||
};
|
||||
return el;
|
||||
}
|
||||
|
||||
function setup() {
|
||||
const el = { textContent: 'status line', innerHTML: '' };
|
||||
const adm = fakeIndicator();
|
||||
const calls = { connected: [], resets: [], refreshStatus: [], proactive: 0 };
|
||||
_pysimCardStateKey = null;
|
||||
_pysimCardSession = null;
|
||||
_pysimProactiveSeq = null;
|
||||
globalThis.document = { getElementById: () => el, querySelectorAll: () => [] };
|
||||
_pysimAdmVerified = null;
|
||||
_pysimServerAvailable = null;
|
||||
globalThis.document = {
|
||||
getElementById: id => id === 'state-indicator-adm' ? adm : el,
|
||||
querySelectorAll: () => [],
|
||||
};
|
||||
globalThis.pysimSetConnected = v => calls.connected.push(v);
|
||||
globalThis.pysimResetCardData = refresh => calls.resets.push(refresh);
|
||||
globalThis.pysimApplyAvailability = () => {};
|
||||
globalThis.isViewVisible = () => true;
|
||||
globalThis.pysimProactiveLogRender = () => { calls.proactive++; };
|
||||
return { el, calls };
|
||||
return { el, adm, calls };
|
||||
}
|
||||
|
||||
function status(extra) {
|
||||
@@ -168,3 +191,37 @@ test('pysimStkStatusChanged detects menu state transitions', () => {
|
||||
assert.ok(pysimStkStatusChanged({ active: true, pending: false }));
|
||||
assert.ok(!pysimStkStatusChanged(null));
|
||||
});
|
||||
|
||||
test('the header ADM badge shows verified / not verified / hidden', () => {
|
||||
const { adm, calls } = setup();
|
||||
pysimCardStateUpdate(status({ connected: true, adm_verified: true }));
|
||||
assert.ok(!adm.classes.has('hidden'));
|
||||
assert.strictEqual(adm.textContent, 'ADM ✓');
|
||||
assert.ok(adm.classes.has('text-emerald-600'));
|
||||
assert.ok(adm.classes.has('dark:text-emerald-400'));
|
||||
assert.strictEqual(adm.title, 'ADM verified');
|
||||
// an unchanged state must not rewrite the badge
|
||||
adm.textContent = '';
|
||||
pysimCardStateUpdate(status({ connected: true, adm_verified: true }));
|
||||
assert.strictEqual(adm.textContent, '', 'unchanged ADM state rewrote the badge');
|
||||
// verification lost (e.g. card reset)
|
||||
pysimCardStateUpdate(status({ connected: true, adm_verified: false }));
|
||||
assert.strictEqual(adm.textContent, 'ADM ✗');
|
||||
assert.ok(adm.classes.has('text-red-500'));
|
||||
assert.ok(!adm.classes.has('text-emerald-600'));
|
||||
assert.strictEqual(adm.title, 'ADM not verified');
|
||||
// no card session hides it
|
||||
pysimCardStateUpdate(status({ connected: false }));
|
||||
assert.ok(adm.classes.has('hidden'));
|
||||
assert.strictEqual(adm.title, null);
|
||||
// the ADM update must not disturb the connect/reset flow
|
||||
assert.deepStrictEqual(calls.connected, [true, false]);
|
||||
});
|
||||
|
||||
test('losing the server hides the ADM badge', () => {
|
||||
const { adm } = setup();
|
||||
pysimCardStateUpdate(status({ connected: true, adm_verified: true }));
|
||||
assert.ok(!adm.classes.has('hidden'));
|
||||
pysimSetServerAvailable(false);
|
||||
assert.ok(adm.classes.has('hidden'));
|
||||
});
|
||||
|
||||
@@ -25,6 +25,23 @@ test('cards list shows the SCP81 PSK column with blue/red row buttons', () => {
|
||||
assert.match(fn[0], /cardsRemove\(' \+ i \+ '\)" class="[^"]*bg-red-600 text-white/);
|
||||
});
|
||||
|
||||
test('PLI qualifier tables cover all standard qualifiers', () => {
|
||||
// ESN (07), MEID (0B) and Supported RATs (1A) must at least be named, in
|
||||
// both the TR Config dictionary and the proactive-log short labels.
|
||||
const pli = /const PLI_QUALIFIERS = \[([\s\S]*?)\];/.exec(html);
|
||||
assert.ok(pli, 'PLI_QUALIFIERS not found');
|
||||
for (const code of ['07', '0B', '1A']) {
|
||||
assert.ok(pli[1].includes("{code:'" + code + "'"), 'PLI_QUALIFIERS missing ' + code);
|
||||
}
|
||||
const block = /const CMD_QUALIFIER_SHORT = \{([\s\S]*?)\n\};/.exec(html);
|
||||
assert.ok(block, 'CMD_QUALIFIER_SHORT not found');
|
||||
const short = /'26': \{([^}]*)\}/.exec(block[1]);
|
||||
assert.ok(short, "CMD_QUALIFIER_SHORT['26'] not found");
|
||||
for (const key of ['0x07', '0x0B', '0x1A']) {
|
||||
assert.ok(short[1].includes(key + ':'), 'CMD_QUALIFIER_SHORT 26 missing ' + key);
|
||||
}
|
||||
});
|
||||
|
||||
test('profile rows have a Clone action', () => {
|
||||
assert.match(html, /onclick="profilerClone\(' \+ i \+ '\)"/);
|
||||
assert.match(html, /t\('Clone'\)/);
|
||||
@@ -62,12 +79,24 @@ test('header state indicator and profiler custom-files tab', () => {
|
||||
assert.ok(!html.includes('data-pysim-sub="custom"'));
|
||||
});
|
||||
|
||||
test('header status indicator has a compact ADM badge', () => {
|
||||
assert.ok(html.includes('id="state-indicator-adm"'));
|
||||
});
|
||||
|
||||
test('file manager has FID / Name sort pills', () => {
|
||||
assert.match(html, /data-fs-sort="fid" onclick="pysimFsSetSort\('fid'\)"/);
|
||||
assert.match(html, /data-fs-sort="name" onclick="pysimFsSetSort\('name'\)"/);
|
||||
assert.ok(html.includes('pysim-fs-sort-pill'));
|
||||
});
|
||||
|
||||
test('file manager keeps sort/probe controls above the scrolling tree', () => {
|
||||
// The sort pills and the Probe all files button/status must sit outside
|
||||
// the scrolling tree container so they stay visible while it scrolls.
|
||||
assert.ok(html.indexOf('id="pysim-fs-probe-btn"') < html.indexOf('id="pysim-fs-tree"'));
|
||||
assert.ok(html.indexOf('pysim-fs-sort-pill') < html.indexOf('id="pysim-fs-tree"'));
|
||||
assert.match(html, /style="max-height:65vh"[^>]*>\s*<div id="pysim-fs-tree">/);
|
||||
});
|
||||
|
||||
test('custom files form has add/save and cancel controls', () => {
|
||||
assert.match(html, /id="pysim-cf-add-btn"[^>]*data-l10n="Add"/);
|
||||
assert.match(html, /id="pysim-cf-cancel-btn"[^>]*class="hidden[^"]*"[^>]*data-l10n="Cancel"/);
|
||||
|
||||
Reference in New Issue
Block a user