Printers move out of Settings into their own table and page: each has an optional nickname (the model is shown when blank), a model from the Bambu lineup with a line drawing that follows the selection, an AMS type suggested from the model, and its address, serial and access code. Access codes are never returned to the browser. The printer set up in Settings is migrated automatically and its settings rows removed. Background sync covers every printer. Grams left are filled in only from an AMS that measures (AMS, AMS 2 Pro, AMS HT), never from an AMS lite. Spools now show their RFID tag ID, product code and filament code, and say which printer they're loaded in. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
19 lines
808 B
JavaScript
19 lines
808 B
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const { publicPrinter, measures } = require('../lib/printers');
|
|
|
|
test('a printer sent to the browser never carries its access code', () => {
|
|
const p = publicPrinter({ id: 1, nickname: null, model: 'A1', serial: 'S1', access_code: 'secret' });
|
|
assert.equal('access_code' in p, false);
|
|
assert.equal(p.codeSet, true);
|
|
assert.equal(publicPrinter({ id: 2, access_code: null }).codeSet, false);
|
|
});
|
|
|
|
test('only AMS types that weigh filament count as measuring', () => {
|
|
assert.equal(measures('ams_lite'), false);
|
|
assert.equal(measures('none'), false);
|
|
assert.equal(measures(null), false);
|
|
assert.equal(measures('ams'), true);
|
|
assert.equal(measures('ams_2_pro'), true);
|
|
assert.equal(measures('ams_ht'), true);
|
|
});
|