This commit is contained in:
syuilo 2020-04-03 23:35:14 +09:00
parent 99fc77b678
commit eec1af1f52
11 changed files with 107 additions and 880 deletions

View file

@ -1,12 +1,12 @@
import { Users, Signins } from '../models';
// node built/tools/ show-signin-history username
// node built/tools/show-signin-history username
// => {Success} {Date} {IPAddrsss}
// node built/tools/ show-signin-history username user-agent,x-forwarded-for
// node built/tools/show-signin-history username user-agent,x-forwarded-for
// with user-agent and x-forwarded-for
// node built/tools/ show-signin-history username all
// node built/tools/show-signin-history username all
// with full request headers
async function main(username: string, headers?: string[]) {
@ -35,25 +35,22 @@ async function main(username: string, headers?: string[]) {
}
}
export default () => {
// get args
const args = process.argv.slice(3);
// get args
const args = process.argv.slice(2);
let username = args[0];
let headers: string[] | undefined;
let username = args[0];
let headers: string[] | undefined;
if (args[1] != null) {
headers = args[1].split(/,/).map(header => header.toLowerCase());
}
// normalize args
username = username.replace(/^@/, '');
main(username, headers).then(() => {
process.exit(0);
}).catch(e => {
console.warn(e);
process.exit(1);
});
if (args[1] != null) {
headers = args[1].split(/,/).map(header => header.toLowerCase());
}
// normalize args
username = username.replace(/^@/, '');
main(username, headers).then(() => {
process.exit(0);
}).catch(e => {
console.warn(e);
process.exit(1);
});