🐛 启动报错和支持 http Basic、子域名
This commit is contained in:
parent
139fed40d8
commit
f788990705
@ -35,8 +35,8 @@ const getFrpcVersionWorkerPath = (
|
|||||||
|
|
||||||
const isRangePort = (m: Proxy) => {
|
const isRangePort = (m: Proxy) => {
|
||||||
return (
|
return (
|
||||||
(m.localPort.indexOf("-") !== -1 || m.localPort.indexOf(",") !== -1) &&
|
(m.type === "tcp" || m.type === "udp") &&
|
||||||
(m.type === "tcp" || m.type === "udp")
|
(m.localPort.indexOf("-") !== -1 || m.localPort.indexOf(",") !== -1)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -82,7 +82,14 @@ remotePort = ${m.remotePort}
|
|||||||
localIP = "${m.localIp}"
|
localIP = "${m.localIp}"
|
||||||
localPort = ${m.localPort}
|
localPort = ${m.localPort}
|
||||||
customDomains=[${m.customDomains.map(m => `"${m}"`)}]
|
customDomains=[${m.customDomains.map(m => `"${m}"`)}]
|
||||||
|
subdomain="${m.subdomain}"
|
||||||
`;
|
`;
|
||||||
|
if (m.basicAuth) {
|
||||||
|
toml += `
|
||||||
|
httpUser = "${m.httpUser}"
|
||||||
|
httpPassword = "${m.httpPassword}"
|
||||||
|
`;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "stcp":
|
case "stcp":
|
||||||
if (m.stcpModel === "visitors") {
|
if (m.stcpModel === "visitors") {
|
||||||
@ -204,7 +211,7 @@ export const genIniConfig = (config: FrpConfig, proxys: Proxy[]) => {
|
|||||||
const proxyIni = proxys.map(m => {
|
const proxyIni = proxys.map(m => {
|
||||||
const rangePort = isRangePort(m);
|
const rangePort = isRangePort(m);
|
||||||
let ini = `
|
let ini = `
|
||||||
[${rangePort ? 'range:' : ''}${m.name}]
|
[${rangePort ? "range:" : ""}${m.name}]
|
||||||
type = "${m.type}"
|
type = "${m.type}"
|
||||||
`;
|
`;
|
||||||
switch (m.type) {
|
switch (m.type) {
|
||||||
@ -222,7 +229,14 @@ remote_port = ${m.remotePort}
|
|||||||
local_ip = "${m.localIp}"
|
local_ip = "${m.localIp}"
|
||||||
local_port = ${m.localPort}
|
local_port = ${m.localPort}
|
||||||
custom_domains=[${m.customDomains.map(m => `"${m}"`)}]
|
custom_domains=[${m.customDomains.map(m => `"${m}"`)}]
|
||||||
|
subdomain="${m.subdomain}"
|
||||||
`;
|
`;
|
||||||
|
if (m.basicAuth) {
|
||||||
|
ini += `
|
||||||
|
httpUser = "${m.httpUser}"
|
||||||
|
httpPassword = "${m.httpPassword}"
|
||||||
|
`;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "stcp":
|
case "stcp":
|
||||||
if (m.stcpModel === "visitors") {
|
if (m.stcpModel === "visitors") {
|
||||||
|
@ -537,6 +537,7 @@ onUnmounted(() => {
|
|||||||
placeholder="token"
|
placeholder="token"
|
||||||
type="password"
|
type="password"
|
||||||
v-model="formData.authToken"
|
v-model="formData.authToken"
|
||||||
|
:show-password="true"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -57,7 +57,11 @@ const defaultForm = ref<Proxy>({
|
|||||||
secretKey: "",
|
secretKey: "",
|
||||||
bindAddr: "",
|
bindAddr: "",
|
||||||
bindPort: null,
|
bindPort: null,
|
||||||
status: true
|
status: true,
|
||||||
|
subdomain: "",
|
||||||
|
basicAuth: false,
|
||||||
|
httpUser: "",
|
||||||
|
httpPassword: ""
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,7 +137,12 @@ const editFormRules = reactive<FormRules>({
|
|||||||
trigger: "blur"
|
trigger: "blur"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
bindPort: [{ required: true, message: "请输入绑定的端口", trigger: "blur" }]
|
bindPort: [{ required: true, message: "请输入绑定的端口", trigger: "blur" }],
|
||||||
|
basicAuth: [
|
||||||
|
{ required: true, message: "请选择是否开启HTTP基本认证", trigger: "blur" }
|
||||||
|
],
|
||||||
|
httpUser: [{ required: true, message: "请输入认证用户名", trigger: "blur" }],
|
||||||
|
httpPassword: [{ required: true, message: "请输入认证密码", trigger: "blur" }]
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -192,6 +201,9 @@ const handleGetPortCount = (portString: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleRangePort = () => {
|
const handleRangePort = () => {
|
||||||
|
if (isHttp || isHttps) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (editForm.value.localPort.indexOf("-") !== -1) {
|
if (editForm.value.localPort.indexOf("-") !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -631,13 +643,20 @@ onUnmounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog
|
<el-drawer
|
||||||
v-model="edit.visible"
|
|
||||||
:title="edit.title"
|
:title="edit.title"
|
||||||
class="sm:w-[500px] md:w-[600px] lg:w-[800px]"
|
v-model="edit.visible"
|
||||||
top="5%"
|
direction="rtl"
|
||||||
|
size="60%"
|
||||||
@close="editForm = defaultForm"
|
@close="editForm = defaultForm"
|
||||||
>
|
>
|
||||||
|
<!-- <el-dialog-->
|
||||||
|
<!-- v-model="edit.visible"-->
|
||||||
|
<!-- :title="edit.title"-->
|
||||||
|
<!-- class="sm:w-[500px] md:w-[600px] lg:w-[800px]"-->
|
||||||
|
<!-- top="5%"-->
|
||||||
|
<!-- @close="editForm = defaultForm"-->
|
||||||
|
<!-- >-->
|
||||||
<el-form
|
<el-form
|
||||||
v-loading="loading.form"
|
v-loading="loading.form"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
@ -693,7 +712,7 @@ onUnmounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
共享密钥:
|
共享密钥:
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -701,6 +720,7 @@ onUnmounted(() => {
|
|||||||
type="password"
|
type="password"
|
||||||
v-model="editForm.secretKey"
|
v-model="editForm.secretKey"
|
||||||
placeholder="密钥"
|
placeholder="密钥"
|
||||||
|
:show-password="true"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -762,7 +782,6 @@ onUnmounted(() => {
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="isHttp || isHttps"></template>
|
|
||||||
<template v-if="isTcp || isUdp">
|
<template v-if="isTcp || isUdp">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="外网端口:" prop="remotePort">
|
<el-form-item label="外网端口:" prop="remotePort">
|
||||||
@ -781,6 +800,44 @@ onUnmounted(() => {
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="isHttp || isHttps">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="子域名:" prop="remotePort">
|
||||||
|
<template #label>
|
||||||
|
<div class="inline-block">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="mr-1">
|
||||||
|
<el-popover
|
||||||
|
placement="top"
|
||||||
|
trigger="hover"
|
||||||
|
:width="180"
|
||||||
|
>
|
||||||
|
<template #default>
|
||||||
|
对应参数:<span class="font-black text-[#5A3DAA]"
|
||||||
|
>subdomain</span
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template #reference>
|
||||||
|
<IconifyIconOffline
|
||||||
|
class="text-base"
|
||||||
|
color="#5A3DAA"
|
||||||
|
icon="info"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-popover>
|
||||||
|
</div>
|
||||||
|
子域名:
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<el-input
|
||||||
|
class="w-full"
|
||||||
|
placeholder="subdomain"
|
||||||
|
v-model="editForm.subdomain"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
<template v-if="isHttp || isHttps">
|
<template v-if="isHttp || isHttps">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
@ -824,23 +881,6 @@ onUnmounted(() => {
|
|||||||
自定义域名:
|
自定义域名:
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <el-popover-->
|
|
||||||
<!-- placement="top"-->
|
|
||||||
<!-- trigger="hover"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <template #default>-->
|
|
||||||
<!-- 对应参数:<span class="font-black text-[#5A3DAA]">customDomains</span>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- <template #reference>-->
|
|
||||||
<!-- <IconifyIconOffline class="text-base" color="#5A3DAA" icon="info"/>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- </el-popover>-->
|
|
||||||
<!-- <div class="flex items-center inin">-->
|
|
||||||
<!-- <div class="h-full flex items-center mr-1">-->
|
|
||||||
<!-- -->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- <div>自定义域名:</div>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
</template>
|
</template>
|
||||||
<el-input
|
<el-input
|
||||||
class="domain-input"
|
class="domain-input"
|
||||||
@ -866,6 +906,38 @@ onUnmounted(() => {
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="isHttp || isHttps">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="HTTP基本认证:" prop="basicAuth">
|
||||||
|
<el-switch
|
||||||
|
active-text="开"
|
||||||
|
inline-prompt
|
||||||
|
inactive-text="关"
|
||||||
|
v-model="editForm.basicAuth"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" v-if="editForm.basicAuth">
|
||||||
|
<el-form-item label="认证用户名:" prop="httpUser">
|
||||||
|
<el-input
|
||||||
|
class="w-full"
|
||||||
|
placeholder="httpUser"
|
||||||
|
v-model="editForm.httpUser"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" v-if="editForm.basicAuth">
|
||||||
|
<el-form-item label="认证密码:" prop="httpPassword">
|
||||||
|
<el-input
|
||||||
|
type="password"
|
||||||
|
class="w-full"
|
||||||
|
placeholder="httpPassword"
|
||||||
|
v-model="editForm.httpPassword"
|
||||||
|
:show-password="true"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
<template v-if="isStcpVisitors">
|
<template v-if="isStcpVisitors">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="被访问者代理名称:" prop="serverName">
|
<el-form-item label="被访问者代理名称:" prop="serverName">
|
||||||
@ -982,7 +1054,8 @@ onUnmounted(() => {
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-dialog>
|
</el-drawer>
|
||||||
|
<!-- </el-dialog>-->
|
||||||
|
|
||||||
<el-dialog v-model="listPortsVisible" title="内网端口" width="600" top="5%">
|
<el-dialog v-model="listPortsVisible" title="内网端口" width="600" top="5%">
|
||||||
<el-table
|
<el-table
|
||||||
@ -1055,4 +1128,12 @@ onUnmounted(() => {
|
|||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.el-drawer__header) {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-drawer__body) {
|
||||||
|
//padding-top: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
6
types/global.d.ts
vendored
6
types/global.d.ts
vendored
@ -26,7 +26,11 @@ declare global {
|
|||||||
secretKey: string;
|
secretKey: string;
|
||||||
bindAddr: string;
|
bindAddr: string;
|
||||||
bindPort: number;
|
bindPort: number;
|
||||||
status: boolean
|
status: boolean;
|
||||||
|
subdomain: string;
|
||||||
|
basicAuth: boolean;
|
||||||
|
httpUser: string;
|
||||||
|
httpPassword: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user