Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
f9a8d22a5f | |||
7c08cf12d4 | |||
1c02247714 | |||
f89c825357 | |||
4d4ad94bcc |
2 changed files with 23 additions and 16 deletions
31
README.md
31
README.md
|
@ -1,21 +1,28 @@
|
|||
# misskey gooner remover 3000
|
||||
|
||||
simple nodejs script to remove inactive accounts on sharkey / misskey fediverse instances
|
||||
Simple nodejs script to remove inactive accounts on sharkey / misskey fediverse instances
|
||||
|
||||
## installation
|
||||
## Installation
|
||||
|
||||
```
|
||||
bun install
|
||||
node main.js
|
||||
1. Install bun and run:
|
||||
|
||||
```
|
||||
```text
|
||||
bun install
|
||||
node main.js
|
||||
```
|
||||
|
||||
## ENV structure
|
||||
## Create env file
|
||||
|
||||
```
|
||||
USER_TOKEN=token
|
||||
INSTANCE_URL=https://example.com
|
||||
PERIOD=int // Time in days
|
||||
```
|
||||
1. Create an API key with the permissions
|
||||
- Delete user account
|
||||
- View private user info
|
||||
|
||||
2. Create a `.env` file in the current directory with:
|
||||
|
||||
```env
|
||||
USER_TOKEN=token
|
||||
INSTANCE_URL=https://example.com
|
||||
PERIOD=int // Time in days
|
||||
```
|
||||
|
||||
License: MIT
|
||||
|
|
8
main.js
8
main.js
|
@ -57,13 +57,13 @@ async function main() {
|
|||
const createdAt = new Date(user.createdAt);
|
||||
const updatedAt = new Date(user.updatedAt);
|
||||
const excludedUsers = ['instance.actor', 'relay.actor'];
|
||||
return user.notesCount === 0 &&
|
||||
createdAt < timeAgo &&
|
||||
return user.notesCount === 0 &&
|
||||
createdAt < timeAgo &&
|
||||
updatedAt < timeAgo &&
|
||||
!excludedUsers.includes(user.username)
|
||||
});
|
||||
|
||||
console.log(`Found ${usersToDelete.length} users matching criteria (no posts, not updated, and older than 5 days)`);
|
||||
console.log(`Found ${usersToDelete.length} users matching criteria (no posts, not updated, and older than ${PERIOD} days)`);
|
||||
|
||||
console.log('\nUsers to be deleted:');
|
||||
usersToDelete.forEach(user => {
|
||||
|
@ -75,7 +75,7 @@ async function main() {
|
|||
console.log();
|
||||
|
||||
const confirmed = await askForConfirmation(`Are you sure you want to delete ${usersToDelete.length} users?`);
|
||||
|
||||
|
||||
if (!confirmed) {
|
||||
console.log('Operation cancelled by user');
|
||||
rl.close();
|
||||
|
|
Loading…
Reference in a new issue