diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..9439a1d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "type": "node-terminal", + "name": "运行脚本: dev", + "request": "launch", + "command": "npm run dev", + "cwd": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/electron/api/frpc.ts b/electron/api/frpc.ts index e56418d..5e46a3f 100644 --- a/electron/api/frpc.ts +++ b/electron/api/frpc.ts @@ -114,7 +114,7 @@ type = "https2http" localAddr = "${m.localIp}:${m.localPort}" crtPath = "${m.https2httpCaFile}" -keyPath = "${m.https2httpCaFile}" +keyPath = "${m.https2httpKeyFile}" `; } else { toml += ` @@ -265,18 +265,42 @@ remote_port = ${m.remotePort} `; break; case "http": + ini += ` + local_ip = "${m.localIp}" + local_port = ${m.localPort} + custom_domains=[${m.customDomains.map(m => `${m}`)}] + subdomain="${m.subdomain}" + `; + if (m.basicAuth) { + ini += ` + httpUser = "${m.httpUser}" + httpPassword = "${m.httpPassword}" + `; + } + break; case "https": ini += ` -local_ip = "${m.localIp}" -local_port = ${m.localPort} custom_domains=[${m.customDomains.map(m => `${m}`)}] subdomain="${m.subdomain}" -`; + `; if (m.basicAuth) { ini += ` httpUser = "${m.httpUser}" httpPassword = "${m.httpPassword}" -`; + `; + } + if (m.https2http) { + ini += ` +plugin = https2http +plugin_local_addr = ${m.localIp}:${m.localPort} +plugin_crt_path = ${m.https2httpCaFile} +plugin_key_path = ${m.https2httpKeyFile} + `; + } else { + ini += ` +local_ip = "${m.localIp}" +local_port = ${m.localPort} + `; } break; case "stcp": diff --git a/src/views/proxy/index.vue b/src/views/proxy/index.vue index c18a0da..b840286 100644 --- a/src/views/proxy/index.vue +++ b/src/views/proxy/index.vue @@ -147,8 +147,7 @@ const editFormRules = reactive({ { required: true, message: "请选择是否开启HTTP基本认证", trigger: "blur" } ], httpUser: [{ required: true, message: "请输入认证用户名", trigger: "blur" }], - httpPassword: [{ required: true, message: "请输入认证密码", trigger: "blur" }], - + httpPassword: [{ required: true, message: "请输入认证密码", trigger: "blur" }] }); /** @@ -565,6 +564,20 @@ const handleRandomProxyName = () => { `df_${editForm.value.type}_${result}`.toLocaleLowerCase(); }; +const handleSelectFile = (type: number, ext: string[]) => { + ipcRenderer.invoke("file.selectFile", ext).then(r => { + switch (type) { + case 1: + editForm.value.https2httpCaFile = r[0]; + break; + case 2: + editForm.value.https2httpKeyFile = r[0]; + break; + } + console.log(r); + }); +}; + onMounted(() => { handleInitHook(); handleLoadProxys(); @@ -627,7 +640,7 @@ onUnmounted(() => { class="mr-2" type="danger" size="small" - >已禁用 + >已禁用 被访问者 + >被访问者 @@ -716,7 +729,9 @@ onUnmounted(() => {
@@ -849,8 +864,8 @@ onUnmounted(() => {