From 35f1bf35cab4807336d04722865c9456a9b4d82d Mon Sep 17 00:00:00 2001 From: Bauke Date: Thu, 29 Jun 2023 18:51:18 +0200 Subject: [PATCH] Add back the default known groups. --- source/storage/exports.ts | 3 ++- source/storage/known-groups.ts | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 source/storage/known-groups.ts diff --git a/source/storage/exports.ts b/source/storage/exports.ts index 96ffd80..847e4ce 100644 --- a/source/storage/exports.ts +++ b/source/storage/exports.ts @@ -1,6 +1,7 @@ import {createValue} from "@holllo/webextension-storage"; import browser from "webextension-polyfill"; import {Data, Feature} from "./enums.js"; +import {defaultKnownGroups} from "./known-groups.js"; import {collectUsernameColors} from "./username-color.js"; import {collectUserLabels} from "./user-label.js"; @@ -38,7 +39,7 @@ export const storageValues = { deserialize: (input) => new Set(JSON.parse(input) as string[]), serialize: (input) => JSON.stringify(Array.from(input)), key: Data.KnownGroups, - value: new Set([]), + value: new Set(defaultKnownGroups), storage: browser.storage.sync, }), [Data.LatestActiveFeatureTab]: createValue({ diff --git a/source/storage/known-groups.ts b/source/storage/known-groups.ts new file mode 100644 index 0000000..9268984 --- /dev/null +++ b/source/storage/known-groups.ts @@ -0,0 +1,44 @@ +/** + * A list of default known groups to seed the Autocomplete feature with. + * + * This list does not need to be updated to match the groups available on Tildes. + * Instead, in `source/utilities/groups.ts` is a function that will extract the + * groups from Tildes whenever the user goes to `https://tildes.net/groups`. + * + * Inside `source/content-scripts/setup.tsx` a list of features that uses this + * data is defined, when any of those features are enabled the extract function + * will be called. So if a feature ever gets added that uses this data, remember + * to add it to the list in the content scripts setup. + */ +export const defaultKnownGroups = [ + "~anime", + "~arts", + "~books", + "~comp", + "~creative", + "~design", + "~enviro", + "~finance", + "~food", + "~games", + "~games.game_design", + "~games.tabletop", + "~health", + "~hobbies", + "~humanities", + "~lgbt", + "~life", + "~misc", + "~movies", + "~music", + "~news", + "~science", + "~space", + "~sports", + "~talk", + "~tech", + "~test", + "~tildes", + "~tildes.official", + "~tv", +];