Play saved audio and display artwork directly from browser storage
Build and Publish / Build and Publish Docker Image (push) Successful in 2m44s

This commit is contained in:
ab committed 2026-11-24 04:19:25 +02:00
1 parent 32057fd67b
commit 1354f9c5f0
16 files changed
+576 -115

No files matched your search

+6 -1
View File
@@ -8,7 +8,7 @@ const player = path.join(__dirname, '..', 'src', 'player');
const catalog = fs.readFileSync(path.join(player, 'offline-catalog.js'), 'utf8');
(async () => {
let account = '17', unavailable = false, authOutage = false, hangingRequest;
let account = '17', unavailable = false, authOutage = false, dropProbe = false, hangingRequest;
const log = [];
const server = http.createServer((req,res) => {
const url = new URL(req.url, 'http://localhost');
@@ -24,6 +24,7 @@ const catalog = fs.readFileSync(path.join(player, 'offline-catalog.js'), 'utf8')
if (authOutage && url.pathname === '/offline-probe') { res.statusCode = 500; return res.end(); }
if (url.pathname === '/logout') { account = ''; return res.end('logged out'); }
if (url.pathname === '/offline-probe') {
if (dropProbe) return req.socket.destroy();
res.setHeader('X-Furumusic-Player-Account',account || '0');
res.statusCode = account ? 204 : 401;
return res.end();
@@ -116,6 +117,10 @@ const catalog = fs.readFileSync(path.join(player, 'offline-catalog.js'), 'utf8')
await mode('auto');
assert.equal(await page.evaluate(() => fetch('/offline-probe').then(r=>r.status)),204);
dropProbe = true;
assert.equal(await page.evaluate(() => fetch('/offline-probe').then(r=>r.status)),503,
'a disconnected probe gets an unavailable response from the worker');
dropProbe = false;
await mode('online');
assert.equal(await page.evaluate(() => fetch('/api/player/me').then(r=>r.json()).then(p=>p.name)), 'Network');
authOutage = true;