✨ 多用户插件适配
This commit is contained in:
parent
a4ffd0199f
commit
df23ec676c
@ -63,8 +63,16 @@ localPort = ${m.localPort}
|
|||||||
const toml = `
|
const toml = `
|
||||||
serverAddr = "${config.serverAddr}"
|
serverAddr = "${config.serverAddr}"
|
||||||
serverPort = ${config.serverPort}
|
serverPort = ${config.serverPort}
|
||||||
auth.method = "${config.authMethod}"
|
${config.authMethod === 'token' ? `
|
||||||
|
auth.method = "token"
|
||||||
auth.token = "${config.authToken}"
|
auth.token = "${config.authToken}"
|
||||||
|
` : ""}
|
||||||
|
${config.authMethod === 'multiuser' ? `
|
||||||
|
user = ${config.user}
|
||||||
|
metadatas.token = ${config.metaToken}
|
||||||
|
` : ""}
|
||||||
|
|
||||||
|
|
||||||
log.to = "frpc.log"
|
log.to = "frpc.log"
|
||||||
log.level = "${config.logLevel}"
|
log.level = "${config.logLevel}"
|
||||||
log.maxDays = ${config.logMaxDays}
|
log.maxDays = ${config.logMaxDays}
|
||||||
@ -118,8 +126,14 @@ local_port = ${m.localPort}
|
|||||||
[common]
|
[common]
|
||||||
server_addr = ${config.serverAddr}
|
server_addr = ${config.serverAddr}
|
||||||
server_port = ${config.serverPort}
|
server_port = ${config.serverPort}
|
||||||
authentication_method = "${config.authMethod}"
|
${config.authMethod === 'token' ? `
|
||||||
auth_token = "${config.authToken}"
|
authentication_method = ${config.authMethod}
|
||||||
|
token = ${config.authToken}
|
||||||
|
` : ""}
|
||||||
|
${config.authMethod === 'multiuser' ? `
|
||||||
|
user = ${config.user}
|
||||||
|
meta_token = ${config.metaToken}
|
||||||
|
` : ""}
|
||||||
log_file = "frpc.log"
|
log_file = "frpc.log"
|
||||||
log_level = ${config.logLevel}
|
log_level = ${config.logLevel}
|
||||||
log_max_days = ${config.logMaxDays}
|
log_max_days = ${config.logMaxDays}
|
||||||
@ -154,6 +168,7 @@ export const generateConfig = (
|
|||||||
const {currentVersion} = config;
|
const {currentVersion} = config;
|
||||||
let filename = null;
|
let filename = null;
|
||||||
let configContent = "";
|
let configContent = "";
|
||||||
|
console.log(currentVersion, "currentVersion")
|
||||||
if (currentVersion < 124395282) {
|
if (currentVersion < 124395282) {
|
||||||
// 版本小于v0.52.0
|
// 版本小于v0.52.0
|
||||||
filename = "frp.ini";
|
filename = "frp.ini";
|
||||||
@ -185,7 +200,7 @@ export const generateConfig = (
|
|||||||
* @param configPath
|
* @param configPath
|
||||||
*/
|
*/
|
||||||
const startFrpcProcess = (commandPath: string, configPath: string) => {
|
const startFrpcProcess = (commandPath: string, configPath: string) => {
|
||||||
console.log(commandPath, 'commandP')
|
console.log(app.getPath("userData") + "\\" + commandPath, 'commandP')
|
||||||
const command = `${commandPath} -c ${configPath}`;
|
const command = `${commandPath} -c ${configPath}`;
|
||||||
console.info("启动", command)
|
console.info("启动", command)
|
||||||
frpcProcess = spawn(command, {
|
frpcProcess = spawn(command, {
|
||||||
@ -276,7 +291,7 @@ export const frpcProcessStatus = () => {
|
|||||||
* 启动frpc流程
|
* 启动frpc流程
|
||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
export const startFrpWorkerProcess = (config: Config) => {
|
export const startFrpWorkerProcess = async (config: Config) => {
|
||||||
getFrpcVersionWorkerPath(
|
getFrpcVersionWorkerPath(
|
||||||
config.currentVersion,
|
config.currentVersion,
|
||||||
(frpcVersionPath: string) => {
|
(frpcVersionPath: string) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user