diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx index e8baad6..650482a 100644 --- a/dashboard/src/App.jsx +++ b/dashboard/src/App.jsx @@ -159,14 +159,23 @@ const postizHeaders = (key, url) => { // Older builds defaulted to a maintainer-hosted Postiz instance and persisted // it to localStorage on mount, so an upgrade could silently keep sending a -// user's API key to someone else's server. Recognize that retired default and -// treat it as unset. The host is assembled from parts so no live reference to -// it remains in the source. +// user's API key to a server they never chose. Retire that one legacy value +// ONCE (guarded by a marker) instead of on every read: blanking it on each load +// also threw away a URL the user deliberately saved — a self-hoster's own +// instance can legitimately live on that host — and forced them to retype it +// every session. The host is assembled from parts so no live reference to it +// remains in the source. const RETIRED_POSTIZ_HOST = ['postiz', 'pbento', 'pt'].join('.'); +const POSTIZ_URL_RETIRED_KEY = 'postiz_url_retired_v1'; const normalizeStoredPostizUrl = (url) => { const base = String(url || '').trim().replace(/\/$/, ''); if (!base) return ''; - return base === `https://${RETIRED_POSTIZ_HOST}` ? '' : base; + let retired = false; + try { + retired = localStorage.getItem(POSTIZ_URL_RETIRED_KEY) === '1'; + localStorage.setItem(POSTIZ_URL_RETIRED_KEY, '1'); + } catch (_) { /* storage unavailable: nothing to migrate */ } + return !retired && base === `https://${RETIRED_POSTIZ_HOST}` ? '' : base; }; const SESSION_KEY = 'clipwright_session';