From 9c5b86c2d7f2af7c5905a1cd63aacb8927d7ec4c Mon Sep 17 00:00:00 2001 From: vnugent Date: Thu, 25 Apr 2024 14:55:50 -0400 Subject: latest noscryp integrations and testing --- extension/src/features/nip07allow-api.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'extension/src/features/nip07allow-api.ts') diff --git a/extension/src/features/nip07allow-api.ts b/extension/src/features/nip07allow-api.ts index 89639d1..653b7ed 100644 --- a/extension/src/features/nip07allow-api.ts +++ b/extension/src/features/nip07allow-api.ts @@ -15,10 +15,10 @@ import { tabs, type Tabs } from "webextension-polyfill"; import { Watchable } from "./types"; -import { defaultTo, filter, includes, isEqual } from "lodash"; +import { defaultTo, includes, defer } from "lodash"; import { BgRuntime, FeatureApi, IFeatureExport, exportForegroundApi, popupAndOptionsOnly } from "./framework"; import { AppSettings } from "./settings"; -import { set, get, toRefs } from "@vueuse/core"; +import { set, get, toRefs, watchDebounced, watchThrottled, controlledRef } from "@vueuse/core"; import { computed, shallowRef } from "vue"; import { waitForChangeFn, push, remove } from "./util"; @@ -44,13 +44,20 @@ export const useInjectAllowList = (): IFeatureExport) => { - const store = state.useStorageSlot('nip07-allowlist', { origins: [], enabled: true }); + const { state: store, sync } = state.useServerSlot('nvault-site-whitelist', true, { origins: [], enabled: true }); const { origins, enabled } = toRefs(store) const { currentOrigin, currentTab } = (() => { const currentTab = shallowRef(undefined) - const currentOrigin = computed(() => currentTab.value?.url ? new URL(currentTab.value.url).origin : undefined) + const currentOrigin = computed(() => { + try{ + return new URL(currentTab.value!.url!).origin + } + catch{ + return '' + } + }) //Watch for changes to the current tab tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => { @@ -126,7 +133,9 @@ export const useInjectAllowList = (): IFeatureExport