Add privatri wco
This commit is contained in:
@@ -196,7 +196,7 @@ apx.listendatawco = (newpropertie) => {
|
||||
if (!apx.wco) apx.wco = {};
|
||||
console.log(
|
||||
"wco dynamic into the webpage",
|
||||
apx.wco,
|
||||
apx.data.wco,
|
||||
"no propertie to add:",
|
||||
!newpropertie
|
||||
);
|
||||
@@ -217,13 +217,19 @@ apx.listendatawco = (newpropertie) => {
|
||||
const elements = document.querySelectorAll(`[data-wco='${p}']`);
|
||||
elements.forEach((e) => actionprop(apx.data.wco[p], e));
|
||||
//console.log(p, Object.hasOwnProperty(apx.wco));
|
||||
if (Object.hasOwnProperty(apx.wco)) {
|
||||
Object.defineProperty(apx.wco, p, {
|
||||
if (!apx.data.wco.hasOwnProperty(p)) {
|
||||
let _val = apx.data.wco[p]; // Stocke la valeur initiale
|
||||
Object.defineProperty(apx.data.wco, p, {
|
||||
get: () => _val,
|
||||
set: (newv) => {
|
||||
this[p] = newv;
|
||||
_val = newv; // Met à jour la valeur interne
|
||||
const elements = document.querySelectorAll(`[data-wco='${p}']`); // Re-sélectionne les éléments au cas où le DOM aurait changé
|
||||
elements.forEach((e) => actionprop(newv, e));
|
||||
},
|
||||
});
|
||||
if (_val !== undefined) {
|
||||
apx.data.wco[p] = _val;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -491,7 +497,7 @@ apx.update = async () => {
|
||||
console.log("WARNING!!, local apxtri.wco was erase by updatelocaldb.wco");
|
||||
}*/
|
||||
Object.keys(initset.data.data).forEach((k) => {
|
||||
if (k != "headers") {
|
||||
if (k !== "headers") {
|
||||
apx.data[k] = initset.data.data[k];
|
||||
}
|
||||
});
|
||||
|
@@ -2,7 +2,7 @@ var apx = apx || {};
|
||||
apx.apxauth = {};
|
||||
apx.apxauth.loadwco = async (id, ctx) => {
|
||||
// check if not authenticate, do nothing cause by default screensignin and wait authentification
|
||||
// if authenticate, if url xhash then redirect if no url then change wco-link=screenmytribes
|
||||
// if authenticate, if url xhash then redirect if no url then change wco-link=screenmyworld
|
||||
// if (dayjs(apx.data.headers.xdays).diff(dayjs(), "hours") >= 24) apx.apxauth.checkisauth();
|
||||
//load main.mustache of the component
|
||||
//when wco-xxx change it run this function
|
||||
@@ -35,7 +35,7 @@ apx.apxauth.getdata = (id, ctx) => {
|
||||
? apx.data.appdata.emailsupport
|
||||
: "";
|
||||
switch (ctx.link) {
|
||||
case "logout":
|
||||
case "myworld":
|
||||
if (!data.profils) data.profils = [];
|
||||
apx.data.headers.xprofils.forEach((p) => {
|
||||
if (!["anonymous", "pagans", "persons"].includes(p)) {
|
||||
@@ -45,15 +45,47 @@ apx.apxauth.getdata = (id, ctx) => {
|
||||
data.noprofils = data.profils.length == 0;
|
||||
data.member = apx.data.headers.xprofils.includes("persons");
|
||||
data.websites = apx.data.appdata.websites;
|
||||
// get tribes activities
|
||||
/*["", "https://wall-ants.ndda.fr"];
|
||||
data.optionlinks=apx.data.tpldata[tpldataname].optionlinks
|
||||
data.town=apx.data.town
|
||||
data.nation=apx.data.nation
|
||||
if (1==1 || apx.data.headers.xprofils.includes('major')){
|
||||
apx.data.tpldata[tpldataname].optionlinksmajor.forEach(o=>data.optionlinks.push(o))
|
||||
apx.save()
|
||||
}
|
||||
// get towns list
|
||||
axios
|
||||
.get(`/api/apxtri/tribes/activities`, {
|
||||
.get(`/api/apxtri/odmdb/idx/apxtri/towns/towns`, {
|
||||
headers: apx.data.headers,
|
||||
})
|
||||
.then((rep) => {})
|
||||
.catch((err) => {});
|
||||
*/
|
||||
.then((rep) => {
|
||||
console.log(rep)
|
||||
if (rep.status==200){
|
||||
apx.data.itms.towns=rep.data.data.idx
|
||||
data.townsnumber= Object.keys(apx.data.itms.towns).length;
|
||||
apx.data.wco.townsnumber={textContent:Object.keys(apx.data.itms.towns).length};
|
||||
apx.listendatawco('townsnumber');
|
||||
apx.save()
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("ERROR, geting towns itms not available",err)
|
||||
});
|
||||
axios
|
||||
.get(`/api/apxtri/odmdb/idx/apxtri/pagans/lst_alias`, {
|
||||
headers: apx.data.headers,
|
||||
})
|
||||
.then((rep) => {
|
||||
if (rep.status==200){
|
||||
console.log(rep)
|
||||
data.pagansnumber=rep.data.data.idx.length
|
||||
apx.data.wco.pagansnumber={textContent:rep.data.data.idx.length};
|
||||
apx.listendatawco('pagansnumber');
|
||||
apx.save();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("ERROR, geting pagans itms not available",err)
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -253,7 +285,7 @@ apx.apxauth.authentifyme = async (
|
||||
//location.reload();
|
||||
document
|
||||
.getElementById(idparent)
|
||||
.setAttribute("wco-link", "mytribes");
|
||||
.setAttribute("wco-link", "myworld");
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -484,7 +516,7 @@ apx.apxauth.authenticatedetachedSignature = async (
|
||||
message
|
||||
) => {
|
||||
/**
|
||||
* Check that alias (pubkey) signe a message
|
||||
* Check that alias (pubkey) sign a message
|
||||
* @alias {string} alias link to the publickey
|
||||
* @pubK {string} publiKey text format
|
||||
* @detachedSignature {string} a detachedsignatured get from apx.apxauth.detachedSignature
|
||||
|
@@ -1,39 +0,0 @@
|
||||
<div class="flex flex-col space-y-1 text-center">
|
||||
<div class="mt-1">
|
||||
<h1 class="mb-6">
|
||||
Bonjour {{xalias}},
|
||||
</h1>
|
||||
<p>
|
||||
Si cet appareil ne vous appartiens pas et que vous n'utilisez pas l'application, vous devriez vous deconnecter.
|
||||
</p>
|
||||
<p class="text-center text-gray-500">
|
||||
Nettoyer mes traces de cet appareil?
|
||||
<a class="font-semibold leading-6 text-secondary hover:text-primary"
|
||||
onclick="apx.apxauth.logout('{{id}}','logout','logout','apxauth')">Se deconnecter</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<p class="text-center text-gray-500">
|
||||
Voir mes échanges?
|
||||
<a class="font-semibold leading-6 text-secondary hover:text-primary"
|
||||
href="https://wall-ants.ndda.fr/apxwallet_fr.html" >Mon activité </a>
|
||||
</p>
|
||||
{{#member}}
|
||||
<p>
|
||||
Vous êtes membre de {{xtribe}} {{#noprofils}} sand profil particulier {{/noprofils}} {{^noprofils}}avec le(s) profil(s):<br><span class="text-info"> {{#profils}} {{.}}<br> {{/profils}} </span> {{/noprofils}}
|
||||
</p>
|
||||
{{/member}}
|
||||
{{^member}}
|
||||
<p> Vous n'êtes pas encore membre de {{xtribe}} </p>
|
||||
<p class=" mt-1 text-center text-gray-500">
|
||||
Envie d'jouter cette tribut {{xtribe}}?
|
||||
<a class="font-semibold leading-6 text-secondary hover:text-primary"
|
||||
onclick="apx.apxauth.jointribe('{{id}}')">Rejoindre {{xtribe}}</a>
|
||||
</p>
|
||||
{{/member}}
|
||||
<p>Les applications ou pages web de {{xtribe}} à visiter:<br>
|
||||
{{#websites}}<a class="font-semibold leading-6 text-secondary hover:text-primary" href='{{{href}}}'>{{{name}}}</a><br> {{/websites}}
|
||||
</p>
|
||||
<button class="btn btn-primary" onclick="apx.apxauth.runtest()">testbtn</button>
|
||||
</div>
|
||||
</div>
|
@@ -1,23 +0,0 @@
|
||||
<div class="flex flex-col space-y-1 text-center">
|
||||
<div class="mt-1">
|
||||
<h1 class="mb-6">
|
||||
Bonjour {{xalias}},
|
||||
</h1>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<p class="text-center text-gray-500">
|
||||
Redirige vers
|
||||
<a class="font-semibold leading-6 text-secondary hover:text-primary"
|
||||
onclick="apx.apxauth.redirecturlwithauth('http://recruiter.smatchit.newdev.ants/src/offer_fr.html','smatchit','recruiter',true);" >Redirige vers recruiter.smatchit.io/offer_fr.html&xhash....</a>
|
||||
</p>
|
||||
{{#member}}
|
||||
<p>
|
||||
Vous êtes membre de {{xtribe}} {{#noprofils}} sand profil particulier {{/noprofils}} {{^noprofils}}avec le(s) profil(s):<br><span class="text-info"> {{#profils}} {{.}}<br> {{/profils}} </span> {{/noprofils}}
|
||||
</p>
|
||||
{{/member}}
|
||||
<p>Les applications ou pages web de {{xtribe}} à visiter:<br>
|
||||
{{#websites}}<a class="font-semibold leading-6 text-secondary hover:text-primary" href='{{{href}}}'>{{{name}}}</a><br> {{/websites}}
|
||||
</p>
|
||||
<button class="btn btn-primary" onclick="apx.apxauth.runtest()">testbtn</button>
|
||||
</div>
|
||||
</div>
|
41
wco/apxauth/screenmyworld_fr.mustache
Normal file
41
wco/apxauth/screenmyworld_fr.mustache
Normal file
@@ -0,0 +1,41 @@
|
||||
<div class="p-2">
|
||||
Authentifié avec l'alias: <span class="text-success">{{xalias}}</span> dans <span class="text-success">{{town}}-{{nation}}</span>
|
||||
</div>
|
||||
<div class="p-4 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 justify-items-center">
|
||||
{{#optionlinks}}
|
||||
<div class="indicator">
|
||||
{{#notification_count}}
|
||||
<span class="indicator-item badge badge-{{typebadge}} text-white">{{notification_count}}</span>
|
||||
{{/notification_count}}
|
||||
<a {{{onclick}}} title="{{title}}" class="grid w-20 h-20 bg-base-200 rounded-lg place-items-center hover:bg-base-300 transition-colors">
|
||||
{{{svg}}}
|
||||
</a>
|
||||
</div>
|
||||
{{/optionlinks}}
|
||||
</div>
|
||||
<div class="flex justify-center p-2">
|
||||
<div class="stats stats-horizontal shadow">
|
||||
<div class="stat place-items-center">
|
||||
<div class="stat-title">Nombre d'uniques</div>
|
||||
<div class="stat-value" data-wco="pagansnumber">{{pagansnumber}}</div>
|
||||
<div class="stat-desc">identités actives</div>
|
||||
</div>
|
||||
<div class="stat place-items-center">
|
||||
<div class="stat-title">Nombre de towns</div>
|
||||
<div class="stat-value text-secondary" data-wco="townsnumber">{{townsnumber}}</div>
|
||||
<div class="stat-desc text-secondary">Actives en ce moment</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-4 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 justify-items-center">
|
||||
{{#mytribes}}
|
||||
<div class="indicator">
|
||||
{{#notification_count}}
|
||||
<span class="indicator-item badge badge-{{typebadge}} text-white">{{notification_count}}</span>
|
||||
{{/notification_count}}
|
||||
<a {{{onclick}}} title="{{title}}" class="grid w-20 h-20 bg-base-200 rounded-lg place-items-center hover:bg-base-300 transition-colors">
|
||||
{{{tribename}}}
|
||||
</a>
|
||||
</div>
|
||||
{{/mytribes}}
|
||||
</div>
|
@@ -3,61 +3,72 @@ var apx = apx || {};
|
||||
apx.crypto = apx.crypto || {};
|
||||
|
||||
apx.crypto.genKey = async (uuid) => {
|
||||
return await openpgp.generateKey(
|
||||
{
|
||||
type: "ecc",
|
||||
curve: "curve25519",
|
||||
userIDs: [
|
||||
{
|
||||
alias: uuid
|
||||
}
|
||||
],
|
||||
passphrase: "",
|
||||
format: "armored",
|
||||
}
|
||||
);
|
||||
return await openpgp.generateKey({
|
||||
type: "ecc",
|
||||
curve: "curve25519",
|
||||
userIDs: [
|
||||
{
|
||||
alias: uuid,
|
||||
},
|
||||
],
|
||||
passphrase: "",
|
||||
format: "armored",
|
||||
});
|
||||
};
|
||||
|
||||
apx.crypto.encryptMessage = async (message, publicKey) => {
|
||||
publicKey = await openpgp.readKey(
|
||||
{
|
||||
armoredKey: publicKey
|
||||
}
|
||||
);
|
||||
publicKey = await openpgp.readKey({
|
||||
armoredKey: publicKey,
|
||||
});
|
||||
|
||||
return await openpgp.encrypt(
|
||||
{
|
||||
message: await openpgp.createMessage(
|
||||
{
|
||||
text: message
|
||||
}
|
||||
),
|
||||
encryptionKeys: publicKey
|
||||
}
|
||||
);
|
||||
return await openpgp.encrypt({
|
||||
message: await openpgp.createMessage({
|
||||
text: message,
|
||||
}),
|
||||
encryptionKeys: publicKey,
|
||||
});
|
||||
};
|
||||
|
||||
apx.crypto.decryptMessage = async (encryptedMessage, privateKey) => {
|
||||
privateKey = await openpgp.readPrivateKey(
|
||||
{
|
||||
armoredKey: privateKey
|
||||
}
|
||||
);
|
||||
privateKey = await openpgp.readPrivateKey({
|
||||
armoredKey: privateKey,
|
||||
});
|
||||
|
||||
const message = await openpgp.readMessage(
|
||||
{
|
||||
armoredMessage: encryptedMessage
|
||||
}
|
||||
);
|
||||
const message = await openpgp.readMessage({
|
||||
armoredMessage: encryptedMessage,
|
||||
});
|
||||
|
||||
return await openpgp.decrypt(
|
||||
{
|
||||
message,
|
||||
decryptionKeys: privateKey
|
||||
}
|
||||
);
|
||||
return await openpgp.decrypt({
|
||||
message,
|
||||
decryptionKeys: privateKey,
|
||||
});
|
||||
};
|
||||
apx.crypto.isSignedby = async (
|
||||
alias,
|
||||
publicKey,
|
||||
detachedSignature,
|
||||
message
|
||||
) => {
|
||||
const publickey = await openpgp.readKey({ armoredKey: publicKey });
|
||||
const msg = await openpgp.createMessage({ text: message });
|
||||
const signature = await openpgp.readSignature({
|
||||
armoredSignature: atob(detachedSignature), // parse detached signature
|
||||
});
|
||||
const verificationResult = await openpgp.verify({
|
||||
msg, // Message object
|
||||
signature,
|
||||
verificationKeys: publickey,
|
||||
});
|
||||
const { verified, keyID } = verificationResult.signatures[0];
|
||||
try {
|
||||
await verified; // throws on invalid signature
|
||||
//console.log("Signed by key id " + keyID.toHex());
|
||||
return KeyId.toHex().alias == alias;
|
||||
} catch (e) {
|
||||
console.log("Signature could not be verified: " + e.message);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
apx.crypto.sign = async (message, privateKey) => {
|
||||
privateKey = await openpgp.readPrivateKey(
|
||||
{
|
||||
@@ -107,4 +118,4 @@ apx.crypto.verifySignature = async (message, signature, publicKey) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default apx;
|
||||
export default apx;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
"apxauthscreensignup": "apxtri/objects/wco/apxauth/screensignup",
|
||||
"apxauthscreensignin": "apxtri/objects/wco/apxauth/screensignin",
|
||||
"apxauthscreenlogout": "apxtri/objects/wco/apxauth/screenlogout",
|
||||
"apxauthscreenmytribes": "apxtri/objects/wco/apxauth/screenmytribes",
|
||||
"apxauthscreenmyworld": "apxtri/objects/wco/apxauth/screenmyworld",
|
||||
"apxauthscreeninformation": "apxtri/objects/wco/apxauth/screeninformation",
|
||||
"apxauthscreenforgetkey": "apxtri/objects/wco/apxauth/screenforgetkey"
|
||||
},
|
||||
|
Reference in New Issue
Block a user