Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"message": "Bypass List"
},
"config_section_advance": {
"message": "Advance Config"
"message": "Advanced Config"
},
"config_reference_bypass_list": {
"message": "Learn more about bypass list"
Expand Down
9 changes: 7 additions & 2 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,16 @@ class StatsProvider {
// this.stats.addFailedRequest(details);
// TODO: update indicator
const proxySetting = await getCurrentProxySetting();
console.log("onResponseStarted", details);
if (details.tabId > 0 && proxySetting.activeProfile) {
let parsedUrl: URL;
try {
parsedUrl = new URL(details.url);
} catch {
return;
}
const ret = await findProfile(
proxySetting.activeProfile,
new URL(details.url)
parsedUrl
);

StatsProvider.stats.setCurrentProfile(details.tabId, ret);
Expand Down
1 change: 0 additions & 1 deletion src/components/configs/AutoSwitchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ const getConditionInputRule = (type: AutoSwitchType): FieldRule<string> => {
case "url":
return {
validator: async (value: string, cb: (message?: string) => void) => {
console.log("test");
let u;
try {
u = new URL(value || "");
Expand Down
1 change: 0 additions & 1 deletion src/components/controls/ThemeSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const onDarkModeChanged = (newMode: DarkMode) => {
};

const toggleDarkMode = async () => {
console.log(await currentDarkMode());
switch (await currentDarkMode()) {
case DarkMode.Dark:
onDarkModeChanged(DarkMode.Light);
Expand Down
4 changes: 1 addition & 3 deletions src/pages/PopupPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ onMounted(async () => {

const jumpTo = (to: RouteLocationRaw) => {
const path = router.resolve(to).fullPath;
window.open(`/index.html#${path}`, import.meta.url);
// window.open(router.resolve(to).href, import.meta.url)
window.open(`/index.html#${path}`, "_blank");
};

// actions
const setProxyByProfile = async (val: ProxyProfile) => {
try {
console.log(toRaw(val));
await setProxy(toRaw(val));
activeProfile.value = toRaw(val);
} catch (e: any) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/preference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export async function changeDarkMode(newMode: DarkMode) {

switch (newMode) {
case DarkMode.Dark:
document && document.body.setAttribute("arco-theme", "dark");
document?.body?.setAttribute("arco-theme", "dark");
break;
case DarkMode.Light:
document && document.body.removeAttribute("arco-theme");
document?.body?.removeAttribute("arco-theme");
break;
}
}
2 changes: 1 addition & 1 deletion src/services/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async function overwriteProfiles(profiles: ProfilesStorage) {
// Deep clone to remove any Proxy objects before saving
const clonedProfiles = deepClone(profiles);
await Host.set(keyProfileStorage, clonedProfiles);
onProfileUpdateListeners.map((cb) => cb(profiles));
onProfileUpdateListeners.forEach((cb) => cb(profiles));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/services/proxy/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class ProfileAuthProvider {
];

// check if there's any matching host and port
auths.map((item) => {
auths.forEach((item) => {
if (!item) return;

if (
Expand Down
2 changes: 1 addition & 1 deletion src/services/proxy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export async function refreshProxy() {
const newProfile = await getProfile(current.activeProfile.profileID);

// if it's preset profiles, then do nothing
if (!newProfile || current.activeProfile.proxyType in ["system", "direct"]) {
if (!newProfile || ["system", "direct"].includes(current.activeProfile.proxyType)) {
return;
}

Expand Down
5 changes: 5 additions & 0 deletions src/services/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
* Deep clone an object to remove all Proxy objects (e.g., from Vue reactivity).
* This is necessary because chrome.storage and browser.storage use structured clone
* which cannot clone Proxy objects.
*
* Note: structuredClone() is NOT used here intentionally — it throws a DataCloneError
* on JavaScript Proxy objects (including Vue reactive/ref wrappers). JSON round-trip
* serializes through the Proxy traps and produces a plain object, which is exactly
* what chrome.storage requires.
*/
export function deepClone<T>(obj: T): T {
return JSON.parse(JSON.stringify(obj));
Expand Down