getwtxt / getwtxt

twtxt registry server
https://sr.ht/~gbmor/getwtxt
GNU General Public License v3.0
43 stars 1 forks source link

howto delete a user entry #14

Closed cremesk closed 2 years ago

cremesk commented 3 years ago

hi,

how can i delete a user entry?

i use leveldb.

gbmor commented 2 years ago

Hey @cremesk

Sorry, I have been slacking on my projects so I didn't see this. Right now, you could use leveldb-cli or similar to remove them, however, that might be tedious because there will be a lot of records to remove. I plan to remove leveldb support and fix up sqlite support (sqlite is broken right now), and I'll add in an endpoint to delete a user. I should probably also add in an endpoint to accept an existing user list to make it easy to migrate... preserving add date etc.

I could probably hack something in sooner to delete a user.

gbmor commented 2 years ago

@cremesk I'm starting on this now. I'll add an endpoint for an administrator to use to delete a user. It'll be hacky, but I need to overhaul a good bit of this so I don't mind doing a hacky patch for this to get it working.

cremesk commented 2 years ago

hi @gbmor , thanks for your effort and also sorry for my late reply. I tried to use leveldb-cli but that seems kind of broken and is not executable.

gbmor commented 2 years ago

@cremesk OK, it's merged in.

There's a new config file field AdminPassword (just below DatabasePath in the provided default config), be sure to change it or getwtxt won't start.

Then:

$ curl -X DELETE -H 'X-Auth: mypassword' 'https://twtxt.envs.net/api/admin/users?url=http://example.com/twtxt.txt'

200 OK

Also the makefile should chmod 600 your existing config file but double check it after just to make sure everyone can't see the admin password

Lemme know when you have it set up and I'll close this.

cremesk commented 2 years ago

wow thank you ben! It works quite excellently here on my site!

also the update ran without problems ;)