1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-11-09 20:00:12 +00:00
Commit Graph

177 Commits

Author SHA1 Message Date
ab3989f233
admin: add build tags to "About"
build tags like e2ee and external are now included in the about page.
2024-08-11 17:55:12 +01:00
86c7551ff8
proxy: use wherever http.Client is, update mautrix
Added a new common.ConfigurableTransport interface which mediabrowser,
ombi, jellyseer, discord, telegram and matrix (i.e.
ThirdPartService/ContactMethodLinker) now all implement. proxies are
bound to them in main.go, Email is still a special case (but from the
previous commit, mailgun does use the proxy).

mautrix/go has been updated, and context.TODO()s stuck everywhere since
I still don't really comprehend why I should use them (FIXME literally).
2024-08-09 21:42:16 +01:00
2310130e6b
api clients: return data, error, no status
jellyseerr already did this, but it's been standardised a little more.

Mediabrowser uses it's own genericErr function and error types due to
being a separate package, while jellyseerr and ombi now share errors
defined in common/.
2024-08-06 14:48:31 +01:00
8f3c723b07
systemd: get executable path properly
was just evaluating os.Args[0], which incorrectly points to your current
directory if jfa-go was in your PATH (i.e. you ran `jfa-go` not
`/usr/bin/jfa-go`). Uses Go's os.Executable() now. Fixes #352.
2024-08-04 20:53:09 +01:00
54e4a51a7f
users: huge cleanup/dedupe, interface-based third-party services
shared "newUser" method is now "NewUserPostVerification", and is shared
between all routes which create a jellyfin account. The new
"NewUserFromInvite", "NewUserFromAdmin" and "NewUserFromConfirmationKey"
are smaller as a result. Discord, Telegram, and Matrix now implement the
"ContactMethodLinker" and "ContactMethodUser" interfaces, meaning code
is shared a lot between them in the NewUser methods, and the specifics
are now in their own files. Ombi/Jellyseerr similarly implement a
simpler interface "ThirdPartyService", which simply has ImportUser and
AddContactMethod routes. Note these new interface methods are only used
for user creation as of yet, but could likely be used in other places.
2024-08-03 21:27:46 +01:00
e9b8d970d1
logging: start consolidating log lines
log messages are very fragmented and are often repeated many times throughout the software with small differences.

Messages will be listed in logmessages/, which are simply strings with
formatting directives if necessary. So far, only main.go has been
completed.
2024-07-31 17:45:05 +01:00
a136800ff2
jellyseerr: set appropriate daemon period
was 30s for testing, is now every 10 minutes.
2024-07-31 15:32:49 +01:00
1fa340f096
jellyseerr: add option to auto-import users
"import_existing" option in settings enables an every 5-minute daemon
which loops through users and imports them to Jellyseerr and copies
contact info, if necessary. Also sets new API client flag
AutoImportUsers, which decides whether to automatically import non-existent users in
it's various methods.

also cleaned up the various daemons in the software, most now using the
GenericDaemon struct and just providing a new constructor.

broken page loop in jellyseerr client also fixed.
2024-07-31 15:02:25 +01:00
785395dd20
disable request logging 2024-07-30 20:56:48 +01:00
35f8337a36
jellyseer: revert auto-nulling of NotifTypes
All-zeros in NotifTypes means the user shouldn't receive any
communication, which is a state we'd like to store in/apply from a profile.
2024-07-30 16:53:40 +01:00
a97bccc88f
jellyseerr: use in profiles, apply on user creation and modification
added in the same way as ombi profiles. Most code is copy-pasted and
adjusted from ombi (especially on web), so maybe this can be merged in
the future. Also, profile names are url-escaped like announcement
template names were not too long ago. API client has "LogRequestBodies"
option which just dumps the request body when enabled (useful for
recreating reqs in the jellyseerr swagger UI). User.Name() helper
returns a name from all three possible values in the struct.
2024-07-30 16:44:46 +01:00
7c989fda08
tls: don't "crash" on server close
TLS server section called Fatalf, while the normal section called Printf
on server close. Fatalf is now only called if the server wasn't shutdown
manually, e.g. when certificates are wrong. Same change was applied to
non-tls section, so crashes will actually occur when things like ports are occupied.

Fixes #343.
2024-07-21 17:27:41 +01:00
d7c94edc61
bump api version 2023-12-26 22:46:12 +00:00
b75bd4d6c5
Crash on SSL cert/key error, describe issue in log
if serving ssl/tls fails, the cert/key files are checked to see if they
    are accessible, and any errors logged.
2023-12-26 14:19:22 +00:00
00379824df
Merge branch 'main' into kimboslice99-main 2023-12-23 21:53:39 +00:00
269836fc99
ips: add advanced settings for ip logging 2023-12-23 21:00:32 +00:00
278588ca39
pwr: functioning captcha/recaptcha 2023-12-23 20:10:48 +00:00
bc2e9cffda
backups: move code to own files 2023-12-21 18:17:03 +00:00
ff73c72b0e
backups: add -restore cli argument 2023-12-21 17:27:28 +00:00
733ab37539
backups: add backup daemon to run every n minutes, keep x most recent backups 2023-12-21 13:03:16 +00:00
df1581d48e
activity: route to show activity activity log
filterable by type, sortable by time, and paginated.
2023-10-19 22:10:42 +01:00
742f5c095a
log: add basic database write debug logging
A series of settings can be found in Settings > Advanced for logging
writes to the database, for each main storage object. "All" logs all
writes, "Deletion" logs Delete* Calls and Write* calls where the
principal data in the object (e.g. address in an EmailAddress object) is
set to "".
2023-10-12 18:12:18 +01:00
5702e8012c
proxy: use for updater & SMTP
imports a new package to create a HTTP proxy dialer for the SMTP client.
2023-10-05 12:32:25 +01:00
523902f951
proxy: add http/socks5 support, use for Jellyfin
can be found in advanced. Currently only used for the main Jellyfin
client.
2023-10-05 11:25:58 +01:00
f6fdd41b35
jellyfin: retry initial connection (configurable)
retries initial connection to Jellyfin 6 times, with a 10s gap between,
before failing. SHould help with issues of jfa-go starting before
Jellyfin.
Configurable in Settings > Advanced > "Initial auth retry count/gap".
2023-10-03 09:33:56 +01:00
ea0598e507
db: move legacy data loading out of main/config
put it in loadLegacyData in migrations, which is only called by
migrateToBadger.
2023-06-25 20:17:10 +01:00
63948a6de0
db: migrate invites, user expiry
some fixes to stuff in there too, probably
2023-06-24 19:13:05 +01:00
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
b7b3aa1eb7
build: fix goreleaser, include optional builder name
builder name shows up in about section again, as does the build time.
2023-06-23 14:41:21 +01:00
14c18bd668
form: rework email confirmation
realized half the info from the signup form wasnt being stored in the JWT
used to create the account after email confirmation, and instead of
adding them, the -whole request- from the browser is stored temporarily
by the server, indexed by a smaller JWT that only includes the invite
code. Someone complained on reddit about me storing the password in the
JWT a while back, and although security-wise that isn't an issue (only
the server can decrypt the token), it doesn't happen anymore. Happy?
2023-06-21 21:14:41 +01:00
d3c5feaf1b
userpage: use form langfile, move login strings to common
login-related stuff was moved into common using the langmover script, so
that the user page doesn't have to use the admin language files.
2023-06-17 12:48:28 +01:00
726acb9c29
userpage: initial page
login, lang, and theme work. Currently only makes a request to a
hello-world type endpoint to verify auth works. Accessible at
/my/account.
2023-06-16 14:43:37 +01:00
918f8816c5
auth: slight refactor, setup user auth
user-auth.go contains slightly adjusted versions of auth.go functions,
for authorizing jellyfin users (admin or not). Refactored auth.go so that
most code is shared. User auth isn't hooked up yet, nor has it been
tested.
2023-06-15 21:32:18 +01:00
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
f88f71d933
pwreset: Stop daemon on restart, dont fail if json is malformed
daemon now stops on the RESTART signal, and when it fails to read JSON,
it no longer stops the whole daemon.
2023-06-11 16:35:41 +01:00
d688dd02c8
args: respect other args when start/stop/daemon are used
these being present in os.Args messes up "flag"'s parsing of the rest of
the arguments, so when they are found, they are removed.

Fixes #267
2023-06-11 16:06:18 +01:00
6431613363
update version; mention log button in bug report template 2022-01-30 14:27:00 +00:00
d1b5b74060
make most modals white 2021-12-31 17:28:08 +00:00
d81679fbae
print error if logging fails 2021-12-20 19:05:18 +00:00
4fcba32f74
apidocs: re-version, set up for hosted ui
swagger.json is uploaded after each build, and is hosted at
api.jfa-go.com.
2021-11-15 00:19:52 +00:00
eeb9b07bce
admin: add manual "Send Password reset" to accounts tab
Only appears with Reset links enabled.
Pressing this sends a PWR link to the users selected.
if one user is selected, or if one of you selected users doesn't have a
method of contact, a link is given to the admin to send to them
manually.
2021-10-13 15:04:22 +01:00
fbe3553b25
fix missing last log line
Sometimes calls to app.err.Fatalf would fail to print the error to the
console, and fail to show "A crash report has been saves to...". Both of
these should be fixed now.
2021-09-18 13:43:11 +01:00
2be34ed063
quote jellyfin URL for censoring in logs 2021-08-22 13:54:39 +01:00
eb3489b34f
tray: fix crashlogs, restart from web 2021-08-16 23:01:08 +01:00
6e88c1f4fc
setup: MkdirAll config dir if necessary
some have had this issue in the past on new systems/users where ~/.config
doesn't exist yet.
2021-07-27 10:54:52 +01:00
67c60cb677
fix 'jfa-go systemd' layout
lines were printing out-of-order for some reason, so i added time.Sleep
between them.
2021-07-27 10:47:07 +01:00
6551eeb938
setup: also respect -host 2021-07-21 17:24:06 +01:00
36c23c1e4f
setup: respect -p/-port
fixes #128.
2021-07-21 17:17:59 +01:00
833d02b032
matrix: end-to-end encryption by default
Existing chats will remain unencrypted but new ones will be.
2021-07-13 19:02:16 +01:00
3e55cd1e31
accounts: add templates for announcements
you can now save announcements as templates, and then use them later by
hovering over the "Announce" button, as well as delete them.
2021-07-10 16:43:27 +01:00