mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 13:22:54 +00:00
feat: seed anonymous session actors with baseline block list
- Added `seedLocalBaseline` to `js/userBlocks.js` to merge admin blacklist into local block list for session actors. - Implemented `_saveLocal` and `_loadLocal` in `js/userBlocks.js` to persist local-only block lists to `localStorage`. - Updated `loadBlocks` to prioritize local storage for session actors, bypassing relay fetching when local data exists. - Modified `js/app.js` to call `seedLocalBaseline` with the admin blacklist during initialization if the user is anonymous. - Ensured `UserBlockListManager` correctly resolves `localStorage` in various environments (browser/test). - Verified changes with `tests/user-blocks-local-seed.test.mjs`.
This commit is contained in:
1 parent
760eeb906e
commit
c080b83108
2 files changed
+182
-5
No files matched your search
@@ -482,6 +482,21 @@ class Application {
|
||||
|
||||
await Promise.all([accessControlPromise, adminPanePromise]);
|
||||
|
||||
if (!this.pubkey && nostrClient.sessionActor?.pubkey) {
|
||||
const blacklist = accessControl.getBlacklist();
|
||||
try {
|
||||
await userBlocks.seedLocalBaseline(
|
||||
nostrClient.sessionActor.pubkey,
|
||||
Array.from(blacklist || []),
|
||||
);
|
||||
} catch (error) {
|
||||
devLogger.warn(
|
||||
"[app.init()] Failed to seed local baseline for session actor:",
|
||||
error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Grab the "Subscriptions" link by its id in the sidebar
|
||||
this.subscriptionsLink = document.getElementById("subscriptionsLink");
|
||||
|
||||
|
||||
Reference in new issue
Block a user