mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Fix syntax errors blocking app bootstrap
This commit is contained in:
1 parent
78ce75ef62
commit
0a2a2c4e78
18 files changed
+80
-64
No files matched your search
@@ -8,8 +8,8 @@ import {
|
||||
isDevMode,
|
||||
} from "./config.js";
|
||||
import { nostrClient } from "./nostr.js";
|
||||
import {
|
||||
import { devLogger, userLogger } from "./utils/logger.js";
|
||||
import {
|
||||
buildAdminListEvent,
|
||||
ADMIN_LIST_IDENTIFIERS,
|
||||
} from "./nostrEventSchemas.js";
|
||||
@@ -151,8 +151,10 @@ function readJsonListFromStorage(key) {
|
||||
const parsed = JSON.parse(raw);
|
||||
return Array.isArray(parsed) ? parsed : null;
|
||||
} catch (error) {
|
||||
devLogger.warn(`[adminListStore] Failed to parse legacy list for ${key:`, error);
|
||||
}
|
||||
devLogger.warn(
|
||||
`[adminListStore] Failed to parse legacy list for ${key}:`,
|
||||
error,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -198,8 +200,10 @@ function clearLegacyStorageFor(listKey) {
|
||||
try {
|
||||
localStorage.removeItem(key);
|
||||
} catch (error) {
|
||||
devLogger.warn(`[adminListStore] Failed to clear legacy storage for ${key:`, error);
|
||||
}
|
||||
devLogger.warn(
|
||||
`[adminListStore] Failed to clear legacy storage for ${key}:`,
|
||||
error,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ import {
|
||||
requestInvoice
|
||||
} from "./payments/lnurl.js";
|
||||
import { getPlatformLightningAddress } from "./payments/platformAddress.js";
|
||||
import {
|
||||
import { userLogger } from "./utils/logger.js";
|
||||
import {
|
||||
ensureWallet,
|
||||
sendPayment as sendWalletPayment
|
||||
} from "./payments/nwcClient.js";
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// js/config.js
|
||||
|
||||
import {
|
||||
import { userLogger } from "./utils/logger.js";
|
||||
import {
|
||||
IS_DEV_MODE,
|
||||
ADMIN_SUPER_NPUB,
|
||||
ADMIN_DM_IMAGE_URL,
|
||||
|
||||
+1
-1
@@ -13,8 +13,8 @@ import {
|
||||
initThemeController,
|
||||
refreshThemeControls,
|
||||
} from "./themeController.js";
|
||||
import {
|
||||
import { devLogger, userLogger } from "./utils/logger.js";
|
||||
import {
|
||||
prepareStaticModal,
|
||||
openStaticModal,
|
||||
closeStaticModal,
|
||||
|
||||
+45
-38
@@ -1620,8 +1620,7 @@ function normalizePointerInput(pointer) {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
devLogger.warn(`[nostr] Failed to decode pointer ${trimmed:`, err);
|
||||
}
|
||||
devLogger.warn(`[nostr] Failed to decode pointer ${trimmed}:`, err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5681,17 +5680,18 @@ export class NostrClient {
|
||||
|
||||
this.restoreLocalData();
|
||||
|
||||
try {
|
||||
await this.ensurePool();
|
||||
const results = await this.connectToRelays();
|
||||
const successfulRelays = results
|
||||
.filter((r) => r.success)
|
||||
.map((r) => r.url);
|
||||
if (successfulRelays.length === 0) {
|
||||
throw new Error("No relays connected");
|
||||
}
|
||||
devLogger.log(`Connected to ${successfulRelays.length relay(s)`);
|
||||
}
|
||||
try {
|
||||
await this.ensurePool();
|
||||
const results = await this.connectToRelays();
|
||||
const successfulRelays = results
|
||||
.filter((r) => r.success)
|
||||
.map((r) => r.url);
|
||||
if (successfulRelays.length === 0) {
|
||||
throw new Error("No relays connected");
|
||||
}
|
||||
devLogger.log(
|
||||
`Connected to ${successfulRelays.length} relay(s)`,
|
||||
);
|
||||
} catch (err) {
|
||||
userLogger.error("Nostr init failed:", err);
|
||||
throw err;
|
||||
@@ -6159,12 +6159,11 @@ export class NostrClient {
|
||||
}
|
||||
}
|
||||
|
||||
if (!signerPubkey && signedEvent && typeof signedEvent.pubkey === "string") {
|
||||
signerPubkey = signedEvent.pubkey;
|
||||
}
|
||||
if (!signerPubkey && signedEvent && typeof signedEvent.pubkey === "string") {
|
||||
signerPubkey = signedEvent.pubkey;
|
||||
}
|
||||
|
||||
devLogger.log(`Signed ${devLogLabel event:`, signedEvent);
|
||||
}
|
||||
devLogger.log(`Signed ${devLogLabel} event:`, signedEvent);
|
||||
|
||||
let targetRelays = sanitizeRelayList(
|
||||
Array.isArray(relaysOverride) && relaysOverride.length
|
||||
@@ -7373,11 +7372,13 @@ export class NostrClient {
|
||||
try {
|
||||
const events = await this.pool.list([url], [filter]);
|
||||
return Array.isArray(events) ? events : [];
|
||||
} catch (error) {
|
||||
devLogger.warn(`[nostr] NIP-71 fetch failed on ${url:`, error);
|
||||
} catch (error) {
|
||||
devLogger.warn(
|
||||
`[nostr] NIP-71 fetch failed on ${url}:`,
|
||||
error,
|
||||
);
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@@ -8538,14 +8539,18 @@ export class NostrClient {
|
||||
});
|
||||
const count = this.extractCountValue(frame?.[2]);
|
||||
return { url, ok: true, frame, count };
|
||||
} catch (error) {
|
||||
const isUnsupported = error?.code === "count-unsupported";
|
||||
if (isUnsupported) {
|
||||
this.countUnsupportedRelays.add(url);
|
||||
} else devLogger.warn(`[nostr] COUNT request failed on ${url:`, error);
|
||||
} catch (error) {
|
||||
const isUnsupported = error?.code === "count-unsupported";
|
||||
if (isUnsupported) {
|
||||
this.countUnsupportedRelays.add(url);
|
||||
} else {
|
||||
devLogger.warn(
|
||||
`[nostr] COUNT request failed on ${url}:`,
|
||||
error,
|
||||
);
|
||||
}
|
||||
return { url, ok: false, error, unsupported: isUnsupported };
|
||||
}
|
||||
return { url, ok: false, error, unsupported: isUnsupported };
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@@ -8735,16 +8740,18 @@ export class NostrClient {
|
||||
|
||||
try {
|
||||
const perRelay = await Promise.all(
|
||||
this.relays.map(async (url) => {
|
||||
try {
|
||||
const events = await this.pool.list([url], [filter]);
|
||||
return events || [];
|
||||
} catch (err) {
|
||||
devLogger.warn(`[nostr] History fetch failed on ${url:`, err);
|
||||
this.relays.map(async (url) => {
|
||||
try {
|
||||
const events = await this.pool.list([url], [filter]);
|
||||
return events || [];
|
||||
} catch (err) {
|
||||
devLogger.warn(
|
||||
`[nostr] History fetch failed on ${url}:`,
|
||||
err,
|
||||
);
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
})
|
||||
})
|
||||
);
|
||||
|
||||
const merged = perRelay.flat();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
import { devLogger } from "./utils/logger.js";
|
||||
import {
|
||||
ADMIN_LIST_NAMESPACE,
|
||||
isDevMode,
|
||||
WATCH_HISTORY_KIND,
|
||||
@@ -830,8 +830,9 @@ function resolveAdminNoteType(listKey) {
|
||||
export function buildAdminListEvent(listKey, { pubkey, created_at, hexPubkeys = [] }) {
|
||||
const schema = getNostrEventSchema(resolveAdminNoteType(listKey));
|
||||
if (!schema) {
|
||||
devLogger.warn(`[nostrEventSchemas] Unknown admin list key: ${listKey`);
|
||||
}
|
||||
devLogger.warn(
|
||||
`[nostrEventSchemas] Unknown admin list key: ${listKey}`,
|
||||
);
|
||||
return {
|
||||
kind: 30000,
|
||||
pubkey,
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
} from "./lnurl.js";
|
||||
import { ensureWallet, sendPayment } from "./nwcClient.js";
|
||||
import { getPlatformLightningAddress } from "./platformAddress.js";
|
||||
import {
|
||||
import { userLogger } from "../utils/logger.js";
|
||||
import {
|
||||
clampPercent,
|
||||
parsePercentValue,
|
||||
resolvePlatformFeePercent,
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
import { isDevMode } from "./config.js";
|
||||
import { DEFAULT_RELAY_URLS, nostrClient } from "./nostr.js";
|
||||
import { buildRelayListEvent } from "./nostrEventSchemas.js";
|
||||
import {
|
||||
import { devLogger, userLogger } from "./utils/logger.js";
|
||||
import {
|
||||
publishEventToRelays,
|
||||
assertAnyRelayAccepted,
|
||||
} from "./nostrPublish.js";
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
getPubkey,
|
||||
getCurrentUserNpub,
|
||||
} from "../state/appState.js";
|
||||
import {
|
||||
import { userLogger } from "../utils/logger.js";
|
||||
import {
|
||||
getSavedProfiles,
|
||||
getActiveProfilePubkey,
|
||||
setActiveProfilePubkey,
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
} from "../nostr.js";
|
||||
import { accessControl } from "../accessControl.js";
|
||||
import { ALLOW_NSFW_CONTENT } from "../config.js";
|
||||
import {
|
||||
import { userLogger } from "../utils/logger.js";
|
||||
import {
|
||||
getVideosMap as getStoredVideosMap,
|
||||
setVideosMap as setStoredVideosMap,
|
||||
getVideoSubscription as getStoredVideoSubscription,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { isDevMode } from "../config.js";
|
||||
import { pointerArrayToKey } from "../utils/pointer.js";
|
||||
import {
|
||||
import { devLogger, userLogger } from "../utils/logger.js";
|
||||
import {
|
||||
ingestLocalViewEvent as defaultIngestLocalViewEvent,
|
||||
} from "../viewCounter.js";
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
import { userLogger } from "../utils/logger.js";
|
||||
import {
|
||||
readUrlHealthFromStorage,
|
||||
removeUrlHealthFromStorage,
|
||||
writeUrlHealthToStorage,
|
||||
|
||||
@@ -2,8 +2,8 @@ import { normalizeDesignSystemContext } from "../../designSystem.js";
|
||||
import { updateVideoCardSourceVisibility } from "../../utils/cardSourceVisibility.js";
|
||||
import positionFloatingPanel from "../utils/positionFloatingPanel.js";
|
||||
import { createFloatingPanelStyles } from "../utils/floatingPanelStyles.js";
|
||||
import {
|
||||
import { userLogger } from "../../utils/logger.js";
|
||||
import {
|
||||
getPopupOffsetPx,
|
||||
getPopupViewportPaddingPx,
|
||||
} from "../../designSystem/metrics.js";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { normalizeDesignSystemContext } from "../designSystem.js";
|
||||
import positionFloatingPanel from "./utils/positionFloatingPanel.js";
|
||||
import { createFloatingPanelStyles } from "./utils/floatingPanelStyles.js";
|
||||
import {
|
||||
import { userLogger } from "../utils/logger.js";
|
||||
import {
|
||||
getPopupOffsetPx,
|
||||
getPopupViewportPaddingPx,
|
||||
} from "../designSystem/metrics.js";
|
||||
|
||||
@@ -350,13 +350,17 @@ export default class WatchHistoryController {
|
||||
try {
|
||||
const result = this.watchHistoryService.snapshot(undefined, { reason });
|
||||
return Promise.resolve(result).catch((error) => {
|
||||
devLogger.warn(`[${context] Watch history flush failed:`, error);
|
||||
}
|
||||
devLogger.warn(
|
||||
`[${context}] Watch history flush failed:`,
|
||||
error,
|
||||
);
|
||||
throw error;
|
||||
});
|
||||
} catch (error) {
|
||||
devLogger.warn(`[${context] Failed to queue watch history flush:`, error);
|
||||
}
|
||||
devLogger.warn(
|
||||
`[${context}] Failed to queue watch history flush:`,
|
||||
error,
|
||||
);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ import {
|
||||
requestInvoice,
|
||||
} from "../payments/lnurl.js";
|
||||
import { getPlatformLightningAddress } from "../payments/platformAddress.js";
|
||||
import {
|
||||
import { devLogger, userLogger } from "../utils/logger.js";
|
||||
import {
|
||||
ensureWallet as ensureWalletDefault,
|
||||
sendPayment as sendPaymentDefault,
|
||||
} from "../payments/nwcClient.js";
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
// js/userBlocks.js
|
||||
import { nostrClient } from "./nostr.js";
|
||||
import { buildBlockListEvent, BLOCK_LIST_IDENTIFIER } from "./nostrEventSchemas.js";
|
||||
import {
|
||||
import { userLogger } from "./utils/logger.js";
|
||||
import {
|
||||
publishEventToRelays,
|
||||
assertAnyRelayAccepted,
|
||||
} from "./nostrPublish.js";
|
||||
|
||||
+1
-1
@@ -16,8 +16,8 @@ import {
|
||||
VIEW_COUNT_CACHE_TTL_MS,
|
||||
VIEW_COUNT_DEDUPE_WINDOW_SECONDS,
|
||||
} from "./config.js";
|
||||
import {
|
||||
import { userLogger } from "./utils/logger.js";
|
||||
import {
|
||||
countVideoViewEvents,
|
||||
listVideoViewEvents,
|
||||
subscribeVideoViewEvents,
|
||||
|
||||
Reference in new issue
Block a user