mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-04-22 07:58:01 +03:00
feat: Minor 3.1.0 (#150)
* Some features are now optional (#148) * fix(dev): yarn.lock tree fix * feat: bookmarks moved to optional permissions * fix: analytics not working in firefox * feat!: ability to turn off analytics (uses permissions on firefox) * feat: analytics tracker for bookmark export * feat: add privacy policy link in about section * docs: privacy policy update * feat: ability to chain multiple dialogs * fix(loc): analytics option translation * feat: settings review dialog * fix: background script fails to load because of frontend code * chore: use analytics permission as storage value * fix: inverted analytics value * feat!: option to disable thumbnail capture * fix(ci): sed typo * fix: minor fixes * fix(firefox): web-ext lint error fix * chore(ci): switch web-ext action * chore(lint): fix eslint warnings * chore(deps): monthly dependency bump (September 2025) (#149) * chore: 3.1.0 version bump * chore: minor cleanup * fix: allow analytics checkbox stays inactive after denying permission on firefox * fix(deps): yarn.lock rebuild * fix: type assertion for userId * fix: settings review dialog not showing if welcome dialog is not required * fix: analytics and thumbnail capture toggles react incorrectly if permission is denied
This commit is contained in:
@@ -5,6 +5,9 @@ export { default as getCollections } from "./utils/getCollections";
|
||||
export { default as resoveConflict } from "./utils/resolveConflict";
|
||||
export { default as saveCollections } from "./utils/saveCollections";
|
||||
export { default as setCloudStorage } from "./utils/setCloudStorage";
|
||||
export { default as clearGraphicsStorage } from "./utils/clearGraphics";
|
||||
|
||||
export { default as thumbnailCaptureEnabled } from "./utils/thumbnailCaptureEnabled";
|
||||
|
||||
export const collectionCount = collectionStorage.count;
|
||||
export const graphics = collectionStorage.graphics;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { collectionStorage } from "./collectionStorage";
|
||||
|
||||
export default async function clearGraphicsStorage(): Promise<void>
|
||||
{
|
||||
await collectionStorage.graphics.removeValue();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import { Permissions } from "wxt/browser";
|
||||
import { Unwatch, WatchCallback, WxtStorageItem } from "wxt/storage";
|
||||
|
||||
const thumbnailCaptureEnabled: Pick<WxtStorageItem<boolean, Record<string, unknown>>, "getValue" | "watch" | "setValue"> =
|
||||
{
|
||||
getValue: async (): Promise<boolean> =>
|
||||
await browser.permissions.contains({ permissions: ["scripting"], origins: ["<all_urls>"] }),
|
||||
|
||||
watch: (cb: WatchCallback<boolean>): Unwatch =>
|
||||
{
|
||||
const listener = async (permissions: Permissions.Permissions): Promise<void> =>
|
||||
{
|
||||
if (permissions.permissions?.includes("scripting") || permissions.origins?.includes("<all_urls>"))
|
||||
{
|
||||
const isGranted: boolean = await browser.permissions.contains({ permissions: ["scripting"], origins: ["<all_urls>"] });
|
||||
console.log("thumbnailCaptureEnabled changed", isGranted);
|
||||
cb(isGranted, !isGranted);
|
||||
}
|
||||
};
|
||||
|
||||
browser.permissions.onAdded.addListener(listener);
|
||||
browser.permissions.onRemoved.addListener(listener);
|
||||
|
||||
return (): void =>
|
||||
{
|
||||
browser.permissions.onAdded.removeListener(listener);
|
||||
browser.permissions.onRemoved.removeListener(listener);
|
||||
};
|
||||
},
|
||||
|
||||
setValue: async (value: boolean): Promise<void> =>
|
||||
{
|
||||
let result: boolean = false;
|
||||
|
||||
if (value)
|
||||
result = await browser.permissions.request({ permissions: ["scripting"], origins: ["<all_urls>"] });
|
||||
else
|
||||
{
|
||||
result = await browser.permissions.remove({ origins: ["<all_urls>"] });
|
||||
|
||||
if (import.meta.env.DEV)
|
||||
await browser.permissions.request({ origins: ["http://localhost/*"] });
|
||||
}
|
||||
|
||||
if (!result)
|
||||
throw new Error("Permission request was denied");
|
||||
}
|
||||
};
|
||||
|
||||
export default thumbnailCaptureEnabled;
|
||||
Reference in New Issue
Block a user