mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 01:33:45 +08:00
chore: decode base64
This commit is contained in:
parent
97629c1fc3
commit
22f7f059ce
@ -127,7 +127,31 @@ export const ProxiesEditorViewer = (props: Props) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleParse = () => {
|
||||
let proxies = [] as IProxyConfig[];
|
||||
let names: string[] = [];
|
||||
let uris = "";
|
||||
try {
|
||||
uris = atob(proxyUri);
|
||||
} catch {
|
||||
uris = proxyUri;
|
||||
}
|
||||
uris
|
||||
.trim()
|
||||
.split("\n")
|
||||
.forEach((uri) => {
|
||||
try {
|
||||
let proxy = parseUri(uri.trim());
|
||||
if (!names.includes(proxy.name)) {
|
||||
proxies.push(proxy);
|
||||
names.push(proxy.name);
|
||||
}
|
||||
} catch (err: any) {
|
||||
Notice.error(err.message || err.toString());
|
||||
}
|
||||
});
|
||||
return proxies;
|
||||
};
|
||||
const fetchProfile = async () => {
|
||||
let data = await readProfileFile(profileUid);
|
||||
|
||||
@ -247,18 +271,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
||||
fullWidth
|
||||
variant="contained"
|
||||
onClick={() => {
|
||||
let proxies = [] as IProxyConfig[];
|
||||
proxyUri
|
||||
.trim()
|
||||
.split("\n")
|
||||
.forEach((uri) => {
|
||||
try {
|
||||
let proxy = parseUri(uri.trim());
|
||||
proxies.push(proxy);
|
||||
} catch (err: any) {
|
||||
Notice.error(err.message || err.toString());
|
||||
}
|
||||
});
|
||||
let proxies = handleParse();
|
||||
setPrependSeq([...prependSeq, ...proxies]);
|
||||
}}
|
||||
>
|
||||
@ -270,18 +283,7 @@ export const ProxiesEditorViewer = (props: Props) => {
|
||||
fullWidth
|
||||
variant="contained"
|
||||
onClick={() => {
|
||||
let proxies = [] as IProxyConfig[];
|
||||
proxyUri
|
||||
.trim()
|
||||
.split("\n")
|
||||
.forEach((uri) => {
|
||||
try {
|
||||
let proxy = parseUri(uri.trim());
|
||||
proxies.push(proxy);
|
||||
} catch (err: any) {
|
||||
Notice.error(err.message || err.toString());
|
||||
}
|
||||
});
|
||||
let proxies = handleParse();
|
||||
setAppendSeq([...appendSeq, ...proxies]);
|
||||
}}
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user