Compare commits

...

3 Commits

3 changed files with 84 additions and 5 deletions

View File

@ -20,10 +20,47 @@ function parseRq (bytes) {
class APIMethods { class APIMethods {
constructor (parentObj) { constructor (parentObj) {
this.parentObj = parentObj; this.parentObj = parentObj;
this.info.cache = new Object();
// Clear method cache on update config
global.server.on("config.update", () => {
this.info.cache = new Object();
});
} }
info (con, req, cb) { info (con, req, cb) {
const serverInfo = require("./server-info"); if (!req.fields) req.fields = "*";
if (!req.fieldsExtSource) req.fieldsExtSource = "*";
const cache = this.info.cache[
JSON.stringify({
f: req.fields, e: req.fieldsExtSource
})
];
if (cache) {
console.debug("CACHE!");
return cb({ result: cache, trace_id: req.trace_id, ended: true });
}
const serverInfo = require("./server-info")();
if (req.fields !== "*") {
const fields = Object.fromEntries(req.fields.split(/\s*,\s*/g).map(x => [x.trim(), true]));
Object.keys(serverInfo).forEach(k => {
if (!fields[k]) serverInfo[k] = undefined;
});
}
if (req.fieldsExtSource !== "*" && req.fields.extSource !== undefined) {
const fields = Object.fromEntries(req.fieldsExtSource.split(/\s*,\s*/g).map(x => [x.trim(), true]));
Object.keys(serverInfo).forEach(k => {
if (!fields[k]) serverInfo.extSource[k] = undefined;
});
}
this.info.cache[
JSON.stringify({
f: req.fields, e: req.fieldsExtSource
})
] = serverInfo;
cb({ result: serverInfo, trace_id: req.trace_id, ended: true }); cb({ result: serverInfo, trace_id: req.trace_id, ended: true });
} }
@ -88,7 +125,7 @@ class API {
} }
decrypt (address, bytes) { decrypt (address, bytes) {
throw new Error("Deprecated. Use TLS. If you see this error, please, add issue into: https://git.fullgream.tech/fullgream/ai-adventure-labs/issues"); throw new Error("Deprecated. Use TLS. If you see this error, please, create issue into: https://git.fullgream.tech/fullgream/ai-adventure-labs/issues");
} }
async exec (connection, bytes, cb) { async exec (connection, bytes, cb) {

View File

@ -116,14 +116,40 @@
backdrop-filter: blur(5px); backdrop-filter: blur(5px);
border-radius : 15px; border-radius : 15px;
width: calc(90vw); width: calc(90vw);
height: calc(80vh); height: calc(85vh);
margin-left: calc(5%); margin-left: calc(5vw);
margin-top: calc(5%); margin-top: calc(5vh);
padding: 5px; padding: 5px;
} }
.flex-box {
display: flex;
}
.charlist-item {
width: 25vw;
}
.avatar-on-charlist {
width: 50px;
height: 50px;
margin-right: 15px;
border-radius: 100%;
}
.characters-menu {
width: 25vw;
height: 75vh;
}
.character-menu {
float: left;
width: 65vw;
height: 75vh;
}
/* $accordion-color:green; */ /* $accordion-color:green; */
/* $accordion-padding-y:1.3rem; */ /* $accordion-padding-y:1.3rem; */
/* $accordion-padding-x:2.5rem; */ /* $accordion-padding-x:2.5rem; */

View File

@ -104,6 +104,22 @@ ServerAuth.mainMenuForm.innerHTML = `
<div id="main-panel" > <div id="main-panel" >
<div id="main-content"> <div id="main-content">
<center><h2>Your Profile</h2></center><hr/> <center><h2>Your Profile</h2></center><hr/>
<div class="flex-box">
<div class="characters-menu">
<center><h4>Characters</h4></center>
<div class="user-character-list btn-group-vertical charlist-item" role="group" aria-label="Characters">
<button type="button" class="btn btn-dark btn-outline-light">
<div class="flex-box"><img src="https://fullgream.tech/assets/contacts-image.jpg" class="avatar-on-charlist" /><h5>John Doe</h5></div>
</button>
<button type="button" class="btn btn-success btn-outline-light">Add character</button>
</div>
</div>
<div class="character-menu">
<center><h4>Character</h4></center>
<div>
</div>
</div>
</div>
</div> </div>
</div> </div>