1
Fork 0

Add back the default known groups.

This commit is contained in:
Bauke 2023-06-29 18:51:18 +02:00
parent 009ff2e424
commit 35f1bf35ca
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 46 additions and 1 deletions

View File

@ -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({

View File

@ -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",
];