Add 'fields' and 'fieldsExtSource' on method info

This commit is contained in:
fullgream 2025-08-16 18:30:34 +03:00
parent cf50254bae
commit 416592d7df
8 changed files with 20 additions and 42 deletions

View File

@ -28,7 +28,7 @@ function getFaviconMain () {
return getBase64fromPath(global.config.source.favicon);
}
module.exports = {
module.exports = () => ({
name: global.config.server.info.name,
tag: global.config.server.info.tag,
authMode: authModes[global.config.server["auth-mode"] ?? 1],
@ -37,4 +37,4 @@ module.exports = {
bgmain: getBGMain(),
favicon: getFaviconMain(),
}
};
});

View File

@ -56,9 +56,11 @@ class ApiMethods extends ProtoApiMethods {
super(api);
}
async info () {
async info (fields = null, fieldsExtSource = null) {
return await super._protoMethod({
method: "info",
fields: fields?.join(",") ?? "*",
fieldsExtSource: fieldsExtSource?.join(",") ?? "*",
});
}

View File

@ -20,12 +20,15 @@ document.body.innerHTML = `<nav id="navbar-main" class="navbar navbar-connect-da
</a>
<div class="collapse navbar-collapse noselect" id="navbarNav"><ul class="navbar-nav"><ul class="navbar-nav">
<div class="vr"></div>
<li class="nav-item">
<li class="nav-item" style="cursor: pointer;">
<a class="nav-link translate linked-btn noselect" aria-current="page" id="nav-home-btn"><i class="fas fa-home"></i> Home</a>
</li>
<li class="nav-item">
<li class="nav-item" style="cursor: pointer;">
<a class="nav-link translate linked-btn noselect" aria-current="page" id="nav-docs-btn"><i class="fas fa-dice-d20"></i> Games</a>
</li>
<li class="nav-item" style="cursor: pointer;">
<a class="nav-link translate linked-btn noselect" aria-current="page" id="nav-docs-btn"><i class="fas fa-server"></i> Storage</a>
</li>
</ul></div>
<div class="vr" style="margin-right:5px"></div>

View File

@ -168,6 +168,7 @@ fl.bindLoad("/connect", () => {
ping = (new Date()) - ping;
socket.onmessage = (ev) => {
const data = JSON.parse(ev.data).result;
console.debug("data:", data);
data.tls = serverItem.tls;
itemIDs.push({
...data,
@ -188,6 +189,7 @@ fl.bindLoad("/connect", () => {
};
socket.send(JSON.stringify({
method: "info",
fields: "name,tag",
trace_id
}));
};

View File

@ -107,7 +107,11 @@ const translationTree = {
"connection-failed": "Соединение оборвалось",
"retry-connecting": "Повторить попытку",
}
}
},
"/connect-area": {
"en-US": {},
"ru-RU": {}
}
}
Object.entries(translationTree).forEach(([page, langs]) => {

View File

@ -14,7 +14,6 @@
"express": "^4.19.2",
"fs": "^0.0.1-security",
"https": "^1.0.0",
"md5": "^2.3.0",
"net": "^1.0.2",
"path": "^0.12.7",
"selfsigned": "^2.4.1",
@ -108,14 +107,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==",
"engines": {
"node": "*"
}
},
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
@ -148,14 +139,6 @@
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
},
"node_modules/crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==",
"engines": {
"node": "*"
}
},
"node_modules/crypto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz",
@ -452,21 +435,6 @@
"node": ">= 0.10"
}
},
"node_modules/is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
},
"node_modules/md5": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
"integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
"dependencies": {
"charenc": "0.0.2",
"crypt": "0.0.2",
"is-buffer": "~1.1.6"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",

View File

@ -5,7 +5,6 @@
"express": "^4.19.2",
"fs": "^0.0.1-security",
"https": "^1.0.0",
"md5": "^2.3.0",
"net": "^1.0.2",
"path": "^0.12.7",
"selfsigned": "^2.4.1",

View File

@ -197,12 +197,12 @@ const defaultConfigData = {
},
};
const server = new Server();
cfgHandle(server, defaultConfigData, logger);
global.server = new Server();
cfgHandle(global.server, defaultConfigData, logger);
logger.log("Current config:", global.config);
server.run(global.config.server.address, global.config.server.port);
global.server.run(global.config.server.address, global.config.server.port);
/*
if (global.config.server.secureMode) {