Commit Graph

44 Commits

Author SHA1 Message Date
Harvey Tindall 2f3d5e4e3a
discord: update profile list when changes occur 2023-10-11 12:00:38 +01:00
Harvey Tindall 2fb2f3ee74
discord: send error message when inv construction fails 2023-10-11 11:38:55 +01:00
Harvey Tindall 7813c8c68b
discord: Use GenerateInviteCode in /inv 2023-10-11 11:35:08 +01:00
Harvey Tindall 7db94dcebf
Merge /inv command additions
Merge branch 'main' of github.com:VioletLeporid/jfa-go
2023-10-11 11:25:00 +01:00
Violet Scheen 525c13ff6a
Update discord.go 2023-10-10 12:55:56 -04:00
Violet Scheen 0366e5116d
Update discord.go
Cleaning up a bit
2023-10-10 11:14:57 -04:00
Harvey Tindall 62923d5e45
discord: register available profiles for /inv
profiles are registered as options for /inv as startup. Note in
description added to restart jfa-go to reload them.
2023-10-10 15:15:25 +01:00
Harvey Tindall 10a32ad1ae
discord: re-add optional args 2023-10-10 14:52:54 +01:00
Harvey Tindall e52e21a54b
discord: fix up /inv basic functionality
sending now succeeds, and a reponse of "Invite sent." is given to the
requester. Also some formatting changes.
2023-10-10 13:45:29 +01:00
Violet Scheen dd93758b0e
Update discord.go 2023-10-03 23:59:42 -04:00
Violet Scheen b595d3ea03
Update discord.go 2023-10-03 23:37:24 -04:00
Violet Scheen 49dfac514d
Update discord.go 2023-10-03 23:22:20 -04:00
Violet Scheen 729548334d
Update discord.go 2023-09-30 12:16:06 -04:00
Violet Scheen 27f85f866e
Update discord.go
Hopefully functional, any errors are coming from elsewhere
2023-09-30 12:10:38 -04:00
Violet Scheen c43d5cf1b0
Update discord.go 2023-09-30 11:25:36 -04:00
HekeHokkus 3538935d3b
Update discord.go
Adding /invite command and Discord status message to the bot
2023-09-28 19:37:35 -04:00
HekeHokkus edf6c13f03
Update discord.go 2023-09-28 17:55:47 -04:00
HekeHokkus b30d6c3ee1
Update discord.go 2023-09-28 15:54:48 -04:00
Harvey Tindall b17d8424e9
profiles: fix application
moving to a DB meant empty slices in the Configuration & Policy structs
were being stored as null, and striking a nerve with Jellyfin.
Mediabrowser library change fixed that by de-nulling them itself, and a
new bool field called "Homescreen" is now used to decide if a profile
has a homescreen layout stored or not. This field is hopefully correctly
filled in during migration.
2023-06-26 13:01:17 +01:00
Harvey Tindall 833be688ac
storage: start db migration (badger(hold))
migrating to badger, with the badgerhold frontend. So far, done:
* Announcements (small, for a quick test)
* Discord/Telegram/Matrix/Email

most interaction with badgerhold is done through the standard
Get<x>/Get<x>Key/Set<x>Key/Delete<x>Key. UserExists functions have been
added for email and matrix, and those and the original ones now use a
query against the database rather than sifting through every record.
I've tagged these searched fields as "index" for badgerhold, although this
definitely isn't used yet, and i'm not entirely sure if it'll be useful.

migrateToBadger is now in migrations.go, and a temporary config key
"migrated_to_badger" has been added, although it isn't being used yet,
migration is just running every time during development.
2023-06-24 17:05:04 +01:00
Harvey Tindall 6b3fc3d492
lang: correct language names
Low German/Saxon (NDS) is empty entirely, which caused discord lang
registration to error, so i've just filled in the name. Somebody
directly translated "English (US)" into italian instead of putting
Italian in italian, corrected that. Use some common sense!
2023-06-23 13:09:26 +01:00
Harvey Tindall e4a7172517
messages: assign tokens to jf users on userpage
pins generated on the user page are assigned to that user, no other
jellyifn user can verify them.
2023-06-21 18:26:08 +01:00
Harvey Tindall 3747eaa3a7
messages: refactor dc/tg, fix tg
less external access to Discord/TelegramDaemon internals, will be easier
to keep user/admin-side uses functioning similarly. Also changed their
internal token stores to use a map, and store an expiry. verifiedTokens
is also now a map in telegram. Also fixed issue where token wasn't being
deleted after use on the user page.
2023-06-21 18:02:33 +01:00
Harvey Tindall 68004e1d34
storage: user set/get methods for contact method access
Get/GetKey/SetKey/DeleteKey methods are used for access to
email/discord/telegram/matrix, everywhere. Mutex added for each, avoids
concurrent read/write issues. Will also make potential transition to
database easier.
2023-06-20 12:19:24 +01:00
Harvey Tindall 094f7cea94
discord: use placeholder if guild icon not available
also centers the invite on the form/user discord modal.
2023-06-19 17:48:24 +01:00
Harvey Tindall 48403ce940
discord: proper support for discriminator-less
names with no discriminator are shown as @username, and search works
with the @ too. Also bumped go version to 1.20, since it was stuck on
1.16 and i felt like trying generics (in an ugly way).
2023-06-12 16:32:40 +01:00
Harvey Tindall ad40d7d8a9
fix bugs with restarts/interrupts
The password reset daemon wasn't being closed on restarts, so an extra
pwr would be sent w/ every restart. Restarts & Interrupts (Ctrl-C)
rarely worked, as there were multiple listeners to the "RESTART"
channel, and I didn't know the message was consumed by whoever got it
first, meaning if the main thread didn't get it first, the app wouldn't
quit. Listeners are now registered, and the restart message is
re-broadcasted until everyone's got it.

Fixes #264
2023-06-11 19:50:50 +01:00
Harvey Tindall 0674e04ee1
go module update/tidy 2023-02-20 10:47:54 +00:00
Harvey Tindall 4b02960fd1
form: add captcha regen button
lots of false negatives so this is a solution for now.

Also the registering of each discord command is now logged for debugging
purposes.
2022-01-26 22:14:16 +00:00
Harvey Tindall 15e5564b12
discord: add/move to slash commands
the version of the discord library with support for this isn't
necessarily stable, so normal ! commands will still be available. The
user is no longer DMed for the PIN, instead they type /pin <PIN>.
2022-01-26 21:47:02 +00:00
Harvey Tindall 8fd097836f
discord: send in-channel reply to !start 2022-01-14 17:26:19 +00:00
Harvey Tindall 25a1ca5a9f
bots: fix language selection
you may have to re-apply your language choice.
2022-01-14 17:01:42 +00:00
Harvey Tindall 32af107699
discord: add role to user on signup
This requires an extra permission, so you'll have to modify your bot
settings, kick it from your server and re-add it for this to work. The
role you select must also be lower in hierarchy than the bot's group.
2022-01-13 22:34:52 +00:00
Harvey Tindall 86ef665b12
Discord: Try to avoid more race conditions
also added RACE=on to Makefile to enable go's race detector.
2021-05-23 22:26:56 +01:00
Harvey Tindall 1f9af8df89
Discord: Add option to provide server invite
When enabled, a temporary one-use invite is created and shown to the
user on the account creation form.
2021-05-23 19:50:03 +01:00
Harvey Tindall 0676b6c41f
Discord: Display channel on account creation form 2021-05-23 17:31:20 +01:00
Harvey Tindall ce8cdced4d
Discord: Fix GetUsers, add invite messages
The "Send to" box on the invite tab now accepts username#discriminator,
and a search icon has been added which opens a search window similar to
the one on the accounts tab. DiscordDaemon.GetUsers was also very broken
and wouldn't work with full username#discriminator, that's been fixed.
2021-05-23 16:16:31 +01:00
Harvey Tindall 24fa841c0d
Discord: Wait for non-nil pointer to bot data
While testing others things, I had quite a few nil pointer dereference
errors from accessing bot data right after initializing. A for loop now
waits until the first of the pointers is non-nil, which should
hopefully avoid crashes.
2021-05-23 01:09:03 +01:00
Harvey Tindall 9fac79b1f0
Discord: Add users via accounts tab
Doesn't require a PIN like Telegram, as we can access a list of guild
users with the GuildMembers intent set. This has to be enabled under
Bot > Priviliged Gateway intents on the developer portal.
2021-05-22 21:42:15 +01:00
Harvey Tindall 591e3c5ca1
Discord: embed images
![alt](image link) is now converted to an image embed.
2021-05-22 15:32:51 +01:00
Harvey Tindall 3bf722c5fe
Discord: send links as embeds
Kind of janky but works. This kind of messes up the layout if you write
links in-line.
2021-05-21 21:59:50 +01:00
Harvey Tindall f8f5f35cc1
PIN verification, notifications, multiple notif providers
Discord, Email & Telegram can be enabled, although email is always
enabled right now (will fix). Also apparently markdown hyperlinks don't
work in Discord, eventually will implement something to convert them to
embeds.
2021-05-21 21:35:25 +01:00
Harvey Tindall 22bba922f9
Discord: Add !lang command 2021-05-18 18:41:42 +01:00
Harvey Tindall d928df7ab2
Discord: Start bot, add !start and pin validity check
The bot should be created by the admin and added to a discord server
mutual to the intended new user(s). On !start in the server,
communication is moved to DMs. Currently !start works, and validity of a
given PIN is checked although nothing it done with this yet.
2021-05-17 23:42:33 +01:00