Nettoyage serveur et client : restes des anciennes notifications

- Migration 20261128120000 (appliquée) : azuu_notify (vide) supprimée et ses appels retirés
  de 6 fonctions ; table notifications réduite aux colonnes utiles (abonnements)
- Fonction serveur send-push remplacée par une version qui refuse tout (410) : à supprimer
  depuis le tableau de bord Supabase
- src/lib/push.ts (résiliation des anciens abonnements push) retiré

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
Claude committed 2026-11-27 17:37:51 +00:00
1 parent e366f38727
commit 81c6a447d9
3 files changed
+53 -26

No files matched your search

-5
View File
@@ -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)
-21
View File
@@ -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<void> {
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 */
}
}
@@ -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;