1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-06-25 19:07:47 +02:00
Commit Graph

165 Commits

Author SHA1 Message Date
b8e3fc636c
Accounts: Fix cog on telegram when no discord linked
Also, disable telegram & discord if an auth/initialization error occurs.
2021-05-23 14:48:36 +01:00
a6447165b7
add email notify enable/disable; remove (de)hyphening
hyphen/dehyphen conflicted with new migration for email contact
preference, and it's been a while since this has been an issue so i've
just commented it out for now.
2021-05-21 22:46:46 +01:00
e931c09a34
add message when web ui is loaded
a lack of output after "Loading routes" was a little confusing.
2021-05-21 21:39:32 +01:00
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
8cf9b1f905
add basic tray functionality
enable with `make TRAY=on ...`. Cross compilation apparently should work
from linux to linux & windows.
2021-05-16 16:23:28 +01:00
33f8070e57
cleanup; fix stripping with DEBUG=on 2021-05-16 15:00:13 +01:00
ea0293bd4e
Split some settings into new "messages" section
Most email dependant sections now depend on this. Also renamed more
email things.
2021-05-07 21:53:29 +01:00
99875b9176
almost complete telegram user verification
When signing up, the user is given a pin code which they send to a
telegram bot. This provides user verification, but more importantly
allows the bot to message the user, as the Telegram API requires the
user to interact with the bot before it can do the opposite.

The bot should recognize the correct language, but a /lang command is
also provided to change it.

The verification process is pretty much functional but ui is still
broken, and it isn't properly integrated yet.
2021-05-07 01:08:12 +01:00
9944cc2db9
refactor; move logger to module 2021-05-01 00:13:57 +01:00
a2c344de83
add shorthand flag names
along with an ugly wrapper for the help message that merges the
descriptions for the short & long versions.
2021-04-24 23:54:56 +01:00
886ae64feb
add "systemd" command to generate a .service file
never got around to adding this from jellyfin-accounts for some reason.
2021-04-24 18:54:31 +01:00
47ac505cac
shutdown your background workers!
I believe everything #74 was caused by not shutting down the userDaemon
when we do a pseudo-restart. shutdown of it and the invite daemon are
now deferred so this should fix any problems and reduce log spam.
2021-04-06 18:12:06 +01:00
78049d4a33
hyphenate/dehyphenate users.json if necessary
doubt this would have caused problems anyway but why not.
2021-04-06 15:46:28 +01:00
76b822213e
add more error logging; mutex for app.storage.users 2021-04-06 13:44:52 +01:00
2a0edeb3c5
bump mediabrowser version, more consistent logs
uses descriptive errors added in mb v0.2.0. Also improved
the consistency of logs in api.go/main.go.
2021-04-02 22:13:04 +01:00
9370913ace
add password reset link option
When enabled (in Settings > Password Resets), a magic link will be sent
instead of a PIN when the user tries reset their password. By doing
this the user doesn't have to keep the Jellyfin tab open to enter the
code.
2021-03-30 22:41:28 +01:00
762dac2581
move mediabrowser to separate repo 2021-03-29 21:49:46 +01:00
1cf8d3037b
remove dependency on common from mediabrowser 2021-03-29 20:57:13 +01:00
f0dccc58aa
separate pprof from debug mode
enabled with -pprof now.
2021-03-23 21:59:04 +00:00
1a6d78352c
add comments, fix user expiry log spam
now actually removes the already deleted user from the expiry list.
2021-03-21 22:50:33 +00:00
de92516d52
add updates section to setup 2021-03-20 18:00:01 +00:00
92332206f0
add basic update functionality
If enabled, jfa-go pings buildrone (hosted at builds.hrfee.pw) every 30
min for new updates. If there is one, it gets information (and if
applicable, a binary) from the appropriate source (buildrone, github, or
dockerhub) and displays it on the admin page. You can switch update
channels between stable and unstable. For binary releases, updates are
downloaded automatically and installed when the user presses update.

Since this obviously introduces some "phone-home" functionality into
jfa-go, I just want to say IPs are not and will not be logged by
buildrone, although I may later introduce functionality to give a rough
idea of the number of users (again, no IPs stored). The whole thing can
also be turned off in settings.
2021-03-07 15:23:44 +00:00
1e9d184508
implement user expiry functionality
All works now, but i'll add a field on the accounts tab for users with
an expiry, as well as a 'disabled' badge.
2021-02-28 15:41:06 +00:00
b3fa667db1
version with ldflags instead of script 2021-02-22 01:23:42 +00:00
78157f763f
use different color library, wrap logger functions with it 2021-02-19 16:12:14 +00:00
76fa171575
cleanup logs and use structs in jf/emby api
Also means times are directly parsed when pulling data from jf/emby,
which was *painful* to get working (something broke the whole program and it
took me an hour to figure out it was this lol). Time parsing should be a
lot stabler too.
2021-02-19 00:47:01 +00:00
adbb5b9d38
Fix filepath separator and external files on windows
For some reason, '/' is used instead of '\' on windows when loading
lang. FSJoin will now use whatever already exists in the path.
app.GetPath now creates a DirFS from the containing directory instead of
app.systemFS, which fixes loading on windows.
2021-02-18 12:58:30 +00:00
ea99966057
refactor, move route loading to router.go 2021-02-12 14:59:16 +00:00
aaed272bf2
use embed.fs wrapper on data 2021-02-12 14:35:16 +00:00
e6775cd2d1
use embed.fs wrapper for langFS so lang/ is not needed in paths
[files]lang_files is now the path to the lang directory, not path to a
directory containing it.
2021-02-12 14:35:16 +00:00
72cf3e2240
add external/internal data options
"make all" will build with internal data, whereas "make debug"/"make
all-external" will make an external "data/" directory.
2021-02-12 14:32:48 +00:00
815bdc35ac
fully self-contained
paths are pretty janky, but it works. Also, [files]/lang_files now must
be the path to a directory CONTAINING a "lang/" directory. I'll work
around this at a later date.
2021-02-12 14:28:09 +00:00
0330540f87
Use fs for language, add lang_files option
The local app translations are loaded, and then if [files]/lang_files
is provided (a directory containing custom translations), any found
inside it are loaded over top. This makes customizing much easier.
2021-02-12 14:28:09 +00:00
fefe2d82a4
rebase 12/02, use go1.16rc1 in make, remove ioutil, start switching to io/fs for file i/o
ioutil's contents are now in io and os.
Eventually jfa-go's files will be embedded in the binary with go1.16's
new embed feature. Using io/fs will provide abstraction for accessing
these files, and allow for both embedded and non-embedded versions.
Also, internal paths to things like email templates, etc. will be
prefixed with "jfa-go:" to indicate to use the app's own Filesystem
instead of reading the file normally. This also allows for custom files
to continue to be used as they are currently.
2021-02-12 14:27:01 +00:00
4c653fea36
fix url base on invite and broken getLanguages 2021-02-12 12:52:08 +00:00
f72def0399
serve on / and URL base for easy proxying 2021-02-11 23:06:51 +00:00
d061721f56
explicitly set js mimetype 2021-02-08 15:25:02 +00:00
b037b08152
respect URL Base in http preloads and inline html links 2021-02-05 13:10:47 +00:00
90c6cee780
add restart button 2021-01-31 19:01:20 +00:00
8c871bc5fa
Add ts to link setting dependance
Also make store each setting as classes in a settings object, to make it
easier to serialize on submitting. Also, added
"substitute_jellyfin_strings", "no_username" and welcome_email.
2021-01-26 22:57:29 +00:00
bf1e6230dc
split some strings into common file; use lang file to setup page 2021-01-25 21:26:54 +00:00
cd2ea2e579
reload email after lang is loaded
fixes #37.
2021-01-21 18:57:32 +00:00
e834445b0b
Restructure language loading to support incomplete translations
On startup, files are scanned and any missing values are replaced with
the english version.
2021-01-19 00:29:29 +00:00
772e12d11c
add optional tls/http2 support
Allows for http2 server push, see the advanced section.
2021-01-15 14:43:32 +00:00
bc99dc34ee
Add email translation, add part of french translations
Admin translation from @Killianbe, Email translation from
@Cornichon420. French is currently not functional, a few things are
missing which i'm waiting on.
2021-01-15 14:43:32 +00:00
4679c6f355
add language selector to admin 2021-01-15 14:43:32 +00:00
c470e40737
Start adding translation support for admin 2021-01-15 14:43:31 +00:00
3fbbc7f620
add language selector to form 2021-01-11 19:17:43 +00:00
e532000ad0 Mention emby in README, add notices about password resets 2021-01-10 16:10:03 +00:00
8d0dc232d7 option to substitute "Jellyfin" in form.html
setting is jellyfin/substitute_jellyfin_strings.
2021-01-10 16:10:03 +00:00
f5602f1e96 change settings description and console warning 2021-01-10 16:10:03 +00:00
d9e1e2f58b compiles, basic issues fixed
Server type is found under the Jellyfin settings tab, where you can
change it to emby. Currently:

* logs in
* creates users
* parses accounts
2021-01-10 16:10:03 +00:00
5d56ed5378 fix most incompatibilites, start separating api clients 2021-01-10 16:10:03 +00:00
eb370d64df
Merge a17t-redesign, kinda ts-ify setup.js
the web ui has been redesigned with the a17t toolkit, which imo looks a
lot better than bootstrap. This also brought a complete rework of the
web code, which now makes a lot more sense hopefully. the setup page is
still stuck with bootstrap, its not much of a priority but i'll rewrite
it eventually.
2021-01-05 18:16:23 +00:00
ee6f81b9e9
Add ability to revert to non-hyphenated user IDs
The first 10.7.0 build i tried used hyphens, but a later one didn't.
emails.json can now be converted between the two forms depending on what
the server uses.
2020-12-18 15:44:19 +00:00
3c952d21f7
fix 10.7.0 compatibility, simplify scss
Hyphens are added to user IDs from 10.7.0, so if the server is running
it, emails.json will be modified to include them. The existing file is
backed up. Also, scss files have been simplified since bs4-jf and bs5-jf share
much of the same content.
2020-11-29 18:01:10 +00:00
9dbf60e3df
add URL base option for subfolder proxies
also cleaned up the naming of some things.
2020-11-22 16:36:43 +00:00
d64e98da37
use Bearer auth instead of Basic
this was a relic from the python version, i'd modeled the auth code off
some random blog post back then.
2020-11-12 21:05:46 +00:00
493f10fa36
add french, fix language selector in settings
note: custom language files can now be added in data/lang/form and will be
listed in settings.
2020-11-03 21:11:43 +00:00
8e45ecb214
add cache_timeout option
controls how old the Jellyfin user cache can be before refetching. defaults to 30 minutes.
2020-11-02 23:26:46 +00:00
c84ea17af4
refactor; separate jfapi and ombi into modules 2020-11-02 00:53:08 +00:00
d64d5c194f
initial steps for localisation 2020-10-30 22:51:47 +00:00
9abb177427
use typescript for form.html in separate file, allow customization of
requirement strings

Password requirement text is now loaded by the typescript, and can be
customized by changing the validationStrings variable. See wiki for more
info.
2020-10-20 23:00:30 +01:00
2f9965bcda
Print full error if writing config fails 2020-10-20 21:16:46 +01:00
82d07e423c
add optional path to custom web ui pages
'html_templates' in 'files' can be set to a directory, in which you can
place custom version of the web ui pages. Added for #9. Wiki explainer
to follow.
2020-10-18 21:48:20 +01:00
2a2435ae11
remove version, device, device_id options, set them automatically
not sure why i exposed these to the user in the first place. they are
set to <jfa-go version>, <jfa-go>, <jfa-go-<version>-<commit>>
respectively.
2020-09-29 20:51:15 +01:00
e104bd8362
small changes, new images and readme updated 2020-09-24 23:57:42 +01:00
64ad8ccf6e
Fix docker build; add some color 2020-09-24 21:59:08 +01:00
313b75bead
Add SWAGGER and DEBUG env variables
Should be useful for docker installations.
2020-09-24 21:05:23 +01:00
9f6e405d1c
Add auth and tags to swagger 2020-09-24 18:50:03 +01:00
b6537cef65
Add basic swagger documentation
accessible by running with -swagger. Accessible at /swagger/index.html.
Currently doesn't have authentication setup, so no requests will work.
2020-09-24 17:51:13 +01:00
544f5674e8
rename routes to make more sense
for example, /getInvite and /generateInvite become GET(/invites) and
    POST(/invites) respectively.
2020-09-24 14:03:25 +01:00
89e70f6f7a
Add default profile functionality
Default profile can be selected in settings.
2020-09-23 18:48:00 +01:00
903a61d0f2
Profiles replace user templates
Profile functionality is essentially complete, and they can be created
in settings. Only thing currently missing is a way to set a default
profile.
2020-09-23 00:01:07 +01:00
b6ceee508c
Fix bug with invites in webui, add profile selector
invite codes starting with a digit don't work with the webui, so
GenerateInvite regenerates uuids until theres one that doesn't.
2020-09-22 00:34:11 +01:00
c4acb43cb8
Initial features for move to profiles
user templates will become profiles. You will be able to make multiple,
and assign them  to invites individually. This commit migrates the
separate template files into one profile entry called "Default", and
lets you select them on invites. No way to create profiles has been
added yet.
2020-09-20 11:21:04 +01:00
d4b94bc9d9
add user button
added create user button for the admin to use.
2020-09-18 00:59:59 +01:00
9213f2a078
Add account deletion with email notification
Select users to delete, then optionally opt to notify the user in an
email with a provided reason.
2020-09-17 23:50:07 +01:00
7ac750879f
Remove email addresses in settings, move to accounts tab
still a little rough, but it works.
2020-09-17 21:23:45 +01:00
cd61989495
Initial features of accounts tab
It's rough right now, but the accounts tab shows a list of users and
info. Right now the only action available is to apply settings (from
template or another user) to a selection of users. More to come.
2020-09-17 16:51:19 +01:00
7d84fdec96
userByName reloads cache if user not found, more things in test 2020-09-16 19:19:04 +01:00
e0c4d7c545
add "test" mode for debugging
running with "test" in the arguments will print jellyfin server info,
and try to getUsers.
2020-09-16 11:55:35 +01:00
51839b5942
Restructure email sending
smtp and mailgun now implement an emailClient interface, which the
Emailer can use.
2020-09-13 21:07:15 +01:00
831296a3e8
remove windows related messages
self restarts now work, so no need.
2020-09-08 23:13:44 +01:00
bbb0568cc4
basic daemon functionality, self-restarts without syscall.exec
running 'jfa-go start' will run it as a daemon in the background, and
'jfa-go stop' will tell it to quit via a unix socket. Self-restarts are
now implented by simply exiting the main function (now called start) and
running it again.
2020-09-08 23:08:50 +01:00
f5f2a0f190
Add notice about no self-restarts on windows 2020-09-05 21:52:23 +01:00
ba67fa7536
Initial Ombi integration
When enabled, an account for the user is created on both Jellyfin and
Ombi. Account defaults can be stored similarly to jf.
2020-09-05 17:32:49 +01:00
1b0ca34586
include version and commit hash at compile time
when using makefile, version is set to "git". Currently  printed on
start, but an about page in the web UI will be added.
2020-08-31 14:57:42 +01:00
6e3d5dac19
use newJellyfin instead of constructor method 2020-08-30 20:44:10 +01:00
d12335bb4a
cleaned up auth 2020-08-23 14:59:07 +01:00
ee3b421566
Fixed flaw with jellyfin_login; store refresh token in cookies
with jellyfin_login enabled, the username and password vals in the User
struct would be "". If you disabled 'required' on the login form, blank
username and password would allow you in.
2020-08-20 20:20:31 +01:00
d144077e62
Add refresh tokens for persistent login, logout button
the main JWT is stored temporarily, whereas the refresh token is stored
as a cookie and can only be used to obtain a new main token. Logout
button adds token to blocklist internally and deletes JWT and refresh
token from browser storage.
2020-08-19 22:30:54 +01:00
56478e96c9
create new css link to smoothly transition between themes
Previously, directly editing the <link> tag with the new file would
cause the page to have no stylesheet for a moment while the new file is
downloaded. A new element is now appended below the original instead,
which smoothens out the transition.
2020-08-19 14:31:41 +01:00
ec7609ed8c
Add debug flag; warning label for debug mode 2020-08-19 14:09:48 +01:00
151062fbc1
set gin mode before router initialization
this was previously set after the router was created, causing a debug
message every start.
2020-08-17 12:33:26 +01:00
8c4bd4541c
Added non interactive makefile option; fixed flags again
fixed another problem with the -data option, and added 'make headless'
for use in the dockerfile
2020-08-16 20:11:16 +01:00
6436dba48f
fixed custom config and data paths
any specified custom data path was only being used for the config file.
All combinations of options should work together now.
2020-08-16 14:26:07 +01:00
fd766e7b1a
use app identifier instead of ctx
changing this because ctx is commonly used with the context package.
2020-08-16 13:36:54 +01:00
19bd31d968
attempt at using a config struct instead of the ini library
Added script to convert config-base.json into a go struct, so that
access to config values and metadata could be unified and simpler. It
probably won't see any actual use though as mapping the ini into it is
painful.
2020-08-15 22:07:48 +01:00
39bf3ad7f1
Safe shutdown 2020-08-05 16:58:24 +01:00