Fix Questify & WebContextMenus
This commit is contained in:
parent
a57edd6a28
commit
1c2d573f1d
3 changed files with 15 additions and 8 deletions
|
|
@ -25,14 +25,21 @@ function getCurrentSettings(pluginList: string[]): KnownPluginSettingsMap {
|
|||
]));
|
||||
}
|
||||
|
||||
export async function getKnownSettings(): Promise<KnownPluginSettingsMap> {
|
||||
let map = await DataStore.get(KNOWN_SETTINGS_DATA_KEY) as KnownPluginSettingsMap;
|
||||
if (map === undefined) {
|
||||
export async function getKnownSettings(): Promise<Map<string, Set<string>>> {
|
||||
const raw = await DataStore.get(KNOWN_SETTINGS_DATA_KEY);
|
||||
let map: Map<string, Set<string>>;
|
||||
|
||||
if (!raw) {
|
||||
const knownPlugins = await DataStore.get(KNOWN_PLUGINS_LEGACY_DATA_KEY) ?? [] as string[];
|
||||
const Plugins = [...Object.keys(plugins), ...knownPlugins];
|
||||
map = getCurrentSettings(Plugins);
|
||||
DataStore.set(KNOWN_SETTINGS_DATA_KEY, map);
|
||||
await DataStore.set(KNOWN_SETTINGS_DATA_KEY, [...map.entries()].map(
|
||||
([plugin, settings]) => [plugin, [...settings]]
|
||||
));
|
||||
} else {
|
||||
map = new Map(raw.map(([plugin, settings]: [string, string[]]) => [plugin, new Set(settings)]));
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1044,7 +1044,7 @@ export default definePlugin({
|
|||
// Run Questify's sort function every time due to hook requirements but return
|
||||
// early if not applicable. If the sort method is set to "Questify", replace the
|
||||
// quests with the sorted ones. Also, setup a trigger to rerender the memo.
|
||||
match: /(?<=function \i\((\i).{0,100}?useRef\(\i\);)(return \i.useMemo\(\(\)=>{)/,
|
||||
match: /(?<=function \i\((\i).{0,100}?useRef\(0\);)(return \i.useMemo\(\(\)=>{)/,
|
||||
replace: "const questRerenderTrigger=$self.useQuestRerender();const questifySorted=$self.sortQuests($1,arguments[1].sortMethod!==\"questify\");$2if(arguments[1].sortMethod===\"questify\"){$1=questifySorted;};"
|
||||
},
|
||||
{
|
||||
|
|
@ -1059,7 +1059,7 @@ export default definePlugin({
|
|||
},
|
||||
{
|
||||
// Add the trigger to the memo for rerendering Quests order due to progress changes, etc.
|
||||
match: /(?<=current=\i,\i},\[\i,\i,\i)/,
|
||||
match: /(?<=current=\i\.length,\i},\[\i,\i,\i)/,
|
||||
replace: ",questRerenderTrigger,questifySorted"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -138,8 +138,8 @@ export default definePlugin({
|
|||
replace: "false"
|
||||
},
|
||||
{
|
||||
match: /canCopyImage\(.+?(?=return"function"==typeof \i\.clipboard\.copyImage)/,
|
||||
replace: "$&return true;"
|
||||
match: /(canCopyImage\(.+?)\|\|"function"!=typeof \i\.clipboard\.copyImage/,
|
||||
replace: "$1"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue