mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 10:52:27 +00:00
Clear legacy admin defaults and trust adapter state
This commit is contained in:
1 parent
66595edaf6
commit
c6c297e16b
3 files changed
+14
-51
No files matched your search
+2
-12
@@ -7,10 +7,6 @@ import {
|
||||
setWhitelistMode as persistWhitelistMode,
|
||||
ADMIN_WHITELIST_MODE_STORAGE_KEY,
|
||||
} from "./config.js";
|
||||
import {
|
||||
ADMIN_INITIAL_BLACKLIST,
|
||||
ADMIN_INITIAL_WHITELIST,
|
||||
} from "./lists.js";
|
||||
import {
|
||||
ADMIN_BLACKLIST_KEY,
|
||||
ADMIN_EDITORS_KEY,
|
||||
@@ -86,16 +82,10 @@ class AccessControl {
|
||||
this.editors = new Set(
|
||||
dedupeNpubs([...ADMIN_EDITORS_NPUBS, ...editors])
|
||||
);
|
||||
const normalizedWhitelist = dedupeNpubs([
|
||||
...ADMIN_INITIAL_WHITELIST,
|
||||
...whitelist,
|
||||
]);
|
||||
const normalizedWhitelist = dedupeNpubs(whitelist);
|
||||
this.whitelist = new Set(normalizedWhitelist);
|
||||
|
||||
const blacklistDedupe = dedupeNpubs([
|
||||
...ADMIN_INITIAL_BLACKLIST,
|
||||
...blacklist,
|
||||
]);
|
||||
const blacklistDedupe = dedupeNpubs(blacklist);
|
||||
const whitelistSet = new Set(normalizedWhitelist.map(normalizeNpub));
|
||||
const adminGuardSet = new Set([
|
||||
normalizeNpub(ADMIN_SUPER_NPUB),
|
||||
|
||||
+6
-17
@@ -7,10 +7,7 @@ import {
|
||||
ADMIN_EDITORS_NPUBS,
|
||||
isDevMode,
|
||||
} from "./config.js";
|
||||
import {
|
||||
ADMIN_INITIAL_BLACKLIST,
|
||||
ADMIN_INITIAL_WHITELIST,
|
||||
} from "./lists.js";
|
||||
import { ADMIN_INITIAL_BLACKLIST, ADMIN_INITIAL_WHITELIST } from "./lists.js";
|
||||
import { nostrClient } from "./nostr.js";
|
||||
|
||||
export const ADMIN_EDITORS_KEY = "bitvid_admin_editors";
|
||||
@@ -87,11 +84,9 @@ function sanitizeNpubList(values) {
|
||||
|
||||
function sanitizeAdminState(state = {}) {
|
||||
const sanitizedEditors = sanitizeNpubList(state.editors || []);
|
||||
const sanitizedWhitelist = sanitizeNpubList(state.whitelist || []);
|
||||
const sanitizedWhitelistSet = new Set([
|
||||
...ADMIN_INITIAL_WHITELIST.map(normalizeNpub),
|
||||
...sanitizedWhitelist,
|
||||
]);
|
||||
const sanitizedWhitelistSet = new Set(
|
||||
sanitizeNpubList(state.whitelist || [])
|
||||
);
|
||||
|
||||
const adminGuardSet = new Set([
|
||||
normalizeNpub(ADMIN_SUPER_NPUB),
|
||||
@@ -361,10 +356,7 @@ async function persistNostrState(actorNpub, updates = {}) {
|
||||
...sanitizeNpubList(updates.editors || []),
|
||||
]);
|
||||
const whitelistSet = new Set(
|
||||
sanitizeNpubList([
|
||||
...ADMIN_INITIAL_WHITELIST,
|
||||
...(updates.whitelist || []),
|
||||
])
|
||||
sanitizeNpubList(updates.whitelist || [])
|
||||
);
|
||||
const sanitizedBlacklist = base.filter((npub) => {
|
||||
const normalized = normalizeNpub(npub);
|
||||
@@ -391,10 +383,7 @@ async function persistNostrState(actorNpub, updates = {}) {
|
||||
}
|
||||
|
||||
if (key === "whitelist") {
|
||||
const mergedWhitelist = sanitizeNpubList([
|
||||
...ADMIN_INITIAL_WHITELIST,
|
||||
...base,
|
||||
]);
|
||||
const mergedWhitelist = sanitizeNpubList(base);
|
||||
return [key, mergedWhitelist];
|
||||
}
|
||||
|
||||
|
||||
+6
-22
@@ -1,26 +1,10 @@
|
||||
// js/lists.js
|
||||
|
||||
// Whitelist of npubs that can access the video upload functions
|
||||
const npubs = [
|
||||
"npub13yarr7j6vjqjjkahd63dmr27curypehx45ucue286ac7sft27y0srnpmpe", // bitvid
|
||||
"npub15jnttpymeytm80hatjqcvhhqhzrhx6gxp8pq0wn93rhnu8s9h9dsha32lx", // thePR0M3TH3AN
|
||||
"npub1j37gc05qpqzyrmdc5vetsc9h5qtstas7tr25j0n9sdpqxghz6m4q2ej6n8", // Ghost Grid Network
|
||||
"npub1epvnvv3kskvpnmpqgnm2atevsmdferhp7dg2s0yc7uc0hdmqmgssx09tu2", // Chain Reaction
|
||||
"npub1qny3tkh0acurzla8x3zy4nhrjz5zd8l9sy9jys09umwng00manysew95gx", // ODELL
|
||||
"npub1qxduthz4p8v5zsux524df569pt7lj0d36dyqadnta2val64dtnhsr50h64", // NosToons
|
||||
"npub19ma2w9dmk3kat0nt0k5dwuqzvmg3va9ezwup0zkakhpwv0vcwvcsg8axkl", // vinney
|
||||
"npub1rcr8h76csgzhdhea4a7tq5w5gydcpg9clgf0cffu6z45rnc6yp5sj7cfuz", // djmeistro
|
||||
"npub1m5s9w4t03znyetxswhgq0ud7fq8ef8y3l4kscn2e8wkvmv42hh3qujgjl3", // mister_monster
|
||||
"npub13qexjtmajssuhz8gdchgx65dwsnr705drse294zz5vt4e78ya2vqzyg8lv", // SatoshiSignal
|
||||
"npub1da7m2ksdj24995hm8afv88pjpvzt6t9vh70mg8t52yjwtxza3vjszyar58", // GoblinBox
|
||||
"npub196rl3tls3c4y79pc3ptrrj2430z7p5uwetfhukhtkt69hph0fvwq08l43q", // ~Bordut-Nodlex
|
||||
];
|
||||
|
||||
console.log("DEBUG: lists.js loaded, npubs:", npubs);
|
||||
|
||||
// Blacklist of npubs that events will not be displayed in the bitvid official client
|
||||
export const ADMIN_INITIAL_WHITELIST = npubs;
|
||||
export const ADMIN_INITIAL_BLACKLIST = [""];
|
||||
// Operators must manage admin lists through the Admin panel UI or remote
|
||||
// adapters. These legacy constants are intentionally empty so new installs do
|
||||
// not ship with hard-coded accounts.
|
||||
export const ADMIN_INITIAL_WHITELIST = [];
|
||||
export const ADMIN_INITIAL_BLACKLIST = [];
|
||||
|
||||
// Block specific events with the nevent
|
||||
export const ADMIN_INITIAL_EVENT_BLACKLIST = [""];
|
||||
export const ADMIN_INITIAL_EVENT_BLACKLIST = [];
|
||||
Reference in new issue
Block a user