diff --git a/docs/options.md b/docs/options.md index 8956c65..5b89749 100644 --- a/docs/options.md +++ b/docs/options.md @@ -117,12 +117,6 @@ When enabled, the following items can appear in the context menu: When you right-click the extension's toolbar icon, by default only a minimal set of actions are shown. Enabling this option adds all available context menu actions to the toolbar icon's right-click menu, matching the full set available in the page context menu. -#### Show Error Notifications - -Shows a browser notification if a cache clear operation triggered by a **keyboard shortcut** or **right-click context menu** encounters an error. Errors that occur through the popup UI are always shown inline regardless of this setting. - -Disable this if you find error notifications disruptive and prefer to check results manually. - #### Show Deprecated Options Some cache types are deprecated — they were part of older browser APIs that are no longer actively used (such as App Cache, Web SQL, and File Systems). These options are hidden by default to keep the interface clean. diff --git a/src/components/OptionsForm.vue b/src/components/OptionsForm.vue index 0ff8e29..31573d2 100644 --- a/src/components/OptionsForm.vue +++ b/src/components/OptionsForm.vue @@ -38,7 +38,7 @@ const props = withDefaults( 'showConfirmation', 'contextMenu', 'contextAction', - 'showErrorNotifications', + // 'showErrorNotifications', 'showDeprecated', 'showUpdate', ], diff --git a/src/entrypoints/background/index.ts b/src/entrypoints/background/index.ts index a2f2add..2641316 100644 --- a/src/entrypoints/background/index.ts +++ b/src/entrypoints/background/index.ts @@ -16,7 +16,7 @@ export default defineBackground(() => { chrome.commands?.onCommand.addListener(onCommand) chrome.contextMenus?.onClicked.addListener(onClicked) - chrome.notifications.onClicked.addListener(notificationsOnClicked) + // chrome.notifications.onClicked.addListener(notificationsOnClicked) }) async function onInstalled(details: chrome.runtime.InstalledDetails) { @@ -107,10 +107,10 @@ async function onClicked(ctx: chrome.contextMenus.OnClickData, tab?: chrome.tabs } } -async function notificationsOnClicked(notificationId: string) { - console.log('notificationsOnClicked:', notificationId) - await chrome.notifications.clear(notificationId) -} +// async function notificationsOnClicked(notificationId: string) { +// console.log('notificationsOnClicked:', notificationId) +// await chrome.notifications.clear(notificationId) +// } async function setDefaultOptions(defaultOptions: object) { console.log('setDefaultOptions', defaultOptions) diff --git a/src/entrypoints/background/upgrade.ts b/src/entrypoints/background/upgrade.ts index 33487de..170af85 100644 --- a/src/entrypoints/background/upgrade.ts +++ b/src/entrypoints/background/upgrade.ts @@ -5,25 +5,28 @@ export function processUpdate(options: Options, version: string, previous?: stri console.log('processUpdate:', options) console.log('version:', version) console.log('previous:', previous) - const config = getAppConfig() - - if ( - previous !== undefined && - compareSemver(previous, '1.0.0') < 0 && - compareSemver(version, '1.0.0') >= 0 - ) { - upgrade100(options) - // TODO: Determine strategy to set updateUrl path... - const url = `${config.updateUrl}/v1.0` - console.log('url:', url) - chrome.tabs.create({ active: false, url }).catch(console.warn) + try { + const config = getAppConfig() + if ( + previous !== undefined && + compareSemver(previous, '1.0.0') < 0 && + compareSemver(version, '1.0.0') >= 0 + ) { + upgrade100(options) + // TODO: Determine strategy to set updateUrl path... + const url = `${config.updateUrl}/v1.0` + console.log('url:', url) + chrome.tabs.create({ active: false, url }).catch(console.warn) + } + } catch (e) { + console.warn(e) } } function upgrade100(options: Options) { console.log('%c--- Processing v1.0.0 Upgrade ---', 'color: Gold') let changed - if ('enable' in options.ctx) { + if (options.ctx && 'enable' in options.ctx) { console.log('Deleting: options.ctx.enable:', options.ctx.enable) delete options.ctx.enable changed = true diff --git a/src/utils/cache.ts b/src/utils/cache.ts index 431a84c..a1c92c4 100644 --- a/src/utils/cache.ts +++ b/src/utils/cache.ts @@ -1,10 +1,9 @@ // noinspection JSDeprecatedSymbols -import { i18n } from '#imports' import { isFirefox, isMobile } from '@/utils/system.ts' import { getOptions } from '@/utils/options.ts' -import { sendNotifications } from '@/utils/extension.ts' import type { Options } from '@/utils/options.ts' +// import { sendNotifications } from '@/utils/extension.ts' export async function clearCache(type: ClearCacheType) { const isAll = type.endsWith('All') @@ -18,10 +17,10 @@ export async function clearCache(type: ClearCacheType) { } } catch (e) { console.error(e) - if (options.showErrorNotifications) { - const message = e instanceof Error ? e.message : i18n.t('ui.text.unknown') - await sendNotifications(i18n.t('ui.cache.error'), message) - } + // if (options.showErrorNotifications) { + // const message = e instanceof Error ? e.message : i18n.t('ui.text.unknown') + // await sendNotifications(i18n.t('ui.cache.error'), message) + // } } } diff --git a/src/utils/extension.ts b/src/utils/extension.ts index fb62bcd..92f760a 100644 --- a/src/utils/extension.ts +++ b/src/utils/extension.ts @@ -133,13 +133,12 @@ export function clickOpen(e: Event, close = false) { .catch(console.log) } -export async function sendNotifications(title: string, message: string) { - // TODO: Add error icon... - const notification = await chrome.notifications.create({ - type: 'basic', - iconUrl: chrome.runtime.getURL('icons/48.png'), - title, - message: message, - }) - console.debug('notification:', notification) -} +// export async function sendNotifications(title: string, message: string) { +// const notification = await chrome.notifications.create({ +// type: 'basic', +// iconUrl: chrome.runtime.getURL('icons/48.png'), +// title, +// message: message, +// }) +// console.debug('notification:', notification) +// } diff --git a/src/utils/options.ts b/src/utils/options.ts index 2d5e983..95de7c1 100644 --- a/src/utils/options.ts +++ b/src/utils/options.ts @@ -6,7 +6,7 @@ export const defaultOptions = { showDeprecated: false, contextMenu: true, contextAction: false, - showErrorNotifications: true, + // showErrorNotifications: true, showUpdate: false, radioBackground: 'bgPicture' as 'bgNone' | 'bgPicture' | 'bgVideo', diff --git a/wxt.config.ts b/wxt.config.ts index 1bd397c..d6f8e8b 100644 --- a/wxt.config.ts +++ b/wxt.config.ts @@ -34,7 +34,7 @@ export default defineConfig({ 'activeTab', 'browsingData', 'contextMenus', - 'notifications', + // 'notifications', 'scripting', 'storage', ],