add a `Clear Plugin Scan Cache` button.
This commit is contained in:
parent
fee98d4dd3
commit
172a909aa8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -89,6 +89,14 @@ export default new class ContentManager {
|
|||
dataStore.setSettingGroup("PluginCertifierHashes", encryptSettingsCache(JSON.stringify(addonCache)))
|
||||
}
|
||||
|
||||
resetAddonCache(){
|
||||
Object.keys(addonCache).forEach(key => {
|
||||
delete addonCache[key]
|
||||
})
|
||||
console.log(addonCache)
|
||||
this.saveAddonCache()
|
||||
}
|
||||
|
||||
watchContent(contentType) {
|
||||
if (this.watchers[contentType]) return;
|
||||
const isPlugin = contentType === "plugin";
|
||||
|
|
|
@ -450,4 +450,12 @@ export function encryptSettingsCache(data){
|
|||
let encrypted = cipher.update(Buffer.from(data, "utf8"));
|
||||
encrypted = Buffer.concat([encrypted, cipher.final()]);
|
||||
return encrypted.toString("base64")
|
||||
}
|
||||
export function clearCaches(){
|
||||
Object.keys(cache).forEach(key => {
|
||||
delete cache[key]
|
||||
})
|
||||
Object.keys(cache2).forEach(key => {
|
||||
delete cache[key]
|
||||
})
|
||||
}
|
|
@ -33,6 +33,7 @@ import core from "./core";
|
|||
import popoutWindow from "./popoutWindow";
|
||||
import TextInputSetting from "../ui/TextInputSetting";
|
||||
import { useForceUpdate } from "./hooks";
|
||||
import { clearCaches } from "./pluginCertifier";
|
||||
|
||||
class BDSidebarHeader extends React.PureComponent {
|
||||
render(){
|
||||
|
@ -321,6 +322,7 @@ export default new class V2_SettingsPanel {
|
|||
}
|
||||
|
||||
lightcordComponent(sidebar, forceUpdate) {
|
||||
// this code is shit, I'm gonna rewritte everything in the next version
|
||||
let appSettings = window.Lightcord.Api.settings
|
||||
return [
|
||||
this.lightcordSettings.map((section, i) => {
|
||||
|
@ -461,7 +463,22 @@ export default new class V2_SettingsPanel {
|
|||
},
|
||||
wrapper: true,
|
||||
disabled: isClearingCache
|
||||
}, "Clear cache")
|
||||
}, "Clear cache"),
|
||||
React.createElement(Lightcord.Api.Components.inputs.Button, {
|
||||
color: "yellow",
|
||||
look: "ghost",
|
||||
size: "medium",
|
||||
hoverColor: "red",
|
||||
onClick: () => {
|
||||
clearCaches()
|
||||
ContentManager.resetAddonCache()
|
||||
Utils.showToast("Cache is cleared !", {
|
||||
type: "success"
|
||||
})
|
||||
},
|
||||
wrapper: true,
|
||||
disabled: false
|
||||
}, "Clear Plugin Scan Cache")
|
||||
]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue