mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-09 08:35:14 +08:00
pushy uploadIpa
This commit is contained in:
@@ -13,35 +13,31 @@ const {
|
||||
const crypto = require('crypto');
|
||||
|
||||
function md5(str) {
|
||||
return crypto.createHash('md5').update(str).digest('base64');
|
||||
return crypto.createHash('md5').update(str).digest('hex');
|
||||
}
|
||||
|
||||
exports.commands = {
|
||||
login: async function ({args}){
|
||||
const login = args[0] || await question('user:');
|
||||
const email = args[0] || await question('email:');
|
||||
const pwd = args[1] || await question('password:', true);
|
||||
const {token} = await post('/user/login', {
|
||||
login,
|
||||
const {token, info} = await post('/user/login', {
|
||||
email,
|
||||
pwd: md5(pwd),
|
||||
});
|
||||
replaceSession({token});
|
||||
await saveSession();
|
||||
console.log('OK.');
|
||||
console.log(`Welcome, ${info.name}.`);
|
||||
},
|
||||
logout: async function (){
|
||||
await closeSession();
|
||||
console.log('Logged out.');
|
||||
},
|
||||
me: async function (){
|
||||
try {
|
||||
const me = await get('/user/me');
|
||||
console.log(me);
|
||||
} catch (e) {
|
||||
if (e.status === 401) {
|
||||
console.log('Not loggined.\nRun `pushy login` at your project directory to login.');
|
||||
} else {
|
||||
throw e;
|
||||
const me = await get('/user/me');
|
||||
for (const k in me) {
|
||||
if (k !== 'ok') {
|
||||
console.log(`${k}: ${me[k]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user