modif model nginx
This commit is contained in:
@@ -20,6 +20,12 @@ const conf = require(`${process.env.dirtown}/conf.json`);
|
||||
const Pagans = {};
|
||||
|
||||
Pagans.getalias = (alias) => {
|
||||
/**
|
||||
* @param {string} alias a alias that exist or not
|
||||
* @return {object} { status: 200, ref:"pagans",msg:"aliasexist",data: { alias, publicKey } }
|
||||
* { status: 404, ref:"pagans",msg:"aliasdoesnotexist",data: { alias} }
|
||||
*
|
||||
**/
|
||||
console.log(`${conf.dirapi}/nationchains/pagans/itm/${alias}.json`);
|
||||
if (fs.existsSync(`${conf.dirapi}/nationchains/pagans/itm/${alias}.json`)) {
|
||||
return {
|
||||
@@ -41,12 +47,20 @@ Pagans.getalias = (alias) => {
|
||||
};
|
||||
|
||||
Pagans.getperson = (alias, tribeid) => {
|
||||
/**
|
||||
* @param {string} alias that exist
|
||||
* @param {string} tribeId that exist with a person alias
|
||||
* @return {object} { status: 200, ref:"pagans",msg:"personexist",data: { person } }
|
||||
* { status: 404, ref:"pagans",msg:"persondoesnotexist",data: { person } }
|
||||
*
|
||||
**/
|
||||
if (
|
||||
fs.existsSync(`${conf.dirtown}/tribes/${tribeid}/person/itm/${alias}.json`)
|
||||
) {
|
||||
const person = fs.readJsonSync(
|
||||
`${conf.dirtown}/tribes/${tribeid}/person/itm/${alias}.json`
|
||||
);
|
||||
delete person.auth;
|
||||
return {
|
||||
status: 200,
|
||||
ref: "Pagans",
|
||||
@@ -171,4 +185,15 @@ Pagans.authenticatedetachedSignature = async (
|
||||
}
|
||||
};
|
||||
|
||||
Pagans.keyrecovery = (tribeid, email) => {
|
||||
glob
|
||||
.GlobSync(`${conf.dirtown}/tribes/${tribeId}/Person/*.json`)
|
||||
.forEach((f) => {
|
||||
const person = fs.readJsonSync(f);
|
||||
if (person.recoveryauth && person.recoveryauth.email) {
|
||||
// send email (alias publickey privatekey )
|
||||
}
|
||||
});
|
||||
return { status: 200, ref: "Pagans", msg: "todo" };
|
||||
};
|
||||
module.exports = Pagans;
|
||||
|
Reference in New Issue
Block a user