file manager: path-based selection + ADF AID normalization

Make the DF context from the resolver actually reach the live views:

- pysimFsSelected now stores the canonical path (pysimFsNodePath), not
  the node name; pysimFsRenderNode emits the path in the click/toggle
  handlers; every consumer resolves via pysimFsFindNodeByPath.  The
  name-based pysimFsFindNode is removed - two same-named files under
  different DFs (EF.ECC/EF.AD, DF.PHONEBOOK copies) are now distinct.
- efDfFromPath maps ADF-rooted parent segments by RID (A0000000871002
  -> ADF.USIM, A0000000871004 -> ADF.ISIM), so snapshot/profile paths
  rooted by AID resolve to the same DF key as the named form.
- efDecEcc shares efEccCategory with efDecEccUsim (TS 24.008
  Table 10.5.135d), so the SIM and USIM category displays can't drift.

Frontend 1087 + Python 1090 tests green.  (Version/sw bump deferred -
  this is part of the unreleased decoded-editing batch.)
This commit is contained in:
catarrh committed 2026-10-25 21:01:11 +03:00
1 parent 8e0a97f025
commit 5ebcd0773d
7 files changed
+237 -91

No files matched your search

+16 -2
View File
@@ -24,6 +24,9 @@ function extractFunc(src, name) {
let code = 'var pysimFsSelected = null;\n'
+ 'var pysimFsDecodedMode = false;\n'
+ 'var pysimFsTreeRoot = null;\n';
code += extractFunc(html, 'efFidFromPath') + '\n';
code += extractFunc(html, 'efDfFromPath') + '\n';
code += extractFunc(html, 'pysimFsFallbackNode') + '\n';
code += extractFunc(html, 'pysimFsSyncContentVisibility') + '\n';
code += extractFunc(html, 'pysimFsRead') + '\n';
eval(code);
@@ -53,7 +56,7 @@ function setup() {
};
globalThis.t = s => s;
globalThis.esc = s => s;
globalThis.pysimFsFindNode = () => ({ name: 'EF.IMSI', fid: '6f07' });
globalThis.pysimFsFindNodeByPath = () => ({ name: 'EF.IMSI', fid: '6f07' });
globalThis.pysimFsSelectBody = () => ({});
globalThis.pysimFsShowError = (el, sw, err) => {
errorShown = { sw, err };
@@ -63,7 +66,7 @@ function setup() {
if (fetchResult instanceof Error) throw fetchResult;
return fetchResult;
};
pysimFsSelected = 'EF.IMSI';
pysimFsSelected = 'ADF.USIM/6F07';
pysimFsDecodedMode = false;
pysimFsTreeRoot = { name: 'MF' };
fetchResult = { success: true, sw: '9000', data: 'AABB' };
@@ -92,6 +95,17 @@ test('a successful read fills and shows the content pane', async () => {
assert.strictEqual(status.textContent, 'SW: 9000 OK');
});
test('a path whose node is not loaded selects by its last segment and FID', async () => {
setup();
globalThis.pysimFsFindNodeByPath = () => null;
let body = null;
globalThis.pysimFsSelectBody = node => { body = node; return {}; };
pysimFsSelected = 'MF/7F20/6FB7';
const ok = await pysimFsRead();
assert.strictEqual(ok, true);
assert.deepStrictEqual(body, { name: '6FB7', fid: '6FB7' });
});
test('a failed read keeps the content pane hidden', async () => {
setup();
fetchResult = { success: false, sw: '6982', error: 'Security status not satisfied' };