chore: Canonical variable name

This commit is contained in:
onejibang 2024-05-13 19:22:33 +08:00
parent 93a1ba7b50
commit cea16d8c44

View File

@ -50,7 +50,9 @@ export class OpenAPI {
if (isLoon || isSurge) if (isLoon || isSurge)
this.cache = JSON.parse($persistentStore.read(this.name) || '{}'); this.cache = JSON.parse($persistentStore.read(this.name) || '{}');
if (isGUIforCores) if (isGUIforCores)
this.cache = JSON.parse(Plugins.$memory.get(this.name) || '{}'); this.cache = JSON.parse(
$Plugins.SubStoreCache.get(this.name) || '{}',
);
if (isNode) { if (isNode) {
// create a json for root cache // create a json for root cache
const basePath = const basePath =
@ -88,7 +90,7 @@ export class OpenAPI {
const data = JSON.stringify(this.cache, null, 2); const data = JSON.stringify(this.cache, null, 2);
if (isQX) $prefs.setValueForKey(data, this.name); if (isQX) $prefs.setValueForKey(data, this.name);
if (isLoon || isSurge) $persistentStore.write(data, this.name); if (isLoon || isSurge) $persistentStore.write(data, this.name);
if (isGUIforCores) Plugins.$memory.set(this.name, data); if (isGUIforCores) $Plugins.SubStoreCache.set(this.name, data);
if (isNode) { if (isNode) {
const basePath = const basePath =
eval('process.env.SUB_STORE_DATA_BASE_PATH') || '.'; eval('process.env.SUB_STORE_DATA_BASE_PATH') || '.';
@ -122,7 +124,7 @@ export class OpenAPI {
this.root[key] = data; this.root[key] = data;
} }
if (isGUIforCores) { if (isGUIforCores) {
return Plugins.$memory.set(key, data); return $Plugins.SubStoreCache.set(key, data);
} }
} else { } else {
this.cache[key] = data; this.cache[key] = data;
@ -144,7 +146,7 @@ export class OpenAPI {
return this.root[key]; return this.root[key];
} }
if (isGUIforCores) { if (isGUIforCores) {
return Plugins.$memory.get(key); return $Plugins.SubStoreCache.get(key);
} }
} else { } else {
return this.cache[key]; return this.cache[key];
@ -165,7 +167,7 @@ export class OpenAPI {
delete this.root[key]; delete this.root[key];
} }
if (isGUIforCores) { if (isGUIforCores) {
return Plugins.$memory.remove(key); return $Plugins.SubStoreCache.remove(key);
} }
} else { } else {
delete this.cache[key]; delete this.cache[key];