feat: a share link pasted into an open tab is handled like a fresh arrival
All checks were successful
Forgejo Docker Build / Root app tests (push) Successful in 50s
Forgejo Docker Build / Build Docker image (push) Successful in 19s
Forgejo Docker Build / End-to-end (browser) (push) Successful in 6s

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU
This commit is contained in:
Daniel 2026-09-13 19:04:48 +02:00
parent fa5ed6c2b4
commit 4de76dbfd9

View file

@ -495,6 +495,15 @@ document.addEventListener('DOMContentLoaded', function() {
// Expose activateTab globally so auth.js can call it after login
window.activateTab = activateTab;
// A share link pasted into a tab that is already open changes only the hash,
// so nothing reloads. Treat it like a fresh arrival: note the token, open My
// Resources, and let it ask whether to add the resource.
window.addEventListener('hashchange', function() {
var wanted = null;
try { wanted = openTabFromHash(window, document, window.localStorage); } catch (e) {}
if (wanted && window.CURRENT_USER) activateTab(wanted);
});
document.querySelectorAll('.tab-btn').forEach(function(btn) {
btn.addEventListener('click', function() {
activateTab(btn.getAttribute('data-tab'));