Add proxy switcher to the mix

This commit is contained in:
MotorTruck1221
2025-04-21 23:26:40 -06:00
parent 5b808afae5
commit 4ea7ab5e11
4 changed files with 14 additions and 5 deletions
+2 -1
View File
@@ -48,7 +48,8 @@ class SW {
return template.replace("%s", encodeURIComponent(input));
}
encodeURL(string: string, proxy: 'uv' | 'sj'): string {
encodeURL(string: string): string {
const proxy = this.#storageManager.getVal("proxy") as 'uv' | 'sj';
const input = this.#search(string, "https://google.com/search?q=%s");
return proxy === 'uv' ? `${__uv$config.prefix}${__uv$config.encodeUrl!(input)}` : this.#scramjetController!.encodeUrl(input)
}
+3 -1
View File
@@ -71,7 +71,9 @@ class Settings {
: document.documentElement.className = theme || this.#storageManager.getVal('theme');
}
proxy(prox: 'uv' | 'sj') {}
proxy(prox: 'uv' | 'sj') {
this.#storageManager.setVal('proxy', prox);
}
async *#init() {
yield this.theme(this.#storageManager.getVal('theme') || 'default');