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.
34 lines
998 B
34 lines
998 B
7 years ago
|
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 = {
|
||
|
pubkey: 'nativeonly',
|
||
|
result: 'success',
|
||
|
handle: '',
|
||
|
status: _status ? 'unlocked' : 'locked',
|
||
|
duration: 2507830,
|
||
|
};
|
||
|
|
||
|
res.end(JSON.stringify(successObj));
|
||
|
});
|
||
|
|
||
|
return shepherd;
|
||
|
};
|