mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-19 00:57:37 +01:00
Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0af76364a | ||
|
|
169622bf95 | ||
|
|
78b5136b9a | ||
|
|
e546f50141 | ||
|
|
e35fe8d425 | ||
|
|
6ed2f7aaa6 | ||
|
|
084e8ec432 | ||
|
|
fd7f74682b | ||
|
|
9950c158a1 | ||
|
|
21125033ff | ||
|
|
1dc0b2234a | ||
|
|
0ea5c7fdc0 | ||
|
|
b538922c05 | ||
|
|
f0f4e8118e | ||
|
|
2f501697db | ||
|
|
0a71d5b216 | ||
|
|
0014db44f0 | ||
|
|
885d2ebf0f | ||
|
|
6d089a9818 | ||
|
|
de81c7e29f | ||
|
|
e49996c401 | ||
|
|
aa40a72075 | ||
|
|
19b7341e80 | ||
|
|
73645a7569 | ||
|
|
a9dac8c04c | ||
|
|
43fbbbcd16 | ||
|
|
fc57a8c97f | ||
|
|
1fb2ef5675 | ||
|
|
e0d994c35c | ||
|
|
cab30eb628 | ||
|
|
71df011556 | ||
|
|
b2828110e3 | ||
|
|
50eb05776a | ||
|
|
19715f25f6 | ||
|
|
d41a281d53 | ||
|
|
a8229631bd | ||
|
|
0a2cf6132f | ||
|
|
d7ab01063a | ||
|
|
6fb8f1ed7f | ||
|
|
555d5abf59 | ||
|
|
93937ec3b5 | ||
|
|
93c7a6e31b | ||
|
|
a9cabe3d74 | ||
|
|
d6fd1d6894 | ||
|
|
561c461a18 | ||
|
|
953a66ec47 |
15
.drone.yml
15
.drone.yml
@@ -9,7 +9,7 @@ steps:
|
||||
commands:
|
||||
- git fetch --tags
|
||||
- name: release
|
||||
image: golang:latest
|
||||
image: hrfee/jfa-go-build-docker:latest
|
||||
volumes:
|
||||
- name: ssh_key
|
||||
path: /id_rsa
|
||||
@@ -19,11 +19,6 @@ steps:
|
||||
GITHUB_TOKEN:
|
||||
from_secret: github_token
|
||||
commands:
|
||||
- apt-get update -y
|
||||
- apt-get install build-essential python3-pip curl software-properties-common sed upx gcc libgtk-3-dev libappindicator3-dev gcc-mingw-w64-x86-64 -y
|
||||
- (curl -sL https://deb.nodesource.com/setup_14.x | bash -)
|
||||
- apt-get install nodejs
|
||||
|
||||
- curl -sL https://git.io/goreleaser > ../goreleaser
|
||||
- chmod +x ../goreleaser
|
||||
- ./scripts/version.sh ../goreleaser
|
||||
@@ -81,21 +76,19 @@ type: docker
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: golang:latest
|
||||
image: hrfee/jfa-go-build-docker:latest
|
||||
volumes:
|
||||
- name: ssh_key
|
||||
path: /id_rsa
|
||||
commands:
|
||||
- apt-get update -y
|
||||
- apt-get install build-essential python3-pip curl software-properties-common sed upx gcc libgtk-3-dev libappindicator3-dev gcc-mingw-w64-x86-64 -y
|
||||
- (curl -sL https://deb.nodesource.com/setup_14.x | bash -)
|
||||
- apt-get install nodejs
|
||||
- curl -sL https://git.io/goreleaser > goreleaser
|
||||
- chmod +x goreleaser
|
||||
- ./scripts/version.sh ./goreleaser --snapshot --skip-publish --rm-dist
|
||||
- wget https://builds.hrfee.pw/upload.py
|
||||
- pip3 install requests
|
||||
- bash -c 'sftp -P 2022 -i /id_rsa -o StrictHostKeyChecking=no root@161.97.102.153:/repo/incoming <<< $"put dist/*.deb"'
|
||||
# - bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "reprepro -Vb /repo remove trusty-unstable jfa-go"'
|
||||
# - bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "reprepro -Vb /repo remove trusty-unstable jfa-go-tray"'
|
||||
- bash -c 'ssh -i /id_rsa root@161.97.102.153 -p 2022 "repo-process-deb trusty"'
|
||||
- bash -c 'python3 upload.py https://builds.hrfee.pw hrfee jfa-go --upload ./dist/*.zip ./dist/*.rpm ./dist/*.apk --tag internal-git=true'
|
||||
environment:
|
||||
|
||||
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -19,8 +19,11 @@ What to do to reproduce the problem.
|
||||
|
||||
**Logs**
|
||||
|
||||
**If you're using a build with a tray icon, right-click on it and press "Open logs" to access your logs.**
|
||||
|
||||
When you notice the problem, check the output of `jfa-go`. If the problem is not obvious (e.g a panic (red text) or 'ERROR' log), re-run jfa-go with the `-debug` argument and reproduce the problem. You should then take a screenshot of the output, or paste it here, preferably between \`\`\` tags (e.g \`\`\``Log here`\`\`\`). Remember to censor any personal information.
|
||||
|
||||
|
||||
If nothing catches your eye in the log, access the admin page via your browser, go into the console (Right click > Inspect Element > Console), refresh, reproduce the problem then paste the output here in the same way as above.
|
||||
|
||||
**Configuration**
|
||||
|
||||
@@ -25,6 +25,12 @@ before:
|
||||
- npx esbuild --bundle ts/pwr.ts --outfile=./data/web/js/pwr.js --minify
|
||||
- npx esbuild --bundle ts/form.ts --outfile=./data/web/js/form.js --minify
|
||||
- npx esbuild --bundle ts/setup.ts --outfile=./data/web/js/setup.js --minify
|
||||
- npx esbuild --bundle ts/crash.ts --outfile=./data/crash.js --minify
|
||||
- cp html/crash.html data/
|
||||
- npx uncss data/crash.html --csspath web/css --output data/bundle.css
|
||||
- npx inline-source --root data data/crash.html data/crash.html
|
||||
- rm data/bundle.css
|
||||
- mv data/crash.html data/html/
|
||||
- go get -u github.com/swaggo/swag/cmd/swag
|
||||
- swag init -g main.go
|
||||
builds:
|
||||
@@ -101,7 +107,7 @@ archives:
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "0.0.0-{{.ShortCommit}}"
|
||||
name_template: "0.0.0-{{ .Env.JFA_GO_NFPM_EPOCH }}"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
|
||||
12
Makefile
12
Makefile
@@ -45,11 +45,13 @@ ifeq ($(DEBUG), on)
|
||||
TYPECHECK := tsc -noEmit --project ts/tsconfig.json
|
||||
# jank
|
||||
COPYTS := rm -r $(DATA)/web/js/ts; cp -r ts $(DATA)/web/js
|
||||
UNCSS := cp $(DATA)/web/css/bundle.css $(DATA)/bundle.css
|
||||
else
|
||||
LDFLAGS := -s -w $(LDFLAGS)
|
||||
SOURCEMAP :=
|
||||
COPYTS :=
|
||||
TYPECHECK :=
|
||||
UNCSS := npx uncss $(DATA)/crash.html --csspath web/css --output $(DATA)/bundle.css
|
||||
endif
|
||||
|
||||
RACE ?= off
|
||||
@@ -87,6 +89,7 @@ typescript:
|
||||
-$(ESBUILD) --bundle ts/pwr.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/pwr.js --minify
|
||||
-$(ESBUILD) --bundle ts/form.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/form.js --minify
|
||||
-$(ESBUILD) --bundle ts/setup.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/setup.js --minify
|
||||
-$(ESBUILD) --bundle ts/crash.ts --outfile=./$(DATA)/crash.js --minify
|
||||
$(COPYTS)
|
||||
|
||||
swagger:
|
||||
@@ -108,11 +111,18 @@ bundle-css:
|
||||
$(info bundling css)
|
||||
$(ESBUILD) --bundle css/base.css --outfile=$(DATA)/web/css/bundle.css --external:remixicon.css --minify
|
||||
|
||||
inline:
|
||||
cp html/crash.html $(DATA)/crash.html
|
||||
$(UNCSS)
|
||||
npx inline-source --root $(DATA) $(DATA)/crash.html $(DATA)/crash.html
|
||||
rm $(DATA)/bundle.css
|
||||
|
||||
copy:
|
||||
$(info copying fonts)
|
||||
cp -r node_modules/remixicon/fonts/remixicon.css node_modules/remixicon/fonts/remixicon.woff2 $(DATA)/web/css/
|
||||
$(info copying html)
|
||||
cp -r html $(DATA)/
|
||||
mv $(DATA)/crash.html $(DATA)/html/
|
||||
$(info copying static data)
|
||||
-mkdir -p $(DATA)/web
|
||||
cp -r static/* $(DATA)/web/
|
||||
@@ -141,4 +151,4 @@ clean:
|
||||
-rm docs/docs.go docs/swagger.json docs/swagger.yaml
|
||||
go clean
|
||||
|
||||
all: configuration npm email typescript bundle-css swagger copy compile
|
||||
all: configuration npm email typescript bundle-css inline swagger copy compile
|
||||
|
||||
@@ -20,7 +20,7 @@ a rewrite of [jellyfin-accounts](https://github.com/hrfee/jellyfin-accounts) (or
|
||||
* ⌛ User expiry: Specify a validity period, and new users accounts will be disabled/deleted after it. The period can be manually extended too.
|
||||
* 🔗 Ombi Integration: Automatically creates Ombi accounts for new users using their email address and login details, and your own defined set of permissions.
|
||||
* Account management: Apply settings to your users individually or en masse, and delete users, optionally sending them an email notification with a reason.
|
||||
* Telegram & Discord Integration: Verify users via a Telegram or Discord bot, and send Password Resets, Announcements, etc. through it.
|
||||
* Telegram/Discord/Matrix Integration: Verify users via a chat bot, and send Password Resets, Announcements, etc. through it.
|
||||
* 📨 Email storage: Add your existing users email addresses through the UI, and jfa-go will ask new users for them on account creation.
|
||||
* Email addresses can optionally be used instead of usernames
|
||||
* 🔑 Password resets: When users forget their passwords and request a change in Jellyfin, jfa-go reads the PIN from the created file and sends it straight to the user via email/telegram.
|
||||
|
||||
81
api.go
81
api.go
@@ -1383,6 +1383,77 @@ func (app *appContext) ModifyEmails(gc *gin.Context) {
|
||||
respondBool(200, true, gc)
|
||||
}
|
||||
|
||||
// @Summary Resets a user's password with a PIN, and optionally set a new password if given.
|
||||
// @Produce json
|
||||
// @Success 200 {object} boolResponse
|
||||
// @Success 400 {object} PasswordValidation
|
||||
// @Failure 500 {object} boolResponse
|
||||
// @Param ResetPasswordDTO body ResetPasswordDTO true "Pin and optional Password."
|
||||
// @Router /reset [post]
|
||||
// @tags Other
|
||||
func (app *appContext) ResetSetPassword(gc *gin.Context) {
|
||||
var req ResetPasswordDTO
|
||||
gc.BindJSON(&req)
|
||||
validation := app.validator.validate(req.Password)
|
||||
valid := true
|
||||
for _, val := range validation {
|
||||
if !val {
|
||||
valid = false
|
||||
}
|
||||
}
|
||||
if !valid || req.PIN == "" {
|
||||
// 200 bcs idk what i did in js
|
||||
app.info.Printf("%s: Password reset failed: Invalid password", req.PIN)
|
||||
gc.JSON(400, validation)
|
||||
return
|
||||
}
|
||||
resp, status, err := app.jf.ResetPassword(req.PIN)
|
||||
if status != 200 || err != nil || !resp.Success {
|
||||
app.err.Printf("Password Reset failed (%d): %v", status, err)
|
||||
respondBool(status, false, gc)
|
||||
return
|
||||
}
|
||||
if req.Password == "" || len(resp.UsersReset) == 0 {
|
||||
respondBool(200, false, gc)
|
||||
return
|
||||
}
|
||||
user, status, err := app.jf.UserByName(resp.UsersReset[0], false)
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to get user \"%s\" (%d): %v", resp.UsersReset[0], status, err)
|
||||
respondBool(500, false, gc)
|
||||
return
|
||||
}
|
||||
status, err = app.jf.SetPassword(user.ID, req.PIN, req.Password)
|
||||
if !(status == 200 || status == 204) || err != nil {
|
||||
app.err.Printf("Failed to change password for \"%s\" (%d): %v", resp.UsersReset[0], status, err)
|
||||
respondBool(500, false, gc)
|
||||
return
|
||||
}
|
||||
if app.config.Section("ombi").Key("enabled").MustBool(false) {
|
||||
// Silently fail for changing ombi passwords
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to get user \"%s\" from jellyfin/emby (%d): %v", resp.UsersReset[0], status, err)
|
||||
respondBool(200, true, gc)
|
||||
return
|
||||
}
|
||||
ombiUser, status, err := app.getOmbiUser(user.ID)
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to get user \"%s\" from ombi (%d): %v", resp.UsersReset[0], status, err)
|
||||
respondBool(200, true, gc)
|
||||
return
|
||||
}
|
||||
ombiUser["password"] = req.Password
|
||||
status, err = app.ombi.ModifyUser(ombiUser)
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to set password for ombi user \"%s\" (%d): %v", ombiUser["userName"], status, err)
|
||||
respondBool(200, true, gc)
|
||||
return
|
||||
}
|
||||
app.debug.Printf("Reset password for ombi user \"%s\"", ombiUser["userName"])
|
||||
}
|
||||
respondBool(200, true, gc)
|
||||
}
|
||||
|
||||
// @Summary Apply settings to a list of users, either from a profile or from another user.
|
||||
// @Produce json
|
||||
// @Param userSettingsDTO body userSettingsDTO true "Parameters for applying settings"
|
||||
@@ -1576,6 +1647,7 @@ func (app *appContext) ModifyConfig(gc *gin.Context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
tempConfig.Section("").Key("first_run").SetValue("false")
|
||||
if err := tempConfig.SaveTo(app.configPath); err != nil {
|
||||
app.err.Printf("Failed to save config to \"%s\": %v", app.configPath, err)
|
||||
respondBool(500, false, gc)
|
||||
@@ -1585,9 +1657,10 @@ func (app *appContext) ModifyConfig(gc *gin.Context) {
|
||||
gc.JSON(200, map[string]bool{"success": true})
|
||||
if req["restart-program"] != nil && req["restart-program"].(bool) {
|
||||
app.info.Println("Restarting...")
|
||||
err := app.Restart()
|
||||
if err != nil {
|
||||
app.err.Printf("Couldn't restart, try restarting manually: %s", err)
|
||||
if TRAY {
|
||||
TRAYRESTART <- true
|
||||
} else {
|
||||
RESTART <- true
|
||||
}
|
||||
}
|
||||
app.loadConfig()
|
||||
@@ -2121,7 +2194,7 @@ func (app *appContext) TelegramAddUser(gc *gin.Context) {
|
||||
respondBool(200, true, gc)
|
||||
}
|
||||
|
||||
// @Summary Sets whether to notify a user through telegram or not.
|
||||
// @Summary Sets whether to notify a user through telegram/discord/matrix/email or not.
|
||||
// @Produce json
|
||||
// @Param SetContactMethodsDTO body SetContactMethodsDTO true "User's Jellyfin ID and whether or not to notify then through Telegram."
|
||||
// @Success 200 {object} boolResponse
|
||||
|
||||
@@ -12,7 +12,7 @@ type TimeoutHandler func()
|
||||
func NewTimeoutHandler(name, addr string, noFail bool) TimeoutHandler {
|
||||
return func() {
|
||||
if r := recover(); r != nil {
|
||||
out := fmt.Sprintf("Failed to authenticate with %s @ %s: Timed out", name, addr)
|
||||
out := fmt.Sprintf("Failed to authenticate with %s @ \"%s\": Timed out", name, addr)
|
||||
if noFail {
|
||||
log.Print(out)
|
||||
} else {
|
||||
|
||||
50
config.go
50
config.go
@@ -151,53 +151,3 @@ func (app *appContext) loadConfig() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (app *appContext) migrateEmailConfig() {
|
||||
tempConfig, _ := ini.Load(app.configPath)
|
||||
fmt.Println(warning("Part of your email configuration will be migrated to the new \"messages\" section.\nA backup will be made."))
|
||||
err := tempConfig.SaveTo(app.configPath + "_" + commit + ".bak")
|
||||
if err != nil {
|
||||
app.err.Fatalf("Failed to backup config: %v", err)
|
||||
return
|
||||
}
|
||||
for _, setting := range []string{"use_24h", "date_format", "message"} {
|
||||
if val := app.config.Section("email").Key(setting).Value(); val != "" {
|
||||
tempConfig.Section("email").Key(setting).SetValue("")
|
||||
tempConfig.Section("messages").Key(setting).SetValue(val)
|
||||
}
|
||||
}
|
||||
if app.config.Section("messages").Key("enabled").MustBool(false) || app.config.Section("telegram").Key("enabled").MustBool(false) {
|
||||
tempConfig.Section("messages").Key("enabled").SetValue("true")
|
||||
}
|
||||
err = tempConfig.SaveTo(app.configPath)
|
||||
if err != nil {
|
||||
app.err.Fatalf("Failed to save config: %v", err)
|
||||
return
|
||||
}
|
||||
app.loadConfig()
|
||||
}
|
||||
|
||||
func (app *appContext) migrateEmailStorage() error {
|
||||
var emails map[string]interface{}
|
||||
err := loadJSON(app.storage.emails_path, &emails)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
newEmails := map[string]EmailAddress{}
|
||||
for jfID, addr := range emails {
|
||||
newEmails[jfID] = EmailAddress{
|
||||
Addr: addr.(string),
|
||||
Contact: true,
|
||||
}
|
||||
}
|
||||
err = storeJSON(app.storage.emails_path+".bak", emails)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = storeJSON(app.storage.emails_path, newEmails)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
app.info.Println("Migrated to new email format. A backup has also been made.")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -784,6 +784,15 @@
|
||||
"value": false,
|
||||
"description": "Send users a link to reset their password instead of a PIN. Must be enabled to reset Ombi password at the same time as the Jellyfin password."
|
||||
},
|
||||
"set_password": {
|
||||
"name": "Set password through link",
|
||||
"required": false,
|
||||
"requires_restart": true,
|
||||
"depends_true": "link_reset",
|
||||
"type": "bool",
|
||||
"value": false,
|
||||
"description": "Instead of automatically setting the user's password to the PIN, allow them to set a new password through the reset link."
|
||||
},
|
||||
"language": {
|
||||
"name": "Default reset link language",
|
||||
"required": false,
|
||||
@@ -1235,6 +1244,14 @@
|
||||
"value": "",
|
||||
"description": "Location of stored invites (json)."
|
||||
},
|
||||
"password_resets": {
|
||||
"name": "Password Resets",
|
||||
"required": false,
|
||||
"requires_restart": true,
|
||||
"type": "text",
|
||||
"value": "",
|
||||
"description": "Location of stored non-Jellyfin password resets (json)."
|
||||
},
|
||||
"emails": {
|
||||
"name": "Email Addresses",
|
||||
"required": false,
|
||||
|
||||
12
css/base.css
12
css/base.css
@@ -521,3 +521,15 @@ img.img-circle {
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
div.card:contains(section.banner.footer) {
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
.card.sectioned {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.card.sectioned .section {
|
||||
padding: var(--spacing-4, 1rem);
|
||||
}
|
||||
|
||||
2
email.go
2
email.go
@@ -536,7 +536,7 @@ func (emailer *Emailer) resetValues(pwr PasswordReset, app *appContext, noSub bo
|
||||
if inviteLink != "" {
|
||||
// Strip /invite form end of this URL, ik its ugly.
|
||||
template["link_reset"] = true
|
||||
pinLink := fmt.Sprintf("%s/reset?pin=%s", strings.Replace(inviteLink, "/invite", "", 1), pwr.Pin)
|
||||
pinLink := fmt.Sprintf("%s/reset?pin=%s", strings.TrimPrefix(inviteLink, "/invite"), pwr.Pin)
|
||||
template["pin"] = pinLink
|
||||
// Only used in html email.
|
||||
template["pin_code"] = pwr.Pin
|
||||
|
||||
44
exit.go
Normal file
44
exit.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/browser"
|
||||
)
|
||||
|
||||
// Exit dumps the last 100 lines of output to a crash file in /tmp (or equivalent), and generates a prettier HTML file containing it that is opened in the browser if possible.
|
||||
func Exit(err interface{}) {
|
||||
tmpl, err2 := template.ParseFS(localFS, "html/crash.html", "html/header.html")
|
||||
if err2 != nil {
|
||||
log.Fatalf("Failed to load template: %v", err)
|
||||
}
|
||||
logCache := lineCache.String()
|
||||
sanitized := sanitizeLog(logCache)
|
||||
data := map[string]interface{}{
|
||||
"Log": logCache,
|
||||
"SanitizedLog": sanitized,
|
||||
}
|
||||
if err != nil {
|
||||
data["Err"] = err
|
||||
}
|
||||
fpath := filepath.Join(temp, "jfa-go-crash-"+time.Now().Local().Format("2006-01-02T15:04:05"))
|
||||
err2 = os.WriteFile(fpath+".txt", []byte(logCache), 0666)
|
||||
if err2 != nil {
|
||||
log.Fatalf("Failed to write crash dump file: %v", err2)
|
||||
}
|
||||
log.Printf("\n------\nA crash report has been saved to \"%s\".\n------", fpath+".txt")
|
||||
f, err2 := os.OpenFile(fpath+".html", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
|
||||
if err2 != nil {
|
||||
log.Fatalf("Failed to open crash dump file: %v", err2)
|
||||
}
|
||||
defer f.Close()
|
||||
err2 = tmpl.Execute(f, data)
|
||||
if err2 != nil {
|
||||
log.Fatalf("Failed to execute template: %v", err2)
|
||||
}
|
||||
browser.OpenFile(fpath + ".html")
|
||||
}
|
||||
25
go.mod
25
go.mod
@@ -10,37 +10,42 @@ replace github.com/hrfee/jfa-go/ombi => ./ombi
|
||||
|
||||
replace github.com/hrfee/jfa-go/logger => ./logger
|
||||
|
||||
replace github.com/hrfee/jfa-go/linecache => ./linecache
|
||||
|
||||
require (
|
||||
github.com/bwmarrin/discordgo v0.23.2 // indirect
|
||||
github.com/bwmarrin/discordgo v0.23.2
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/emersion/go-autostart v0.0.0-20210130080809-00ed301c8e9a // indirect
|
||||
github.com/emersion/go-autostart v0.0.0-20210130080809-00ed301c8e9a
|
||||
github.com/fatih/color v1.10.0
|
||||
github.com/fsnotify/fsnotify v1.4.9
|
||||
github.com/getlantern/systray v1.1.0 // indirect
|
||||
github.com/getlantern/systray v1.1.0
|
||||
github.com/gin-contrib/pprof v1.3.0
|
||||
github.com/gin-contrib/static v0.0.0-20200916080430-d45d9a37d28e
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
||||
github.com/go-openapi/spec v0.20.3 // indirect
|
||||
github.com/go-openapi/swag v0.19.15 // indirect
|
||||
github.com/go-playground/validator/v10 v10.4.1 // indirect
|
||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect
|
||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible
|
||||
github.com/golang/protobuf v1.4.3 // indirect
|
||||
github.com/gomarkdown/markdown v0.0.0-20210408062403-ad838ccf8cdd
|
||||
github.com/google/uuid v1.1.2 // indirect
|
||||
github.com/hrfee/jfa-go/common v0.0.0-20210105184019-fdc97b4e86cc
|
||||
github.com/hrfee/jfa-go/docs v0.0.0-20201112212552-b6f3cd7c1f71
|
||||
github.com/hrfee/jfa-go/linecache v0.0.0-00010101000000-000000000000 // indirect
|
||||
github.com/hrfee/jfa-go/logger v0.0.0-00010101000000-000000000000
|
||||
github.com/hrfee/jfa-go/ombi v0.0.0-20201112212552-b6f3cd7c1f71
|
||||
github.com/hrfee/mediabrowser v0.3.3
|
||||
github.com/hrfee/mediabrowser v0.3.4
|
||||
github.com/itchyny/timefmt-go v0.1.2
|
||||
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible
|
||||
github.com/lithammer/shortuuid/v3 v3.0.4
|
||||
github.com/mailgun/mailgun-go/v4 v4.5.1
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16 // indirect
|
||||
github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16
|
||||
github.com/pkg/browser v0.0.0-20210606212950-a7b7a6107d32 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
|
||||
github.com/smartystreets/goconvey v1.6.4 // indirect
|
||||
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14
|
||||
github.com/swaggo/gin-swagger v1.3.0
|
||||
@@ -49,9 +54,9 @@ require (
|
||||
github.com/ugorji/go v1.2.0 // indirect
|
||||
github.com/writeas/go-strip-markdown v2.0.1+incompatible
|
||||
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9 // indirect
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
|
||||
golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea // indirect
|
||||
golang.org/x/tools v0.1.1 // indirect
|
||||
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b // indirect
|
||||
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 // indirect
|
||||
golang.org/x/tools v0.1.3 // indirect
|
||||
google.golang.org/protobuf v1.25.0 // indirect
|
||||
gopkg.in/ini.v1 v1.62.0
|
||||
)
|
||||
|
||||
44
go.sum
44
go.sum
@@ -90,6 +90,8 @@ github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL9
|
||||
github.com/go-openapi/jsonreference v0.19.4/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=
|
||||
github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM=
|
||||
github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=
|
||||
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
|
||||
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
|
||||
github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
|
||||
github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
|
||||
github.com/go-openapi/spec v0.19.14/go.mod h1:gwrgJS15eCUgjLpMjBJmbZezCsw88LmgeEip0M63doA=
|
||||
@@ -152,8 +154,8 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/hrfee/mediabrowser v0.3.3 h1:7E05uiol8hh2ytKn3WVLrUIvHAyifYEIy3Y5qtuNh8I=
|
||||
github.com/hrfee/mediabrowser v0.3.3/go.mod h1:PnHZbdxmbv1wCVdAQyM7nwPwpVj9fdKx2EcET7sAk+U=
|
||||
github.com/hrfee/mediabrowser v0.3.4 h1:D2FTnuRDXUUAHW80L1kamhVUKNifm8peZVVPNe0yWmA=
|
||||
github.com/hrfee/mediabrowser v0.3.4/go.mod h1:PnHZbdxmbv1wCVdAQyM7nwPwpVj9fdKx2EcET7sAk+U=
|
||||
github.com/itchyny/timefmt-go v0.1.2 h1:q0Xa4P5it6K6D7ISsbLAMwx1PnWlixDcJL6/sFs93Hs=
|
||||
github.com/itchyny/timefmt-go v0.1.2/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A=
|
||||
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible h1:jdpOPRN1zP63Td1hDQbZW73xKmzDvZHzVdNYxhnTMDA=
|
||||
@@ -209,6 +211,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
|
||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
|
||||
github.com/pkg/browser v0.0.0-20210606212950-a7b7a6107d32 h1:K3WnH8Ka32vWygzmjKEhz1zAVqckNoWDqX3azMxuiSA=
|
||||
github.com/pkg/browser v0.0.0-20210606212950-a7b7a6107d32/go.mod h1:yvwcBfzEX4m+eTgxPBbNYytaWFv4PSQzBaeYjxp8Iik=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
@@ -267,7 +271,6 @@ github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
|
||||
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
|
||||
github.com/writeas/go-strip-markdown v2.0.1+incompatible h1:IIqxTM5Jr7RzhigcL6FkrCNfXkvbR+Nbu1ls48pXYcw=
|
||||
github.com/writeas/go-strip-markdown v2.0.1+incompatible/go.mod h1:Rsyu10ZhbEK9pXdk8V6MVnZmTzRG0alMNLMwa0J01fE=
|
||||
github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5 h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
@@ -286,7 +289,6 @@ golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTk
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
@@ -305,22 +307,18 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c h1:KHUzaHIpjWVlVVNh65G3hhuj3KB1HnjY6Cq5cTvRQT8=
|
||||
golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210510120150-4163338589ed h1:p9UgmWI9wKpfYmgaV/IZKGdXc5qEK45tDwwwDyjS26I=
|
||||
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210521195947-fe42d452be8f h1:Si4U+UcgJzya9kpiEUJKQvjr512OLli+gL4poHrz93U=
|
||||
golang.org/x/net v0.0.0-20210521195947-fe42d452be8f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A=
|
||||
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -338,25 +336,21 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54 h1:rF3Ohx8DRyl8h2zw9qojyLHLhrJpEMgyPOImREEryf0=
|
||||
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
|
||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1 h1:lCnv+lfrU9FRPGf8NeRuWAAPjNnema5WtBinMgs1fD8=
|
||||
golang.org/x/sys v0.0.0-20210521203332-0cec03c779c1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea h1:+WiDlPBBaO+h9vPNZi8uJ3k4BkKQB7Iow3aqwHVA5hI=
|
||||
golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210531080801-fdfd190a6549 h1:OL5GcZ2XPkte3dpfuFQ9o884vrE3BZQhajdntNMruv4=
|
||||
golang.org/x/sys v0.0.0-20210531080801-fdfd190a6549/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 h1:faDu4veV+8pcThn4fewv6TVlNCezafGoC1gM/mxQLbQ=
|
||||
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
@@ -371,10 +365,10 @@ golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgw
|
||||
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20201120155355-20be4ac4bd6e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.2 h1:kRBLX7v7Af8W7Gdbbc908OJcdgtK8bOz9Uaj8/F1ACA=
|
||||
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.3 h1:L69ShwSZEyCsLKoAxDKeMvLDZkumEe8gXUZAjab0tX8=
|
||||
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<script>
|
||||
window.URLBase = "{{ .urlBase }}";
|
||||
window.notificationsEnabled = {{ .notifications }};
|
||||
window.emailEnabled = {{ .email_enabled }};
|
||||
window.telegramEnabled = {{ .telegram_enabled }};
|
||||
window.discordEnabled = {{ .discord_enabled }};
|
||||
window.matrixEnabled = {{ .matrix_enabled }};
|
||||
window.emailEnabled = {{ .emailEnabled }};
|
||||
window.telegramEnabled = {{ .telegramEnabled }};
|
||||
window.discordEnabled = {{ .discordEnabled }};
|
||||
window.matrixEnabled = {{ .matrixEnabled }};
|
||||
window.ombiEnabled = {{ .ombiEnabled }};
|
||||
window.usernameEnabled = {{ .username }};
|
||||
window.langFile = JSON.parse({{ .language }});
|
||||
@@ -311,7 +311,7 @@
|
||||
<span class="button ~urge !normal full-width center" id="update-update">{{ .strings.update }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{ if .telegram_enabled }}
|
||||
{{ if .telegramEnabled }}
|
||||
<div id="modal-telegram" class="modal">
|
||||
<div class="modal-content card">
|
||||
<span class="heading mb-1">{{ .strings.linkTelegram }}</span>
|
||||
@@ -329,7 +329,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if .discord_enabled }}
|
||||
{{ if .discordEnabled }}
|
||||
<div id="modal-discord" class="modal">
|
||||
<div class="modal-content card">
|
||||
<span class="heading mb-1"><span id="discord-header"></span><span class="modal-close">×</span></span>
|
||||
@@ -515,7 +515,7 @@
|
||||
<div id="create-send-to-container">
|
||||
<label class="label supra">{{ .strings.inviteSendToEmail }}</label>
|
||||
<div class="flex-expand mb-1 mt-half">
|
||||
{{ if .discord_enabled }}
|
||||
{{ if .discordEnabled }}
|
||||
<input type="text" id="create-send-to" class="input ~neutral !normal mr-1" placeholder="example@example.com | user#1234">
|
||||
<span id="create-send-to-search" class="button ~neutral !normal mr-1">
|
||||
<i class="icon ri-search-2-line" title="{{ .strings.search }}"></i>
|
||||
@@ -556,13 +556,13 @@
|
||||
<th><input type="checkbox" value="" id="accounts-select-all"></th>
|
||||
<th>{{ .strings.username }}</th>
|
||||
<th>{{ .strings.emailAddress }}</th>
|
||||
{{ if .telegram_enabled }}
|
||||
{{ if .telegramEnabled }}
|
||||
<th>Telegram</th>
|
||||
{{ end }}
|
||||
{{ if .matrix_enabled }}
|
||||
{{ if .matrixEnabled }}
|
||||
<th>Matrix</th>
|
||||
{{ end }}
|
||||
{{ if .discord_enabled }}
|
||||
{{ if .discordEnabled }}
|
||||
<th>Discord</th>
|
||||
{{ end }}
|
||||
<th>{{ .strings.expiry }}</th>
|
||||
|
||||
49
html/crash.html
Normal file
49
html/crash.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link inline rel="stylesheet" type="text/css" href="bundle.css">
|
||||
{{ template "header.html" . }}
|
||||
<title>Crash report</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-container">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card ~critical sectioned">
|
||||
<section class="section ~critical">
|
||||
<span class="heading">Crash report for jfa-go</span>
|
||||
{{ if .Err }}
|
||||
<div class="monospace pre-line mt-1 mb-1">
|
||||
Error: {{ .Err }}
|
||||
</div>
|
||||
{{ end }}
|
||||
<a class="button ~critical mb-1" target="_blank" href="https://github.com/hrfee/jfa-go/issues/new/choose">Create an Issue</a>
|
||||
</section>
|
||||
<section class="section ~neutral !low">
|
||||
<div class="flex-expand">
|
||||
<span class="subheading">Full Log</span>
|
||||
<span class="button ~urge ml-half" id="copy-log">Copy</span>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col mr-1">
|
||||
<span class="button ~neutral !high supra full-width center" id="button-log-normal">Normal</span>
|
||||
</label>
|
||||
<label class="col mr-1">
|
||||
<span class="button ~neutral !normal supra full-width center" id="button-log-sanitized">Sanitized</span>
|
||||
</label>
|
||||
</div>
|
||||
<div id="log-normal">
|
||||
<pre class="monospace pre-line">{{ .Log }}</pre>
|
||||
</div>
|
||||
<div id="log-sanitized" class="unfocused">
|
||||
<p class="subheading">An attempt has been made to remove sensitive info, but make sure to check yourself.</p>
|
||||
<pre class="monospace pre-line">{{ .SanitizedLog }}</pre>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script inline src="crash.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -26,5 +26,9 @@
|
||||
window.matrixRequired = {{ .matrixRequired }};
|
||||
window.matrixUserID = "{{ .matrixUser }}";
|
||||
</script>
|
||||
{{ if .passwordReset }}
|
||||
<script src="js/pwr.js" type="module"></script>
|
||||
{{ else }}
|
||||
<script src="js/form.js" type="module"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
@@ -3,7 +3,13 @@
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="css/bundle.css">
|
||||
{{ template "header.html" . }}
|
||||
<title>{{ .strings.pageTitle }}</title>
|
||||
<title>
|
||||
{{ if .passwordReset }}
|
||||
{{ .strings.passwordReset }}
|
||||
{{ else }}
|
||||
{{ .strings.pageTitle }}
|
||||
{{ end }}
|
||||
</title>
|
||||
</head>
|
||||
<body class="max-w-full overflow-x-hidden section">
|
||||
<div id="modal-success" class="modal">
|
||||
@@ -80,8 +86,20 @@
|
||||
<div class="page-container">
|
||||
<div class="card ~neutral !low">
|
||||
<div class="row baseline">
|
||||
<span class="col heading">{{ .strings.createAccountHeader }}</span>
|
||||
<span class="col subheading"> {{ .helpMessage }}</span>
|
||||
<span class="col heading">
|
||||
{{ if .passwordReset }}
|
||||
{{ .strings.passwordReset }}
|
||||
{{ else }}
|
||||
{{ .strings.createAccountHeader }}
|
||||
{{ end }}
|
||||
</span>
|
||||
<span class="col subheading">
|
||||
{{ if .passwordReset }}
|
||||
{{ .strings.enterYourPassword }}
|
||||
{{ else }}
|
||||
{{ .helpMessage }}
|
||||
{{ end }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -89,6 +107,7 @@
|
||||
<aside class="col aside sm ~warning" id="user-expiry-message"></aside>
|
||||
{{ end }}
|
||||
<form class="card ~neutral !normal" id="form-create" href="">
|
||||
{{ if not .passwordReset }}
|
||||
<label class="label supra">
|
||||
{{ .strings.username }}
|
||||
<input type="text" class="input ~neutral !high mt-half mb-1" placeholder="{{ .strings.username }}" id="create-username" aria-label="{{ .strings.username }}">
|
||||
@@ -127,6 +146,7 @@
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<label class="label supra" for="create-password">{{ .strings.password }}</label>
|
||||
<input type="password" class="input ~neutral !high mt-half mb-1" placeholder="{{ .strings.password }}" id="create-password" aria-label="{{ .strings.password }}">
|
||||
|
||||
@@ -134,7 +154,13 @@
|
||||
<input type="password" class="input ~neutral !high mt-half mb-1" placeholder="{{ .strings.password }}" id="create-reenter-password" aria-label="{{ .strings.reEnterPassword }}">
|
||||
<label>
|
||||
<input type="submit" class="unfocused">
|
||||
<span class="button ~urge !normal full-width center supra submit">{{ .strings.createAccountButton }}</span>
|
||||
<span class="button ~urge !normal full-width center supra submit">
|
||||
{{ if .passwordReset }}
|
||||
{{ .strings.reset }}
|
||||
{{ else }}
|
||||
{{ .strings.createAccountButton }}
|
||||
{{ end }}
|
||||
</span>
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
||||
@@ -159,4 +185,3 @@
|
||||
{{ template "form-base" . }}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -40,6 +40,6 @@
|
||||
</div>
|
||||
<i class="content">{{ .contactMessage }}</i>
|
||||
</div>
|
||||
<script src="{{ .urlBase }}/js/pwr.js" type="module"></script>
|
||||
<script src="{{ .urlBase }}/js/pwr-pin.js" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -42,7 +42,7 @@ func (rt *inviteDaemon) run() {
|
||||
}
|
||||
}
|
||||
|
||||
func (rt *inviteDaemon) shutdown() {
|
||||
func (rt *inviteDaemon) Shutdown() {
|
||||
rt.Stopped = true
|
||||
rt.ShutdownChannel <- "Down"
|
||||
<-rt.ShutdownChannel
|
||||
@@ -94,7 +94,13 @@
|
||||
"conditionals": "Bedingungen",
|
||||
"contactThrough": "Kontakt über:",
|
||||
"sendPIN": "Bitte den Benutzer, die unten stehende PIN an den Bot zu senden.",
|
||||
"inviteMonths": "Monate"
|
||||
"inviteMonths": "Monate",
|
||||
"add": "Hinzufügen",
|
||||
"select": "Auswählen",
|
||||
"searchDiscordUser": "Gib den Discord-Benutzername ein, um den Benutzer zu finden.",
|
||||
"findDiscordUser": "Suche Discord-Benutzer",
|
||||
"linkMatrixDescription": "Gib den Benutzernamen und das Passwort des Benutzers ein, der als Bot verwendet werden soll. Nach dem Absenden wird die App neu gestartet.",
|
||||
"matrixHomeServer": "Adresse des Homeservers"
|
||||
},
|
||||
"notifications": {
|
||||
"changedEmailAddress": "E-Mail-Adresse von {n} geändert.",
|
||||
@@ -133,7 +139,8 @@
|
||||
"updateAvailable": "Eine neue Aktualisierung ist verfügbar, überprüfe die Einstellungen.",
|
||||
"noUpdatesAvailable": "Keinen neuen Aktualisierungen verfügbar.",
|
||||
"updateAppliedRefresh": "Update angewendet, bitte aktualisieren.",
|
||||
"telegramVerified": "Telegram-Konto verifiziert."
|
||||
"telegramVerified": "Telegram-Konto verifiziert.",
|
||||
"accountConnected": "Konto verbunden."
|
||||
},
|
||||
"quantityStrings": {
|
||||
"modifySettingsFor": {
|
||||
|
||||
@@ -94,7 +94,13 @@
|
||||
"conditionals": "Voorwaarden",
|
||||
"donate": "Doneer",
|
||||
"contactThrough": "Stuur bericht via:",
|
||||
"sendPIN": "Vraag de gebruiker om onderstaande pincode naar de bot te sturen."
|
||||
"sendPIN": "Vraag de gebruiker om onderstaande pincode naar de bot te sturen.",
|
||||
"add": "Voeg toe",
|
||||
"searchDiscordUser": "Begin de Discord gebruikersnaam te typen om de gebruiker te vinden.",
|
||||
"linkMatrixDescription": "Vul de gebruikersnaam en wachtwoord in van de gebruiker om als bot te gebruiken. De app start zodra ze zijn verstuurd.",
|
||||
"select": "Selecteer",
|
||||
"findDiscordUser": "Zoek Discord gebruiker",
|
||||
"matrixHomeServer": "Adres home server"
|
||||
},
|
||||
"notifications": {
|
||||
"changedEmailAddress": "E-mailadres van {n} gewijzigd.",
|
||||
@@ -133,7 +139,8 @@
|
||||
"updateAvailable": "Er is een nieuwe update beschikbaar, kijk bij instellingen.",
|
||||
"noUpdatesAvailable": "Geen nieuwe updates beschikbaar.",
|
||||
"telegramVerified": "Telegram-account goedgekeurd.",
|
||||
"updateAppliedRefresh": "Update toegepast, ververs alsjeblieft."
|
||||
"updateAppliedRefresh": "Update toegepast, ververs alsjeblieft.",
|
||||
"accountConnected": "Account gekoppeld."
|
||||
},
|
||||
"quantityStrings": {
|
||||
"modifySettingsFor": {
|
||||
|
||||
@@ -94,7 +94,12 @@
|
||||
"conditionals": "Condicionais",
|
||||
"donate": "Doar",
|
||||
"contactThrough": "Contato através:",
|
||||
"sendPIN": "Peça ao usuário para enviar o PIN abaixo para o bot."
|
||||
"sendPIN": "Peça ao usuário para enviar o PIN abaixo para o bot.",
|
||||
"searchDiscordUser": "Digite o nome de usuário do Discord.",
|
||||
"findDiscordUser": "Encontrar usuário Discord",
|
||||
"add": "Adicionar",
|
||||
"linkMatrixDescription": "Digite o nome de usuário e a senha para usar como bot. Depois de enviado, o aplicativo será reiniciado.",
|
||||
"select": "Selecionar"
|
||||
},
|
||||
"notifications": {
|
||||
"changedEmailAddress": "Endereço de e-mail alterado de {n}.",
|
||||
@@ -133,7 +138,8 @@
|
||||
"errorCheckUpdate": "Falha ao verificar atualizações.",
|
||||
"noUpdatesAvailable": "Nenhuma atualização disponível.",
|
||||
"telegramVerified": "Conta do Telegram verificada.",
|
||||
"updateAppliedRefresh": "Atualização instalada, atualize."
|
||||
"updateAppliedRefresh": "Atualização instalada, atualize.",
|
||||
"accountConnected": "Conta conectada."
|
||||
},
|
||||
"quantityStrings": {
|
||||
"modifySettingsFor": {
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
"copied": "Kopiert",
|
||||
"linkTelegram": "Link Telegram",
|
||||
"contactEmail": "Kontakt über E-Mail",
|
||||
"contactTelegram": "Kontakt über Telegram"
|
||||
"contactTelegram": "Kontakt über Telegram",
|
||||
"linkDiscord": "Link Discord",
|
||||
"linkMatrix": "Link Matrix",
|
||||
"send": "Senden",
|
||||
"contactDiscord": "Kontakt über Discord"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
"copied": "Gekopieerd",
|
||||
"linkTelegram": "Koppel Telegram",
|
||||
"contactEmail": "Stuur e-mailbericht",
|
||||
"contactTelegram": "Stuur Telegram-bericht"
|
||||
"contactTelegram": "Stuur Telegram-bericht",
|
||||
"send": "Verstuur",
|
||||
"linkDiscord": "Koppel Discord",
|
||||
"linkMatrix": "Koppel Matrix",
|
||||
"contactDiscord": "Stuur Discord bericht"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,12 @@
|
||||
"time24h": "Horário 24h",
|
||||
"time12h": "Horário 12h",
|
||||
"copied": "Copiado",
|
||||
"linkTelegram": "Link Telegram",
|
||||
"linkTelegram": "Link do Telegram",
|
||||
"contactEmail": "Contato por Email",
|
||||
"contactTelegram": "Contato pelo Telegram"
|
||||
"contactTelegram": "Contato pelo Telegram",
|
||||
"send": "Enviar",
|
||||
"linkDiscord": "Link do Discord",
|
||||
"linkMatrix": "Link do Matrix",
|
||||
"contactDiscord": "Contato através do Discord"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"name": "Português (BR)"
|
||||
},
|
||||
"strings": {
|
||||
"ifItWasNotYou": "Se não foi você, ignore este e-mail.",
|
||||
"ifItWasNotYou": "Se não foi você, ignore.",
|
||||
"reason": "Razão",
|
||||
"helloUser": "Ola {username},"
|
||||
},
|
||||
@@ -49,7 +49,7 @@
|
||||
"welcome": "Bem vindo ao Jellyfin!",
|
||||
"youCanLoginWith": "Abaixo está os detalhes para fazer o login",
|
||||
"jellyfinURL": "URL",
|
||||
"name": "Email de Boas vindas",
|
||||
"name": "Bem-vindo",
|
||||
"yourAccountWillExpire": "Sua conta irá expirar em {date}."
|
||||
},
|
||||
"emailConfirmation": {
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
"confirmationRequired": "E-Mail-Bestätigung erforderlich",
|
||||
"confirmationRequiredMessage": "Bitte überprüfe dein Posteingang und bestätige deine E-Mail-Adresse.",
|
||||
"yourAccountIsValidUntil": "Dein Konto wird bis zum {date} gültig sein.",
|
||||
"sendPIN": "Sende die untenstehende PIN an den Bot und komm dann hierher zurück, um dein Konto zu verbinden."
|
||||
"sendPIN": "Sende die untenstehende PIN an den Bot und komm dann hierher zurück, um dein Konto zu verbinden.",
|
||||
"sendPINDiscord": "Gib auf Discord {command} in {server_channel} ein und sende die untenstehende PIN als DM an den Bot.",
|
||||
"matrixEnterUser": "Gib deine Benutzer-ID ein und drücke auf Absenden. Anschließend erhälst du ein PIN, die hier eingegeben wird um fortzufahren."
|
||||
},
|
||||
"validationStrings": {
|
||||
"length": {
|
||||
@@ -47,6 +49,10 @@
|
||||
"errorInvalidCode": "Ungültiger Invite-Code.",
|
||||
"telegramVerified": "Telegram-Konto verifiziert.",
|
||||
"errorTelegramVerification": "Verifizierung von Telegram erforderlich.",
|
||||
"errorInvalidPIN": "Telegram PIN ist ungültig."
|
||||
"errorInvalidPIN": "PIN ist ungültig.",
|
||||
"errorDiscordVerification": "Discord-Verifizierung erforderlich.",
|
||||
"errorMatrixVerification": "Matrix-Verifizierung erforderlich.",
|
||||
"errorUnknown": "Unbekannter Fehler.",
|
||||
"verified": "Konto verifiziert."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
"confirmationRequired": "Bevestiging van e-mailadres verplicht",
|
||||
"confirmationRequiredMessage": "Controleer je e-mail inbox om je adres te bevestigen.",
|
||||
"yourAccountIsValidUntil": "Je account zal geldig zijn tot {date}.",
|
||||
"sendPIN": "Stuur onderstaande pincode naar de bot, en kom daarna hier terug om je account te koppelen."
|
||||
"sendPIN": "Stuur onderstaande pincode naar de bot, en kom daarna hier terug om je account te koppelen.",
|
||||
"matrixEnterUser": "Voer je gebruikers ID in, druk op versturen, en er wordt je een pincode toegestuurd. Vul die hier in om door te gaan.",
|
||||
"sendPINDiscord": "Typ {command} in {server_channel} op Discord, stuur daarna onderstaande pincode via DM naar de bot."
|
||||
},
|
||||
"validationStrings": {
|
||||
"length": {
|
||||
@@ -47,6 +49,10 @@
|
||||
"errorInvalidCode": "Ongeldige uitnodigingscode.",
|
||||
"telegramVerified": "Telegram-account goedgekeurd.",
|
||||
"errorTelegramVerification": "Telegram-verificatie nodig.",
|
||||
"errorInvalidPIN": "Telegram pincode is ongeldig."
|
||||
"errorInvalidPIN": "Pincode is ongeldig.",
|
||||
"errorDiscordVerification": "Discord-verificatie vereist.",
|
||||
"errorUnknown": "Onbekende fout.",
|
||||
"errorMatrixVerification": "Matrix-verificatie vereist.",
|
||||
"verified": "Account geverifieerd."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,20 @@
|
||||
"confirmationRequired": "Confirmação por e-mail",
|
||||
"confirmationRequiredMessage": "Verifique sua caixa de email para finalizar o cadastro.",
|
||||
"yourAccountIsValidUntil": "Sua conta é válida até {date}.",
|
||||
"sendPIN": "Envie o PIN abaixo para o bot e volte aqui para vincular sua conta."
|
||||
"sendPIN": "Envie o PIN abaixo para o bot e volte aqui para vincular sua conta.",
|
||||
"sendPINDiscord": "Digite {command} em {server_channel} no Discord e envie o PIN abaixo via DM para o bot.",
|
||||
"matrixEnterUser": "Digite sua ID de usuário, pressione enviar e um PIN será enviado. E digite aqui para continuar."
|
||||
},
|
||||
"notifications": {
|
||||
"errorUserExists": "Esse usuário já existe.",
|
||||
"errorInvalidCode": "Código do convite invalido.",
|
||||
"telegramVerified": "Conta do Telegram verificada.",
|
||||
"errorInvalidPIN": "O PIN do telegram é inválido.",
|
||||
"errorTelegramVerification": "Requer a verificação do telegram."
|
||||
"errorInvalidPIN": "PIN inválido.",
|
||||
"errorTelegramVerification": "Requer a verificação do telegram.",
|
||||
"errorDiscordVerification": "Necessária verificação pelo Discord.",
|
||||
"errorMatrixVerification": "Necessária verificação Matrix.",
|
||||
"errorUnknown": "Erro desconhecido.",
|
||||
"verified": "Conta verificada."
|
||||
},
|
||||
"validationStrings": {
|
||||
"length": {
|
||||
|
||||
@@ -17,11 +17,15 @@
|
||||
"successContinueButton": "Fortsätt",
|
||||
"confirmationRequired": "E-postbekräftelse krävs",
|
||||
"confirmationRequiredMessage": "Kontrollera din e-postkorg för att verifiera din adress.",
|
||||
"yourAccountIsValidUntil": "Ditt konto är giltigt fram tills {date}."
|
||||
"yourAccountIsValidUntil": "Ditt konto är giltigt fram tills {date}.",
|
||||
"sendPIN": "Skicka PIN-koden nedan till botten, återvänd sedan till den här sidan för att länka ditt konto."
|
||||
},
|
||||
"notifications": {
|
||||
"errorUserExists": "Användare finns redan.",
|
||||
"errorInvalidCode": "Ogiltig inbjudningskod."
|
||||
"errorInvalidCode": "Ogiltig inbjudningskod.",
|
||||
"errorInvalidPIN": "Telegram-PIN är ogiltig.",
|
||||
"errorTelegramVerification": "Telegram-verifiering krävs.",
|
||||
"telegramVerified": "Telegram-konto verifierades."
|
||||
},
|
||||
"validationStrings": {
|
||||
"length": {
|
||||
|
||||
13
lang/pwreset/en-GB.json
Normal file
13
lang/pwreset/en-GB.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": ""
|
||||
},
|
||||
"strings": {
|
||||
"passwordReset": "",
|
||||
"resetFailed": "",
|
||||
"tryAgain": "",
|
||||
"youCanLogin": "",
|
||||
"youCanLoginOmbi": "",
|
||||
"changeYourPassword": ""
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,12 @@
|
||||
},
|
||||
"strings": {
|
||||
"passwordReset": "Password reset",
|
||||
"reset": "Reset",
|
||||
"resetFailed": "Password reset failed",
|
||||
"tryAgain": "Please try again.",
|
||||
"youCanLogin": "You can now log in with the below code as your password.",
|
||||
"youCanLoginOmbi": "You can now log in to Jellyfin & Ombi with the below code as your password.",
|
||||
"changeYourPassword": "Make sure to change your password after you log in."
|
||||
"changeYourPassword": "Make sure to change your password after you log in.",
|
||||
"enterYourPassword": "Enter your new password below."
|
||||
}
|
||||
}
|
||||
|
||||
13
lang/pwreset/pt-BR.json
Normal file
13
lang/pwreset/pt-BR.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Português (BR)"
|
||||
},
|
||||
"strings": {
|
||||
"passwordReset": "Redefinir senha",
|
||||
"resetFailed": "Falha ao redefinir a senha",
|
||||
"tryAgain": "Tente novamente.",
|
||||
"youCanLogin": "Agora você pode fazer login com o código abaixo como senha.",
|
||||
"youCanLoginOmbi": "Agora você pode fazer login no Jellyfin & Ombi com o código abaixo como senha.",
|
||||
"changeYourPassword": "Certifique-se de alterar sua senha depois de fazer o login."
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@
|
||||
},
|
||||
"ombi": {
|
||||
"title": "Ombi",
|
||||
"description": "Genom att ansluta till Ombi skapas både ett Jellyfin- och Ombi-konto när en användare går med genom jfa-go. Efter installationen, om du är klar, gå till Inställningar för att ställa in en standardprofil för nya ombi-användare.",
|
||||
"description": "Genom att ansluta till Ombi skapas både ett Jellyfin- och Ombi-konto när en användare går med genom jfa-go. Efter installationen är klar, gå till Inställningar för att ställa in en standardprofil för nya ombi-användare.",
|
||||
"apiKeyNotice": "Hitta detta i den första fliken i Ombi-inställningarna."
|
||||
},
|
||||
"email": {
|
||||
@@ -101,7 +101,10 @@
|
||||
"title": "Lösenordsåterställningar",
|
||||
"description": "När en användare försöker återställa sitt lösenord skapar Jellyfin en fil med namnet 'passwordreset-*.json' som innehåller en PIN-kod. jfa-go läser filen och skickar PIN-koden till användaren.",
|
||||
"pathToJellyfin": "Sökväg till Jellyfin-konfigurationskatalogen",
|
||||
"pathToJellyfinNotice": "Om du inte vet var det är, försök återställa lösenordet i Jellyfin. En popup med '<sökväg till jellyfin>/passwordreset-*.json' kommer då visas."
|
||||
"pathToJellyfinNotice": "Om du inte vet var det är, försök återställa lösenordet i Jellyfin. En popup med '<sökväg till jellyfin>/passwordreset-*.json' kommer då visas.",
|
||||
"resetLinks": "Skicka en länk istället för en PIN",
|
||||
"resetLinksNotice": "Om Ombi-integrationen är aktiverad, använd den för att synkronisera lösenordsåterställningar med Ombi.",
|
||||
"resetLinksLanguage": "Förvalt språk för återställningslänk"
|
||||
},
|
||||
"passwordValidation": {
|
||||
"title": "Validering av lösenord",
|
||||
@@ -123,5 +126,12 @@
|
||||
"successMessageNotice": "Visas när en användare skapar sitt konto.",
|
||||
"emailMessage": "E-postmeddelande",
|
||||
"emailMessageNotice": "Visas längst ner i e-postmeddelanden."
|
||||
},
|
||||
"updates": {
|
||||
"title": "Uppdateringar",
|
||||
"updateChannel": "Uppdateringskanal",
|
||||
"description": "Aktivera för att få notifikation när nya uppdateringar finns tillgängliga. jfa-go kollar {n} var 30:e minut. Inga IP-adresser eller personligt identifierande handlingar samlas in.",
|
||||
"stable": "Stabil",
|
||||
"unstable": "Ostabil"
|
||||
}
|
||||
}
|
||||
|
||||
12
lang/telegram/de-DE.json
Normal file
12
lang/telegram/de-DE.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Deutsch (DE)"
|
||||
},
|
||||
"strings": {
|
||||
"startMessage": "Hallo,\ngib deinen Jellyfin-PIN-Code ein, um dein Konto zu verifizieren.",
|
||||
"matrixStartMessage": "Hallo,\ngib den untenstehenden PIN auf der Anmeldeseite von Jellyfin ein, um dein Konto zu verifizieren.",
|
||||
"invalidPIN": "Diese PIN war ungültig, versuche es erneut.",
|
||||
"pinSuccess": "Erfolg! Du kannst nun zur Anmeldeseite zurückkehren.",
|
||||
"languageMessage": "Hinweis: Zeige verfügbare Sprachen mit {command} an und stelle mit {command} <Sprachcode> die gewünschte ein."
|
||||
}
|
||||
}
|
||||
12
lang/telegram/nl-NL.json
Normal file
12
lang/telegram/nl-NL.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Nederlands (NL)"
|
||||
},
|
||||
"strings": {
|
||||
"startMessage": "Hallo!\nVoer je Jellyfin pincode in om je account te verifiëren.",
|
||||
"matrixStartMessage": "Hallo\nVoer onderstaande pincode in op de Jellyfin aanmeldpagina om je account te verifiëren.",
|
||||
"invalidPIN": "Die pincode was ongeldig, probeer het nogmaals.",
|
||||
"pinSuccess": "Succes! Je kunt nu teruggaan naar de aanmeldpagina.",
|
||||
"languageMessage": "Opmerking: Bekijk beschikbare talen met {command}, en stel de taal in met {command} <taalcode>."
|
||||
}
|
||||
}
|
||||
12
lang/telegram/pt-BR.json
Normal file
12
lang/telegram/pt-BR.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Português (BR)"
|
||||
},
|
||||
"strings": {
|
||||
"startMessage": "Oi!\nDigite seu código PIN Jellyfin aqui para verificar sua conta.",
|
||||
"matrixStartMessage": "Oi\nDigite o PIN abaixo na página do Jellyfin para verificar sua conta.",
|
||||
"invalidPIN": "PIN invalido, tente novamente.",
|
||||
"pinSuccess": "Concluído. Agora você pode retornar à página de inscrição.",
|
||||
"languageMessage": "Nota: Veja os idiomas disponíveis com {command} e defina o idioma com {command} <language code>."
|
||||
}
|
||||
}
|
||||
3
linecache/go.mod
Normal file
3
linecache/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module github.com/hrfee/jfa-go/linecache
|
||||
|
||||
go 1.16
|
||||
66
linecache/linecache.go
Normal file
66
linecache/linecache.go
Normal file
@@ -0,0 +1,66 @@
|
||||
// Package linecache provides a writer that stores n lines of text at once, overwriting old content as it reaches its capacity. Its contents can be read from with a String() method.
|
||||
package linecache
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// LineCache provides an io.Writer that stores a fixed number of lines of text.
|
||||
type LineCache struct {
|
||||
count int
|
||||
lines [][]byte
|
||||
current int
|
||||
lock *sync.Mutex
|
||||
}
|
||||
|
||||
// NewLineCache returns a new line cache of capacity (n) lines.
|
||||
func NewLineCache(n int) *LineCache {
|
||||
return &LineCache{
|
||||
current: 0,
|
||||
count: n,
|
||||
lines: make([][]byte, n),
|
||||
lock: &sync.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
// Write writes a given byte array to the cache.
|
||||
func (l *LineCache) Write(p []byte) (n int, err error) {
|
||||
l.lock.Lock()
|
||||
defer l.lock.Unlock()
|
||||
lines := strings.Split(string(p), "\n")
|
||||
for _, line := range lines {
|
||||
if string(line) == "" {
|
||||
continue
|
||||
}
|
||||
if l.current == l.count {
|
||||
l.current = 0
|
||||
}
|
||||
l.lines[l.current] = []byte(line)
|
||||
l.current++
|
||||
}
|
||||
n = len(p)
|
||||
return
|
||||
}
|
||||
|
||||
// String returns a string representation of the cache contents.
|
||||
func (l *LineCache) String() string {
|
||||
i := 0
|
||||
if l.lines[l.count-1] != nil && l.current != l.count {
|
||||
i = l.current
|
||||
}
|
||||
out := ""
|
||||
for {
|
||||
if l.lines[i] == nil {
|
||||
return out
|
||||
}
|
||||
out += string(l.lines[i]) + "\n"
|
||||
i++
|
||||
if i == l.current {
|
||||
return out
|
||||
}
|
||||
if i == l.count {
|
||||
i = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
17
linecache/linecache_test.go
Normal file
17
linecache/linecache_test.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package linecache
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Test(t *testing.T) {
|
||||
wr := NewLineCache(10)
|
||||
for i := 10; i < 50; i++ {
|
||||
fmt.Fprintln(wr, i)
|
||||
fmt.Print(strings.ReplaceAll(wr.String(), "\n", " "), "\n")
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}
|
||||
77
log.go
Normal file
77
log.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/hrfee/jfa-go/linecache"
|
||||
)
|
||||
|
||||
var logPath string = filepath.Join(temp, "jfa-go.log")
|
||||
var lineCache = linecache.NewLineCache(100)
|
||||
|
||||
func logOutput() (closeFunc func()) {
|
||||
old := os.Stdout
|
||||
log.Printf("Logging to \"%s\"", logPath)
|
||||
writers := []io.Writer{old, colorStripper{lineCache}}
|
||||
wExit := make(chan bool)
|
||||
r, w, _ := os.Pipe()
|
||||
if TRAY {
|
||||
f, err := os.OpenFile(logPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
|
||||
if err != nil {
|
||||
closeFunc = func() {}
|
||||
return
|
||||
}
|
||||
writers = append(writers, colorStripper{f})
|
||||
closeFunc = func() {
|
||||
w.Close()
|
||||
<-wExit
|
||||
f.Close()
|
||||
}
|
||||
} else {
|
||||
closeFunc = func() {
|
||||
w.Close()
|
||||
<-wExit
|
||||
}
|
||||
}
|
||||
writer := io.MultiWriter(writers...)
|
||||
os.Stdout, os.Stderr = w, w
|
||||
log.SetOutput(writer)
|
||||
gin.DefaultWriter, gin.DefaultErrorWriter = writer, writer
|
||||
go func() {
|
||||
io.Copy(writer, r)
|
||||
wExit <- true
|
||||
}()
|
||||
return
|
||||
}
|
||||
|
||||
// Regex that removes ANSI color escape sequences. Used for outputting to log file and log cache.
|
||||
var stripColors = func() *regexp.Regexp {
|
||||
r, err := regexp.Compile("\\x1b\\[[0-9;]*m")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to compile color escape regexp: %v", err)
|
||||
}
|
||||
return r
|
||||
}()
|
||||
|
||||
type colorStripper struct {
|
||||
file io.Writer
|
||||
}
|
||||
|
||||
func (c colorStripper) Write(p []byte) (n int, err error) {
|
||||
_, err = c.file.Write(stripColors.ReplaceAll(p, []byte("")))
|
||||
n = len(p)
|
||||
return
|
||||
}
|
||||
|
||||
func sanitizeLog(l string) string {
|
||||
quoteCensor, err := regexp.Compile("\"([^\"]*)\"")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to compile sanitizing regexp: %v", err)
|
||||
}
|
||||
return string(quoteCensor.ReplaceAll([]byte(l), []byte("\"CENSORED\"")))
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
"runtime"
|
||||
@@ -16,12 +17,14 @@ type Logger interface {
|
||||
Println(v ...interface{})
|
||||
Fatal(v ...interface{})
|
||||
Fatalf(format string, v ...interface{})
|
||||
SetFatalFunc(f func(err interface{}))
|
||||
}
|
||||
|
||||
type logger struct {
|
||||
logger *log.Logger
|
||||
shortfile bool
|
||||
printer *c.Color
|
||||
fatalFunc func(err interface{})
|
||||
}
|
||||
|
||||
func Lshortfile() string {
|
||||
@@ -97,7 +100,16 @@ func (l logger) Fatalf(format string, v ...interface{}) {
|
||||
out = Lshortfile()
|
||||
}
|
||||
out += " " + l.printer.Sprintf(format, v...)
|
||||
l.logger.Fatal(out)
|
||||
if l.fatalFunc != nil {
|
||||
l.logger.Print(out)
|
||||
l.fatalFunc(errors.New(out))
|
||||
} else {
|
||||
l.logger.Fatal(out)
|
||||
}
|
||||
}
|
||||
|
||||
func (l logger) SetFatalFunc(f func(err interface{})) {
|
||||
l.fatalFunc = f
|
||||
}
|
||||
|
||||
type EmptyLogger bool
|
||||
@@ -107,3 +119,4 @@ func (l EmptyLogger) Print(v ...interface{}) {}
|
||||
func (l EmptyLogger) Println(v ...interface{}) {}
|
||||
func (l EmptyLogger) Fatal(v ...interface{}) {}
|
||||
func (l EmptyLogger) Fatalf(format string, v ...interface{}) {}
|
||||
func (l EmptyLogger) SetFatalFunc(f func(err interface{})) {}
|
||||
|
||||
163
main.go
163
main.go
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"log"
|
||||
"mime"
|
||||
@@ -21,7 +20,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/hrfee/jfa-go/common"
|
||||
_ "github.com/hrfee/jfa-go/docs"
|
||||
"github.com/hrfee/jfa-go/logger"
|
||||
@@ -36,6 +34,7 @@ var (
|
||||
SOCK string = "jfa-go.sock"
|
||||
SRV *http.Server
|
||||
RESTART chan bool
|
||||
TRAYRESTART chan bool
|
||||
DATA, CONFIG, HOST *string
|
||||
PORT *int
|
||||
DEBUG *bool
|
||||
@@ -60,8 +59,6 @@ var temp = func() string {
|
||||
return temp
|
||||
}()
|
||||
|
||||
var logPath string = filepath.Join(temp, "jfa-go.log")
|
||||
|
||||
var serverTypes = map[string]string{
|
||||
"jellyfin": "Jellyfin",
|
||||
"emby": "Emby (experimental)",
|
||||
@@ -176,7 +173,9 @@ func start(asDaemon, firstCall bool) {
|
||||
}
|
||||
|
||||
app.info = logger.NewLogger(os.Stdout, "[INFO] ", log.Ltime, color.FgHiWhite)
|
||||
app.info.SetFatalFunc(Exit)
|
||||
app.err = logger.NewLogger(os.Stdout, "[ERROR] ", log.Ltime|log.Lshortfile, color.FgRed)
|
||||
app.err.SetFatalFunc(Exit)
|
||||
|
||||
app.loadArgs(firstCall)
|
||||
|
||||
@@ -201,6 +200,9 @@ func start(asDaemon, firstCall bool) {
|
||||
app.err.Fatalf("Couldn't copy default config.")
|
||||
}
|
||||
app.info.Printf("Copied default configuration to \"%s\"", app.configPath)
|
||||
tempConfig, _ := ini.Load(app.configPath)
|
||||
tempConfig.Section("").Key("first_run").SetValue("true")
|
||||
tempConfig.SaveTo(app.configPath)
|
||||
}
|
||||
|
||||
var debugMode bool
|
||||
@@ -209,9 +211,8 @@ func start(asDaemon, firstCall bool) {
|
||||
app.err.Fatalf("Failed to load config file \"%s\": %v", app.configPath, err)
|
||||
}
|
||||
|
||||
// Some message settings have been moved from "email" to "messages", this will switch them.
|
||||
if app.config.Section("email").Key("use_24h").Value() != "" {
|
||||
app.migrateEmailConfig()
|
||||
if app.config.Section("").Key("first_run").MustBool(false) {
|
||||
firstRun = true
|
||||
}
|
||||
|
||||
app.version = app.config.Section("jellyfin").Key("version").String()
|
||||
@@ -325,7 +326,7 @@ func start(asDaemon, firstCall bool) {
|
||||
app.storage.emails_path = app.config.Section("files").Key("emails").String()
|
||||
if err := app.storage.loadEmails(); err != nil {
|
||||
app.err.Printf("Failed to load Emails: %v", err)
|
||||
err := app.migrateEmailStorage()
|
||||
err := migrateEmailStorage(app)
|
||||
if err != nil {
|
||||
app.err.Printf("Failed to migrate Email storage: %v", err)
|
||||
}
|
||||
@@ -361,23 +362,6 @@ func start(asDaemon, firstCall bool) {
|
||||
|
||||
app.storage.profiles_path = app.config.Section("files").Key("user_profiles").String()
|
||||
app.storage.loadProfiles()
|
||||
// Migrate from pre-0.2.0 user templates to profiles
|
||||
if !(app.storage.policy.BlockedTags == nil && app.storage.configuration.GroupedFolders == nil && len(app.storage.displayprefs) == 0) {
|
||||
app.info.Println("Migrating user template files to new profile format")
|
||||
app.storage.migrateToProfile()
|
||||
for _, path := range [3]string{app.storage.policy_path, app.storage.configuration_path, app.storage.displayprefs_path} {
|
||||
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
||||
dir, fname := filepath.Split(path)
|
||||
newFname := strings.Replace(fname, ".json", ".old.json", 1)
|
||||
err := os.Rename(path, filepath.Join(dir, newFname))
|
||||
if err != nil {
|
||||
app.err.Fatalf("Failed to rename %s: %s", fname, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
app.info.Println("In case of a problem, your original files have been renamed to <file>.old.json")
|
||||
app.storage.storeProfiles()
|
||||
}
|
||||
|
||||
if app.config.Section("ombi").Key("enabled").MustBool(false) {
|
||||
app.storage.ombi_path = app.config.Section("files").Key("ombi_template").String()
|
||||
@@ -396,17 +380,6 @@ func start(asDaemon, firstCall bool) {
|
||||
configBase, _ := fs.ReadFile(localFS, app.configBasePath)
|
||||
json.Unmarshal(configBase, &app.configBase)
|
||||
|
||||
themes := map[string]string{
|
||||
"Jellyfin (Dark)": "dark-theme",
|
||||
"Default (Light)": "light-theme",
|
||||
}
|
||||
// For move from Bootstrap to a17t (0.2.5)
|
||||
if app.config.Section("ui").Key("theme").String() == "Bootstrap (Light)" {
|
||||
app.config.Section("ui").Key("theme").SetValue("Default (Light)")
|
||||
}
|
||||
if val, ok := themes[app.config.Section("ui").Key("theme").String()]; ok {
|
||||
app.cssClass = val
|
||||
}
|
||||
secret, err := generateSecret(16)
|
||||
if err != nil {
|
||||
app.err.Fatal(err)
|
||||
@@ -417,17 +390,17 @@ func start(asDaemon, firstCall bool) {
|
||||
server := app.config.Section("jellyfin").Key("server").String()
|
||||
cacheTimeout := int(app.config.Section("jellyfin").Key("cache_timeout").MustUint(30))
|
||||
stringServerType := app.config.Section("jellyfin").Key("type").String()
|
||||
timeoutHandler := mediabrowser.NewNamedTimeoutHandler("Jellyfin", server, true)
|
||||
timeoutHandler := mediabrowser.NewNamedTimeoutHandler("Jellyfin", "\""+server+"\"", true)
|
||||
if stringServerType == "emby" {
|
||||
serverType = mediabrowser.EmbyServer
|
||||
timeoutHandler = mediabrowser.NewNamedTimeoutHandler("Emby", server, true)
|
||||
timeoutHandler = mediabrowser.NewNamedTimeoutHandler("Emby", "\""+server+"\"", true)
|
||||
app.info.Println("Using Emby server type")
|
||||
fmt.Println(warning("WARNING: Emby compatibility is experimental, and support is limited.\nPassword resets are not available."))
|
||||
} else {
|
||||
app.info.Println("Using Jellyfin server type")
|
||||
}
|
||||
|
||||
app.jf, _ = mediabrowser.NewServer(
|
||||
app.jf, err = mediabrowser.NewServer(
|
||||
serverType,
|
||||
server,
|
||||
app.config.Section("jellyfin").Key("client").String(),
|
||||
@@ -437,85 +410,20 @@ func start(asDaemon, firstCall bool) {
|
||||
timeoutHandler,
|
||||
cacheTimeout,
|
||||
)
|
||||
if err != nil {
|
||||
app.err.Fatalf("Failed to authenticate with Jellyfin @ \"%s\": %v", server, err)
|
||||
}
|
||||
if debugMode {
|
||||
app.jf.Verbose = true
|
||||
}
|
||||
var status int
|
||||
_, status, err = app.jf.Authenticate(app.config.Section("jellyfin").Key("username").String(), app.config.Section("jellyfin").Key("password").String())
|
||||
if status != 200 || err != nil {
|
||||
app.err.Fatalf("Failed to authenticate with Jellyfin @ %s (%d): %v", server, status, err)
|
||||
app.err.Fatalf("Failed to authenticate with Jellyfin @ \"%s\" (%d): %v", server, status, err)
|
||||
}
|
||||
app.info.Printf("Authenticated with %s", server)
|
||||
// /* A couple of unstable Jellyfin 10.7.0 releases decided to hyphenate user IDs.
|
||||
// This checks if the version is equal or higher. */
|
||||
// checkVersion := func(version string) int {
|
||||
// numberStrings := strings.Split(version, ".")
|
||||
// n := 0
|
||||
// for _, s := range numberStrings {
|
||||
// num, err := strconv.Atoi(s)
|
||||
// if err == nil {
|
||||
// n += num
|
||||
// }
|
||||
// }
|
||||
// return n
|
||||
// }
|
||||
// if serverType == mediabrowser.JellyfinServer && checkVersion(app.jf.ServerInfo.Version) >= checkVersion("10.7.0") {
|
||||
// // Get users to check if server uses hyphenated userIDs
|
||||
// app.jf.GetUsers(false)
|
||||
|
||||
// noHyphens := true
|
||||
// for id := range app.storage.emails {
|
||||
// if strings.Contains(id, "-") {
|
||||
// noHyphens = false
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// if noHyphens == app.jf.Hyphens {
|
||||
// var newEmails map[string]interface{}
|
||||
// var newUsers map[string]time.Time
|
||||
// var status, status2 int
|
||||
// var err, err2 error
|
||||
// if app.jf.Hyphens {
|
||||
// app.info.Println(info("Your build of Jellyfin appears to hypenate user IDs. Your emails.json/users.json file will be modified to match."))
|
||||
// time.Sleep(time.Second * time.Duration(3))
|
||||
// newEmails, status, err = app.hyphenateEmailStorage(app.storage.emails)
|
||||
// newUsers, status2, err2 = app.hyphenateUserStorage(app.storage.users)
|
||||
// } else {
|
||||
// app.info.Println(info("Your emails.json/users.json file uses hyphens, but the Jellyfin server no longer does. It will be modified."))
|
||||
// time.Sleep(time.Second * time.Duration(3))
|
||||
// newEmails, status, err = app.deHyphenateEmailStorage(app.storage.emails)
|
||||
// newUsers, status2, err2 = app.deHyphenateUserStorage(app.storage.users)
|
||||
// }
|
||||
// if status != 200 || err != nil {
|
||||
// app.err.Printf("Failed to get users from Jellyfin (%d): %v", status, err)
|
||||
// app.err.Fatalf("Couldn't upgrade emails.json")
|
||||
// }
|
||||
// if status2 != 200 || err2 != nil {
|
||||
// app.err.Printf("Failed to get users from Jellyfin (%d): %v", status, err)
|
||||
// app.err.Fatalf("Couldn't upgrade users.json")
|
||||
// }
|
||||
// emailBakFile := app.storage.emails_path + ".bak"
|
||||
// usersBakFile := app.storage.users_path + ".bak"
|
||||
// err = storeJSON(emailBakFile, app.storage.emails)
|
||||
// err2 = storeJSON(usersBakFile, app.storage.users)
|
||||
// if err != nil {
|
||||
// app.err.Fatalf("couldn't store emails.json backup: %v", err)
|
||||
// }
|
||||
// if err2 != nil {
|
||||
// app.err.Fatalf("couldn't store users.json backup: %v", err)
|
||||
// }
|
||||
// app.storage.emails = newEmails
|
||||
// app.storage.users = newUsers
|
||||
// err = app.storage.storeEmails()
|
||||
// err2 = app.storage.storeUsers()
|
||||
// if err != nil {
|
||||
// app.err.Fatalf("couldn't store emails.json: %v", err)
|
||||
// }
|
||||
// if err2 != nil {
|
||||
// app.err.Fatalf("couldn't store users.json: %v", err)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
runMigrations(app)
|
||||
|
||||
// Auth (manual user/pass or jellyfin)
|
||||
app.jellyfinLogin = true
|
||||
@@ -561,7 +469,7 @@ func start(asDaemon, firstCall bool) {
|
||||
|
||||
invDaemon := newInviteDaemon(time.Duration(60*time.Second), app)
|
||||
go invDaemon.run()
|
||||
defer invDaemon.shutdown()
|
||||
defer invDaemon.Shutdown()
|
||||
|
||||
userDaemon := newUserDaemon(time.Duration(60*time.Second), app)
|
||||
go userDaemon.run()
|
||||
@@ -690,7 +598,7 @@ func flagPassed(name string) (found bool) {
|
||||
}
|
||||
|
||||
// @title jfa-go internal API
|
||||
// @version 0.3.4
|
||||
// @version 0.3.6
|
||||
// @description API for the jfa-go frontend
|
||||
// @contact.name Harvey Tindall
|
||||
// @contact.email hrfee@hrfee.dev
|
||||
@@ -734,34 +642,13 @@ func printVersion() {
|
||||
fmt.Println(info("jfa-go version: %s (%s)%s\n", hiwhite(version), white(commit), tray))
|
||||
}
|
||||
|
||||
func logOutput() func() {
|
||||
old := os.Stdout
|
||||
log.Printf("Logging to \"%s\"", logPath)
|
||||
f, err := os.OpenFile(logPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
|
||||
if err != nil {
|
||||
return func() {}
|
||||
}
|
||||
writer := io.MultiWriter(old, f)
|
||||
r, w, _ := os.Pipe()
|
||||
os.Stdout, os.Stderr = w, w
|
||||
log.SetOutput(writer)
|
||||
gin.DefaultWriter, gin.DefaultErrorWriter = writer, writer
|
||||
wExit := make(chan bool)
|
||||
go func() {
|
||||
io.Copy(writer, r)
|
||||
wExit <- true
|
||||
}()
|
||||
return func() {
|
||||
w.Close()
|
||||
<-wExit
|
||||
f.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
if TRAY {
|
||||
defer logOutput()()
|
||||
}
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
Exit(r)
|
||||
}
|
||||
}()
|
||||
defer logOutput()()
|
||||
printVersion()
|
||||
SOCK = filepath.Join(temp, SOCK)
|
||||
fmt.Println("Socket:", SOCK)
|
||||
|
||||
180
migrations.go
Normal file
180
migrations.go
Normal file
@@ -0,0 +1,180 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/ini.v1"
|
||||
)
|
||||
|
||||
func runMigrations(app *appContext) {
|
||||
migrateProfiles(app)
|
||||
migrateBootstrap(app)
|
||||
migrateEmailStorage(app)
|
||||
// migrateHyphens(app)
|
||||
}
|
||||
|
||||
// Migrate pre-0.2.0 user templates to profiles
|
||||
func migrateProfiles(app *appContext) {
|
||||
if !(app.storage.policy.BlockedTags == nil && app.storage.configuration.GroupedFolders == nil && len(app.storage.displayprefs) == 0) {
|
||||
app.info.Println("Migrating user template files to new profile format")
|
||||
app.storage.migrateToProfile()
|
||||
for _, path := range [3]string{app.storage.policy_path, app.storage.configuration_path, app.storage.displayprefs_path} {
|
||||
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
||||
dir, fname := filepath.Split(path)
|
||||
newFname := strings.Replace(fname, ".json", ".old.json", 1)
|
||||
err := os.Rename(path, filepath.Join(dir, newFname))
|
||||
if err != nil {
|
||||
app.err.Fatalf("Failed to rename %s: %s", fname, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
app.info.Println("In case of a problem, your original files have been renamed to <file>.old.json")
|
||||
app.storage.storeProfiles()
|
||||
}
|
||||
}
|
||||
|
||||
// Migrate pre-0.2.5 bootstrap theme choice to a17t version.
|
||||
func migrateBootstrap(app *appContext) {
|
||||
themes := map[string]string{
|
||||
"Jellyfin (Dark)": "dark-theme",
|
||||
"Default (Light)": "light-theme",
|
||||
}
|
||||
|
||||
if app.config.Section("ui").Key("theme").String() == "Bootstrap (Light)" {
|
||||
app.config.Section("ui").Key("theme").SetValue("Default (Light)")
|
||||
}
|
||||
if val, ok := themes[app.config.Section("ui").Key("theme").String()]; ok {
|
||||
app.cssClass = val
|
||||
}
|
||||
}
|
||||
|
||||
func migrateEmailConfig(app *appContext) {
|
||||
tempConfig, _ := ini.Load(app.configPath)
|
||||
fmt.Println(warning("Part of your email configuration will be migrated to the new \"messages\" section.\nA backup will be made."))
|
||||
err := tempConfig.SaveTo(app.configPath + "_" + commit + ".bak")
|
||||
if err != nil {
|
||||
app.err.Fatalf("Failed to backup config: %v", err)
|
||||
return
|
||||
}
|
||||
for _, setting := range []string{"use_24h", "date_format", "message"} {
|
||||
if val := app.config.Section("email").Key(setting).Value(); val != "" {
|
||||
tempConfig.Section("email").Key(setting).SetValue("")
|
||||
tempConfig.Section("messages").Key(setting).SetValue(val)
|
||||
}
|
||||
}
|
||||
if app.config.Section("messages").Key("enabled").MustBool(false) || app.config.Section("telegram").Key("enabled").MustBool(false) {
|
||||
tempConfig.Section("messages").Key("enabled").SetValue("true")
|
||||
}
|
||||
err = tempConfig.SaveTo(app.configPath)
|
||||
if err != nil {
|
||||
app.err.Fatalf("Failed to save config: %v", err)
|
||||
return
|
||||
}
|
||||
app.loadConfig()
|
||||
}
|
||||
|
||||
// Migrate pre-0.3.6 email settings to the new messages section.
|
||||
// Called just after loading email storage in main.go.
|
||||
func migrateEmailStorage(app *appContext) error {
|
||||
// use_24h was moved to messages, so this checks if migration has already occurred or not.
|
||||
if app.config.Section("email").Key("use_24h").Value() == "" {
|
||||
return nil
|
||||
}
|
||||
var emails map[string]interface{}
|
||||
err := loadJSON(app.storage.emails_path, &emails)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
newEmails := map[string]EmailAddress{}
|
||||
for jfID, addr := range emails {
|
||||
newEmails[jfID] = EmailAddress{
|
||||
Addr: addr.(string),
|
||||
Contact: true,
|
||||
}
|
||||
}
|
||||
err = storeJSON(app.storage.emails_path+".bak", emails)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = storeJSON(app.storage.emails_path, newEmails)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
app.info.Println("Migrated to new email format. A backup has also been made.")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Migrate between hyphenated & non-hyphenated user IDs. Doesn't seem to happen anymore, so disabled.
|
||||
// func migrateHyphens(app *appContext) {
|
||||
// checkVersion := func(version string) int {
|
||||
// numberStrings := strings.Split(version, ".")
|
||||
// n := 0
|
||||
// for _, s := range numberStrings {
|
||||
// num, err := strconv.Atoi(s)
|
||||
// if err == nil {
|
||||
// n += num
|
||||
// }
|
||||
// }
|
||||
// return n
|
||||
// }
|
||||
// if serverType == mediabrowser.JellyfinServer && checkVersion(app.jf.ServerInfo.Version) >= checkVersion("10.7.0") {
|
||||
// // Get users to check if server uses hyphenated userIDs
|
||||
// app.jf.GetUsers(false)
|
||||
//
|
||||
// noHyphens := true
|
||||
// for id := range app.storage.emails {
|
||||
// if strings.Contains(id, "-") {
|
||||
// noHyphens = false
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// if noHyphens == app.jf.Hyphens {
|
||||
// var newEmails map[string]interface{}
|
||||
// var newUsers map[string]time.Time
|
||||
// var status, status2 int
|
||||
// var err, err2 error
|
||||
// if app.jf.Hyphens {
|
||||
// app.info.Println(info("Your build of Jellyfin appears to hypenate user IDs. Your emails.json/users.json file will be modified to match."))
|
||||
// time.Sleep(time.Second * time.Duration(3))
|
||||
// newEmails, status, err = app.hyphenateEmailStorage(app.storage.emails)
|
||||
// newUsers, status2, err2 = app.hyphenateUserStorage(app.storage.users)
|
||||
// } else {
|
||||
// app.info.Println(info("Your emails.json/users.json file uses hyphens, but the Jellyfin server no longer does. It will be modified."))
|
||||
// time.Sleep(time.Second * time.Duration(3))
|
||||
// newEmails, status, err = app.deHyphenateEmailStorage(app.storage.emails)
|
||||
// newUsers, status2, err2 = app.deHyphenateUserStorage(app.storage.users)
|
||||
// }
|
||||
// if status != 200 || err != nil {
|
||||
// app.err.Printf("Failed to get users from Jellyfin (%d): %v", status, err)
|
||||
// app.err.Fatalf("Couldn't upgrade emails.json")
|
||||
// }
|
||||
// if status2 != 200 || err2 != nil {
|
||||
// app.err.Printf("Failed to get users from Jellyfin (%d): %v", status, err)
|
||||
// app.err.Fatalf("Couldn't upgrade users.json")
|
||||
// }
|
||||
// emailBakFile := app.storage.emails_path + ".bak"
|
||||
// usersBakFile := app.storage.users_path + ".bak"
|
||||
// err = storeJSON(emailBakFile, app.storage.emails)
|
||||
// err2 = storeJSON(usersBakFile, app.storage.users)
|
||||
// if err != nil {
|
||||
// app.err.Fatalf("couldn't store emails.json backup: %v", err)
|
||||
// }
|
||||
// if err2 != nil {
|
||||
// app.err.Fatalf("couldn't store users.json backup: %v", err)
|
||||
// }
|
||||
// app.storage.emails = newEmails
|
||||
// app.storage.users = newUsers
|
||||
// err = app.storage.storeEmails()
|
||||
// err2 = app.storage.storeUsers()
|
||||
// if err != nil {
|
||||
// app.err.Fatalf("couldn't store emails.json: %v", err)
|
||||
// }
|
||||
// if err2 != nil {
|
||||
// app.err.Fatalf("couldn't store users.json: %v", err)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -305,3 +305,8 @@ type MatrixLoginDTO struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type ResetPasswordDTO struct {
|
||||
PIN string `json:"pin"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
6246
package-lock.json
generated
6246
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -20,11 +20,14 @@
|
||||
"@ts-stack/markdown": "^1.3.0",
|
||||
"@types/node": "^15.0.1",
|
||||
"a17t": "^0.4.0",
|
||||
"browserslist": "^4.16.6",
|
||||
"esbuild": "^0.8.57",
|
||||
"inline-source-cli": "^2.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mjml": "^4.8.0",
|
||||
"remixicon": "^2.5.0",
|
||||
"remove-markdown": "^0.3.0",
|
||||
"typescript": "^4.0.3"
|
||||
"typescript": "^4.0.3",
|
||||
"uncss": "^0.17.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,10 +54,12 @@ func pwrMonitor(app *appContext, watcher *fsnotify.Watcher) {
|
||||
var pwr PasswordReset
|
||||
data, err := os.ReadFile(event.Name)
|
||||
if err != nil {
|
||||
app.debug.Printf("PWR: Failed to read file: %v", err)
|
||||
return
|
||||
}
|
||||
err = json.Unmarshal(data, &pwr)
|
||||
if len(pwr.Pin) == 0 || err != nil {
|
||||
app.debug.Printf("PWR: Failed to read PIN: %v", err)
|
||||
return
|
||||
}
|
||||
app.info.Printf("New password reset for user \"%s\"", pwr.Username)
|
||||
|
||||
@@ -108,6 +108,9 @@ func (app *appContext) loadRoutes(router *gin.Engine) {
|
||||
|
||||
if app.config.Section("password_resets").Key("link_reset").MustBool(false) {
|
||||
router.GET(p+"/reset", app.ResetPassword)
|
||||
if app.config.Section("password_resets").Key("set_password").MustBool(false) {
|
||||
router.POST(p+"/reset", app.ResetSetPassword)
|
||||
}
|
||||
}
|
||||
|
||||
router.GET(p+"/accounts", app.AdminPage)
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
# sets version environment variable for goreleaser to use
|
||||
# scripts/version.sh goreleaser ...
|
||||
JFA_GO_VERSION=$(git describe --exact-match HEAD 2> /dev/null || echo 'vgit')
|
||||
JFA_GO_VERSION="$(echo $JFA_GO_VERSION | sed 's/v//g')" $@
|
||||
JFA_GO_NFPM_EPOCH=$(git rev-list --all --count) JFA_GO_VERSION="$(echo $JFA_GO_VERSION | sed 's/v//g')" $@
|
||||
|
||||
83
storage.go
83
storage.go
@@ -917,86 +917,3 @@ func storeJSON(path string, obj interface{}) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// // One build of JF 10.7.0 hyphenated user IDs while another one later didn't. These functions will hyphenate/de-hyphenate email storage.
|
||||
//
|
||||
// func hyphenate(userID string) string {
|
||||
// if userID[8] == '-' {
|
||||
// return userID
|
||||
// }
|
||||
// return userID[:8] + "-" + userID[8:12] + "-" + userID[12:16] + "-" + userID[16:20] + "-" + userID[20:]
|
||||
// }
|
||||
//
|
||||
// func (app *appContext) deHyphenateStorage(old map[string]interface{}) (map[string]interface{}, int, error) {
|
||||
// jfUsers, status, err := app.jf.GetUsers(false)
|
||||
// if status != 200 || err != nil {
|
||||
// return nil, status, err
|
||||
// }
|
||||
// newEmails := map[string]interface{}{}
|
||||
// for _, user := range jfUsers {
|
||||
// unHyphenated := user.ID
|
||||
// hyphenated := hyphenate(unHyphenated)
|
||||
// val, ok := old[hyphenated]
|
||||
// if ok {
|
||||
// newEmails[unHyphenated] = val
|
||||
// }
|
||||
// }
|
||||
// return newEmails, status, err
|
||||
// }
|
||||
//
|
||||
// func (app *appContext) hyphenateStorage(old map[string]interface{}) (map[string]interface{}, int, error) {
|
||||
// jfUsers, status, err := app.jf.GetUsers(false)
|
||||
// if status != 200 || err != nil {
|
||||
// return nil, status, err
|
||||
// }
|
||||
// newEmails := map[string]interface{}{}
|
||||
// for _, user := range jfUsers {
|
||||
// unstripped := user.ID
|
||||
// stripped := strings.ReplaceAll(unstripped, "-", "")
|
||||
// val, ok := old[stripped]
|
||||
// if ok {
|
||||
// newEmails[unstripped] = val
|
||||
// }
|
||||
// }
|
||||
// return newEmails, status, err
|
||||
// }
|
||||
//
|
||||
// func (app *appContext) hyphenateEmailStorage(old map[string]interface{}) (map[string]interface{}, int, error) {
|
||||
// return app.hyphenateStorage(old)
|
||||
// }
|
||||
//
|
||||
// func (app *appContext) deHyphenateEmailStorage(old map[string]interface{}) (map[string]interface{}, int, error) {
|
||||
// return app.deHyphenateStorage(old)
|
||||
// }
|
||||
//
|
||||
// func (app *appContext) hyphenateUserStorage(old map[string]time.Time) (map[string]time.Time, int, error) {
|
||||
// asInterface := map[string]interface{}{}
|
||||
// for k, v := range old {
|
||||
// asInterface[k] = v
|
||||
// }
|
||||
// fixed, status, err := app.hyphenateStorage(asInterface)
|
||||
// if err != nil {
|
||||
// return nil, status, err
|
||||
// }
|
||||
// out := map[string]time.Time{}
|
||||
// for k, v := range fixed {
|
||||
// out[k] = v.(time.Time)
|
||||
// }
|
||||
// return out, status, err
|
||||
// }
|
||||
//
|
||||
// func (app *appContext) deHyphenateUserStorage(old map[string]time.Time) (map[string]time.Time, int, error) {
|
||||
// asInterface := map[string]interface{}{}
|
||||
// for k, v := range old {
|
||||
// asInterface[k] = v
|
||||
// }
|
||||
// fixed, status, err := app.deHyphenateStorage(asInterface)
|
||||
// if err != nil {
|
||||
// return nil, status, err
|
||||
// }
|
||||
// out := map[string]time.Time{}
|
||||
// for k, v := range fixed {
|
||||
// out[k] = v.(time.Time)
|
||||
// }
|
||||
// return out, status, err
|
||||
// }
|
||||
|
||||
37
tray.go
37
tray.go
@@ -53,11 +53,29 @@ func onReady() {
|
||||
}()
|
||||
|
||||
RESTART = make(chan bool, 1)
|
||||
TRAYRESTART = make(chan bool, 1)
|
||||
go start(false, true)
|
||||
mStart.Disable()
|
||||
mStop.Enable()
|
||||
mRestart.Enable()
|
||||
go as.HandleCheck()
|
||||
trayRestart := func() {
|
||||
if RUNNING {
|
||||
RESTART <- true
|
||||
mStop.Disable()
|
||||
mStart.Enable()
|
||||
mRestart.Disable()
|
||||
for {
|
||||
if !RUNNING {
|
||||
break
|
||||
}
|
||||
}
|
||||
go start(false, false)
|
||||
mStart.Disable()
|
||||
mStop.Enable()
|
||||
mRestart.Enable()
|
||||
}
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case <-mStart.ClickedCh:
|
||||
@@ -74,27 +92,14 @@ func onReady() {
|
||||
mStart.Enable()
|
||||
mRestart.Disable()
|
||||
}
|
||||
case <-TRAYRESTART:
|
||||
trayRestart()
|
||||
case <-mRestart.ClickedCh:
|
||||
if RUNNING {
|
||||
RESTART <- true
|
||||
mStop.Disable()
|
||||
mStart.Enable()
|
||||
mRestart.Disable()
|
||||
for {
|
||||
if !RUNNING {
|
||||
break
|
||||
}
|
||||
}
|
||||
go start(false, false)
|
||||
mStart.Disable()
|
||||
mStop.Enable()
|
||||
mRestart.Enable()
|
||||
}
|
||||
trayRestart()
|
||||
case <-mOpenLogs.ClickedCh:
|
||||
open.Start(logPath)
|
||||
case <-mQuit.ClickedCh:
|
||||
systray.Quit()
|
||||
// case <-mOnLogin.ClickedCh:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
ts/crash.ts
Normal file
39
ts/crash.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { toClipboard } from "./modules/common.js";
|
||||
|
||||
const buttonNormal = document.getElementById("button-log-normal") as HTMLInputElement;
|
||||
const buttonSanitized = document.getElementById("button-log-sanitized") as HTMLInputElement;
|
||||
|
||||
const logNormal = document.getElementById("log-normal") as HTMLInputElement;
|
||||
const logSanitized = document.getElementById("log-sanitized") as HTMLInputElement;
|
||||
|
||||
const buttonChange = (type: string) => {
|
||||
console.log("RUN");
|
||||
if (type == "normal") {
|
||||
logSanitized.classList.add("unfocused");
|
||||
logNormal.classList.remove("unfocused");
|
||||
buttonNormal.classList.add("!high");
|
||||
buttonNormal.classList.remove("!normal");
|
||||
buttonSanitized.classList.add("!normal");
|
||||
buttonSanitized.classList.remove("!high");
|
||||
} else {
|
||||
logNormal.classList.add("unfocused");
|
||||
logSanitized.classList.remove("unfocused");
|
||||
buttonSanitized.classList.add("!high");
|
||||
buttonSanitized.classList.remove("!normal");
|
||||
buttonNormal.classList.add("!normal");
|
||||
buttonNormal.classList.remove("!high");
|
||||
}
|
||||
}
|
||||
buttonNormal.onclick = () => buttonChange("normal");
|
||||
buttonSanitized.onclick = () => buttonChange("sanitized");
|
||||
|
||||
const copyButton = document.getElementById("copy-log") as HTMLSpanElement;
|
||||
copyButton.onclick = () => {
|
||||
if (logSanitized.classList.contains("unfocused")) {
|
||||
toClipboard("```\n" + logNormal.textContent + "```");
|
||||
} else {
|
||||
toClipboard("```\n" + logSanitized.textContent + "```");
|
||||
}
|
||||
copyButton.textContent = "Copied.";
|
||||
setTimeout(() => { copyButton.textContent = "Copy"; }, 1500);
|
||||
};
|
||||
146
ts/form.ts
146
ts/form.ts
@@ -2,9 +2,9 @@ import { Modal } from "./modules/modal.js";
|
||||
import { notificationBox, whichAnimationEvent } from "./modules/common.js";
|
||||
import { _get, _post, toggleLoader, addLoader, removeLoader, toDateString } from "./modules/common.js";
|
||||
import { loadLangSelector } from "./modules/lang.js";
|
||||
import { initValidator } from "./modules/validator.js";
|
||||
|
||||
interface formWindow extends Window {
|
||||
validationStrings: pwValStrings;
|
||||
invalidPassword: string;
|
||||
successModal: Modal;
|
||||
telegramModal: Modal;
|
||||
@@ -31,20 +31,6 @@ interface formWindow extends Window {
|
||||
userExpiryMessage: string;
|
||||
}
|
||||
|
||||
interface pwValString {
|
||||
singular: string;
|
||||
plural: string;
|
||||
}
|
||||
|
||||
interface pwValStrings {
|
||||
length: pwValString;
|
||||
uppercase: pwValString;
|
||||
lowercase: pwValString;
|
||||
number: pwValString;
|
||||
special: pwValString;
|
||||
[ type: string ]: pwValString;
|
||||
}
|
||||
|
||||
loadLangSelector("form");
|
||||
|
||||
window.notifications = new notificationBox(document.getElementById("notification-box") as HTMLDivElement);
|
||||
@@ -235,29 +221,6 @@ if (window.userExpiryEnabled) {
|
||||
calculateTime();
|
||||
}
|
||||
|
||||
var defaultPwValStrings: pwValStrings = {
|
||||
length: {
|
||||
singular: "Must have at least {n} character",
|
||||
plural: "Must have at least {n} characters"
|
||||
},
|
||||
uppercase: {
|
||||
singular: "Must have at least {n} uppercase character",
|
||||
plural: "Must have at least {n} uppercase characters"
|
||||
},
|
||||
lowercase: {
|
||||
singular: "Must have at least {n} lowercase character",
|
||||
plural: "Must have at least {n} lowercase characters"
|
||||
},
|
||||
number: {
|
||||
singular: "Must have at least {n} number",
|
||||
plural: "Must have at least {n} numbers"
|
||||
},
|
||||
special: {
|
||||
singular: "Must have at least {n} special character",
|
||||
plural: "Must have at least {n} special characters"
|
||||
}
|
||||
}
|
||||
|
||||
const form = document.getElementById("form-create") as HTMLFormElement;
|
||||
const submitButton = form.querySelector("input[type=submit]") as HTMLInputElement;
|
||||
const submitSpan = form.querySelector("span.submit") as HTMLSpanElement;
|
||||
@@ -267,19 +230,7 @@ if (!window.usernameEnabled) { usernameField.parentElement.remove(); usernameFie
|
||||
const passwordField = document.getElementById("create-password") as HTMLInputElement;
|
||||
const rePasswordField = document.getElementById("create-reenter-password") as HTMLInputElement;
|
||||
|
||||
const checkPasswords = () => {
|
||||
if (passwordField.value != rePasswordField.value) {
|
||||
rePasswordField.setCustomValidity(window.invalidPassword);
|
||||
submitButton.disabled = true;
|
||||
submitSpan.setAttribute("disabled", "");
|
||||
} else {
|
||||
rePasswordField.setCustomValidity("");
|
||||
submitButton.disabled = false;
|
||||
submitSpan.removeAttribute("disabled");
|
||||
}
|
||||
};
|
||||
rePasswordField.addEventListener("keyup", checkPasswords);
|
||||
passwordField.addEventListener("keyup", checkPasswords);
|
||||
var requirements = initValidator(passwordField, rePasswordField, submitButton, submitSpan)
|
||||
|
||||
interface respDTO {
|
||||
response: boolean;
|
||||
@@ -371,96 +322,3 @@ const create = (event: SubmitEvent) => {
|
||||
};
|
||||
|
||||
form.onsubmit = create;
|
||||
|
||||
class Requirement {
|
||||
private _name: string;
|
||||
protected _minCount: number;
|
||||
private _content: HTMLSpanElement;
|
||||
private _valid: HTMLSpanElement;
|
||||
private _li: HTMLLIElement;
|
||||
|
||||
get valid(): boolean { return this._valid.classList.contains("~positive"); }
|
||||
set valid(state: boolean) {
|
||||
if (state) {
|
||||
this._valid.classList.add("~positive");
|
||||
this._valid.classList.remove("~critical");
|
||||
this._valid.innerHTML = `<i class="icon ri-check-line" title="valid"></i>`;
|
||||
} else {
|
||||
this._valid.classList.add("~critical");
|
||||
this._valid.classList.remove("~positive");
|
||||
this._valid.innerHTML = `<i class="icon ri-close-line" title="invalid"></i>`;
|
||||
}
|
||||
}
|
||||
|
||||
constructor(name: string, el: HTMLLIElement) {
|
||||
this._name = name;
|
||||
this._li = el;
|
||||
this._content = this._li.querySelector("span.requirement-content") as HTMLSpanElement;
|
||||
this._valid = this._li.querySelector("span.requirement-valid") as HTMLSpanElement;
|
||||
this.valid = false;
|
||||
this._minCount = +this._li.getAttribute("min");
|
||||
|
||||
let text = "";
|
||||
if (this._minCount == 1) {
|
||||
text = window.validationStrings[this._name].singular.replace("{n}", "1");
|
||||
} else {
|
||||
text = window.validationStrings[this._name].plural.replace("{n}", ""+this._minCount);
|
||||
}
|
||||
this._content.textContent = text;
|
||||
}
|
||||
|
||||
validate = (count: number) => { this.valid = (count >= this._minCount); }
|
||||
}
|
||||
|
||||
// Incredible code right here
|
||||
const isInt = (s: string): boolean => { return (s in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]); }
|
||||
|
||||
const testStrings = (f: pwValString): boolean => {
|
||||
const testString = (s: string): boolean => {
|
||||
if (s == "" || !s.includes("{n}")) { return false; }
|
||||
return true;
|
||||
}
|
||||
return testString(f.singular) && testString(f.plural);
|
||||
}
|
||||
|
||||
interface Validation { [name: string]: number }
|
||||
|
||||
const validate = (s: string): Validation => {
|
||||
let v: Validation = {};
|
||||
for (let criteria of ["length", "lowercase", "uppercase", "number", "special"]) { v[criteria] = 0; }
|
||||
v["length"] = s.length;
|
||||
for (let c of s) {
|
||||
if (isInt(c)) { v["number"]++; }
|
||||
else {
|
||||
const upper = c.toUpperCase();
|
||||
if (upper == c.toLowerCase()) { v["special"]++; }
|
||||
else {
|
||||
if (upper == c) { v["uppercase"]++; }
|
||||
else if (upper != c) { v["lowercase"]++; }
|
||||
}
|
||||
}
|
||||
}
|
||||
return v
|
||||
}
|
||||
passwordField.addEventListener("keyup", () => {
|
||||
const v = validate(passwordField.value);
|
||||
for (let criteria in requirements) {
|
||||
requirements[criteria].validate(v[criteria]);
|
||||
}
|
||||
});
|
||||
|
||||
var requirements: { [category: string]: Requirement} = {};
|
||||
|
||||
if (!window.validationStrings) {
|
||||
window.validationStrings = defaultPwValStrings;
|
||||
} else {
|
||||
for (let category in window.validationStrings) {
|
||||
if (!testStrings(window.validationStrings[category])) {
|
||||
window.validationStrings[category] = defaultPwValStrings[category];
|
||||
}
|
||||
const el = document.getElementById("requirement-" + category);
|
||||
if (el) {
|
||||
requirements[category] = new Requirement(category, el as HTMLLIElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
154
ts/modules/validator.ts
Normal file
154
ts/modules/validator.ts
Normal file
@@ -0,0 +1,154 @@
|
||||
interface valWindow extends Window {
|
||||
validationStrings: pwValStrings;
|
||||
invalidPassword: string;
|
||||
}
|
||||
|
||||
interface pwValString {
|
||||
singular: string;
|
||||
plural: string;
|
||||
}
|
||||
|
||||
interface pwValStrings {
|
||||
length: pwValString;
|
||||
uppercase: pwValString;
|
||||
lowercase: pwValString;
|
||||
number: pwValString;
|
||||
special: pwValString;
|
||||
[ type: string ]: pwValString;
|
||||
}
|
||||
|
||||
declare var window: valWindow;
|
||||
|
||||
class Requirement {
|
||||
private _name: string;
|
||||
protected _minCount: number;
|
||||
private _content: HTMLSpanElement;
|
||||
private _valid: HTMLSpanElement;
|
||||
private _li: HTMLLIElement;
|
||||
|
||||
get valid(): boolean { return this._valid.classList.contains("~positive"); }
|
||||
set valid(state: boolean) {
|
||||
if (state) {
|
||||
this._valid.classList.add("~positive");
|
||||
this._valid.classList.remove("~critical");
|
||||
this._valid.innerHTML = `<i class="icon ri-check-line" title="valid"></i>`;
|
||||
} else {
|
||||
this._valid.classList.add("~critical");
|
||||
this._valid.classList.remove("~positive");
|
||||
this._valid.innerHTML = `<i class="icon ri-close-line" title="invalid"></i>`;
|
||||
}
|
||||
}
|
||||
|
||||
constructor(name: string, el: HTMLLIElement) {
|
||||
this._name = name;
|
||||
this._li = el;
|
||||
this._content = this._li.querySelector("span.requirement-content") as HTMLSpanElement;
|
||||
this._valid = this._li.querySelector("span.requirement-valid") as HTMLSpanElement;
|
||||
this.valid = false;
|
||||
this._minCount = +this._li.getAttribute("min");
|
||||
|
||||
let text = "";
|
||||
if (this._minCount == 1) {
|
||||
text = window.validationStrings[this._name].singular.replace("{n}", "1");
|
||||
} else {
|
||||
text = window.validationStrings[this._name].plural.replace("{n}", ""+this._minCount);
|
||||
}
|
||||
this._content.textContent = text;
|
||||
}
|
||||
|
||||
validate = (count: number) => { this.valid = (count >= this._minCount); }
|
||||
}
|
||||
|
||||
export function initValidator(passwordField: HTMLInputElement, rePasswordField: HTMLInputElement, submitButton: HTMLInputElement, submitSpan: HTMLSpanElement): { [category: string]: Requirement } {
|
||||
var defaultPwValStrings: pwValStrings = {
|
||||
length: {
|
||||
singular: "Must have at least {n} character",
|
||||
plural: "Must have at least {n} characters"
|
||||
},
|
||||
uppercase: {
|
||||
singular: "Must have at least {n} uppercase character",
|
||||
plural: "Must have at least {n} uppercase characters"
|
||||
},
|
||||
lowercase: {
|
||||
singular: "Must have at least {n} lowercase character",
|
||||
plural: "Must have at least {n} lowercase characters"
|
||||
},
|
||||
number: {
|
||||
singular: "Must have at least {n} number",
|
||||
plural: "Must have at least {n} numbers"
|
||||
},
|
||||
special: {
|
||||
singular: "Must have at least {n} special character",
|
||||
plural: "Must have at least {n} special characters"
|
||||
}
|
||||
}
|
||||
|
||||
const checkPasswords = () => {
|
||||
if (passwordField.value != rePasswordField.value) {
|
||||
rePasswordField.setCustomValidity(window.invalidPassword);
|
||||
submitButton.disabled = true;
|
||||
submitSpan.setAttribute("disabled", "");
|
||||
} else {
|
||||
rePasswordField.setCustomValidity("");
|
||||
submitButton.disabled = false;
|
||||
submitSpan.removeAttribute("disabled");
|
||||
}
|
||||
};
|
||||
rePasswordField.addEventListener("keyup", checkPasswords);
|
||||
passwordField.addEventListener("keyup", checkPasswords);
|
||||
|
||||
|
||||
// Incredible code right here
|
||||
const isInt = (s: string): boolean => { return (s in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]); }
|
||||
|
||||
const testStrings = (f: pwValString): boolean => {
|
||||
const testString = (s: string): boolean => {
|
||||
if (s == "" || !s.includes("{n}")) { return false; }
|
||||
return true;
|
||||
}
|
||||
return testString(f.singular) && testString(f.plural);
|
||||
}
|
||||
|
||||
interface Validation { [name: string]: number }
|
||||
|
||||
const validate = (s: string): Validation => {
|
||||
let v: Validation = {};
|
||||
for (let criteria of ["length", "lowercase", "uppercase", "number", "special"]) { v[criteria] = 0; }
|
||||
v["length"] = s.length;
|
||||
for (let c of s) {
|
||||
if (isInt(c)) { v["number"]++; }
|
||||
else {
|
||||
const upper = c.toUpperCase();
|
||||
if (upper == c.toLowerCase()) { v["special"]++; }
|
||||
else {
|
||||
if (upper == c) { v["uppercase"]++; }
|
||||
else if (upper != c) { v["lowercase"]++; }
|
||||
}
|
||||
}
|
||||
}
|
||||
return v
|
||||
}
|
||||
passwordField.addEventListener("keyup", () => {
|
||||
const v = validate(passwordField.value);
|
||||
for (let criteria in requirements) {
|
||||
requirements[criteria].validate(v[criteria]);
|
||||
}
|
||||
});
|
||||
|
||||
var requirements: { [category: string]: Requirement } = {};
|
||||
|
||||
if (!window.validationStrings) {
|
||||
window.validationStrings = defaultPwValStrings;
|
||||
} else {
|
||||
for (let category in window.validationStrings) {
|
||||
if (!testStrings(window.validationStrings[category])) {
|
||||
window.validationStrings[category] = defaultPwValStrings[category];
|
||||
}
|
||||
const el = document.getElementById("requirement-" + category);
|
||||
if (el) {
|
||||
requirements[category] = new Requirement(category, el as HTMLLIElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
return requirements
|
||||
}
|
||||
23
ts/pwr-pin.ts
Normal file
23
ts/pwr-pin.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { toClipboard, notificationBox } from "./modules/common.js";
|
||||
|
||||
const pin = document.getElementById("pin") as HTMLSpanElement;
|
||||
|
||||
if (pin) {
|
||||
// Load this individual string into the DOM, so we don't have to load the whole language file.
|
||||
const copy = document.getElementById("copy-notification");
|
||||
const copyString = copy.textContent;
|
||||
copy.remove();
|
||||
|
||||
window.notifications = new notificationBox(document.getElementById("notification-box") as HTMLDivElement, 5);
|
||||
|
||||
pin.onclick = () => {
|
||||
toClipboard(pin.textContent);
|
||||
window.notifications.customPositive("copied", "", copyString);
|
||||
pin.classList.add("~positive");
|
||||
pin.classList.remove("~urge");
|
||||
setTimeout(() => {
|
||||
pin.classList.add("~urge");
|
||||
pin.classList.remove("~positive");
|
||||
}, 5000);
|
||||
};
|
||||
}
|
||||
100
ts/pwr.ts
100
ts/pwr.ts
@@ -1,24 +1,80 @@
|
||||
import { toClipboard, notificationBox } from "./modules/common.js";
|
||||
import { Modal } from "./modules/modal.js";
|
||||
import { initValidator } from "./modules/validator.js";
|
||||
import { _post, addLoader, removeLoader } from "./modules/common.js";
|
||||
|
||||
|
||||
const pin = document.getElementById("pin") as HTMLSpanElement;
|
||||
|
||||
if (pin) {
|
||||
// Load this individual string into the DOM, so we don't have to load the whole language file.
|
||||
const copy = document.getElementById("copy-notification");
|
||||
const copyString = copy.textContent;
|
||||
copy.remove();
|
||||
|
||||
window.notifications = new notificationBox(document.getElementById("notification-box") as HTMLDivElement, 5);
|
||||
|
||||
pin.onclick = () => {
|
||||
toClipboard(pin.textContent);
|
||||
window.notifications.customPositive("copied", "", copyString);
|
||||
pin.classList.add("~positive");
|
||||
pin.classList.remove("~urge");
|
||||
setTimeout(() => {
|
||||
pin.classList.add("~urge");
|
||||
pin.classList.remove("~positive");
|
||||
}, 5000);
|
||||
};
|
||||
interface formWindow extends Window {
|
||||
invalidPassword: string;
|
||||
successModal: Modal;
|
||||
telegramModal: Modal;
|
||||
discordModal: Modal;
|
||||
matrixModal: Modal;
|
||||
confirmationModal: Modal
|
||||
code: string;
|
||||
messages: { [key: string]: string };
|
||||
confirmation: boolean;
|
||||
telegramRequired: boolean;
|
||||
telegramPIN: string;
|
||||
discordRequired: boolean;
|
||||
discordPIN: string;
|
||||
discordStartCommand: string;
|
||||
discordInviteLink: boolean;
|
||||
discordServerName: string;
|
||||
matrixRequired: boolean;
|
||||
matrixUserID: string;
|
||||
userExpiryEnabled: boolean;
|
||||
userExpiryMonths: number;
|
||||
userExpiryDays: number;
|
||||
userExpiryHours: number;
|
||||
userExpiryMinutes: number;
|
||||
userExpiryMessage: string;
|
||||
}
|
||||
|
||||
declare var window: formWindow;
|
||||
|
||||
const form = document.getElementById("form-create") as HTMLFormElement;
|
||||
const submitButton = form.querySelector("input[type=submit]") as HTMLInputElement;
|
||||
const submitSpan = form.querySelector("span.submit") as HTMLSpanElement;
|
||||
const passwordField = document.getElementById("create-password") as HTMLInputElement;
|
||||
const rePasswordField = document.getElementById("create-reenter-password") as HTMLInputElement;
|
||||
|
||||
window.successModal = new Modal(document.getElementById("modal-success"), true);
|
||||
|
||||
var requirements = initValidator(passwordField, rePasswordField, submitButton, submitSpan)
|
||||
|
||||
interface sendDTO {
|
||||
pin: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
form.onsubmit = (event: Event) => {
|
||||
event.preventDefault();
|
||||
addLoader(submitSpan);
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
let send: sendDTO = {
|
||||
pin: params.get("pin"),
|
||||
password: passwordField.value
|
||||
};
|
||||
_post("/reset", send, (req: XMLHttpRequest) => {
|
||||
if (req.readyState == 4) {
|
||||
removeLoader(submitSpan);
|
||||
if (req.status == 400) {
|
||||
for (let type in req.response) {
|
||||
if (requirements[type]) { requirements[type].valid = req.response[type] as boolean; }
|
||||
}
|
||||
return;
|
||||
} else if (req.status != 200) {
|
||||
const old = submitSpan.textContent;
|
||||
submitSpan.textContent = window.messages["errorUnknown"];
|
||||
submitSpan.classList.add("~critical");
|
||||
submitSpan.classList.remove("~urge");
|
||||
setTimeout(() => {
|
||||
submitSpan.classList.add("~urge");
|
||||
submitSpan.classList.remove("~critical");
|
||||
submitSpan.textContent = old;
|
||||
}, 2000);
|
||||
} else {
|
||||
window.successModal.show();
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
};
|
||||
|
||||
106
views.go
106
views.go
@@ -117,27 +117,29 @@ func (app *appContext) AdminPage(gc *gin.Context) {
|
||||
}
|
||||
license = string(l)
|
||||
gcHTML(gc, http.StatusOK, "admin.html", gin.H{
|
||||
"urlBase": app.getURLBase(gc),
|
||||
"cssClass": app.cssClass,
|
||||
"contactMessage": "",
|
||||
"email_enabled": emailEnabled,
|
||||
"telegram_enabled": telegramEnabled,
|
||||
"discord_enabled": discordEnabled,
|
||||
"matrix_enabled": matrixEnabled,
|
||||
"notifications": notificationsEnabled,
|
||||
"version": version,
|
||||
"commit": commit,
|
||||
"ombiEnabled": ombiEnabled,
|
||||
"username": !app.config.Section("email").Key("no_username").MustBool(false),
|
||||
"strings": app.storage.lang.Admin[lang].Strings,
|
||||
"quantityStrings": app.storage.lang.Admin[lang].QuantityStrings,
|
||||
"language": app.storage.lang.Admin[lang].JSON,
|
||||
"langName": lang,
|
||||
"license": license,
|
||||
"urlBase": app.getURLBase(gc),
|
||||
"cssClass": app.cssClass,
|
||||
"contactMessage": "",
|
||||
"emailEnabled": emailEnabled,
|
||||
"telegramEnabled": telegramEnabled,
|
||||
"discordEnabled": discordEnabled,
|
||||
"matrixEnabled": matrixEnabled,
|
||||
"ombiEnabled": ombiEnabled,
|
||||
"notifications": notificationsEnabled,
|
||||
"version": version,
|
||||
"commit": commit,
|
||||
"username": !app.config.Section("email").Key("no_username").MustBool(false),
|
||||
"strings": app.storage.lang.Admin[lang].Strings,
|
||||
"quantityStrings": app.storage.lang.Admin[lang].QuantityStrings,
|
||||
"language": app.storage.lang.Admin[lang].JSON,
|
||||
"langName": lang,
|
||||
"license": license,
|
||||
})
|
||||
}
|
||||
|
||||
func (app *appContext) ResetPassword(gc *gin.Context) {
|
||||
isBot := strings.Contains(gc.Request.Header.Get("User-Agent"), "Bot")
|
||||
setPassword := app.config.Section("password_resets").Key("set_password").MustBool(false)
|
||||
pin := gc.Query("pin")
|
||||
if pin == "" {
|
||||
app.NoRouteHandler(gc)
|
||||
@@ -147,37 +149,62 @@ func (app *appContext) ResetPassword(gc *gin.Context) {
|
||||
lang := app.getLang(gc, PWRPage, app.storage.lang.chosenPWRLang)
|
||||
data := gin.H{
|
||||
"urlBase": app.getURLBase(gc),
|
||||
"cssClass": app.cssClass,
|
||||
"contactMessage": app.config.Section("ui").Key("contact_message").String(),
|
||||
"strings": app.storage.lang.PasswordReset[lang].Strings,
|
||||
"success": false,
|
||||
"ombiEnabled": app.config.Section("ombi").Key("enabled").MustBool(false),
|
||||
}
|
||||
resp, status, err := app.jf.ResetPassword(pin)
|
||||
if status == 200 && err == nil && resp.Success {
|
||||
data["success"] = true
|
||||
data["pin"] = pin
|
||||
} else {
|
||||
app.err.Printf("Password Reset failed (%d): %v", status, err)
|
||||
if setPassword {
|
||||
data["helpMessage"] = app.config.Section("ui").Key("help_message").String()
|
||||
data["successMessage"] = app.config.Section("ui").Key("success_message").String()
|
||||
data["jfLink"] = app.config.Section("jellyfin").Key("public_server").String()
|
||||
data["validate"] = app.config.Section("password_validation").Key("enabled").MustBool(false)
|
||||
data["requirements"] = app.validator.getCriteria()
|
||||
data["strings"] = app.storage.lang.PasswordReset[lang].Strings
|
||||
data["validationStrings"] = app.storage.lang.Form[lang].validationStringsJSON
|
||||
data["notifications"] = app.storage.lang.Form[lang].notificationsJSON
|
||||
data["langName"] = lang
|
||||
data["passwordReset"] = true
|
||||
data["telegramEnabled"] = false
|
||||
data["discordEnabled"] = false
|
||||
data["matrixEnabled"] = false
|
||||
gcHTML(gc, http.StatusOK, "form-loader.html", data)
|
||||
return
|
||||
}
|
||||
defer gcHTML(gc, http.StatusOK, "password-reset.html", data)
|
||||
if app.config.Section("ombi").Key("enabled").MustBool(false) {
|
||||
jfUser, status, err := app.jf.UserByName(resp.UsersReset[0], false)
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to get user \"%s\" from jellyfin/emby (%d): %v", resp.UsersReset[0], status, err)
|
||||
return
|
||||
// If it's a bot, pretend to be a success so the preview is nice.
|
||||
if isBot {
|
||||
app.debug.Println("PWR: Ignoring magic link visit from bot")
|
||||
data["success"] = true
|
||||
data["pin"] = "NO-BO-TS"
|
||||
} else {
|
||||
resp, status, err := app.jf.ResetPassword(pin)
|
||||
if status == 200 && err == nil && resp.Success {
|
||||
data["success"] = true
|
||||
data["pin"] = pin
|
||||
} else {
|
||||
app.err.Printf("Password Reset failed (%d): %v", status, err)
|
||||
}
|
||||
ombiUser, status, err := app.getOmbiUser(jfUser.ID)
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to get user \"%s\" from ombi (%d): %v", resp.UsersReset[0], status, err)
|
||||
return
|
||||
if app.config.Section("ombi").Key("enabled").MustBool(false) {
|
||||
jfUser, status, err := app.jf.UserByName(resp.UsersReset[0], false)
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to get user \"%s\" from jellyfin/emby (%d): %v", resp.UsersReset[0], status, err)
|
||||
return
|
||||
}
|
||||
ombiUser, status, err := app.getOmbiUser(jfUser.ID)
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to get user \"%s\" from ombi (%d): %v", resp.UsersReset[0], status, err)
|
||||
return
|
||||
}
|
||||
ombiUser["password"] = pin
|
||||
status, err = app.ombi.ModifyUser(ombiUser)
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to set password for ombi user \"%s\" (%d): %v", ombiUser["userName"], status, err)
|
||||
return
|
||||
}
|
||||
app.debug.Printf("Reset password for ombi user \"%s\"", ombiUser["userName"])
|
||||
}
|
||||
ombiUser["password"] = pin
|
||||
status, err = app.ombi.ModifyUser(ombiUser)
|
||||
if status != 200 || err != nil {
|
||||
app.err.Printf("Failed to set password for ombi user \"%s\" (%d): %v", ombiUser["userName"], status, err)
|
||||
return
|
||||
}
|
||||
app.debug.Printf("Reset password for ombi user \"%s\"", ombiUser["userName"])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,6 +313,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
|
||||
"userExpiryMinutes": inv.UserMinutes,
|
||||
"userExpiryMessage": app.storage.lang.Form[lang].Strings.get("yourAccountIsValidUntil"),
|
||||
"langName": lang,
|
||||
"passwordReset": false,
|
||||
"telegramEnabled": telegramEnabled,
|
||||
"discordEnabled": discordEnabled,
|
||||
"matrixEnabled": matrixEnabled,
|
||||
|
||||
Reference in New Issue
Block a user