@@ -86,7 +86,7 @@ function saveStateSync() {
|
||||
const file = getStatePath();
|
||||
const serversList = [];
|
||||
for (const [id, s] of servers) {
|
||||
serversList.push({ id, port: s.port, host: s.host, secure: s.secure, udp: s.udp || false });
|
||||
serversList.push({ id, port: s.port, host: s.host, secure: s.secure, udp: s.udp || false, label: s.label || '' });
|
||||
}
|
||||
const virtualHostsList = [];
|
||||
for (const [hostname, v] of virtualHosts) {
|
||||
@@ -309,8 +309,9 @@ async function startServer(payload) {
|
||||
const host = payload.host || '127.0.0.1';
|
||||
const secure = payload.secure !== false;
|
||||
const udp = payload.udp === true;
|
||||
const label = (payload.label || '').trim();
|
||||
const serverId = useServerId(payload.serverId);
|
||||
debugLog('startServer: serverId=', serverId, 'port=', port, 'host=', host, 'secure=', secure, 'udp=', udp);
|
||||
debugLog('startServer: serverId=', serverId, 'port=', port, 'host=', host, 'secure=', secure, 'udp=', udp, 'label=', label);
|
||||
if (servers.has(serverId)) {
|
||||
debugLog('startServer: serverId already in use');
|
||||
return { ok: false, error: 'Server id already in use' };
|
||||
@@ -325,6 +326,7 @@ async function startServer(payload) {
|
||||
host: hs.info.host,
|
||||
secure,
|
||||
udp,
|
||||
label,
|
||||
url,
|
||||
createdAt: Date.now()
|
||||
});
|
||||
@@ -337,7 +339,8 @@ async function startServer(payload) {
|
||||
port: hs.info.port,
|
||||
host: hs.info.host,
|
||||
secure,
|
||||
udp
|
||||
udp,
|
||||
label
|
||||
};
|
||||
} catch (e) {
|
||||
debugLog('startServer: error', e.message);
|
||||
@@ -372,6 +375,7 @@ function getServers() {
|
||||
url: s.url,
|
||||
secure: s.secure,
|
||||
udp: s.udp || false,
|
||||
label: s.label || '',
|
||||
createdAt: s.createdAt
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user