mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-28 08:22:24 +00:00
Fix: Ensure trust seed mutes are loaded for session actors
- Fixed `ModerationService.reconcileTrustedMuteSubscriptions` to always force re-subscription to trusted seeds, bypassing previous state comparisons. - Enhanced `ModerationService` to filter trusted seeds against the global admin blacklist. - Added blacklist change event support to `AccessControl` and `TrustBootstrap` to dynamically update seeds when the blacklist changes. - Added detailed logging to `ModerationService`, `TrustBootstrap`, and `AccessControl` to trace trust seed initialization and application.
This commit is contained in:
1 parent
cda0671699
commit
8aaa2f69ee
2 files changed
+9
No files matched your search
@@ -243,6 +243,7 @@ class AccessControl {
|
||||
}
|
||||
|
||||
_applyState(state, options = {}) {
|
||||
userLogger.info("[accessControl] _applyState called", { state, options });
|
||||
const markLoaded = options.markLoaded !== false;
|
||||
const editors = Array.isArray(state?.editors) ? state.editors : [];
|
||||
const whitelist = Array.isArray(state?.whitelist) ? state.whitelist : [];
|
||||
@@ -421,9 +422,11 @@ class AccessControl {
|
||||
|
||||
refresh() {
|
||||
if (this._isRefreshing) {
|
||||
userLogger.info("[accessControl] refresh ignored (already refreshing)");
|
||||
return this._refreshPromise;
|
||||
}
|
||||
|
||||
userLogger.info("[accessControl] refresh started");
|
||||
const operation = this._performRefresh();
|
||||
const tracked = operation.catch((error) => {
|
||||
userLogger.error("Failed to refresh admin lists:", error);
|
||||
@@ -440,8 +443,10 @@ class AccessControl {
|
||||
|
||||
try {
|
||||
await this._refreshPromise;
|
||||
userLogger.info("[accessControl] ensureReady resolved");
|
||||
} catch (error) {
|
||||
if (!this.hasLoaded) {
|
||||
userLogger.warn("[accessControl] ensureReady retry");
|
||||
await this.refresh();
|
||||
await this._refreshPromise;
|
||||
} else {
|
||||
|
||||
@@ -92,6 +92,7 @@ async function waitForAccessControl({ timeoutMs = TRUST_SEED_READY_TIMEOUT_MS }
|
||||
}
|
||||
|
||||
export async function bootstrapTrustedSeeds() {
|
||||
devLogger.info("[trustBootstrap] bootstrapTrustedSeeds called");
|
||||
if (
|
||||
!(
|
||||
FEATURE_TRUST_SEEDS &&
|
||||
@@ -99,6 +100,7 @@ export async function bootstrapTrustedSeeds() {
|
||||
typeof moderationService.setTrustedSeeds === "function"
|
||||
)
|
||||
) {
|
||||
devLogger.warn("[trustBootstrap] Trust seeds feature disabled or service missing");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -113,6 +115,7 @@ export async function bootstrapTrustedSeeds() {
|
||||
editors,
|
||||
fallbackSeeds: DEFAULT_TRUST_SEED_NPUBS,
|
||||
});
|
||||
devLogger.info(`[trustBootstrap] Applying ${seeds.size} trusted seeds`, Array.from(seeds));
|
||||
moderationService.setTrustedSeeds(seeds);
|
||||
if (
|
||||
moderationService &&
|
||||
@@ -130,6 +133,7 @@ export async function bootstrapTrustedSeeds() {
|
||||
attempts += 1;
|
||||
try {
|
||||
const result = await waitForAccessControl();
|
||||
devLogger.info("[trustBootstrap] waitForAccessControl result", result);
|
||||
applySeeds();
|
||||
return result;
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user