mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-31 09:52:24 +00:00
refactor: route nostr imports through facades
This commit is contained in:
1 parent
e4dee26023
commit
9ed0fae127
11 files changed
+84
-23
No files matched your search
@@ -1,7 +1,7 @@
|
||||
// js/app.js
|
||||
|
||||
import { nostrClient } from "./nostr.js";
|
||||
import { recordVideoView } from "./nostr/index.js";
|
||||
import { nostrClient } from "./nostrClientFacade.js";
|
||||
import { recordVideoView } from "./nostrViewEventsFacade.js";
|
||||
import { torrentClient } from "./webtorrent.js";
|
||||
import {
|
||||
isDevMode,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// js/channelProfile.js
|
||||
|
||||
import { nostrClient } from "./nostr.js";
|
||||
import { nostrClient } from "./nostrClientFacade.js";
|
||||
import { convertEventToVideo as sharedConvertEventToVideo } from "./nostr/index.js";
|
||||
import { DEFAULT_RELAY_URLS } from "./nostr/toolkit.js";
|
||||
import { subscriptions } from "./subscriptions.js";
|
||||
|
||||
+4
-2
@@ -1,8 +1,10 @@
|
||||
// js/historyView.js
|
||||
|
||||
import watchHistoryService from "./watchHistoryService.js";
|
||||
import { nostrClient } from "./nostr.js";
|
||||
import { updateWatchHistoryList } from "./nostr/watchHistoryBindings.js";
|
||||
import { nostrClient } from "./nostrClientFacade.js";
|
||||
import {
|
||||
updateWatchHistoryListWithDefaultClient as updateWatchHistoryList,
|
||||
} from "./nostrWatchHistoryFacade.js";
|
||||
import { pointerKey, normalizePointerInput } from "./nostr/watchHistory.js";
|
||||
import {
|
||||
WATCH_HISTORY_BATCH_RESOLVE,
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import getAuthProvider, {
|
||||
providers as authProviders,
|
||||
} from "./services/authProviders/index.js";
|
||||
import { accessControl } from "./accessControl.js";
|
||||
import { nostrClient } from "./nostr.js";
|
||||
import { nostrClient } from "./nostrClientFacade.js";
|
||||
import { userBlocks } from "./userBlocks.js";
|
||||
import { relayManager } from "./relayManager.js";
|
||||
|
||||
|
||||
+63
-6
@@ -6,6 +6,45 @@
|
||||
|
||||
export { nostrClient, requestDefaultExtensionPermissions } from "./nostrClientFacade.js";
|
||||
|
||||
export {
|
||||
__testExports,
|
||||
NostrClient,
|
||||
getActiveSigner,
|
||||
setActiveSigner,
|
||||
clearActiveSigner,
|
||||
resolveActiveSigner,
|
||||
shouldRequestExtensionPermissions,
|
||||
} from "./nostr/client.js";
|
||||
|
||||
export {
|
||||
DEFAULT_NIP07_ENCRYPTION_METHODS,
|
||||
DEFAULT_NIP07_PERMISSION_METHODS,
|
||||
} from "./nostr/nip07Permissions.js";
|
||||
|
||||
export {
|
||||
buildNip71MetadataTags,
|
||||
buildNip71VideoEvent,
|
||||
collectNip71PointerRequests,
|
||||
convertEventToVideo,
|
||||
extractNip71MetadataFromTags,
|
||||
getDTagValueFromTags,
|
||||
mergeNip71MetadataIntoVideo,
|
||||
populateNip71MetadataForVideos,
|
||||
processNip71Events,
|
||||
buildVideoPointerValue,
|
||||
stringFromInput,
|
||||
} from "./nostr/nip71.js";
|
||||
|
||||
export {
|
||||
normalizePointerInput,
|
||||
pointerKey,
|
||||
chunkWatchHistoryPayloadItems,
|
||||
normalizeActorKey,
|
||||
parseWatchHistoryContentWithFallback,
|
||||
isNip04EncryptedWatchHistoryEvent,
|
||||
watchHistoryHelpers,
|
||||
} from "./nostr/watchHistory.js";
|
||||
|
||||
export {
|
||||
recordVideoViewWithDefaultClient,
|
||||
listVideoViewEventsWithDefaultClient,
|
||||
@@ -13,11 +52,31 @@ export {
|
||||
countVideoViewEventsWithDefaultClient,
|
||||
} from "./nostrViewEventsFacade.js";
|
||||
|
||||
export {
|
||||
VIEW_EVENT_KIND,
|
||||
createVideoViewEventFilters,
|
||||
deriveViewEventBucketIndex,
|
||||
deriveViewEventPointerScope,
|
||||
getViewEventGuardWindowMs,
|
||||
hasRecentViewPublish,
|
||||
rememberViewPublish,
|
||||
publishViewEvent,
|
||||
recordVideoView as recordVideoViewWithClient,
|
||||
listVideoViewEvents as listVideoViewEventsWithClient,
|
||||
subscribeVideoViewEvents as subscribeVideoViewEventsWithClient,
|
||||
countVideoViewEvents as countVideoViewEventsWithClient,
|
||||
} from "./nostrViewEventsFacade.js";
|
||||
|
||||
export {
|
||||
updateWatchHistoryListWithDefaultClient,
|
||||
removeWatchHistoryItemWithDefaultClient,
|
||||
} from "./nostrWatchHistoryFacade.js";
|
||||
|
||||
export {
|
||||
updateWatchHistoryListWithDefaultClient as updateWatchHistoryList,
|
||||
removeWatchHistoryItemWithDefaultClient as removeWatchHistoryItem,
|
||||
} from "./nostrWatchHistoryFacade.js";
|
||||
|
||||
export {
|
||||
recordVideoViewWithDefaultClient as recordVideoView,
|
||||
listVideoViewEventsWithDefaultClient as listVideoViewEvents,
|
||||
@@ -25,9 +84,7 @@ export {
|
||||
countVideoViewEventsWithDefaultClient as countVideoViewEvents,
|
||||
} from "./nostrViewEventsFacade.js";
|
||||
|
||||
export {
|
||||
updateWatchHistoryListWithDefaultClient as updateWatchHistoryList,
|
||||
removeWatchHistoryItemWithDefaultClient as removeWatchHistoryItem,
|
||||
} from "./nostrWatchHistoryFacade.js";
|
||||
|
||||
export * from "./nostr/index.js";
|
||||
// Legacy modules should import from the specific facades above instead of this
|
||||
// shim. The wildcard export that previously forwarded the entire
|
||||
// "./nostr/index.js" barrel has intentionally been removed so bundlers can tree
|
||||
// shake unused helpers.
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { DEFAULT_RELAY_URLS } from "./nostr/toolkit.js";
|
||||
import {
|
||||
nostrClient,
|
||||
requestDefaultExtensionPermissions,
|
||||
} from "./nostr.js";
|
||||
} from "./nostrClientFacade.js";
|
||||
import { getActiveSigner } from "./nostr/index.js";
|
||||
import { buildRelayListEvent } from "./nostrEventSchemas.js";
|
||||
import { devLogger, userLogger } from "./utils/logger.js";
|
||||
|
||||
+4
-2
@@ -2,13 +2,15 @@
|
||||
import {
|
||||
nostrClient,
|
||||
requestDefaultExtensionPermissions,
|
||||
} from "./nostr.js";
|
||||
} from "./nostrClientFacade.js";
|
||||
import {
|
||||
getActiveSigner,
|
||||
convertEventToVideo as sharedConvertEventToVideo,
|
||||
} from "./nostr/index.js";
|
||||
import {
|
||||
listVideoViewEvents,
|
||||
subscribeVideoViewEvents,
|
||||
} from "./nostr/index.js";
|
||||
} from "./nostrViewEventsFacade.js";
|
||||
import { DEFAULT_RELAY_URLS } from "./nostr/toolkit.js";
|
||||
import {
|
||||
buildSubscriptionListEvent,
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
import {
|
||||
nostrClient,
|
||||
requestDefaultExtensionPermissions,
|
||||
} from "./nostr.js";
|
||||
} from "./nostrClientFacade.js";
|
||||
import { getActiveSigner } from "./nostr/index.js";
|
||||
import { buildBlockListEvent, BLOCK_LIST_IDENTIFIER } from "./nostrEventSchemas.js";
|
||||
import { userLogger } from "./utils/logger.js";
|
||||
|
||||
+5
-5
@@ -17,12 +17,12 @@ import {
|
||||
VIEW_COUNT_DEDUPE_WINDOW_SECONDS,
|
||||
} from "./config.js";
|
||||
import { userLogger } from "./utils/logger.js";
|
||||
import { nostrClient } from "./nostr.js";
|
||||
import { nostrClient } from "./nostrClientFacade.js";
|
||||
import {
|
||||
countVideoViewEvents,
|
||||
listVideoViewEvents,
|
||||
subscribeVideoViewEvents,
|
||||
} from "./nostr/viewEventBindings.js";
|
||||
countVideoViewEventsWithDefaultClient as countVideoViewEvents,
|
||||
listVideoViewEventsWithDefaultClient as listVideoViewEvents,
|
||||
subscribeVideoViewEventsWithDefaultClient as subscribeVideoViewEvents,
|
||||
} from "./nostrViewEventsFacade.js";
|
||||
|
||||
const VIEW_COUNTER_STORAGE_KEY = "bitvid:view-counter:v1";
|
||||
const STORAGE_DEBOUNCE_MS = 500;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { getApplication } from "./applicationContext.js";
|
||||
import nostrService from "./services/nostrService.js";
|
||||
import { nostrClient } from "./nostr.js";
|
||||
import { nostrClient } from "./nostrClientFacade.js";
|
||||
import { logWatchHistoryDebug } from "./watchHistoryDebug.js";
|
||||
|
||||
function logInfo(message, details) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import {
|
||||
nostrClient,
|
||||
requestDefaultExtensionPermissions,
|
||||
} from "./nostr.js";
|
||||
} from "./nostrClientFacade.js";
|
||||
import {
|
||||
normalizePointerInput,
|
||||
pointerKey,
|
||||
|
||||
Reference in new issue
Block a user