fix: keep a hand-edited packet TAR in the SCP80 send (v3.6.21)
The plain "Send to Card" path refreshed the whole preset right before sending (spRefreshFromPreset -> cardsApply -> cardsApplyFields) and re-applied the preset's slot TAR - so a TAR typed for a push/link trigger, an applet OTA message or the HTTP OTA admin params was silently replaced by the preset's ISD TAR (the pack buttons for those sources deliberately leave the TAR manual; the help even said so). - spRefreshFromPreset(selId, keepTar): the plain send passes keepTar, so the form's TAR survives; the counter, keys and SPI are still re-read. - selecting a card preset, ramApplyCard and the chain packs still set the TAR; the RAM operations keep the preset's ISD TAR by design. - spParams()/getRamSpParams() normalise the TAR (strip/upper/pad to 6); only the preview padded before, a short TAR went to the server raw. - help EN/RU clarified, cards_counter/ram tests updated, sw simple-v294. 652 frontend / 499 Python green; version 3.6.21.
This commit is contained in:
@@ -29,7 +29,8 @@ for (const fn of ['cardsTarValue', 'cardsApplyFields', 'cardsApply',
|
||||
eval(code);
|
||||
|
||||
// The SP form is a working copy: the preset is the source of truth, and
|
||||
// every SCP80/RAM operation re-reads it before starting (v3.6.3).
|
||||
// every SCP80/RAM operation re-reads it before starting (v3.6.3). The plain
|
||||
// SCP80 send keeps a hand-edited packet TAR (v3.6.21).
|
||||
function fakeEnv(selValue, selId, presetCntr) {
|
||||
const els = {};
|
||||
for (const id of ['sp-spi1', 'sp-spi2-hex', 'sp-kic-idx', 'sp-kic-alg',
|
||||
@@ -70,6 +71,17 @@ test('spRefreshFromPreset for the RAM selector targets the ISD TAR', () => {
|
||||
assert.strictEqual(env.els['sp-tar'].value, '000000');
|
||||
});
|
||||
|
||||
test('the pre-send refresh keeps a hand-edited packet TAR (v3.6.21)', () => {
|
||||
const env = fakeEnv('0', 'sp-card-sel', '0000000020');
|
||||
env.els['sp-tar'].value = 'AF4D01'; // e.g. a push/link trigger target
|
||||
assert.strictEqual(spRefreshFromPreset('sp-card-sel', true), '0000000020');
|
||||
assert.strictEqual(env.els['sp-tar'].value, 'AF4D01', 'the typed TAR must survive the send');
|
||||
assert.strictEqual(env.els['sp-cntr'].value, '0000000020', 'the counter still refreshes');
|
||||
// an explicit preset apply (or a pack) still sets the TAR
|
||||
cardsApplyFields(0);
|
||||
assert.strictEqual(env.els['sp-tar'].value, 'B00000');
|
||||
});
|
||||
|
||||
test('cardsApplyFields fills the form without generating a packet', () => {
|
||||
const env = fakeEnv('0', 'sp-card-sel', '0000000007');
|
||||
env.els['sp-cntr'].value = 'nonsense';
|
||||
|
||||
@@ -499,6 +499,11 @@ test('getRamSpParams reads the computed SPI2 byte, not the base select', () => {
|
||||
assert.ok(/spi2: document\.getElementById\('sp-spi2-hex'\)/.test(fn), fn);
|
||||
});
|
||||
|
||||
test('getRamSpParams normalises the packet TAR to three bytes', () => {
|
||||
const fn = extractFunc(html, 'getRamSpParams');
|
||||
assert.ok(/tar:[\s\S]*?padEnd\(6, '0'\)\.slice\(0, 6\),/.test(fn), fn);
|
||||
});
|
||||
|
||||
test('ramListingSpi2 requests the SMS-submit PoR for the listing queries', () => {
|
||||
// Apps (40) and ELF (20/10) listings can exceed the ENVELOPE response;
|
||||
// with SPI2=0x01 the card answers actual_response_sms_submit and the data
|
||||
|
||||
Reference in New Issue
Block a user