🚧 代理列表开关

This commit is contained in:
刘嘉伟 2024-09-02 23:26:55 +08:00
parent 3ef47b200c
commit 1ea549323d
4 changed files with 46 additions and 2 deletions

View File

@ -66,4 +66,9 @@ export const initProxyApi = () => {
});
});
});
ipcMain.on("proxy.updateProxyStatus", async (event, args) => {
if (!args._id) return;
});
};

View File

@ -33,6 +33,8 @@ import ExportNotesOutline from "@iconify-icons/material-symbols/export-notes-out
import uploadRounded from "@iconify-icons/material-symbols/upload-rounded";
import downloadRounded from "@iconify-icons/material-symbols/download-rounded";
import deviceReset from "@iconify-icons/material-symbols/device-reset";
import switchAccessOutlineRounded from "@iconify-icons/material-symbols/switch-access-outline-rounded";
import switchAccessRounded from "@iconify-icons/material-symbols/switch-access-rounded";
addIcon("cloud", Cloud);
addIcon("rocket-launch-rounded", RocketLaunchRounded);
@ -61,5 +63,7 @@ addIcon("export", ExportNotesOutline);
addIcon("uploadRounded", uploadRounded);
addIcon("downloadRounded", downloadRounded);
addIcon("deviceReset", deviceReset);
addIcon("switchAccessOutlineRounded", switchAccessOutlineRounded);
addIcon("switchAccessRounded", switchAccessRounded);

View File

@ -219,6 +219,11 @@ const handleInitHook = () => {
loading.value.list--;
const { err, data } = args;
if (!err) {
data.forEach(f => {
if (f.status === null || f.status === undefined) {
f.status = true;
}
});
proxys.value = data;
}
});
@ -248,6 +253,10 @@ const handleOpenUpdate = (proxy: Proxy) => {
};
};
const handleReversalUpdate = (proxy: Proxy) => {
proxy.status = !proxy.status;
};
const handleLoadLocalPorts = () => {
loading.value.localPorts = 1;
ipcRenderer.send("local.getLocalPorts");
@ -327,7 +336,16 @@ onUnmounted(() => {
<span class="text-white text-sm">{{ proxy.type }}</span>
</div>
<div class="h-12 relative">
<div class="text-sm font-bold">{{ proxy.name }}</div>
<div class="text-sm font-bold">
<span>{{ proxy.name }}</span>
</div>
<el-tag
v-if="!proxy.status"
class="mr-2"
type="danger"
size="small"
>已禁用
</el-tag>
<el-tag
v-if="
proxy.type === 'stcp' && proxy.stcpModel === 'visitors'
@ -352,7 +370,7 @@ onUnmounted(() => {
<!-- </el-tag>-->
</div>
</div>
<div>
<div class="flex items-start">
<el-dropdown size="small">
<a
href="javascript:void(0)"
@ -369,6 +387,22 @@ onUnmounted(() => {
/>
<span class="ml-1"> </span>
</el-dropdown-item>
<el-dropdown-item @click="handleReversalUpdate(proxy)">
<IconifyIconOffline
:icon="
proxy.status
? 'switchAccessOutlineRounded'
: 'switchAccessRounded'
"
class="primary-text text-[14px]"
:class="
proxy.status ? 'text-red-500' : 'text-green-500'
"
/>
<span class="ml-1">
{{ proxy.status ? "禁 用" : "启 用" }}
</span>
</el-dropdown-item>
<el-dropdown-item @click="handleDeleteProxy(proxy)">
<IconifyIconOffline
icon="delete-rounded"

1
types/global.d.ts vendored
View File

@ -26,6 +26,7 @@ declare global {
secretKey: string;
bindAddr: string;
bindPort: number;
status: boolean
};
/**