mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat: update profile supports noproxy
This commit is contained in:
@@ -59,12 +59,12 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
const progress = Math.round(((download + upload) * 100) / (total + 0.1));
|
||||
const fromnow = updated > 0 ? dayjs(updated * 1000).fromNow() : "";
|
||||
|
||||
const onUpdate = async () => {
|
||||
const onUpdateWrapper = (withProxy: boolean) => async () => {
|
||||
setAnchorEl(null);
|
||||
if (loading) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
await updateProfile(index);
|
||||
await updateProfile(index, withProxy);
|
||||
mutate("getProfiles");
|
||||
} catch (err: any) {
|
||||
Notice.error(err.toString());
|
||||
@@ -151,7 +151,7 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
disabled={loading}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onUpdate();
|
||||
onUpdateWrapper(false)();
|
||||
}}
|
||||
>
|
||||
<RefreshRounded />
|
||||
@@ -202,7 +202,8 @@ const ProfileItem: React.FC<Props> = (props) => {
|
||||
anchorPosition={position}
|
||||
anchorReference="anchorPosition"
|
||||
>
|
||||
<MenuItem onClick={onUpdate}>Update</MenuItem>
|
||||
<MenuItem onClick={onUpdateWrapper(false)}>Update</MenuItem>
|
||||
<MenuItem onClick={onUpdateWrapper(true)}>Update(Proxy)</MenuItem>
|
||||
<MenuItem onClick={onDelete}>Delete</MenuItem>
|
||||
</Menu>
|
||||
</>
|
||||
|
||||
@@ -10,11 +10,11 @@ export async function syncProfiles() {
|
||||
}
|
||||
|
||||
export async function importProfile(url: string) {
|
||||
return invoke<void>("import_profile", { url });
|
||||
return invoke<void>("import_profile", { url, withProxy: true });
|
||||
}
|
||||
|
||||
export async function updateProfile(index: number) {
|
||||
return invoke<void>("update_profile", { index });
|
||||
export async function updateProfile(index: number, withProxy: boolean) {
|
||||
return invoke<void>("update_profile", { index, withProxy });
|
||||
}
|
||||
|
||||
export async function deleteProfile(index: number) {
|
||||
|
||||
Reference in New Issue
Block a user