2023-11-27 15:03:25 +08:00
|
|
|
|
<script lang="ts" setup>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
import { defineComponent, onMounted, onUnmounted, reactive, ref } from "vue";
|
|
|
|
|
import { ipcRenderer } from "electron";
|
|
|
|
|
import { ElMessage, ElMessageBox, FormInstance, FormRules } from "element-plus";
|
2023-11-27 15:03:25 +08:00
|
|
|
|
import Breadcrumb from "@/layout/compoenets/Breadcrumb.vue";
|
2024-08-16 23:59:40 +08:00
|
|
|
|
import { useDebounceFn } from "@vueuse/core";
|
|
|
|
|
import { clone } from "@/utils/clone";
|
|
|
|
|
import { Base64 } from "js-base64";
|
2024-08-21 22:31:12 +08:00
|
|
|
|
import IconifyIconOffline from "@/components/IconifyIcon/src/iconifyIconOffline";
|
2024-08-24 14:04:03 +08:00
|
|
|
|
import confetti from "canvas-confetti/src/confetti.js";
|
2024-09-04 13:08:16 +08:00
|
|
|
|
|
2023-11-27 15:03:25 +08:00
|
|
|
|
defineComponent({
|
|
|
|
|
name: "Config"
|
|
|
|
|
});
|
|
|
|
|
|
2024-08-16 23:59:40 +08:00
|
|
|
|
type ShareLinkConfig = {
|
2023-11-27 15:03:25 +08:00
|
|
|
|
serverAddr: string;
|
|
|
|
|
serverPort: number;
|
|
|
|
|
authMethod: string;
|
|
|
|
|
authToken: string;
|
2024-08-11 14:59:23 +08:00
|
|
|
|
transportHeartbeatInterval: number;
|
|
|
|
|
transportHeartbeatTimeout: number;
|
2024-08-16 23:59:40 +08:00
|
|
|
|
user: string;
|
|
|
|
|
metaToken: string;
|
2023-11-27 15:03:25 +08:00
|
|
|
|
};
|
|
|
|
|
|
2024-08-16 23:59:40 +08:00
|
|
|
|
const defaultFormData = ref<FrpConfig>({
|
2024-08-17 17:22:46 +08:00
|
|
|
|
currentVersion: -1,
|
2023-11-27 15:03:25 +08:00
|
|
|
|
serverAddr: "",
|
|
|
|
|
serverPort: 7000,
|
|
|
|
|
authMethod: "",
|
2023-11-28 17:49:08 +08:00
|
|
|
|
authToken: "",
|
|
|
|
|
logLevel: "info",
|
2023-12-01 14:16:53 +08:00
|
|
|
|
logMaxDays: 3,
|
|
|
|
|
tlsConfigEnable: false,
|
|
|
|
|
tlsConfigCertFile: "",
|
|
|
|
|
tlsConfigKeyFile: "",
|
|
|
|
|
tlsConfigTrustedCaFile: "",
|
|
|
|
|
tlsConfigServerName: "",
|
2024-01-20 11:24:59 +08:00
|
|
|
|
proxyConfigEnable: false,
|
2024-07-31 20:38:59 +08:00
|
|
|
|
proxyConfigProxyUrl: "",
|
|
|
|
|
systemSelfStart: false,
|
|
|
|
|
systemStartupConnect: false,
|
2024-10-14 11:24:54 +08:00
|
|
|
|
systemSilentStartup: false,
|
2024-07-31 20:38:59 +08:00
|
|
|
|
user: "",
|
2024-08-11 14:59:23 +08:00
|
|
|
|
metaToken: "",
|
|
|
|
|
transportHeartbeatInterval: 30,
|
2024-08-16 23:59:40 +08:00
|
|
|
|
transportHeartbeatTimeout: 90
|
2023-11-27 15:03:25 +08:00
|
|
|
|
});
|
|
|
|
|
|
2024-08-16 23:59:40 +08:00
|
|
|
|
const formData = ref<FrpConfig>(defaultFormData.value);
|
2024-08-11 14:59:23 +08:00
|
|
|
|
|
2023-11-27 15:03:25 +08:00
|
|
|
|
const loading = ref(1);
|
|
|
|
|
|
|
|
|
|
const rules = reactive<FormRules>({
|
2024-08-16 23:59:40 +08:00
|
|
|
|
currentVersion: [{ required: true, message: "请选择版本", trigger: "blur" }],
|
2023-11-27 15:03:25 +08:00
|
|
|
|
serverAddr: [
|
2024-08-16 23:59:40 +08:00
|
|
|
|
{ required: true, message: "请输入服务端地址", trigger: "blur" },
|
2023-11-27 15:03:25 +08:00
|
|
|
|
{
|
|
|
|
|
pattern: /^[\w-]+(\.[\w-]+)+$/,
|
|
|
|
|
message: "请输入正确的服务端地址",
|
|
|
|
|
trigger: "blur"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
serverPort: [
|
2024-08-16 23:59:40 +08:00
|
|
|
|
{ required: true, message: "请输入服务器端口", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
user: [{ required: true, message: "请输入用户", trigger: "blur" }],
|
|
|
|
|
metaToken: [{ required: true, message: "请输入多用户令牌", trigger: "blur" }],
|
|
|
|
|
authMethod: [{ required: true, message: "请选择验证方式", trigger: "blur" }],
|
|
|
|
|
authToken: [{ required: true, message: "请输入 Token 值 ", trigger: "blur" }],
|
|
|
|
|
logLevel: [{ required: true, message: "请选择日志级别 ", trigger: "blur" }],
|
|
|
|
|
logMaxDays: [
|
|
|
|
|
{ required: true, message: "请输入日志保留天数 ", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
tlsConfigEnable: [
|
|
|
|
|
{ required: true, message: "请选择 TLS 状态", trigger: "change" }
|
|
|
|
|
],
|
2024-09-04 13:08:16 +08:00
|
|
|
|
// tlsConfigCertFile: [
|
|
|
|
|
// { required: true, message: "请选择 TLS 证书文件", trigger: "change" }
|
|
|
|
|
// ],
|
|
|
|
|
// tlsConfigKeyFile: [
|
|
|
|
|
// { required: true, message: "请选择 TLS 密钥文件", trigger: "change" }
|
|
|
|
|
// ],
|
|
|
|
|
// tlsConfigTrustedCaFile: [
|
|
|
|
|
// { required: true, message: "请选择 CA 证书文件", trigger: "change" }
|
|
|
|
|
// ],
|
|
|
|
|
// tlsConfigServerName: [
|
|
|
|
|
// { required: true, message: "请输入 TLS Server 名称", trigger: "blur" }
|
|
|
|
|
// ],
|
2024-08-16 23:59:40 +08:00
|
|
|
|
proxyConfigEnable: [
|
|
|
|
|
{ required: true, message: "请选择代理状态", trigger: "change" }
|
2024-08-05 20:05:16 +08:00
|
|
|
|
],
|
2024-01-20 11:24:59 +08:00
|
|
|
|
proxyConfigProxyUrl: [
|
2024-08-16 23:59:40 +08:00
|
|
|
|
{ required: true, message: "请输入代理地址", trigger: "change" },
|
2024-01-20 11:24:59 +08:00
|
|
|
|
{
|
|
|
|
|
pattern: /^https?\:\/\/(\w+:\w+@)?([a-zA-Z0-9.-]+)(:\d+)?$/,
|
|
|
|
|
message: "请输入正确的代理地址",
|
|
|
|
|
trigger: "blur"
|
|
|
|
|
}
|
|
|
|
|
],
|
2024-07-31 20:38:59 +08:00
|
|
|
|
systemSelfStart: [
|
2024-08-16 23:59:40 +08:00
|
|
|
|
{ required: true, message: "请选择是否开机自启", trigger: "change" }
|
2024-08-11 14:59:23 +08:00
|
|
|
|
],
|
|
|
|
|
transportHeartbeatInterval: [
|
2024-08-16 23:59:40 +08:00
|
|
|
|
{ required: true, message: "心跳间隔时间不能为空", trigger: "change" }
|
2024-08-11 14:59:23 +08:00
|
|
|
|
],
|
|
|
|
|
transportHeartbeatTimeout: [
|
2024-08-16 23:59:40 +08:00
|
|
|
|
{ required: true, message: "心跳超时时间不能为空", trigger: "change" }
|
|
|
|
|
]
|
2023-11-27 15:03:25 +08:00
|
|
|
|
});
|
|
|
|
|
|
2024-08-16 23:59:40 +08:00
|
|
|
|
const versions = ref<Array<FrpVersion>>([]);
|
2024-08-11 14:59:23 +08:00
|
|
|
|
const copyServerConfigBase64 = ref();
|
|
|
|
|
const pasteServerConfigBase64 = ref();
|
2023-11-27 15:03:25 +08:00
|
|
|
|
|
|
|
|
|
const formRef = ref<FormInstance>();
|
2024-08-11 17:06:24 +08:00
|
|
|
|
const protocol = ref("frp://");
|
2024-08-11 14:59:23 +08:00
|
|
|
|
|
|
|
|
|
const visibles = reactive({
|
|
|
|
|
copyServerConfig: false,
|
2024-08-21 22:31:12 +08:00
|
|
|
|
pasteServerConfig: false,
|
|
|
|
|
exportConfig: false
|
2024-08-11 14:59:23 +08:00
|
|
|
|
});
|
|
|
|
|
|
2024-08-21 22:31:12 +08:00
|
|
|
|
const exportConfigType = ref("toml");
|
|
|
|
|
|
2023-11-27 15:03:25 +08:00
|
|
|
|
const handleSubmit = useDebounceFn(() => {
|
|
|
|
|
if (!formRef.value) return;
|
|
|
|
|
formRef.value.validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
loading.value = 1;
|
|
|
|
|
const data = clone(formData.value);
|
|
|
|
|
ipcRenderer.send("config.saveConfig", data);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, 300);
|
|
|
|
|
|
|
|
|
|
const handleLoadVersions = () => {
|
|
|
|
|
ipcRenderer.send("config.versions");
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-05 22:30:53 +08:00
|
|
|
|
const handleAuthMethodChange = e => {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
if (e === "multiuser") {
|
|
|
|
|
ElMessageBox.alert(
|
|
|
|
|
'多用户插件需要 Frp版本 >= <span class="font-black text-[#5A3DAA]">v0.31.0</span> 请自行选择正确版本',
|
|
|
|
|
"提示",
|
|
|
|
|
{
|
|
|
|
|
// if you want to disable its autofocus
|
|
|
|
|
autofocus: false,
|
|
|
|
|
confirmButtonText: "知道了",
|
|
|
|
|
dangerouslyUseHTMLString: true
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-08-05 22:30:53 +08:00
|
|
|
|
}
|
2024-08-16 23:59:40 +08:00
|
|
|
|
};
|
2024-08-05 22:30:53 +08:00
|
|
|
|
|
2024-08-12 23:15:18 +08:00
|
|
|
|
const checkAndResetVersion = () => {
|
|
|
|
|
const currentVersion = formData.value.currentVersion;
|
2024-08-16 23:59:40 +08:00
|
|
|
|
if (
|
|
|
|
|
currentVersion &&
|
|
|
|
|
!versions.value.some(item => item.id === currentVersion)
|
|
|
|
|
) {
|
2024-08-17 17:22:46 +08:00
|
|
|
|
formData.value.currentVersion = null;
|
2024-08-12 23:15:18 +08:00
|
|
|
|
}
|
2024-08-16 23:59:40 +08:00
|
|
|
|
};
|
2024-08-12 23:15:18 +08:00
|
|
|
|
|
2023-11-27 15:03:25 +08:00
|
|
|
|
onMounted(() => {
|
|
|
|
|
ipcRenderer.send("config.getConfig");
|
|
|
|
|
handleLoadVersions();
|
|
|
|
|
ipcRenderer.on("Config.getConfig.hook", (event, args) => {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
const { err, data } = args;
|
2023-11-27 15:03:25 +08:00
|
|
|
|
if (!err) {
|
|
|
|
|
if (data) {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
console.log("data", data);
|
2024-08-11 14:59:23 +08:00
|
|
|
|
if (!data.transportHeartbeatInterval) {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
data.transportHeartbeatInterval =
|
|
|
|
|
defaultFormData.value.transportHeartbeatInterval;
|
2024-08-11 14:59:23 +08:00
|
|
|
|
}
|
|
|
|
|
if (!data.transportHeartbeatTimeout) {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
data.transportHeartbeatTimeout =
|
|
|
|
|
defaultFormData.value.transportHeartbeatTimeout;
|
2024-08-11 14:59:23 +08:00
|
|
|
|
}
|
2023-11-27 15:03:25 +08:00
|
|
|
|
formData.value = data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
loading.value--;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ipcRenderer.on("Config.saveConfig.hook", (event, args) => {
|
|
|
|
|
ElMessage({
|
|
|
|
|
type: "success",
|
|
|
|
|
message: "保存成功"
|
|
|
|
|
});
|
|
|
|
|
loading.value--;
|
|
|
|
|
});
|
|
|
|
|
ipcRenderer.on("Config.versions.hook", (event, args) => {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
const { err, data } = args;
|
2023-11-27 15:03:25 +08:00
|
|
|
|
if (!err) {
|
|
|
|
|
versions.value = data;
|
2024-08-12 23:15:18 +08:00
|
|
|
|
checkAndResetVersion();
|
2023-11-27 15:03:25 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2024-08-21 22:31:12 +08:00
|
|
|
|
ipcRenderer.on("Config.exportConfig.hook", (event, args) => {
|
|
|
|
|
const { err, data } = args;
|
|
|
|
|
console.log(err, data, "export");
|
|
|
|
|
if (!err) {
|
|
|
|
|
const { configPath } = data;
|
|
|
|
|
ElMessageBox.alert(`配置路径:${configPath}`, `🎉 导出成功`);
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-08-22 14:19:19 +08:00
|
|
|
|
ipcRenderer.on("Config.clearAll.hook", (event, args) => {
|
2024-08-22 14:28:06 +08:00
|
|
|
|
ElMessageBox.alert("重置成功 请重启软件", `提示`, {
|
2024-08-22 14:19:19 +08:00
|
|
|
|
closeOnClickModal: false,
|
|
|
|
|
showClose: false,
|
|
|
|
|
confirmButtonText: "立即重启"
|
|
|
|
|
}).then(() => {
|
|
|
|
|
ipcRenderer.send("common.relaunch");
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
ipcRenderer.on("Config.importConfig.hook", (event, args) => {
|
|
|
|
|
const { success, data } = args;
|
|
|
|
|
if (success) {
|
2024-08-24 14:04:03 +08:00
|
|
|
|
// 礼花
|
|
|
|
|
confetti({
|
|
|
|
|
zIndex: 12002,
|
|
|
|
|
particleCount: 200,
|
|
|
|
|
spread: 70,
|
|
|
|
|
origin: { y: 0.6 }
|
|
|
|
|
});
|
|
|
|
|
ElMessageBox.alert("🎉 恭喜你,导入成功 请重启软件", `提示`, {
|
2024-08-22 14:19:19 +08:00
|
|
|
|
closeOnClickModal: false,
|
|
|
|
|
showClose: false,
|
|
|
|
|
confirmButtonText: "立即重启"
|
|
|
|
|
}).then(() => {
|
|
|
|
|
ipcRenderer.send("common.relaunch");
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2024-08-22 14:28:06 +08:00
|
|
|
|
ElMessageBox.alert(data, `提示`);
|
2024-08-22 14:19:19 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2023-11-27 15:03:25 +08:00
|
|
|
|
});
|
|
|
|
|
|
2023-12-01 14:16:53 +08:00
|
|
|
|
const handleSelectFile = (type: number, ext: string[]) => {
|
|
|
|
|
ipcRenderer.invoke("file.selectFile", ext).then(r => {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case 1:
|
2024-08-16 23:59:40 +08:00
|
|
|
|
formData.value.tlsConfigCertFile = r[0];
|
2023-12-01 14:16:53 +08:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2024-08-16 23:59:40 +08:00
|
|
|
|
formData.value.tlsConfigKeyFile = r[0];
|
2023-12-01 14:16:53 +08:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2024-08-16 23:59:40 +08:00
|
|
|
|
formData.value.tlsConfigTrustedCaFile = r[0];
|
2023-12-01 14:16:53 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-08-16 23:59:40 +08:00
|
|
|
|
console.log(r);
|
|
|
|
|
});
|
|
|
|
|
};
|
2023-12-01 14:16:53 +08:00
|
|
|
|
|
2024-08-11 14:59:23 +08:00
|
|
|
|
/**
|
|
|
|
|
* 分享配置
|
|
|
|
|
*/
|
|
|
|
|
const handleCopyServerConfig2Base64 = useDebounceFn(() => {
|
|
|
|
|
const shareConfig: ShareLinkConfig = {
|
|
|
|
|
serverAddr: formData.value.serverAddr,
|
|
|
|
|
serverPort: formData.value.serverPort,
|
|
|
|
|
authMethod: formData.value.authMethod,
|
|
|
|
|
authToken: formData.value.authToken,
|
|
|
|
|
transportHeartbeatInterval: formData.value.transportHeartbeatInterval,
|
|
|
|
|
transportHeartbeatTimeout: formData.value.transportHeartbeatTimeout,
|
|
|
|
|
user: formData.value.user,
|
2024-08-16 23:59:40 +08:00
|
|
|
|
metaToken: formData.value.metaToken
|
2024-08-11 14:59:23 +08:00
|
|
|
|
};
|
2024-08-16 23:59:40 +08:00
|
|
|
|
const base64str = Base64.encode(JSON.stringify(shareConfig));
|
2024-08-11 17:06:24 +08:00
|
|
|
|
copyServerConfigBase64.value = protocol.value + base64str;
|
2024-08-11 14:59:23 +08:00
|
|
|
|
visibles.copyServerConfig = true;
|
|
|
|
|
}, 300);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导入配置
|
|
|
|
|
*/
|
|
|
|
|
const handlePasteServerConfig4Base64 = useDebounceFn(() => {
|
|
|
|
|
visibles.pasteServerConfig = true;
|
|
|
|
|
}, 300);
|
|
|
|
|
|
|
|
|
|
const handlePasteServerConfigBase64 = useDebounceFn(() => {
|
2024-08-11 17:06:24 +08:00
|
|
|
|
const tips = () => {
|
2024-08-11 14:59:23 +08:00
|
|
|
|
ElMessage({
|
|
|
|
|
type: "warning",
|
|
|
|
|
message: "链接不正确 请输入正确的链接"
|
|
|
|
|
});
|
2024-08-16 23:59:40 +08:00
|
|
|
|
};
|
2024-08-11 17:06:24 +08:00
|
|
|
|
if (!pasteServerConfigBase64.value.startsWith(protocol.value)) {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
tips();
|
|
|
|
|
return;
|
2024-08-11 17:06:24 +08:00
|
|
|
|
}
|
2024-08-16 23:59:40 +08:00
|
|
|
|
const ciphertext = pasteServerConfigBase64.value.replace("frp://", "");
|
|
|
|
|
const plaintext = Base64.decode(ciphertext);
|
|
|
|
|
console.log("plain", plaintext);
|
2024-08-11 17:06:24 +08:00
|
|
|
|
let serverConfig: ShareLinkConfig = null;
|
|
|
|
|
try {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
serverConfig = JSON.parse(plaintext);
|
2024-08-11 17:06:24 +08:00
|
|
|
|
} catch {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
tips();
|
|
|
|
|
return;
|
2024-08-11 14:59:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!serverConfig && !serverConfig.serverAddr) {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
tips();
|
|
|
|
|
return;
|
2024-08-11 14:59:23 +08:00
|
|
|
|
}
|
|
|
|
|
if (!serverConfig && !serverConfig.serverPort) {
|
2024-08-16 23:59:40 +08:00
|
|
|
|
tips();
|
|
|
|
|
return;
|
2024-08-11 14:59:23 +08:00
|
|
|
|
}
|
2024-08-16 23:59:40 +08:00
|
|
|
|
formData.value.serverAddr = serverConfig.serverAddr;
|
|
|
|
|
formData.value.serverPort = serverConfig.serverPort;
|
|
|
|
|
formData.value.authMethod = serverConfig.authMethod;
|
|
|
|
|
formData.value.authToken = serverConfig.authToken;
|
|
|
|
|
formData.value.transportHeartbeatInterval =
|
|
|
|
|
serverConfig.transportHeartbeatInterval;
|
|
|
|
|
formData.value.transportHeartbeatTimeout =
|
|
|
|
|
serverConfig.transportHeartbeatTimeout;
|
|
|
|
|
formData.value.user = serverConfig.user;
|
|
|
|
|
formData.value.metaToken = serverConfig.metaToken;
|
2024-08-11 14:59:23 +08:00
|
|
|
|
|
|
|
|
|
handleSubmit();
|
2024-08-11 17:06:24 +08:00
|
|
|
|
pasteServerConfigBase64.value = "";
|
2024-08-11 14:59:23 +08:00
|
|
|
|
visibles.pasteServerConfig = false;
|
2024-08-16 23:59:40 +08:00
|
|
|
|
}, 300);
|
2024-08-11 14:59:23 +08:00
|
|
|
|
|
2024-08-21 22:31:12 +08:00
|
|
|
|
const handleShowExportDialog = () => {
|
|
|
|
|
visibles.exportConfig = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleExportConfig = useDebounceFn(() => {
|
|
|
|
|
ipcRenderer.send("config.exportConfig", exportConfigType.value);
|
|
|
|
|
visibles.exportConfig = false;
|
|
|
|
|
}, 300);
|
|
|
|
|
|
2024-08-22 14:19:19 +08:00
|
|
|
|
const handleImportConfig = () => {
|
|
|
|
|
ipcRenderer.send("config.importConfig");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleResetConfig = () => {
|
|
|
|
|
ElMessageBox.alert("是否清空所有配置?", "提示", {
|
|
|
|
|
showCancelButton: true,
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
confirmButtonText: "清空"
|
|
|
|
|
}).then(() => {
|
|
|
|
|
ipcRenderer.send("config.clearAll");
|
|
|
|
|
});
|
|
|
|
|
};
|
2024-08-21 22:31:12 +08:00
|
|
|
|
|
2023-11-27 15:03:25 +08:00
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
ipcRenderer.removeAllListeners("Config.getConfig.hook");
|
|
|
|
|
ipcRenderer.removeAllListeners("Config.saveConfig.hook");
|
|
|
|
|
ipcRenderer.removeAllListeners("Config.versions.hook");
|
2024-08-21 22:31:12 +08:00
|
|
|
|
ipcRenderer.removeAllListeners("Config.exportConfig.hook");
|
2024-08-22 14:19:19 +08:00
|
|
|
|
ipcRenderer.removeAllListeners("Config.clearAll.hook");
|
2023-11-27 15:03:25 +08:00
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<template>
|
2023-11-28 17:49:08 +08:00
|
|
|
|
<div class="main">
|
2024-08-21 22:31:12 +08:00
|
|
|
|
<breadcrumb>
|
2024-08-22 14:19:19 +08:00
|
|
|
|
<el-button plain type="primary" @click="handleResetConfig">
|
|
|
|
|
<IconifyIconOffline icon="deviceReset" />
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button plain type="primary" @click="handleImportConfig">
|
2024-08-21 22:31:12 +08:00
|
|
|
|
<IconifyIconOffline icon="uploadRounded" />
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button plain type="primary" @click="handleShowExportDialog">
|
|
|
|
|
<IconifyIconOffline icon="downloadRounded" />
|
|
|
|
|
</el-button>
|
2024-08-22 14:19:19 +08:00
|
|
|
|
<el-button type="primary" @click="handleSubmit">
|
|
|
|
|
<IconifyIconOffline icon="save-rounded" />
|
|
|
|
|
</el-button>
|
2024-08-21 22:31:12 +08:00
|
|
|
|
</breadcrumb>
|
2023-11-28 17:49:08 +08:00
|
|
|
|
<div class="app-container-breadcrumb pr-2" v-loading="loading > 0">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<div class="w-full bg-white p-4 rounded drop-shadow-lg">
|
2023-11-28 17:49:08 +08:00
|
|
|
|
<el-form
|
2024-08-16 23:59:40 +08:00
|
|
|
|
:model="formData"
|
|
|
|
|
:rules="rules"
|
|
|
|
|
label-position="right"
|
|
|
|
|
ref="formRef"
|
|
|
|
|
label-width="130"
|
2023-11-28 17:49:08 +08:00
|
|
|
|
>
|
|
|
|
|
<el-row :gutter="10">
|
|
|
|
|
<el-col :span="24">
|
2024-08-16 23:04:58 +08:00
|
|
|
|
<div class="h2 flex justify-between">
|
|
|
|
|
<div>版本选择</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="Frp版本:" prop="currentVersion">
|
2023-11-28 17:49:08 +08:00
|
|
|
|
<el-select
|
2024-08-16 23:59:40 +08:00
|
|
|
|
v-model="formData.currentVersion"
|
|
|
|
|
class="w-full"
|
|
|
|
|
clearable
|
2023-11-28 17:49:08 +08:00
|
|
|
|
>
|
|
|
|
|
<el-option
|
2024-08-16 23:59:40 +08:00
|
|
|
|
v-for="v in versions"
|
|
|
|
|
:key="v.id"
|
|
|
|
|
:label="v.name"
|
|
|
|
|
:value="v.id"
|
2023-11-28 17:49:08 +08:00
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
<div class="w-full flex justify-end">
|
2023-12-01 14:51:21 +08:00
|
|
|
|
<el-link type="primary" @click="handleLoadVersions">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<iconify-icon-offline class="mr-1" icon="refresh-rounded" />
|
2023-11-28 17:49:08 +08:00
|
|
|
|
手动刷新
|
2023-12-01 14:51:21 +08:00
|
|
|
|
</el-link>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-link
|
|
|
|
|
class="ml-2"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="$router.replace({ name: 'Download' })"
|
|
|
|
|
>
|
|
|
|
|
<IconifyIconOffline class="mr-1" icon="download" />
|
2023-11-28 17:49:08 +08:00
|
|
|
|
点击这里去下载
|
2023-12-01 14:51:21 +08:00
|
|
|
|
</el-link>
|
2023-11-28 17:49:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
2024-08-11 14:59:23 +08:00
|
|
|
|
<div class="h2 flex justify-between">
|
|
|
|
|
<div>服务器配置</div>
|
|
|
|
|
<div class="flex items-center justify-center">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
@click="handleCopyServerConfig2Base64"
|
|
|
|
|
class="mr-2 cursor-pointer text-xl font-bold"
|
|
|
|
|
icon="content-copy"
|
|
|
|
|
/>
|
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
@click="handlePasteServerConfig4Base64"
|
|
|
|
|
class="mr-2 cursor-pointer text-xl font-bold"
|
|
|
|
|
icon="content-paste-go"
|
|
|
|
|
/>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-11-28 17:49:08 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="服务器地址:" prop="serverAddr">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover placement="top" trigger="hover">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
Frps服务端地址 <br />
|
|
|
|
|
支持
|
|
|
|
|
<span class="font-black text-[#5A3DAA]">域名</span
|
|
|
|
|
>、<span class="font-black text-[#5A3DAA]">IP</span>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
服务器地址:
|
|
|
|
|
</template>
|
2023-11-28 17:49:08 +08:00
|
|
|
|
<el-input
|
2024-08-16 23:59:40 +08:00
|
|
|
|
v-model="formData.serverAddr"
|
|
|
|
|
placeholder="127.0.0.1"
|
2023-11-28 17:49:08 +08:00
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="服务器端口:" prop="serverPort">
|
|
|
|
|
<el-input-number
|
2024-08-16 23:59:40 +08:00
|
|
|
|
placeholder="7000"
|
|
|
|
|
v-model="formData.serverPort"
|
|
|
|
|
:min="0"
|
|
|
|
|
:max="65535"
|
|
|
|
|
controls-position="right"
|
|
|
|
|
class="!w-full"
|
2023-11-28 17:49:08 +08:00
|
|
|
|
></el-input-number>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="验证方式:" prop="authMethod">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover width="200" placement="top" trigger="hover">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>auth.method</span
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 16:23:20 +08:00
|
|
|
|
<!-- <IconifyIconOffline class="text-base" color="#5A3DAA" icon="info"/>-->
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
验证方式:
|
|
|
|
|
</template>
|
2023-11-28 17:49:08 +08:00
|
|
|
|
<el-select
|
2024-08-16 23:59:40 +08:00
|
|
|
|
v-model="formData.authMethod"
|
|
|
|
|
placeholder="请选择验证方式"
|
|
|
|
|
@change="handleAuthMethodChange"
|
|
|
|
|
clearable
|
2023-11-27 15:03:25 +08:00
|
|
|
|
>
|
2024-08-11 11:18:26 +08:00
|
|
|
|
<el-option label="无" value="null"></el-option>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<el-option label="令牌(token)" value="token"></el-option>
|
|
|
|
|
<el-option label="多用户" value="multiuser"></el-option>
|
2023-11-28 17:49:08 +08:00
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24" v-if="formData.authMethod === 'token'">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<el-form-item label="令牌:" prop="authToken">
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover placement="top" trigger="hover" width="200">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>auth.token</span
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
令牌:
|
|
|
|
|
</template>
|
2023-11-28 17:49:08 +08:00
|
|
|
|
<el-input
|
2024-08-16 23:59:40 +08:00
|
|
|
|
placeholder="token"
|
|
|
|
|
type="password"
|
|
|
|
|
v-model="formData.authToken"
|
2024-09-25 10:21:29 +08:00
|
|
|
|
:show-password="true"
|
2023-11-28 17:49:08 +08:00
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<el-col :span="12" v-if="formData.authMethod === 'multiuser'">
|
|
|
|
|
<el-form-item label="用户:" prop="user">
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover placement="top" trigger="hover">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>user</span
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
用户:
|
|
|
|
|
</template>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-input placeholder="请输入用户" v-model="formData.user" />
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12" v-if="formData.authMethod === 'multiuser'">
|
|
|
|
|
<el-form-item label="用户令牌:" prop="metaToken">
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover width="200" placement="top" trigger="hover">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>metadatas.token</span
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
用户令牌:
|
|
|
|
|
</template>
|
|
|
|
|
<el-input
|
2024-08-16 23:59:40 +08:00
|
|
|
|
placeholder="请输入用户令牌"
|
|
|
|
|
type="password"
|
|
|
|
|
v-model="formData.metaToken"
|
2024-08-05 22:30:53 +08:00
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
<el-col :span="12">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="心跳间隔:"
|
|
|
|
|
prop="transportHeartbeatInterval"
|
|
|
|
|
>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover width="300" placement="top" trigger="hover">
|
2024-08-11 14:59:23 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
多长向服务端发发送一次心跳包 单位:
|
|
|
|
|
<span class="font-black text-[#5A3DAA]">秒</span> <br />
|
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>transport.heartbeatInterval</span
|
|
|
|
|
>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
心跳间隔:
|
|
|
|
|
</template>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-input-number
|
|
|
|
|
class="w-full"
|
|
|
|
|
v-model="formData.transportHeartbeatInterval"
|
|
|
|
|
:min="1"
|
2024-09-02 22:53:59 +08:00
|
|
|
|
:max="600"
|
2024-08-16 23:59:40 +08:00
|
|
|
|
controls-position="right"
|
|
|
|
|
/>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
<!-- <el-input-->
|
|
|
|
|
<!-- placeholder="请输入心跳间隔"-->
|
|
|
|
|
<!-- type="number"-->
|
|
|
|
|
<!-- :min="0"-->
|
|
|
|
|
<!-- v-model="formData.heartbeatInterval"-->
|
|
|
|
|
<!-- >-->
|
|
|
|
|
<!-- <template #append>秒</template>-->
|
|
|
|
|
<!-- </el-input>-->
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="心跳超时:" prop="transportHeartbeatTimeout">
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover width="300" placement="top" trigger="hover">
|
2024-08-11 14:59:23 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
心跳超时时间 单位:
|
|
|
|
|
<span class="font-black text-[#5A3DAA]">秒</span> <br />
|
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>transport.heartbeatTimeout</span
|
|
|
|
|
>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
心跳超时:
|
|
|
|
|
</template>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-input-number
|
|
|
|
|
class="w-full"
|
|
|
|
|
v-model="formData.transportHeartbeatTimeout"
|
|
|
|
|
:min="1"
|
2024-09-02 22:53:59 +08:00
|
|
|
|
:max="600"
|
2024-08-16 23:59:40 +08:00
|
|
|
|
controls-position="right"
|
|
|
|
|
/>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
<!-- <el-input-->
|
|
|
|
|
<!-- placeholder="请输入心跳超时时间"-->
|
|
|
|
|
<!-- :min="0"-->
|
|
|
|
|
<!-- type="number"-->
|
|
|
|
|
<!-- v-model="formData.heartbeatTimeout"-->
|
|
|
|
|
<!-- >-->
|
|
|
|
|
<!-- <template #append>秒</template>-->
|
|
|
|
|
<!-- </el-input>-->
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
<el-col :span="24">
|
2024-09-04 09:24:39 +08:00
|
|
|
|
<div class="h2">TLS Config</div>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
2024-09-04 09:24:39 +08:00
|
|
|
|
<el-form-item label="是否启用TLS:" prop="tlsConfigEnable">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-switch
|
|
|
|
|
active-text="开"
|
|
|
|
|
inline-prompt
|
|
|
|
|
inactive-text="关"
|
|
|
|
|
v-model="formData.tlsConfigEnable"
|
|
|
|
|
/>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<template v-if="formData.tlsConfigEnable">
|
|
|
|
|
<el-col :span="24">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="TLS证书文件:"
|
|
|
|
|
prop="tlsConfigCertFile"
|
|
|
|
|
label-width="180"
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover width="260" placement="top" trigger="hover">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>transport.tls.certFile</span
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
TLS 证书文件:
|
|
|
|
|
</template>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
<el-input
|
2024-09-04 13:08:16 +08:00
|
|
|
|
class="button-input !cursor-pointer"
|
2024-08-16 23:59:40 +08:00
|
|
|
|
v-model="formData.tlsConfigCertFile"
|
2024-09-04 13:08:16 +08:00
|
|
|
|
placeholder="点击选择TLS证书文件"
|
2024-08-16 23:59:40 +08:00
|
|
|
|
readonly
|
2024-09-04 13:08:16 +08:00
|
|
|
|
clearable
|
|
|
|
|
@click="handleSelectFile(1, ['crt'])"
|
2023-12-01 14:16:53 +08:00
|
|
|
|
/>
|
2024-09-04 13:08:16 +08:00
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- class="ml-2"-->
|
|
|
|
|
<!-- type="primary"-->
|
|
|
|
|
<!-- @click="handleSelectFile(1, ['crt'])"-->
|
|
|
|
|
<!-- >选择-->
|
|
|
|
|
<!-- </el-button>-->
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-button
|
2024-09-04 13:08:16 +08:00
|
|
|
|
v-if="formData.tlsConfigCertFile"
|
2024-08-16 23:59:40 +08:00
|
|
|
|
class="ml-2"
|
2024-09-04 13:08:16 +08:00
|
|
|
|
type="danger"
|
|
|
|
|
@click="formData.tlsConfigCertFile = ''"
|
|
|
|
|
>清除
|
2024-08-21 22:31:12 +08:00
|
|
|
|
</el-button>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="TLS密钥文件:"
|
|
|
|
|
prop="tlsConfigKeyFile"
|
|
|
|
|
label-width="180"
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover width="260" placement="top" trigger="hover">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>transport.tls.keyFile</span
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
TLS 密钥文件:
|
|
|
|
|
</template>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
<el-input
|
2024-08-16 23:59:40 +08:00
|
|
|
|
class="button-input"
|
|
|
|
|
v-model="formData.tlsConfigKeyFile"
|
2024-09-04 13:08:16 +08:00
|
|
|
|
placeholder="点击选择 TLS 密钥文件"
|
2024-08-16 23:59:40 +08:00
|
|
|
|
readonly
|
2024-09-04 13:08:16 +08:00
|
|
|
|
@click="handleSelectFile(2, ['key'])"
|
2023-12-01 14:16:53 +08:00
|
|
|
|
/>
|
2024-09-04 13:08:16 +08:00
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- class="ml-2"-->
|
|
|
|
|
<!-- type="primary"-->
|
|
|
|
|
<!-- @click="handleSelectFile(2, ['key'])"-->
|
|
|
|
|
<!-- >选择-->
|
|
|
|
|
<!-- </el-button>-->
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-button
|
2024-09-04 13:08:16 +08:00
|
|
|
|
v-if="formData.tlsConfigKeyFile"
|
2024-08-16 23:59:40 +08:00
|
|
|
|
class="ml-2"
|
2024-09-04 13:08:16 +08:00
|
|
|
|
type="danger"
|
|
|
|
|
@click="formData.tlsConfigKeyFile = ''"
|
|
|
|
|
>清除
|
2024-08-21 22:31:12 +08:00
|
|
|
|
</el-button>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="CA证书文件:"
|
|
|
|
|
prop="tlsConfigTrustedCaFile"
|
|
|
|
|
label-width="180"
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover width="310" placement="top" trigger="hover">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>transport.tls.trustedCaFile</span
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
CA 证书文件:
|
|
|
|
|
</template>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
<el-input
|
2024-08-16 23:59:40 +08:00
|
|
|
|
class="button-input"
|
|
|
|
|
v-model="formData.tlsConfigTrustedCaFile"
|
2024-09-04 13:08:16 +08:00
|
|
|
|
placeholder="点击选择 CA 证书文件"
|
2024-08-16 23:59:40 +08:00
|
|
|
|
readonly
|
2024-09-04 13:08:16 +08:00
|
|
|
|
@click="handleSelectFile(3, ['crt'])"
|
2023-12-01 14:16:53 +08:00
|
|
|
|
/>
|
2024-09-04 13:08:16 +08:00
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- class="ml-2"-->
|
|
|
|
|
<!-- type="primary"-->
|
|
|
|
|
<!-- @click="handleSelectFile(3, ['crt'])"-->
|
|
|
|
|
<!-- >选择-->
|
|
|
|
|
<!-- </el-button>-->
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-button
|
2024-09-04 13:08:16 +08:00
|
|
|
|
v-if="formData.tlsConfigTrustedCaFile"
|
2024-08-16 23:59:40 +08:00
|
|
|
|
class="ml-2"
|
2024-09-04 13:08:16 +08:00
|
|
|
|
type="danger"
|
|
|
|
|
@click="formData.tlsConfigTrustedCaFile = ''"
|
|
|
|
|
>清除
|
2024-08-21 22:31:12 +08:00
|
|
|
|
</el-button>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-form-item
|
|
|
|
|
label="TLS Server 名称:"
|
|
|
|
|
prop="tlsConfigServerName"
|
|
|
|
|
label-width="180"
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover width="300" placement="top" trigger="hover">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>transport.tls.serverName</span
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
TLS Server 名称:
|
|
|
|
|
</template>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
<el-input
|
2024-08-16 23:59:40 +08:00
|
|
|
|
v-model="formData.tlsConfigServerName"
|
|
|
|
|
placeholder="请输入TLS Server 名称"
|
2024-09-04 13:08:16 +08:00
|
|
|
|
clearable
|
2023-12-01 14:16:53 +08:00
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</template>
|
2024-01-20 11:24:59 +08:00
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<div class="h2">代理</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="是否启动代理:" prop="proxyConfigEnable">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-switch
|
|
|
|
|
active-text="开"
|
|
|
|
|
inline-prompt
|
|
|
|
|
inactive-text="关"
|
|
|
|
|
v-model="formData.proxyConfigEnable"
|
|
|
|
|
/>
|
2024-01-20 11:24:59 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<template v-if="formData.proxyConfigEnable">
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="代理地址:" prop="proxyConfigProxyUrl">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover width="300" placement="top" trigger="hover">
|
2024-08-05 22:30:53 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>transport.proxyURL</span
|
|
|
|
|
>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-08-05 22:30:53 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
代理地址:
|
|
|
|
|
</template>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.proxyConfigProxyUrl"
|
|
|
|
|
placeholder="http://user:pwd@192.168.1.128:8080"
|
|
|
|
|
/>
|
2024-01-20 11:24:59 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</template>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
|
2023-11-28 17:49:08 +08:00
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<div class="h2">日志配置</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item class="!w-full" label="日志级别:" prop="logLevel">
|
|
|
|
|
<el-select v-model="formData.logLevel">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-option label="info" value="info" />
|
|
|
|
|
<el-option label="debug" value="debug" />
|
|
|
|
|
<el-option label="waring" value="waring" />
|
|
|
|
|
<el-option label="error" value="error" />
|
2023-11-28 17:49:08 +08:00
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="日志保留天数:" prop="logMaxDays">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-input-number
|
|
|
|
|
class="!w-full"
|
|
|
|
|
controls-position="right"
|
|
|
|
|
v-model="formData.logMaxDays"
|
|
|
|
|
/>
|
2023-11-28 17:49:08 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-07-31 20:38:59 +08:00
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<div class="h2">系统配置</div>
|
|
|
|
|
</el-col>
|
2024-10-14 11:24:54 +08:00
|
|
|
|
<el-col :span="8">
|
2024-07-31 20:38:59 +08:00
|
|
|
|
<el-form-item label="开机自启:" prop="systemSelfStart">
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover placement="top" trigger="hover">
|
2024-07-31 20:38:59 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
开机自动启动 <br /><span
|
|
|
|
|
class="font-black text-[#5A3DAA]"
|
|
|
|
|
>Frpc Desktop</span
|
|
|
|
|
>
|
2024-07-31 20:38:59 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-07-31 20:38:59 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
开机自启:
|
|
|
|
|
</template>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-switch
|
|
|
|
|
active-text="开"
|
|
|
|
|
inline-prompt
|
|
|
|
|
inactive-text="关"
|
|
|
|
|
v-model="formData.systemSelfStart"
|
|
|
|
|
/>
|
2024-07-31 20:38:59 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-10-14 11:24:54 +08:00
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="静默启动:" prop="systemSilentStartup">
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
|
|
|
|
<el-popover placement="top" trigger="hover">
|
|
|
|
|
<template #default>
|
|
|
|
|
开启后启动时<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>不打开界面</span
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
静默启动:
|
|
|
|
|
</template>
|
|
|
|
|
<el-switch
|
|
|
|
|
active-text="开"
|
|
|
|
|
inline-prompt
|
|
|
|
|
inactive-text="关"
|
|
|
|
|
v-model="formData.systemSilentStartup"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
2024-07-31 20:38:59 +08:00
|
|
|
|
<el-form-item label="自动连接:" prop="systemStartupConnect">
|
|
|
|
|
<template #label>
|
|
|
|
|
<div class="h-full flex items-center mr-1">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-popover placement="top" trigger="hover">
|
2024-07-31 20:38:59 +08:00
|
|
|
|
<template #default>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
启动软件后是否<span class="font-black text-[#5A3DAA]"
|
|
|
|
|
>自动连接</span
|
|
|
|
|
>服务器
|
2024-07-31 20:38:59 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="text-base"
|
|
|
|
|
color="#5A3DAA"
|
|
|
|
|
icon="info"
|
|
|
|
|
/>
|
2024-07-31 20:38:59 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
自动连接:
|
|
|
|
|
</template>
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-switch
|
|
|
|
|
active-text="开"
|
|
|
|
|
inline-prompt
|
|
|
|
|
inactive-text="关"
|
|
|
|
|
v-model="formData.systemStartupConnect"
|
|
|
|
|
/>
|
2024-07-31 20:38:59 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
2024-08-22 14:19:19 +08:00
|
|
|
|
<!-- <el-col :span="24">-->
|
|
|
|
|
<!-- <el-form-item>-->
|
|
|
|
|
<!-- <el-button plain type="primary" @click="handleSubmit">-->
|
|
|
|
|
<!-- <IconifyIconOffline icon="save" />-->
|
|
|
|
|
<!-- 保 存-->
|
|
|
|
|
<!-- </el-button>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<!-- </el-col>-->
|
2023-11-28 17:49:08 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
2023-11-27 15:03:25 +08:00
|
|
|
|
</div>
|
2024-08-21 22:31:12 +08:00
|
|
|
|
<!-- 链接导入服务器 -->
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-dialog
|
|
|
|
|
v-model="visibles.copyServerConfig"
|
|
|
|
|
title="复制链接"
|
|
|
|
|
width="500"
|
|
|
|
|
top="5%"
|
|
|
|
|
>
|
|
|
|
|
<el-alert
|
|
|
|
|
class="mb-4"
|
|
|
|
|
title="生成内容包含服务器密钥等内容 请妥善保管 且链接仅在Frpc-Desktop中可用"
|
|
|
|
|
type="warning"
|
|
|
|
|
:closable="false"
|
|
|
|
|
/>
|
|
|
|
|
<el-input
|
|
|
|
|
class="h-30"
|
|
|
|
|
v-model="copyServerConfigBase64"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rows="8"
|
|
|
|
|
></el-input>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
</el-dialog>
|
2024-08-21 22:31:12 +08:00
|
|
|
|
<!-- 链接导出服务器-->
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-dialog
|
|
|
|
|
v-model="visibles.pasteServerConfig"
|
|
|
|
|
title="导入链接"
|
|
|
|
|
width="500"
|
|
|
|
|
top="5%"
|
|
|
|
|
>
|
|
|
|
|
<el-input
|
|
|
|
|
class="h-30"
|
|
|
|
|
v-model="pasteServerConfigBase64"
|
|
|
|
|
type="textarea"
|
|
|
|
|
placeholder="frp://......"
|
|
|
|
|
:rows="8"
|
|
|
|
|
></el-input>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
2024-08-16 23:59:40 +08:00
|
|
|
|
<el-button
|
|
|
|
|
plain
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="handlePasteServerConfigBase64"
|
|
|
|
|
>
|
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="cursor-pointer mr-2"
|
|
|
|
|
icon="label-important-rounded"
|
|
|
|
|
/>
|
2024-08-16 16:23:20 +08:00
|
|
|
|
导 入
|
|
|
|
|
</el-button>
|
2024-08-11 14:59:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
2024-08-21 22:31:12 +08:00
|
|
|
|
<!-- 配置导出-->
|
|
|
|
|
<el-dialog
|
|
|
|
|
v-model="visibles.exportConfig"
|
|
|
|
|
title="导出配置"
|
|
|
|
|
width="500"
|
|
|
|
|
top="5%"
|
|
|
|
|
>
|
|
|
|
|
<el-alert
|
|
|
|
|
class="mb-4"
|
|
|
|
|
:title="`导出文件名为 frpc-desktop.${exportConfigType} 重复导出则覆盖`"
|
|
|
|
|
type="warning"
|
|
|
|
|
:closable="false"
|
|
|
|
|
/>
|
|
|
|
|
<el-form>
|
|
|
|
|
<el-form-item label="导出类型">
|
|
|
|
|
<el-radio-group v-model="exportConfigType">
|
|
|
|
|
<el-radio-button label="toml" value="toml" />
|
|
|
|
|
<el-radio-button label="ini" value="ini" />
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
<el-button plain type="primary" @click="handleExportConfig">
|
|
|
|
|
<IconifyIconOffline
|
|
|
|
|
class="cursor-pointer mr-2"
|
|
|
|
|
icon="downloadRounded"
|
|
|
|
|
/>
|
|
|
|
|
导 出
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
2023-11-27 15:03:25 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2023-11-28 17:49:08 +08:00
|
|
|
|
<style lang="scss" scoped>
|
2023-12-01 14:16:53 +08:00
|
|
|
|
.button-input {
|
|
|
|
|
width: calc(100% - 68px);
|
|
|
|
|
}
|
2023-11-28 17:49:08 +08:00
|
|
|
|
</style>
|