diff --git a/src/App.tsx b/src/App.tsx index 1c643f6..840d449 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -20,7 +20,6 @@ import { useMedia } from './store' import type { SearchResult } from './lib/catalogApi' import type { MediaItem } from './types' import type { Completion } from './lib/seasons' -import { dropPushSubscription } from './lib/push' const TABS: Tab[] = ['home', 'catalog', 'stats', 'settings'] // L'administration a sa propre route (#/admin), hors de la navigation principale @@ -57,10 +56,6 @@ export default function App() { const [roulette, setRoulette] = useState(false) const [calendar, setCalendar] = useState(false) - // Notifications retirées : on résilie l'ancien abonnement push de cet appareil, s'il en reste un - useEffect(() => { - void dropPushSubscription() - }, []) useEffect(() => { const onHash = () => setRoute(routeFromHash()) window.addEventListener('hashchange', onHash) diff --git a/src/lib/push.ts b/src/lib/push.ts deleted file mode 100644 index 83ac547..0000000 --- a/src/lib/push.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Les notifications ont été retirées de l'app (novembre 2026). - * Un appareil qui les avait activées garde un abonnement dans son navigateur : on le résilie - * au lancement, pour qu'il ne reste rien. Le serveur, lui, n'en envoie plus aucune. - */ -export async function dropPushSubscription(): Promise { - try { - if (!('serviceWorker' in navigator) || !('PushManager' in window)) return - const reg = await navigator.serviceWorker.getRegistration() - const sub = await reg?.pushManager.getSubscription() - await sub?.unsubscribe() - } catch { - /* rien à faire */ - } - // Ancien état local des notifications push - try { - for (const k of Object.keys(localStorage)) if (/^azuucine:(?:[^:]+:)?push$/.test(k)) localStorage.removeItem(k) - } catch { - /* stockage indisponible */ - } -} diff --git a/supabase/migrations/20261128120000_cleanup_dead_server_code.sql b/supabase/migrations/20261128120000_cleanup_dead_server_code.sql new file mode 100644 index 0000000..fdf305c --- /dev/null +++ b/supabase/migrations/20261128120000_cleanup_dead_server_code.sql @@ -0,0 +1,53 @@ +-- Bobinoo — ménage du 28 novembre 2026 : restes des anciennes notifications (push, commentaires, +-- invitations de listes, épisodes). Idempotent. Seules les notifications d'abonnement subsistent. + +-- 1) Les fonctions qui appelaient azuu_notify (qui ne faisait plus rien) ou nettoyaient des +-- notifications d'invitation (plus jamais créées) : on retire seulement ces lignes, le reste est inchangé. +do $$ +declare + f text; + def text; + cleaned text; +begin + foreach f in array array[ + 'public.add_review_comment(uuid,text,text)', + 'public.invite_to_shared_list(uuid,uuid)', + 'public.delete_shared_list(uuid)', + 'public.leave_shared_list(uuid)', + 'public.remove_shared_list_member(uuid,uuid)', + 'public.respond_shared_list_invite(uuid,boolean)' + ] loop + if to_regprocedure(f) is null then continue; end if; + def := pg_get_functiondef(to_regprocedure(f)); + cleaned := regexp_replace(def, '[ \t]*if n > 0 then\s*perform public\.azuu_notify\([^;]*\);\s*end if;[ \t]*\r?\n', '', 'g'); + cleaned := regexp_replace(cleaned, '[ \t]*--[^\n]*\r?\n[ \t]*perform public\.azuu_notify\([^;]*\);[ \t]*\r?\n', '', 'g'); + cleaned := regexp_replace(cleaned, '[ \t]*perform public\.azuu_notify\([^;]*\);[ \t]*\r?\n', '', 'g'); + cleaned := regexp_replace(cleaned, '[ \t]*delete from public\.notifications [^;]*shared_list_invite[^;]*;[ \t]*\r?\n', '', 'g'); + if cleaned <> def then execute cleaned; end if; + end loop; +end $$; + +-- 2) Plus aucun appel : la fonction vide disparaît +do $$ begin + if not exists ( + select 1 from pg_proc p join pg_namespace n on n.oid = p.pronamespace + where n.nspname = 'public' and p.proname <> 'azuu_notify' and p.prosrc ~ '\mazuu_notify\M' + ) then + drop function if exists public.azuu_notify(uuid, text, uuid, text, text); + end if; +end $$; + +-- 3) Table des notifications réduite à ce qui sert (abonnements) : anciennes colonnes et index retirés +delete from public.notifications where kind not in ('new_follower', 'follow_request', 'unfollow', 'follow_accepted'); +alter table public.notifications drop constraint if exists notifications_kind_check; +alter table public.notifications add constraint notifications_kind_check + check (kind in ('new_follower', 'follow_request', 'unfollow', 'follow_accepted')); +drop index if exists public.notifications_unpushed_idx; +drop index if exists public.notifications_dedup_idx; +alter table public.notifications + drop column if exists item_id, + drop column if exists emoji, + drop column if exists episode, + drop column if exists ep_count, + drop column if exists dedup, + drop column if exists pushed_at;