fix __dirapi by conf.dirapi
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
"title":"Creation date",
|
||||
"description":"Nation date of creation",
|
||||
"type": "string",
|
||||
"format":"datetime"
|
||||
"format":"date-time"
|
||||
},
|
||||
"contracts":{
|
||||
"title":"Social contract of the nation",
|
@@ -17,20 +17,20 @@
|
||||
},
|
||||
"dt_create": {
|
||||
"type": "string",
|
||||
"format": "datetime",
|
||||
"format": "date-time",
|
||||
"default": "dayjs.now()"
|
||||
},
|
||||
"dt_update": {
|
||||
"type": "string",
|
||||
"format": "datetime"
|
||||
"format": "date-time"
|
||||
},
|
||||
"dt_lastlogin": {
|
||||
"type": "string",
|
||||
"format": "datetime"
|
||||
"format": "date-time"
|
||||
},
|
||||
"dt_close": {
|
||||
"type": "string",
|
||||
"format": "datetime"
|
||||
"format": "date-time"
|
||||
},
|
||||
"recoveryauth": {
|
||||
"type": "object",
|
@@ -9,6 +9,7 @@
|
||||
"mainlivinglocation":{"type":"object","$ref":"https://schema.org/PostalAddress"},
|
||||
"secondlivinglocation":{"type":"object","$ref":"https://schema.org/PostalAddress"},
|
||||
"thirdlivinglocation":{"type":"object","$ref":"https://schema.org/PostalAddress"},
|
||||
"fourthlivinglocation":{"type":"object","$ref":"https://schema.org/PostalAddress"},
|
||||
"seekcriterias":{"type":"array","$ref":"schema/seekcriteria.json"},
|
||||
"skills":{"type":"array","$ref":"schema/skills.json"},
|
||||
"educations":{"type":"array","$ref":"schema/educations.json"},
|
@@ -21,10 +21,9 @@
|
||||
"default": "active",
|
||||
"type": "string",
|
||||
"enum":["chain","unchain","tochain"]
|
||||
}
|
||||
},
|
||||
"dns": {
|
||||
"type": "array"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["townId", "status", "nationId", "dns"],
|
||||
@@ -34,4 +33,4 @@
|
||||
{ "key": "nationId", "value": "townId" },
|
||||
{ "key": "townId", "value": [] }
|
||||
]
|
||||
}
|
||||
}
|
@@ -17,10 +17,9 @@
|
||||
"type": "string",
|
||||
"$ref": "nationchains/nations/idx/nations_uuid_uuid.json"
|
||||
},
|
||||
"status": {
|
||||
"default": "unchain",
|
||||
"druidId": {
|
||||
"type": "string",
|
||||
"enum": ["chain","tochain","unchain"]
|
||||
"$ref": "nationchains/pagans/idx/alias_all.json"
|
||||
},
|
||||
"dns": {
|
||||
"type": "array",
|
@@ -9,7 +9,7 @@ root {{{dirapi}}}/;
|
||||
location ~* /nationchains/schema/ {
|
||||
#outside of nationchains for git purpose
|
||||
rewrite /nationchains/schema/(.*$) /$1 break;
|
||||
root {{{dirapi}}}/adminapi/www/adminapx/schema/;
|
||||
root {{{dirapi}}}/adminapi/schema/;
|
||||
}
|
||||
# /plugins/pluginame/components/xxx?plugin=pluginname&pluginkey=key
|
||||
# acess if exist pluginkey
|
||||
|
@@ -9,6 +9,8 @@
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- fontawesome icon cdn -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/all.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="static/style/apxobjmanager.css">
|
||||
<script>
|
||||
const apxlocal = {
|
||||
headers: { xalias: "anonymous", xhash: "anonymous", xdays: 0, xtribe: "town", xapp: "adminapx", xlang: "en" },
|
||||
@@ -36,6 +38,7 @@
|
||||
<script src="static/js/apxtribes.js"></script>
|
||||
<script src="static/js/apxtowns.js"></script>
|
||||
<script src="static/js/apxapp.js"></script>
|
||||
<script src="static/js/apxobjmanager.js"></script>
|
||||
<style>
|
||||
.fakeimg {
|
||||
height: 200px;
|
||||
@@ -89,8 +92,9 @@
|
||||
aria-expanded="false">Mayor's Town</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" add2data tpl="static/tpl/townowner_en.mustache"
|
||||
onclick="app.load('apxmain','townowner',towns.loadtpldata())">Own this town</a></li>
|
||||
<li><a class="dropdown-item" href="#">Manage Tribes</a></li>
|
||||
onclick="app.load('apxmain','townowner',towns.loadtpldata('owner'))">Own this town</a></li>
|
||||
<li><a class="dropdown-item" add2data tpl="static/tpl/towntribes_en.mustache"
|
||||
onclick="app.load('apxmain','towntribes',towns.loadtpldata('tribes'))">Manage Tribes</a></li>
|
||||
<li><a class="dropdown-item" href="#">Backup Town/Tribes</a></li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
|
27
adminapi/www/adminapx/static/js/apxobjmanager.js
Normal file
27
adminapi/www/adminapx/static/js/apxobjmanager.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/*eslint no-undef:0*/
|
||||
/*eslint-env browser*/
|
||||
|
||||
"use strict";
|
||||
var objman = objman || {};
|
||||
|
||||
|
||||
objman.objedit = (idcomponent,id) => {
|
||||
const objdoc = document.getElementById(idcomponent);
|
||||
objdoc.querySelector(".objlist").classList.add("d-none");
|
||||
objdoc.querySelector(".objitm").classList.remove("d-none");
|
||||
objdoc.querySelector(".objaddedit").classList.add("hide");
|
||||
objdoc.querySelector(".inputfilter").classList.add("hide");
|
||||
objdoc.querySelector(".btnfilter").classList.add("hide");
|
||||
objdoc.querySelector(".objlistreturn").classList.remove("d-none");
|
||||
//recupere les data et le schema
|
||||
};
|
||||
objman.returnlist = (idcomponent) => {
|
||||
const objdoc = document.getElementById(idcomponent);
|
||||
objdoc.querySelector(".objlist").classList.remove("d-none");
|
||||
objdoc.querySelector(".objitm").classList.add("d-none");
|
||||
objdoc.querySelector(".objaddedit").classList.remove("hide");
|
||||
objdoc.querySelector(".inputfilter").classList.remove("hide");
|
||||
objdoc.querySelector(".btnfilter").classList.remove("hide");
|
||||
objdoc.querySelector(".objlistreturn").classList.add("d-none");
|
||||
};
|
||||
|
@@ -129,7 +129,7 @@ pagans.createIdentity = async (alias, passphrase = "") => {
|
||||
apx.data.tmp = keys; // to make it available for btn download
|
||||
document.getElementById("generatekeys").classList.add("d-none");
|
||||
document.getElementById("trustintribe").classList.remove("d-none");
|
||||
document.getElementById("downloadkeys").classList.remove("d-none");
|
||||
//document.getElementById("downloadkeys").classList.remove("d-none");
|
||||
document.getElementById("createId").classList.remove("d-none");
|
||||
};
|
||||
|
||||
@@ -188,6 +188,12 @@ pagans.registerIdentity = async () => {
|
||||
.post("api/pagans", data, { headers: apx.data.headers })
|
||||
.then((reppagan) => {
|
||||
console.log(reppagan);
|
||||
if (reppagan.status==200) {
|
||||
document.getElementById('downloadkeys').classList.remove('d-none');
|
||||
alert("Your identity is created, don't forget to download your key")
|
||||
}else{
|
||||
alert('Check the console an error appear');
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("sorry", err);
|
||||
|
@@ -4,26 +4,59 @@
|
||||
"use strict";
|
||||
var towns = towns || {};
|
||||
|
||||
towns.loadtpldata = () => {
|
||||
towns.loadtpldata = (fortpl) => {
|
||||
// adapte tpldata to template tpl
|
||||
const dataowner = apx.data.tpldata.setup;
|
||||
dataowner.alias=apx.data.headers.xalias;
|
||||
dataowner.auth = dataowner.alias!="anonymous";
|
||||
dataowner.devtown = dataowner.townId == "devfarm";
|
||||
if (dataowner.mayorid) dataowner.owner = dataowner.mayorid == dataowner.alias;
|
||||
console.log('Data return to template',dataowner)
|
||||
return dataowner;
|
||||
if (fortpl == "owner") {
|
||||
const dataowner = apx.data.tpldata.setup;
|
||||
dataowner.alias = apx.data.headers.xalias;
|
||||
dataowner.auth = dataowner.alias != "anonymous";
|
||||
dataowner.devtown = dataowner.townId == "devfarm";
|
||||
if (dataowner.mayorId)
|
||||
dataowner.owner = dataowner.mayorId == dataowner.alias;
|
||||
console.log("Data return to template", dataowner);
|
||||
return dataowner;
|
||||
}
|
||||
if (fortpl == "tribes") {
|
||||
const data= {
|
||||
idcomponent: "tribesmanager",
|
||||
objectname:"tribes",
|
||||
itm: [
|
||||
{ tribeId: "tribe1", druidId: "philc" },
|
||||
{ tribeId: "tribe2", druidId: "toto" },
|
||||
]
|
||||
};
|
||||
data.tplform=`
|
||||
<div class='mb-3'>
|
||||
<label for='tribeIdinput' class='form-label'>Tribes Name</label>
|
||||
<input type='text' class='form-control' id='tribIdinput' placeholder='A unique name'>
|
||||
</div>
|
||||
<div class='mb-3'>
|
||||
<label for='druidIdinput' class='form-label'>Druid Alias</label>
|
||||
<input type='text' class='form-control' id='druidIdinput' placeholder='An existing alias to become Tribe's Druid'>
|
||||
</div>
|
||||
<div class='input-group mb-3 objaction'>
|
||||
<button class=' objsave btn btn-outline-primary btn-sm' onclick='towns.addupdatetribe('{{tribeId');'><i class='bi-cloud-arrow-up'></i></button>
|
||||
</div>`;
|
||||
return data;
|
||||
}
|
||||
};
|
||||
towns.owntown = (newowner) => {
|
||||
// only the owner can give ownership to someone else
|
||||
if (!newowner) {newowner=apx.data.headers.xalias}
|
||||
axios.get(`api/towns/changeowner/${newowner}`,{ headers: apx.data.headers }).then(rep=>{
|
||||
console.log(rep)
|
||||
apx.data.tpldata.setup.moyorId=newowner;
|
||||
apx.save();
|
||||
app.load('apxmain','townowner',towns.loadtpldata())
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
if (!newowner) {
|
||||
newowner = apx.data.headers.xalias;
|
||||
}
|
||||
axios
|
||||
.get(`api/towns/changeowner/${newowner}`, { headers: apx.data.headers })
|
||||
.then((rep) => {
|
||||
console.log(rep);
|
||||
apx.data.tpldata.setup.mayorId = newowner;
|
||||
apx.save();
|
||||
app.load("apxmain", "townowner", towns.loadtpldata());
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
towns.addtribe=(tribeId)=>{
|
||||
|
||||
}
|
8
adminapi/www/adminapx/static/style/apxobjmanager.css
Normal file
8
adminapi/www/adminapx/static/style/apxobjmanager.css
Normal file
@@ -0,0 +1,8 @@
|
||||
.objmanager .list-group-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.objmanager .hide {
|
||||
visibility: hidden;
|
||||
}
|
@@ -4,8 +4,8 @@
|
||||
<p>Step by step </p>
|
||||
<div class="input-group mb-3">
|
||||
<input class="form-control me-1" type="search" placeholder="Search" aria-label="Search">
|
||||
<button class="btn btn-outline-primary" onclick="app.search(this)">
|
||||
<i class="fa-solid fa-magnifying-glass"></i>
|
||||
<button class="btn btn-outline-primary btn-sm" onclick="app.search(this)">
|
||||
<i class="bi-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
<h4 class="mt-4">Articles</h4>
|
||||
|
@@ -20,7 +20,7 @@
|
||||
{{^mayorId}}
|
||||
<p>
|
||||
This town is not own by a mayor, anyone can use a pagan account to tell that he is owning this, so please,
|
||||
{{#auth}} you are authenticate under alias: {{alias}} <button class="btn btn-primary" onclick="towns.owntown();">Own this town</button>
|
||||
{{#auth}} you are authenticate under alias: {{alias}} <button class="btn btn-primary" onclick="towns.owntown('{{alias}}');">Own this town</button>
|
||||
{{/auth}}
|
||||
{{^auth}} you have to be authenticat with an alias to own this town. go to Pagan / create login logout and authentify yourself and come back here.
|
||||
{{/auth}}
|
||||
@@ -30,13 +30,13 @@
|
||||
{{#devtown}}
|
||||
<p>You need to change town name (by default it is for dev "devfarm") by running on serveur as sudoer user: </p>
|
||||
<code>node apxtrib.js nationId:nationRequested townId:nameNotalreadyUse dns:domainToAccessTown </code>
|
||||
<p>Come back here.</p>
|
||||
<p>Then Come back here.</p>
|
||||
{{/devtown}}
|
||||
{{^devtown}}
|
||||
<p> As owner you({{alias}}) can give the ownership of this town to an other alias. Be carefull when you click on this button you lose all your accessright on this town.</p>
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" placeholder="Give alias to take the ownership" aria-label="New owner alias" aria-describedby="button-chgown">
|
||||
<button class="btn btn-outline-secondary" type="button" id="button-chgown">Give him the role on this town</button>
|
||||
<input id="newowner" type="text" class="form-control" placeholder="Give alias to take the ownership" aria-label="New owner alias" aria-describedby="button-chgown">
|
||||
<button class="btn btn-outline-secondary" type="button" id="button-chgown" onclick="towns.owntown(document.getelementbyId('newowner').value)">Give him the role on this town</button>
|
||||
</div>
|
||||
|
||||
{{/devtown}}
|
||||
|
42
adminapi/www/adminapx/static/tpl/towntribes_en.mustache
Normal file
42
adminapi/www/adminapx/static/tpl/towntribes_en.mustache
Normal file
@@ -0,0 +1,42 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h4 class="text-center">Manage your tribes</h4>
|
||||
<div id="{{idcomponent}}" class="col-sm-6 objmanager" >
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Tribes</p>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<div class="input-group mb-3">
|
||||
<input class="inputfilter form-control me-1" type="search" placeholder="Filter" aria-label="Search">
|
||||
<button class="btnfilter btn btn-outline-primary btn-sm" onclick="objman.filter('{{idcomponent}}';this)">
|
||||
<i class="bi-search"></i>
|
||||
</button>
|
||||
<button class=" objaddedit btn btn-outline-primary btn-sm" onclick="objman.objedit('{{idcomponent}}');"><i class="bi-plus"></i></button>
|
||||
<button class=" objaddedit btn btn-outline-primary btn-sm" onclick="objman.objedit('{{schema}}');"><i class="bi-filetype-json"></i></button>
|
||||
<button class="objlistreturn btn btn-outline-primary btn-sm d-none" onclick="objman.returnlist('{{idcomponent}}')"><i class="bi-list-ul"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="objlist">
|
||||
<ul class="list-group">
|
||||
{{#itm}}
|
||||
<li class="list-group-item">
|
||||
<span>{{tribeId}} ({{druidId}})</span>
|
||||
<div>
|
||||
<button class="btn btn-outline-primary btn-sm" onclick="objman.objedit('{{idcomponent}}','{{tribeId}}')"><i class="bi-pen"></i></button>
|
||||
<button class="btn btn-outline-primary btn-sm" onclick="{{fctdel}}('{{objectname}}',{{tribeId}})"><i class="bi-trash"></i></button>
|
||||
</div>
|
||||
</li>
|
||||
{{/itm}}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="objitm d-none">
|
||||
{{{tplform}}}
|
||||
<div class="msgaction"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6" >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user