mirror of https://github.com/lukechilds/Agama.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
912 B
31 lines
912 B
module.exports = (shepherd) => {
|
|
/*
|
|
* type: GET
|
|
*
|
|
*/
|
|
shepherd.get('/auth/status', (req, res, next) => { // not finished
|
|
let successObj;
|
|
let _status = false;
|
|
|
|
if (Object.keys(shepherd.coindInstanceRegistry).length) {
|
|
if (Object.keys(shepherd.electrumCoins).length > 1 &&
|
|
shepherd.electrumCoins.auth) {
|
|
_status = true;
|
|
} else if (Object.keys(shepherd.electrumCoins).length === 1 && !shepherd.electrumCoins.auth) {
|
|
_status = true;
|
|
}
|
|
} else if (Object.keys(shepherd.electrumCoins).length > 1 && shepherd.electrumCoins.auth) {
|
|
_status = true;
|
|
} else if (Object.keys(shepherd.electrumCoins).length === 1 && !Object.keys(shepherd.coindInstanceRegistry).length) {
|
|
_status = true;
|
|
}
|
|
|
|
successObj = {
|
|
status: _status ? 'unlocked' : 'locked',
|
|
};
|
|
|
|
res.end(JSON.stringify(successObj));
|
|
});
|
|
|
|
return shepherd;
|
|
};
|