Plex: group connection failures so public/relay results are visible
build-container / build (push) Successful in 2m20s
build-container / build (push) Successful in 2m20s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b5fb8b9c03
commit
4227883a29
1 file changed
+7
-1
@@ -226,7 +226,13 @@ async function plexApi(req, res) {
|
||||
} catch (e) { tried.push(`${c.label}: ${e.cause?.code || e.name || e.message}`); }
|
||||
}
|
||||
console.error('Plex connect failed for', r.name, tried);
|
||||
return json(res, 502, { error: 'Could not reach this server. Tried: ' + tried.slice(0, 8).join('; ') });
|
||||
// Group identical outcomes so a long list of LAN addresses cannot hide the public/relay results.
|
||||
const groups = new Map();
|
||||
for (const t of tried) { const i = t.indexOf(': '), label = t.slice(0, i), why = t.slice(i + 2).replace(/\s*\(id [^)]*\)/, '');
|
||||
const seen = (t.match(/\(id ([^…]+)…/) || [])[1]; const key = why + (seen ? ` (id ${seen}…)` : '');
|
||||
groups.set(key, [...(groups.get(key) || []), label]); }
|
||||
const summary = [...groups].map(([why, labels]) => `${why}: ${labels.join(', ')}`).join(' | ');
|
||||
return json(res, 502, { error: `Could not reach ${r.name} (id ${String(id).slice(0, 6)}…). ` + summary });
|
||||
}
|
||||
if (u.pathname === '/api/plex/logout' && req.method === 'POST') {
|
||||
setCookies(req, res, { plex_token: '', plex_srv: '', plex_stk: '', plex_name: '' });
|
||||
|
||||
Reference in new issue
Block a user