增加 https2http 插件

This commit is contained in:
刘嘉伟 2025-01-05 21:17:56 +08:00
parent 3157b935e0
commit a1910be29c
3 changed files with 117 additions and 39 deletions

16
.vscode/launch.json vendored Normal file
View File

@ -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}"
}
]
}

View File

@ -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":

View File

@ -147,8 +147,7 @@ const editFormRules = reactive<FormRules>({
{ 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();
@ -716,7 +729,9 @@ onUnmounted(() => {
<div
class="text-sm text-left"
v-if="
(proxy.type !== 'stcp' && proxy.type !== 'xtcp' && proxy.type !== 'sudp') ||
(proxy.type !== 'stcp' &&
proxy.type !== 'xtcp' &&
proxy.type !== 'sudp') ||
proxy.stcpModel !== 'visitors'
"
>
@ -1103,7 +1118,16 @@ onUnmounted(() => {
</template>
<template v-if="isHttps">
<el-col :span="24">
<el-form-item label="https2http" prop="https2http">
<el-form-item
label="https2http"
prop="https2http"
:rules="[
{
required: true,
trigger: 'blur'
}
]"
>
<el-switch
active-text="开"
inline-prompt
@ -1118,6 +1142,13 @@ onUnmounted(() => {
label="证书文件:"
prop="https2httpCaFile"
label-width="180"
:rules="[
{
required: true,
message: '证书文件不能为空',
trigger: 'blur'
}
]"
>
<!-- <template #label>
<div class="h-full flex items-center mr-1">
@ -1165,6 +1196,13 @@ onUnmounted(() => {
label="密钥文件:"
prop="https2httpKeyFile"
label-width="180"
:rules="[
{
required: true,
message: '密钥文件不能为空',
trigger: 'blur'
}
]"
>
<!-- <template #label>
<div class="h-full flex items-center mr-1">