FoxxMD / context-mod

an event-based, reddit moderation bot built on top of snoowrap and written in typescript
https://contextmod.dev
MIT License
49 stars 11 forks source link

allow saving wiki changes #38

Closed OmgImAlexis closed 2 years ago

OmgImAlexis commented 2 years ago

Currently you can load but not save the config from the editor.

FoxxMD commented 2 years ago

Yep! My initial trepidation with this was that I didn't want to use the bot to do the edits as one of main selling points (imo) for CM is that only mods have control over their configs. During the bot setup the wikiedit permission is optional so that mods can be confident the bot can only read but not write its own config.

Recently though had a change of perspective when I saw how repost slueth did it -- which is when you (a mod) logs in to the site it asks for permissions for mod invite/etc. from YOU, rather than the bot. Then performs those actions on your behalf. Right now the web ui only asks for basic info to verify what subreddits you are a moderator of but I could leverage this for wiki saving.

Unlike repost sleuth though I'd like to make this a 2 tiered process. Initial authentication (logging in) is just for basic info. If you access the editor and want to also save it'll check what permissions you have (stored in session) and ask you to re-authenticate with wiki permissions if necessary. Then it stores the token with more permissions (in session) so it doesn't have to ask again later.

This should be doable with the current system. I think the only thing that needs to be done is keeping track of permissions requests with user token.