mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 21:30:17 +08:00
bba6524979
- Add default_cost_multiplier field per app type - Add pricing_model_source field (request/response) - Add request_model field to proxy_request_logs table - Implement schema migration v5
27 lines
687 B
TypeScript
27 lines
687 B
TypeScript
const storage = new Map<string, string>();
|
|
|
|
if (
|
|
typeof globalThis.localStorage === "undefined" ||
|
|
typeof globalThis.localStorage?.getItem !== "function"
|
|
) {
|
|
Object.defineProperty(globalThis, "localStorage", {
|
|
value: {
|
|
getItem: (key: string) => storage.get(key) ?? null,
|
|
setItem: (key: string, value: string) => {
|
|
storage.set(key, String(value));
|
|
},
|
|
removeItem: (key: string) => {
|
|
storage.delete(key);
|
|
},
|
|
clear: () => {
|
|
storage.clear();
|
|
},
|
|
key: (index: number) => Array.from(storage.keys())[index] ?? null,
|
|
get length() {
|
|
return storage.size;
|
|
},
|
|
},
|
|
configurable: true,
|
|
});
|
|
}
|