refactor: replace 'let' with 'const' for better variable scoping and immutability
This commit is contained in:
@@ -1,15 +1,23 @@
|
|||||||
import js from "@eslint/js";
|
import js from "@eslint/js";
|
||||||
|
import pluginReact from "eslint-plugin-react";
|
||||||
|
import pluginReactHooks from "eslint-plugin-react-hooks";
|
||||||
|
import { defineConfig } from "eslint/config";
|
||||||
import globals from "globals";
|
import globals from "globals";
|
||||||
import tseslint from "typescript-eslint";
|
import tseslint from "typescript-eslint";
|
||||||
import pluginReact from "eslint-plugin-react";
|
|
||||||
import { defineConfig } from "eslint/config";
|
|
||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
{
|
{
|
||||||
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
||||||
plugins: { js },
|
plugins: {
|
||||||
|
js,
|
||||||
|
"react-hooks": pluginReactHooks,
|
||||||
|
},
|
||||||
extends: ["js/recommended"],
|
extends: ["js/recommended"],
|
||||||
languageOptions: { globals: globals.browser },
|
languageOptions: { globals: globals.browser },
|
||||||
|
rules: {
|
||||||
|
"react-hooks/rules-of-hooks": "error",
|
||||||
|
"react-hooks/exhaustive-deps": "error",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
tseslint.configs.recommended,
|
tseslint.configs.recommended,
|
||||||
pluginReact.configs.flat["jsx-runtime"],
|
pluginReact.configs.flat["jsx-runtime"],
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
"cross-env": "^10.0.0",
|
"cross-env": "^10.0.0",
|
||||||
"eslint": "^9.35.0",
|
"eslint": "^9.35.0",
|
||||||
"eslint-plugin-react": "^7.37.5",
|
"eslint-plugin-react": "^7.37.5",
|
||||||
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"glob": "^11.0.3",
|
"glob": "^11.0.3",
|
||||||
"globals": "^16.4.0",
|
"globals": "^16.4.0",
|
||||||
"https-proxy-agent": "^7.0.6",
|
"https-proxy-agent": "^7.0.6",
|
||||||
|
|||||||
13
pnpm-lock.yaml
generated
13
pnpm-lock.yaml
generated
@@ -180,6 +180,9 @@ importers:
|
|||||||
eslint-plugin-react:
|
eslint-plugin-react:
|
||||||
specifier: ^7.37.5
|
specifier: ^7.37.5
|
||||||
version: 7.37.5(eslint@9.35.0(jiti@2.5.1))
|
version: 7.37.5(eslint@9.35.0(jiti@2.5.1))
|
||||||
|
eslint-plugin-react-hooks:
|
||||||
|
specifier: ^5.2.0
|
||||||
|
version: 5.2.0(eslint@9.35.0(jiti@2.5.1))
|
||||||
glob:
|
glob:
|
||||||
specifier: ^11.0.3
|
specifier: ^11.0.3
|
||||||
version: 11.0.3
|
version: 11.0.3
|
||||||
@@ -2205,6 +2208,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
|
eslint-plugin-react-hooks@5.2.0:
|
||||||
|
resolution: {integrity: sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==}
|
||||||
|
engines: {node: '>=10'}
|
||||||
|
peerDependencies:
|
||||||
|
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0
|
||||||
|
|
||||||
eslint-plugin-react@7.37.5:
|
eslint-plugin-react@7.37.5:
|
||||||
resolution: {integrity: sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==}
|
resolution: {integrity: sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==}
|
||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
@@ -5914,6 +5923,10 @@ snapshots:
|
|||||||
|
|
||||||
escape-string-regexp@4.0.0: {}
|
escape-string-regexp@4.0.0: {}
|
||||||
|
|
||||||
|
eslint-plugin-react-hooks@5.2.0(eslint@9.35.0(jiti@2.5.1)):
|
||||||
|
dependencies:
|
||||||
|
eslint: 9.35.0(jiti@2.5.1)
|
||||||
|
|
||||||
eslint-plugin-react@7.37.5(eslint@9.35.0(jiti@2.5.1)):
|
eslint-plugin-react@7.37.5(eslint@9.35.0(jiti@2.5.1)):
|
||||||
dependencies:
|
dependencies:
|
||||||
array-includes: 3.1.9
|
array-includes: 3.1.9
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ export const BaseSearchBox = (props: SearchProps) => {
|
|||||||
return (content: string) => {
|
return (content: string) => {
|
||||||
if (!searchText) return true;
|
if (!searchText) return true;
|
||||||
|
|
||||||
let item = !matchCase ? content.toLowerCase() : content;
|
const item = !matchCase ? content.toLowerCase() : content;
|
||||||
let searchItem = !matchCase ? searchText.toLowerCase() : searchText;
|
const searchItem = !matchCase ? searchText.toLowerCase() : searchText;
|
||||||
|
|
||||||
if (useRegularExpression) {
|
if (useRegularExpression) {
|
||||||
return new RegExp(searchItem).test(item);
|
return new RegExp(searchItem).test(item);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const GroupItem = (props: Props) => {
|
export const GroupItem = (props: Props) => {
|
||||||
let { type, group, onDelete } = props;
|
const { type, group, onDelete } = props;
|
||||||
const sortable = type === "prepend" || type === "append";
|
const sortable = type === "prepend" || type === "append";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ export const GroupsEditorViewer = (props: Props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const fetchContent = async () => {
|
const fetchContent = async () => {
|
||||||
let data = await readProfileFile(property);
|
const data = await readProfileFile(property);
|
||||||
let obj = yaml.load(data) as ISeqProfileConfig | null;
|
const obj = yaml.load(data) as ISeqProfileConfig | null;
|
||||||
|
|
||||||
setPrependSeq(obj?.prepend || []);
|
setPrependSeq(obj?.prepend || []);
|
||||||
setAppendSeq(obj?.append || []);
|
setAppendSeq(obj?.append || []);
|
||||||
@@ -174,7 +174,7 @@ export const GroupsEditorViewer = (props: Props) => {
|
|||||||
if (currData === "") return;
|
if (currData === "") return;
|
||||||
if (visualization !== true) return;
|
if (visualization !== true) return;
|
||||||
|
|
||||||
let obj = yaml.load(currData) as {
|
const obj = yaml.load(currData) as {
|
||||||
prepend: [];
|
prepend: [];
|
||||||
append: [];
|
append: [];
|
||||||
delete: [];
|
delete: [];
|
||||||
@@ -209,21 +209,21 @@ export const GroupsEditorViewer = (props: Props) => {
|
|||||||
}, [prependSeq, appendSeq, deleteSeq]);
|
}, [prependSeq, appendSeq, deleteSeq]);
|
||||||
|
|
||||||
const fetchProxyPolicy = async () => {
|
const fetchProxyPolicy = async () => {
|
||||||
let data = await readProfileFile(profileUid);
|
const data = await readProfileFile(profileUid);
|
||||||
let proxiesData = await readProfileFile(proxiesUid);
|
const proxiesData = await readProfileFile(proxiesUid);
|
||||||
let originGroupsObj = yaml.load(data) as {
|
const originGroupsObj = yaml.load(data) as {
|
||||||
"proxy-groups": IProxyGroupConfig[];
|
"proxy-groups": IProxyGroupConfig[];
|
||||||
} | null;
|
} | null;
|
||||||
|
|
||||||
let originProxiesObj = yaml.load(data) as { proxies: [] } | null;
|
const originProxiesObj = yaml.load(data) as { proxies: [] } | null;
|
||||||
let originProxies = originProxiesObj?.proxies || [];
|
const originProxies = originProxiesObj?.proxies || [];
|
||||||
let moreProxiesObj = yaml.load(proxiesData) as ISeqProfileConfig | null;
|
const moreProxiesObj = yaml.load(proxiesData) as ISeqProfileConfig | null;
|
||||||
let morePrependProxies = moreProxiesObj?.prepend || [];
|
const morePrependProxies = moreProxiesObj?.prepend || [];
|
||||||
let moreAppendProxies = moreProxiesObj?.append || [];
|
const moreAppendProxies = moreProxiesObj?.append || [];
|
||||||
let moreDeleteProxies =
|
const moreDeleteProxies =
|
||||||
moreProxiesObj?.delete || ([] as string[] | { name: string }[]);
|
moreProxiesObj?.delete || ([] as string[] | { name: string }[]);
|
||||||
|
|
||||||
let proxies = morePrependProxies.concat(
|
const proxies = morePrependProxies.concat(
|
||||||
originProxies.filter((proxy: any) => {
|
originProxies.filter((proxy: any) => {
|
||||||
if (proxy.name) {
|
if (proxy.name) {
|
||||||
return !moreDeleteProxies.includes(proxy.name);
|
return !moreDeleteProxies.includes(proxy.name);
|
||||||
@@ -246,28 +246,30 @@ export const GroupsEditorViewer = (props: Props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
const fetchProfile = async () => {
|
const fetchProfile = async () => {
|
||||||
let data = await readProfileFile(profileUid);
|
const data = await readProfileFile(profileUid);
|
||||||
let mergeData = await readProfileFile(mergeUid);
|
const mergeData = await readProfileFile(mergeUid);
|
||||||
let globalMergeData = await readProfileFile("Merge");
|
const globalMergeData = await readProfileFile("Merge");
|
||||||
|
|
||||||
let originGroupsObj = yaml.load(data) as {
|
const originGroupsObj = yaml.load(data) as {
|
||||||
"proxy-groups": IProxyGroupConfig[];
|
"proxy-groups": IProxyGroupConfig[];
|
||||||
} | null;
|
} | null;
|
||||||
|
|
||||||
let originProviderObj = yaml.load(data) as { "proxy-providers": {} } | null;
|
const originProviderObj = yaml.load(data) as {
|
||||||
let originProvider = originProviderObj?.["proxy-providers"] || {};
|
|
||||||
|
|
||||||
let moreProviderObj = yaml.load(mergeData) as {
|
|
||||||
"proxy-providers": {};
|
"proxy-providers": {};
|
||||||
} | null;
|
} | null;
|
||||||
let moreProvider = moreProviderObj?.["proxy-providers"] || {};
|
const originProvider = originProviderObj?.["proxy-providers"] || {};
|
||||||
|
|
||||||
let globalProviderObj = yaml.load(globalMergeData) as {
|
const moreProviderObj = yaml.load(mergeData) as {
|
||||||
"proxy-providers": {};
|
"proxy-providers": {};
|
||||||
} | null;
|
} | null;
|
||||||
let globalProvider = globalProviderObj?.["proxy-providers"] || {};
|
const moreProvider = moreProviderObj?.["proxy-providers"] || {};
|
||||||
|
|
||||||
let provider = Object.assign(
|
const globalProviderObj = yaml.load(globalMergeData) as {
|
||||||
|
"proxy-providers": {};
|
||||||
|
} | null;
|
||||||
|
const globalProvider = globalProviderObj?.["proxy-providers"] || {};
|
||||||
|
|
||||||
|
const provider = Object.assign(
|
||||||
{},
|
{},
|
||||||
originProvider,
|
originProvider,
|
||||||
moreProvider,
|
moreProvider,
|
||||||
@@ -278,7 +280,7 @@ export const GroupsEditorViewer = (props: Props) => {
|
|||||||
setGroupList(originGroupsObj?.["proxy-groups"] || []);
|
setGroupList(originGroupsObj?.["proxy-groups"] || []);
|
||||||
};
|
};
|
||||||
const getInterfaceNameList = async () => {
|
const getInterfaceNameList = async () => {
|
||||||
let list = await getNetworkInterfaces();
|
const list = await getNetworkInterfaces();
|
||||||
setInterfaceNameList(list);
|
setInterfaceNameList(list);
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -293,7 +295,7 @@ export const GroupsEditorViewer = (props: Props) => {
|
|||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
const validateGroup = () => {
|
const validateGroup = () => {
|
||||||
let group = formIns.getValues();
|
const group = formIns.getValues();
|
||||||
if (group.name === "") {
|
if (group.name === "") {
|
||||||
throw new Error(t("Group Name Required"));
|
throw new Error(t("Group Name Required"));
|
||||||
}
|
}
|
||||||
@@ -794,7 +796,7 @@ export const GroupsEditorViewer = (props: Props) => {
|
|||||||
}
|
}
|
||||||
increaseViewportBy={256}
|
increaseViewportBy={256}
|
||||||
itemContent={(index) => {
|
itemContent={(index) => {
|
||||||
let shift = filteredPrependSeq.length > 0 ? 1 : 0;
|
const shift = filteredPrependSeq.length > 0 ? 1 : 0;
|
||||||
if (filteredPrependSeq.length > 0 && index === 0) {
|
if (filteredPrependSeq.length > 0 && index === 0) {
|
||||||
return (
|
return (
|
||||||
<DndContext
|
<DndContext
|
||||||
@@ -827,7 +829,7 @@ export const GroupsEditorViewer = (props: Props) => {
|
|||||||
</DndContext>
|
</DndContext>
|
||||||
);
|
);
|
||||||
} else if (index < filteredGroupList.length + shift) {
|
} else if (index < filteredGroupList.length + shift) {
|
||||||
let newIndex = index - shift;
|
const newIndex = index - shift;
|
||||||
return (
|
return (
|
||||||
<GroupItem
|
<GroupItem
|
||||||
key={`${filteredGroupList[newIndex].name}-${index}`}
|
key={`${filteredGroupList[newIndex].name}-${index}`}
|
||||||
|
|||||||
@@ -132,8 +132,8 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
};
|
};
|
||||||
// 优化:异步分片解析,避免主线程阻塞,解析完成后批量setState
|
// 优化:异步分片解析,避免主线程阻塞,解析完成后批量setState
|
||||||
const handleParseAsync = (cb: (proxies: IProxyConfig[]) => void) => {
|
const handleParseAsync = (cb: (proxies: IProxyConfig[]) => void) => {
|
||||||
let proxies: IProxyConfig[] = [];
|
const proxies: IProxyConfig[] = [];
|
||||||
let names: string[] = [];
|
const names: string[] = [];
|
||||||
let uris = "";
|
let uris = "";
|
||||||
try {
|
try {
|
||||||
uris = atob(proxyUri);
|
uris = atob(proxyUri);
|
||||||
@@ -148,7 +148,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
for (; idx < end; idx++) {
|
for (; idx < end; idx++) {
|
||||||
const uri = lines[idx];
|
const uri = lines[idx];
|
||||||
try {
|
try {
|
||||||
let proxy = parseUri(uri.trim());
|
const proxy = parseUri(uri.trim());
|
||||||
if (!names.includes(proxy.name)) {
|
if (!names.includes(proxy.name)) {
|
||||||
proxies.push(proxy);
|
proxies.push(proxy);
|
||||||
names.push(proxy.name);
|
names.push(proxy.name);
|
||||||
@@ -171,9 +171,9 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
parseBatch();
|
parseBatch();
|
||||||
};
|
};
|
||||||
const fetchProfile = async () => {
|
const fetchProfile = async () => {
|
||||||
let data = await readProfileFile(profileUid);
|
const data = await readProfileFile(profileUid);
|
||||||
|
|
||||||
let originProxiesObj = yaml.load(data) as {
|
const originProxiesObj = yaml.load(data) as {
|
||||||
proxies: IProxyConfig[];
|
proxies: IProxyConfig[];
|
||||||
} | null;
|
} | null;
|
||||||
|
|
||||||
@@ -181,8 +181,8 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchContent = async () => {
|
const fetchContent = async () => {
|
||||||
let data = await readProfileFile(property);
|
const data = await readProfileFile(property);
|
||||||
let obj = yaml.load(data) as ISeqProfileConfig | null;
|
const obj = yaml.load(data) as ISeqProfileConfig | null;
|
||||||
|
|
||||||
setPrependSeq(obj?.prepend || []);
|
setPrependSeq(obj?.prepend || []);
|
||||||
setAppendSeq(obj?.append || []);
|
setAppendSeq(obj?.append || []);
|
||||||
@@ -196,7 +196,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
if (currData === "") return;
|
if (currData === "") return;
|
||||||
if (visualization !== true) return;
|
if (visualization !== true) return;
|
||||||
|
|
||||||
let obj = yaml.load(currData) as {
|
const obj = yaml.load(currData) as {
|
||||||
prepend: [];
|
prepend: [];
|
||||||
append: [];
|
append: [];
|
||||||
delete: [];
|
delete: [];
|
||||||
@@ -342,7 +342,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
}
|
}
|
||||||
increaseViewportBy={256}
|
increaseViewportBy={256}
|
||||||
itemContent={(index) => {
|
itemContent={(index) => {
|
||||||
let shift = filteredPrependSeq.length > 0 ? 1 : 0;
|
const shift = filteredPrependSeq.length > 0 ? 1 : 0;
|
||||||
if (filteredPrependSeq.length > 0 && index === 0) {
|
if (filteredPrependSeq.length > 0 && index === 0) {
|
||||||
return (
|
return (
|
||||||
<DndContext
|
<DndContext
|
||||||
@@ -375,7 +375,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
|||||||
</DndContext>
|
</DndContext>
|
||||||
);
|
);
|
||||||
} else if (index < filteredProxyList.length + shift) {
|
} else if (index < filteredProxyList.length + shift) {
|
||||||
let newIndex = index - shift;
|
const newIndex = index - shift;
|
||||||
return (
|
return (
|
||||||
<ProxyItem
|
<ProxyItem
|
||||||
key={`${filteredProxyList[newIndex].name}-${index}`}
|
key={`${filteredProxyList[newIndex].name}-${index}`}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ProxyItem = (props: Props) => {
|
export const ProxyItem = (props: Props) => {
|
||||||
let { type, proxy, onDelete } = props;
|
const { type, proxy, onDelete } = props;
|
||||||
const sortable = type === "prepend" || type === "append";
|
const sortable = type === "prepend" || type === "append";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const RuleItem = (props: Props) => {
|
export const RuleItem = (props: Props) => {
|
||||||
let { type, ruleRaw, onDelete } = props;
|
const { type, ruleRaw, onDelete } = props;
|
||||||
const sortable = type === "prepend" || type === "append";
|
const sortable = type === "prepend" || type === "append";
|
||||||
const rule = ruleRaw.replace(",no-resolve", "");
|
const rule = ruleRaw.replace(",no-resolve", "");
|
||||||
|
|
||||||
|
|||||||
@@ -287,8 +287,8 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
const { active, over } = event;
|
const { active, over } = event;
|
||||||
if (over) {
|
if (over) {
|
||||||
if (active.id !== over.id) {
|
if (active.id !== over.id) {
|
||||||
let activeIndex = prependSeq.indexOf(active.id.toString());
|
const activeIndex = prependSeq.indexOf(active.id.toString());
|
||||||
let overIndex = prependSeq.indexOf(over.id.toString());
|
const overIndex = prependSeq.indexOf(over.id.toString());
|
||||||
setPrependSeq(reorder(prependSeq, activeIndex, overIndex));
|
setPrependSeq(reorder(prependSeq, activeIndex, overIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,15 +297,15 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
const { active, over } = event;
|
const { active, over } = event;
|
||||||
if (over) {
|
if (over) {
|
||||||
if (active.id !== over.id) {
|
if (active.id !== over.id) {
|
||||||
let activeIndex = appendSeq.indexOf(active.id.toString());
|
const activeIndex = appendSeq.indexOf(active.id.toString());
|
||||||
let overIndex = appendSeq.indexOf(over.id.toString());
|
const overIndex = appendSeq.indexOf(over.id.toString());
|
||||||
setAppendSeq(reorder(appendSeq, activeIndex, overIndex));
|
setAppendSeq(reorder(appendSeq, activeIndex, overIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const fetchContent = async () => {
|
const fetchContent = async () => {
|
||||||
let data = await readProfileFile(property);
|
const data = await readProfileFile(property);
|
||||||
let obj = yaml.load(data) as ISeqProfileConfig | null;
|
const obj = yaml.load(data) as ISeqProfileConfig | null;
|
||||||
|
|
||||||
setPrependSeq(obj?.prepend || []);
|
setPrependSeq(obj?.prepend || []);
|
||||||
setAppendSeq(obj?.append || []);
|
setAppendSeq(obj?.append || []);
|
||||||
@@ -319,7 +319,7 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
if (currData === "") return;
|
if (currData === "") return;
|
||||||
if (visualization !== true) return;
|
if (visualization !== true) return;
|
||||||
|
|
||||||
let obj = yaml.load(currData) as ISeqProfileConfig | null;
|
const obj = yaml.load(currData) as ISeqProfileConfig | null;
|
||||||
setPrependSeq(obj?.prepend || []);
|
setPrependSeq(obj?.prepend || []);
|
||||||
setAppendSeq(obj?.append || []);
|
setAppendSeq(obj?.append || []);
|
||||||
setDeleteSeq(obj?.delete || []);
|
setDeleteSeq(obj?.delete || []);
|
||||||
@@ -349,21 +349,21 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
}, [prependSeq, appendSeq, deleteSeq]);
|
}, [prependSeq, appendSeq, deleteSeq]);
|
||||||
|
|
||||||
const fetchProfile = async () => {
|
const fetchProfile = async () => {
|
||||||
let data = await readProfileFile(profileUid); // 原配置文件
|
const data = await readProfileFile(profileUid); // 原配置文件
|
||||||
let groupsData = await readProfileFile(groupsUid); // groups配置文件
|
const groupsData = await readProfileFile(groupsUid); // groups配置文件
|
||||||
let mergeData = await readProfileFile(mergeUid); // merge配置文件
|
const mergeData = await readProfileFile(mergeUid); // merge配置文件
|
||||||
let globalMergeData = await readProfileFile("Merge"); // global merge配置文件
|
const globalMergeData = await readProfileFile("Merge"); // global merge配置文件
|
||||||
|
|
||||||
let rulesObj = yaml.load(data) as { rules: [] } | null;
|
const rulesObj = yaml.load(data) as { rules: [] } | null;
|
||||||
|
|
||||||
let originGroupsObj = yaml.load(data) as { "proxy-groups": [] } | null;
|
const originGroupsObj = yaml.load(data) as { "proxy-groups": [] } | null;
|
||||||
let originGroups = originGroupsObj?.["proxy-groups"] || [];
|
const originGroups = originGroupsObj?.["proxy-groups"] || [];
|
||||||
let moreGroupsObj = yaml.load(groupsData) as ISeqProfileConfig | null;
|
const moreGroupsObj = yaml.load(groupsData) as ISeqProfileConfig | null;
|
||||||
let morePrependGroups = moreGroupsObj?.["prepend"] || [];
|
const morePrependGroups = moreGroupsObj?.["prepend"] || [];
|
||||||
let moreAppendGroups = moreGroupsObj?.["append"] || [];
|
const moreAppendGroups = moreGroupsObj?.["append"] || [];
|
||||||
let moreDeleteGroups =
|
const moreDeleteGroups =
|
||||||
moreGroupsObj?.["delete"] || ([] as string[] | { name: string }[]);
|
moreGroupsObj?.["delete"] || ([] as string[] | { name: string }[]);
|
||||||
let groups = morePrependGroups.concat(
|
const groups = morePrependGroups.concat(
|
||||||
originGroups.filter((group: any) => {
|
originGroups.filter((group: any) => {
|
||||||
if (group.name) {
|
if (group.name) {
|
||||||
return !moreDeleteGroups.includes(group.name);
|
return !moreDeleteGroups.includes(group.name);
|
||||||
@@ -374,27 +374,37 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
moreAppendGroups,
|
moreAppendGroups,
|
||||||
);
|
);
|
||||||
|
|
||||||
let originRuleSetObj = yaml.load(data) as { "rule-providers": {} } | null;
|
const originRuleSetObj = yaml.load(data) as { "rule-providers": {} } | null;
|
||||||
let originRuleSet = originRuleSetObj?.["rule-providers"] || {};
|
const originRuleSet = originRuleSetObj?.["rule-providers"] || {};
|
||||||
let moreRuleSetObj = yaml.load(mergeData) as {
|
const moreRuleSetObj = yaml.load(mergeData) as {
|
||||||
"rule-providers": {};
|
"rule-providers": {};
|
||||||
} | null;
|
} | null;
|
||||||
let moreRuleSet = moreRuleSetObj?.["rule-providers"] || {};
|
const moreRuleSet = moreRuleSetObj?.["rule-providers"] || {};
|
||||||
let globalRuleSetObj = yaml.load(globalMergeData) as {
|
const globalRuleSetObj = yaml.load(globalMergeData) as {
|
||||||
"rule-providers": {};
|
"rule-providers": {};
|
||||||
} | null;
|
} | null;
|
||||||
let globalRuleSet = globalRuleSetObj?.["rule-providers"] || {};
|
const globalRuleSet = globalRuleSetObj?.["rule-providers"] || {};
|
||||||
let ruleSet = Object.assign({}, originRuleSet, moreRuleSet, globalRuleSet);
|
const ruleSet = Object.assign(
|
||||||
|
{},
|
||||||
|
originRuleSet,
|
||||||
|
moreRuleSet,
|
||||||
|
globalRuleSet,
|
||||||
|
);
|
||||||
|
|
||||||
let originSubRuleObj = yaml.load(data) as { "sub-rules": {} } | null;
|
const originSubRuleObj = yaml.load(data) as { "sub-rules": {} } | null;
|
||||||
let originSubRule = originSubRuleObj?.["sub-rules"] || {};
|
const originSubRule = originSubRuleObj?.["sub-rules"] || {};
|
||||||
let moreSubRuleObj = yaml.load(mergeData) as { "sub-rules": {} } | null;
|
const moreSubRuleObj = yaml.load(mergeData) as { "sub-rules": {} } | null;
|
||||||
let moreSubRule = moreSubRuleObj?.["sub-rules"] || {};
|
const moreSubRule = moreSubRuleObj?.["sub-rules"] || {};
|
||||||
let globalSubRuleObj = yaml.load(globalMergeData) as {
|
const globalSubRuleObj = yaml.load(globalMergeData) as {
|
||||||
"sub-rules": {};
|
"sub-rules": {};
|
||||||
} | null;
|
} | null;
|
||||||
let globalSubRule = globalSubRuleObj?.["sub-rules"] || {};
|
const globalSubRule = globalSubRuleObj?.["sub-rules"] || {};
|
||||||
let subRule = Object.assign({}, originSubRule, moreSubRule, globalSubRule);
|
const subRule = Object.assign(
|
||||||
|
{},
|
||||||
|
originSubRule,
|
||||||
|
moreSubRule,
|
||||||
|
globalSubRule,
|
||||||
|
);
|
||||||
setProxyPolicyList(
|
setProxyPolicyList(
|
||||||
builtinProxyPolicies.concat(groups.map((group: any) => group.name)),
|
builtinProxyPolicies.concat(groups.map((group: any) => group.name)),
|
||||||
);
|
);
|
||||||
@@ -554,7 +564,7 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
startIcon={<VerticalAlignTopRounded />}
|
startIcon={<VerticalAlignTopRounded />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
try {
|
try {
|
||||||
let raw = validateRule();
|
const raw = validateRule();
|
||||||
if (prependSeq.includes(raw)) return;
|
if (prependSeq.includes(raw)) return;
|
||||||
setPrependSeq([raw, ...prependSeq]);
|
setPrependSeq([raw, ...prependSeq]);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
@@ -572,7 +582,7 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
startIcon={<VerticalAlignBottomRounded />}
|
startIcon={<VerticalAlignBottomRounded />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
try {
|
try {
|
||||||
let raw = validateRule();
|
const raw = validateRule();
|
||||||
if (appendSeq.includes(raw)) return;
|
if (appendSeq.includes(raw)) return;
|
||||||
setAppendSeq([...appendSeq, raw]);
|
setAppendSeq([...appendSeq, raw]);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
@@ -601,7 +611,7 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
}
|
}
|
||||||
increaseViewportBy={256}
|
increaseViewportBy={256}
|
||||||
itemContent={(index) => {
|
itemContent={(index) => {
|
||||||
let shift = filteredPrependSeq.length > 0 ? 1 : 0;
|
const shift = filteredPrependSeq.length > 0 ? 1 : 0;
|
||||||
if (filteredPrependSeq.length > 0 && index === 0) {
|
if (filteredPrependSeq.length > 0 && index === 0) {
|
||||||
return (
|
return (
|
||||||
<DndContext
|
<DndContext
|
||||||
@@ -632,7 +642,7 @@ export const RulesEditorViewer = (props: Props) => {
|
|||||||
</DndContext>
|
</DndContext>
|
||||||
);
|
);
|
||||||
} else if (index < filteredRuleList.length + shift) {
|
} else if (index < filteredRuleList.length + shift) {
|
||||||
let newIndex = index - shift;
|
const newIndex = index - shift;
|
||||||
return (
|
return (
|
||||||
<RuleItem
|
<RuleItem
|
||||||
key={`${filteredRuleList[newIndex]}-${index}`}
|
key={`${filteredRuleList[newIndex]}-${index}`}
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ export const DnsViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
const formatHosts = (hosts: any): string => {
|
const formatHosts = (hosts: any): string => {
|
||||||
if (!hosts || typeof hosts !== "object") return "";
|
if (!hosts || typeof hosts !== "object") return "";
|
||||||
|
|
||||||
let result: string[] = [];
|
const result: string[] = [];
|
||||||
|
|
||||||
Object.entries(hosts).forEach(([domain, value]) => {
|
Object.entries(hosts).forEach(([domain, value]) => {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
|
|
||||||
const onSave = useLockFn(async () => {
|
const onSave = useLockFn(async () => {
|
||||||
try {
|
try {
|
||||||
let tun = {
|
const tun = {
|
||||||
stack: values.stack,
|
stack: values.stack,
|
||||||
device:
|
device:
|
||||||
values.device === ""
|
values.device === ""
|
||||||
@@ -97,7 +97,7 @@ export const TunViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
let tun = {
|
const tun = {
|
||||||
stack: "gvisor",
|
stack: "gvisor",
|
||||||
device: OS === "macos" ? "utun1024" : "Mihomo",
|
device: OS === "macos" ? "utun1024" : "Mihomo",
|
||||||
"auto-route": true,
|
"auto-route": true,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import { useLocalStorage } from "foxact/use-local-storage";
|
|||||||
import { LogLevel } from "@/hooks/use-log-data";
|
import { LogLevel } from "@/hooks/use-log-data";
|
||||||
|
|
||||||
const appWindow = getCurrentWebviewWindow();
|
const appWindow = getCurrentWebviewWindow();
|
||||||
export let portableFlag = false;
|
export const portableFlag = false;
|
||||||
|
|
||||||
dayjs.extend(relativeTime);
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ const ProfilePage = () => {
|
|||||||
async (event: any) => {
|
async (event: any) => {
|
||||||
const paths = event.payload.paths;
|
const paths = event.payload.paths;
|
||||||
|
|
||||||
for (let file of paths) {
|
for (const file of paths) {
|
||||||
if (!file.endsWith(".yaml") && !file.endsWith(".yml")) {
|
if (!file.endsWith(".yaml") && !file.endsWith(".yml")) {
|
||||||
showNotice("error", t("Only YAML Files Supported"));
|
showNotice("error", t("Only YAML Files Supported"));
|
||||||
continue;
|
continue;
|
||||||
@@ -181,7 +181,7 @@ const ProfilePage = () => {
|
|||||||
self_proxy: false,
|
self_proxy: false,
|
||||||
},
|
},
|
||||||
} as IProfileItem;
|
} as IProfileItem;
|
||||||
let data = await readTextFile(file);
|
const data = await readTextFile(file);
|
||||||
await createProfile(item, data);
|
await createProfile(item, data);
|
||||||
await mutateProfiles();
|
await mutateProfiles();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,12 +101,12 @@ const TestPage = () => {
|
|||||||
const { active, over } = event;
|
const { active, over } = event;
|
||||||
if (over) {
|
if (over) {
|
||||||
if (active.id !== over.id) {
|
if (active.id !== over.id) {
|
||||||
let old_index = testList.findIndex((x) => x.uid === active.id);
|
const old_index = testList.findIndex((x) => x.uid === active.id);
|
||||||
let new_index = testList.findIndex((x) => x.uid === over.id);
|
const new_index = testList.findIndex((x) => x.uid === over.id);
|
||||||
if (old_index < 0 || new_index < 0) {
|
if (old_index < 0 || new_index < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let newList = reorder(testList, old_index, new_index);
|
const newList = reorder(testList, old_index, new_index);
|
||||||
await mutateVerge({ ...verge, test_list: newList }, false);
|
await mutateVerge({ ...verge, test_list: newList }, false);
|
||||||
await patchVerge({ test_list: newList });
|
await patchVerge({ test_list: newList });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,20 +217,19 @@ export async function getProxies(): Promise<{
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (global?.all) {
|
if (global?.all) {
|
||||||
let globalGroups: IProxyGroupItem[] = global.all.reduce<IProxyGroupItem[]>(
|
const globalGroups: IProxyGroupItem[] = global.all.reduce<
|
||||||
(acc, name) => {
|
IProxyGroupItem[]
|
||||||
if (proxyRecord[name]?.all) {
|
>((acc, name) => {
|
||||||
acc.push({
|
if (proxyRecord[name]?.all) {
|
||||||
...proxyRecord[name],
|
acc.push({
|
||||||
all: proxyRecord[name].all!.map((item) => generateItem(item)),
|
...proxyRecord[name],
|
||||||
});
|
all: proxyRecord[name].all!.map((item) => generateItem(item)),
|
||||||
}
|
});
|
||||||
return acc;
|
}
|
||||||
},
|
return acc;
|
||||||
[],
|
}, []);
|
||||||
);
|
|
||||||
|
|
||||||
let globalNames = new Set(globalGroups.map((each) => each.name));
|
const globalNames = new Set(globalGroups.map((each) => each.name));
|
||||||
groups = groups
|
groups = groups
|
||||||
.filter((group) => {
|
.filter((group) => {
|
||||||
return !globalNames.has(group.name);
|
return !globalNames.has(group.name);
|
||||||
@@ -674,7 +673,7 @@ export async function saveWebdavConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function listWebDavBackup() {
|
export async function listWebDavBackup() {
|
||||||
let list: IWebDavFile[] = await invoke<IWebDavFile[]>("list_webdav_backup");
|
const list: IWebDavFile[] = await invoke<IWebDavFile[]>("list_webdav_backup");
|
||||||
list.map((item) => {
|
list.map((item) => {
|
||||||
item.filename = item.href.split("/").pop() as string;
|
item.filename = item.href.split("/").pop() as string;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ function URI_SS(line: string): IProxyShadowsocksConfig {
|
|||||||
if (query) {
|
if (query) {
|
||||||
if (/(&|\?)v2ray-plugin=/.test(query)) {
|
if (/(&|\?)v2ray-plugin=/.test(query)) {
|
||||||
const parsed = query.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/);
|
const parsed = query.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/);
|
||||||
let v2rayPlugin = parsed![2];
|
const v2rayPlugin = parsed![2];
|
||||||
if (v2rayPlugin) {
|
if (v2rayPlugin) {
|
||||||
proxy.plugin = "v2ray-plugin";
|
proxy.plugin = "v2ray-plugin";
|
||||||
proxy["plugin-opts"] = JSON.parse(
|
proxy["plugin-opts"] = JSON.parse(
|
||||||
@@ -251,7 +251,7 @@ function URI_SSR(line: string): IProxyshadowsocksRConfig {
|
|||||||
serverAndPort.substring(serverAndPort.lastIndexOf(":") + 1),
|
serverAndPort.substring(serverAndPort.lastIndexOf(":") + 1),
|
||||||
);
|
);
|
||||||
|
|
||||||
let params = line
|
const params = line
|
||||||
.substring(splitIdx + 1)
|
.substring(splitIdx + 1)
|
||||||
.split("/?")[0]
|
.split("/?")[0]
|
||||||
.split(":");
|
.split(":");
|
||||||
@@ -354,7 +354,7 @@ function URI_VMESS(line: string): IProxyVmessConfig {
|
|||||||
);
|
);
|
||||||
const match = /(^[^?]+?)\/?\?(.*)$/.exec(line);
|
const match = /(^[^?]+?)\/?\?(.*)$/.exec(line);
|
||||||
if (match) {
|
if (match) {
|
||||||
let [_, base64Line, qs] = match;
|
const [_, base64Line, qs] = match;
|
||||||
content = decodeBase64OrOriginal(base64Line);
|
content = decodeBase64OrOriginal(base64Line);
|
||||||
|
|
||||||
for (const addon of qs.split("&")) {
|
for (const addon of qs.split("&")) {
|
||||||
@@ -370,7 +370,7 @@ function URI_VMESS(line: string): IProxyVmessConfig {
|
|||||||
const contentMatch = /(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(content);
|
const contentMatch = /(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(content);
|
||||||
|
|
||||||
if (contentMatch) {
|
if (contentMatch) {
|
||||||
let [__, cipher, uuid, server, port] = contentMatch;
|
const [__, cipher, uuid, server, port] = contentMatch;
|
||||||
|
|
||||||
params.scy = cipher;
|
params.scy = cipher;
|
||||||
params.id = uuid;
|
params.id = uuid;
|
||||||
@@ -501,7 +501,7 @@ function URI_VLESS(line: string): IProxyVlessConfig {
|
|||||||
let isShadowrocket;
|
let isShadowrocket;
|
||||||
let parsed = /^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(line)!;
|
let parsed = /^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(line)!;
|
||||||
if (!parsed) {
|
if (!parsed) {
|
||||||
let [_, base64, other] = /^(.*?)(\?.*?$)/.exec(line)!;
|
const [_, base64, other] = /^(.*?)(\?.*?$)/.exec(line)!;
|
||||||
line = `${atob(base64)}${other}`;
|
line = `${atob(base64)}${other}`;
|
||||||
parsed = /^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(line)!;
|
parsed = /^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(line)!;
|
||||||
isShadowrocket = true;
|
isShadowrocket = true;
|
||||||
@@ -636,7 +636,7 @@ function URI_VLESS(line: string): IProxyVlessConfig {
|
|||||||
if (proxy.network === "ws") {
|
if (proxy.network === "ws") {
|
||||||
proxy.servername = proxy["ws-opts"]?.headers?.Host;
|
proxy.servername = proxy["ws-opts"]?.headers?.Host;
|
||||||
} else if (proxy.network === "http") {
|
} else if (proxy.network === "http") {
|
||||||
let httpHost = proxy["http-opts"]?.headers?.Host;
|
const httpHost = proxy["http-opts"]?.headers?.Host;
|
||||||
proxy.servername = Array.isArray(httpHost) ? httpHost[0] : httpHost;
|
proxy.servername = Array.isArray(httpHost) ? httpHost[0] : httpHost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -655,7 +655,7 @@ function URI_Trojan(line: string): IProxyTrojanConfig {
|
|||||||
|
|
||||||
password = decodeURIComponent(password);
|
password = decodeURIComponent(password);
|
||||||
|
|
||||||
let decodedName = trimStr(decodeURIComponent(name));
|
const decodedName = trimStr(decodeURIComponent(name));
|
||||||
|
|
||||||
name = decodedName ?? `Trojan ${server}:${portNum}`;
|
name = decodedName ?? `Trojan ${server}:${portNum}`;
|
||||||
const proxy: IProxyTrojanConfig = {
|
const proxy: IProxyTrojanConfig = {
|
||||||
@@ -701,7 +701,7 @@ function URI_Trojan(line: string): IProxyTrojanConfig {
|
|||||||
proxy["fingerprint"] = value;
|
proxy["fingerprint"] = value;
|
||||||
break;
|
break;
|
||||||
case "encryption":
|
case "encryption":
|
||||||
let encryption = value.split(";");
|
const encryption = value.split(";");
|
||||||
if (encryption.length === 3) {
|
if (encryption.length === 3) {
|
||||||
proxy["ss-opts"] = {
|
proxy["ss-opts"] = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -741,7 +741,7 @@ function URI_Hysteria2(line: string): IProxyHysteria2Config {
|
|||||||
}
|
}
|
||||||
password = decodeURIComponent(password);
|
password = decodeURIComponent(password);
|
||||||
|
|
||||||
let decodedName = trimStr(decodeURIComponent(name));
|
const decodedName = trimStr(decodeURIComponent(name));
|
||||||
|
|
||||||
name = decodedName ?? `Hysteria2 ${server}:${port}`;
|
name = decodedName ?? `Hysteria2 ${server}:${port}`;
|
||||||
|
|
||||||
@@ -786,7 +786,7 @@ function URI_Hysteria(line: string): IProxyHysteriaConfig {
|
|||||||
if (isNaN(portNum)) {
|
if (isNaN(portNum)) {
|
||||||
portNum = 443;
|
portNum = 443;
|
||||||
}
|
}
|
||||||
let decodedName = trimStr(decodeURIComponent(name));
|
const decodedName = trimStr(decodeURIComponent(name));
|
||||||
|
|
||||||
name = decodedName ?? `Hysteria ${server}:${port}`;
|
name = decodedName ?? `Hysteria ${server}:${port}`;
|
||||||
|
|
||||||
@@ -884,7 +884,7 @@ function URI_TUIC(line: string): IProxyTuicConfig {
|
|||||||
portNum = 443;
|
portNum = 443;
|
||||||
}
|
}
|
||||||
password = decodeURIComponent(password);
|
password = decodeURIComponent(password);
|
||||||
let decodedName = trimStr(decodeURIComponent(name));
|
const decodedName = trimStr(decodeURIComponent(name));
|
||||||
|
|
||||||
name = decodedName ?? `TUIC ${server}:${port}`;
|
name = decodedName ?? `TUIC ${server}:${port}`;
|
||||||
|
|
||||||
@@ -963,7 +963,7 @@ function URI_Wireguard(line: string): IProxyWireguardConfig {
|
|||||||
portNum = 443;
|
portNum = 443;
|
||||||
}
|
}
|
||||||
privateKey = decodeURIComponent(privateKey);
|
privateKey = decodeURIComponent(privateKey);
|
||||||
let decodedName = trimStr(decodeURIComponent(name));
|
const decodedName = trimStr(decodeURIComponent(name));
|
||||||
|
|
||||||
name = decodedName ?? `WireGuard ${server}:${port}`;
|
name = decodedName ?? `WireGuard ${server}:${port}`;
|
||||||
const proxy: IProxyWireguardConfig = {
|
const proxy: IProxyWireguardConfig = {
|
||||||
@@ -1047,7 +1047,7 @@ function URI_HTTP(line: string): IProxyHttpConfig {
|
|||||||
if (auth) {
|
if (auth) {
|
||||||
auth = decodeURIComponent(auth);
|
auth = decodeURIComponent(auth);
|
||||||
}
|
}
|
||||||
let decodedName = trimStr(decodeURIComponent(name));
|
const decodedName = trimStr(decodeURIComponent(name));
|
||||||
|
|
||||||
name = decodedName ?? `HTTP ${server}:${portNum}`;
|
name = decodedName ?? `HTTP ${server}:${portNum}`;
|
||||||
const proxy: IProxyHttpConfig = {
|
const proxy: IProxyHttpConfig = {
|
||||||
@@ -1111,7 +1111,7 @@ function URI_SOCKS(line: string): IProxySocks5Config {
|
|||||||
if (auth) {
|
if (auth) {
|
||||||
auth = decodeURIComponent(auth);
|
auth = decodeURIComponent(auth);
|
||||||
}
|
}
|
||||||
let decodedName = trimStr(decodeURIComponent(name));
|
const decodedName = trimStr(decodeURIComponent(name));
|
||||||
name = decodedName ?? `SOCKS5 ${server}:${portNum}`;
|
name = decodedName ?? `SOCKS5 ${server}:${portNum}`;
|
||||||
const proxy: IProxySocks5Config = {
|
const proxy: IProxySocks5Config = {
|
||||||
type: "socks5",
|
type: "socks5",
|
||||||
|
|||||||
Reference in New Issue
Block a user