mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-05 01:40:10 +00:00
bump mediabrowser version, more consistent logs
uses descriptive errors added in mb v0.2.0. Also improved the consistency of logs in api.go/main.go.
This commit is contained in:
parent
30f16e7207
commit
2a0edeb3c5
97
api.go
97
api.go
@ -128,9 +128,9 @@ func (app *appContext) checkInvites() {
|
|||||||
defer wait.Done()
|
defer wait.Done()
|
||||||
msg, err := app.email.constructExpiry(code, data, app, false)
|
msg, err := app.email.constructExpiry(code, data, app, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("%s: Failed to construct expiry notification: %s", code, err)
|
app.err.Printf("%s: Failed to construct expiry notification: %v", code, err)
|
||||||
} else if err := app.email.send(msg, addr); err != nil {
|
} else if err := app.email.send(msg, addr); err != nil {
|
||||||
app.err.Printf("%s: Failed to send expiry notification: %s", code, err)
|
app.err.Printf("%s: Failed to send expiry notification: %v", code, err)
|
||||||
} else {
|
} else {
|
||||||
app.info.Printf("Sent expiry notification to %s", addr)
|
app.info.Printf("Sent expiry notification to %s", addr)
|
||||||
}
|
}
|
||||||
@ -165,9 +165,9 @@ func (app *appContext) checkInvite(code string, used bool, username string) bool
|
|||||||
go func() {
|
go func() {
|
||||||
msg, err := app.email.constructExpiry(code, inv, app, false)
|
msg, err := app.email.constructExpiry(code, inv, app, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("%s: Failed to construct expiry notification: %s", code, err)
|
app.err.Printf("%s: Failed to construct expiry notification: %v", code, err)
|
||||||
} else if err := app.email.send(msg, address); err != nil {
|
} else if err := app.email.send(msg, address); err != nil {
|
||||||
app.err.Printf("%s: Failed to send expiry notification: %s", code, err)
|
app.err.Printf("%s: Failed to send expiry notification: %v", code, err)
|
||||||
} else {
|
} else {
|
||||||
app.info.Printf("Sent expiry notification to %s", address)
|
app.info.Printf("Sent expiry notification to %s", address)
|
||||||
}
|
}
|
||||||
@ -256,15 +256,15 @@ func (app *appContext) NewUserAdmin(gc *gin.Context) {
|
|||||||
}
|
}
|
||||||
user, status, err := app.jf.NewUser(req.Username, req.Password)
|
user, status, err := app.jf.NewUser(req.Username, req.Password)
|
||||||
if !(status == 200 || status == 204) || err != nil {
|
if !(status == 200 || status == 204) || err != nil {
|
||||||
app.err.Printf("%s New user failed: Jellyfin responded with %d", req.Username, status)
|
app.err.Printf("%s New user failed (%d): %v", req.Username, status, err)
|
||||||
respondUser(401, false, false, "Unknown error", gc)
|
respondUser(401, false, false, err.Error(), gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
id := user.ID
|
id := user.ID
|
||||||
if app.storage.policy.BlockedTags != nil {
|
if app.storage.policy.BlockedTags != nil {
|
||||||
status, err = app.jf.SetPolicy(id, app.storage.policy)
|
status, err = app.jf.SetPolicy(id, app.storage.policy)
|
||||||
if !(status == 200 || status == 204 || err == nil) {
|
if !(status == 200 || status == 204 || err == nil) {
|
||||||
app.err.Printf("%s: Failed to set user policy (%d): %s", req.Username, status, err)
|
app.err.Printf("%s: Failed to set user policy (%d): %v", req.Username, status, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if app.storage.configuration.GroupedFolders != nil && len(app.storage.displayprefs) != 0 {
|
if app.storage.configuration.GroupedFolders != nil && len(app.storage.displayprefs) != 0 {
|
||||||
@ -273,7 +273,7 @@ func (app *appContext) NewUserAdmin(gc *gin.Context) {
|
|||||||
status, err = app.jf.SetDisplayPreferences(id, app.storage.displayprefs)
|
status, err = app.jf.SetDisplayPreferences(id, app.storage.displayprefs)
|
||||||
}
|
}
|
||||||
if !((status == 200 || status == 204) && err == nil) {
|
if !((status == 200 || status == 204) && err == nil) {
|
||||||
app.err.Printf("%s: Failed to set configuration template: Code %d", req.Username, status)
|
app.err.Printf("%s: Failed to set configuration template (%d): %v", req.Username, status, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.jf.CacheExpiry = time.Now()
|
app.jf.CacheExpiry = time.Now()
|
||||||
@ -286,7 +286,7 @@ func (app *appContext) NewUserAdmin(gc *gin.Context) {
|
|||||||
if len(app.storage.ombi_template) != 0 {
|
if len(app.storage.ombi_template) != 0 {
|
||||||
errors, code, err := app.ombi.NewUser(req.Username, req.Password, req.Email, app.storage.ombi_template)
|
errors, code, err := app.ombi.NewUser(req.Username, req.Password, req.Email, app.storage.ombi_template)
|
||||||
if err != nil || code != 200 {
|
if err != nil || code != 200 {
|
||||||
app.info.Printf("Failed to create Ombi user (%d): %s", code, err)
|
app.err.Printf("Failed to create Ombi user (%d): %v", code, err)
|
||||||
app.debug.Printf("Errors reported by Ombi: %s", strings.Join(errors, ", "))
|
app.debug.Printf("Errors reported by Ombi: %s", strings.Join(errors, ", "))
|
||||||
} else {
|
} else {
|
||||||
app.info.Println("Created Ombi user")
|
app.info.Println("Created Ombi user")
|
||||||
@ -297,11 +297,11 @@ func (app *appContext) NewUserAdmin(gc *gin.Context) {
|
|||||||
app.debug.Printf("%s: Sending welcome email to %s", req.Username, req.Email)
|
app.debug.Printf("%s: Sending welcome email to %s", req.Username, req.Email)
|
||||||
msg, err := app.email.constructWelcome(req.Username, app, false)
|
msg, err := app.email.constructWelcome(req.Username, app, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("%s: Failed to construct welcome email: %s", req.Username, err)
|
app.err.Printf("%s: Failed to construct welcome email: %v", req.Username, err)
|
||||||
respondUser(500, true, false, err.Error(), gc)
|
respondUser(500, true, false, err.Error(), gc)
|
||||||
return
|
return
|
||||||
} else if err := app.email.send(msg, req.Email); err != nil {
|
} else if err := app.email.send(msg, req.Email); err != nil {
|
||||||
app.err.Printf("%s: Failed to send welcome email: %s", req.Username, err)
|
app.err.Printf("%s: Failed to send welcome email: %v", req.Username, err)
|
||||||
respondUser(500, true, false, err.Error(), gc)
|
respondUser(500, true, false, err.Error(), gc)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
@ -353,11 +353,11 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
|||||||
respond(401, "confirmEmail", gc)
|
respond(401, "confirmEmail", gc)
|
||||||
msg, err := app.email.constructConfirmation(req.Code, req.Username, key, app, false)
|
msg, err := app.email.constructConfirmation(req.Code, req.Username, key, app, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("%s: Failed to construct confirmation email: %s", req.Code, err)
|
app.err.Printf("%s: Failed to construct confirmation email: %v", req.Code, err)
|
||||||
} else if err := app.email.send(msg, req.Email); err != nil {
|
} else if err := app.email.send(msg, req.Email); err != nil {
|
||||||
app.err.Printf("%s: Failed to send user confirmation email: %s", req.Code, err)
|
app.err.Printf("%s: Failed to send user confirmation email: %v", req.Code, err)
|
||||||
} else {
|
} else {
|
||||||
app.info.Printf("%s: Sent user confirmation email to %s", req.Code, req.Email)
|
app.info.Printf("%s: Sent user confirmation email to \"%s\"", req.Code, req.Email)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
success = false
|
success = false
|
||||||
@ -367,7 +367,7 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
|||||||
user, status, err := app.jf.NewUser(req.Username, req.Password)
|
user, status, err := app.jf.NewUser(req.Username, req.Password)
|
||||||
if !(status == 200 || status == 204) || err != nil {
|
if !(status == 200 || status == 204) || err != nil {
|
||||||
f = func(gc *gin.Context) {
|
f = func(gc *gin.Context) {
|
||||||
app.err.Printf("%s New user failed: Jellyfin responded with %d", req.Code, status)
|
app.err.Printf("%s New user failed (%d): %v", req.Code, status, err)
|
||||||
respond(401, app.storage.lang.Admin[app.storage.lang.chosenAdminLang].Notifications.get("errorUnknown"), gc)
|
respond(401, app.storage.lang.Admin[app.storage.lang.chosenAdminLang].Notifications.get("errorUnknown"), gc)
|
||||||
}
|
}
|
||||||
success = false
|
success = false
|
||||||
@ -382,11 +382,11 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
|||||||
go func() {
|
go func() {
|
||||||
msg, err := app.email.constructCreated(req.Code, req.Username, req.Email, invite, app, false)
|
msg, err := app.email.constructCreated(req.Code, req.Username, req.Email, invite, app, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("%s: Failed to construct user creation notification: %s", req.Code, err)
|
app.err.Printf("%s: Failed to construct user creation notification: %v", req.Code, err)
|
||||||
} else if err := app.email.send(msg, address); err != nil {
|
} else if err := app.email.send(msg, address); err != nil {
|
||||||
app.err.Printf("%s: Failed to send user creation notification: %s", req.Code, err)
|
app.err.Printf("%s: Failed to send user creation notification: %v", req.Code, err)
|
||||||
} else {
|
} else {
|
||||||
app.info.Printf("%s: Sent user creation notification to %s", req.Code, address)
|
app.info.Printf("%s: Sent user creation notification to %v", req.Code, address)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@ -403,7 +403,7 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
|||||||
app.debug.Printf("Applying policy from profile \"%s\"", invite.Profile)
|
app.debug.Printf("Applying policy from profile \"%s\"", invite.Profile)
|
||||||
status, err = app.jf.SetPolicy(id, profile.Policy)
|
status, err = app.jf.SetPolicy(id, profile.Policy)
|
||||||
if !((status == 200 || status == 204) && err == nil) {
|
if !((status == 200 || status == 204) && err == nil) {
|
||||||
app.err.Printf("%s: Failed to set user policy (%d): %s", req.Code, status, err)
|
app.err.Printf("%s: Failed to set user policy (%d): %v", req.Code, status, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if profile.Configuration.GroupedFolders != nil && len(profile.Displayprefs) != 0 {
|
if profile.Configuration.GroupedFolders != nil && len(profile.Displayprefs) != 0 {
|
||||||
@ -413,7 +413,7 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
|||||||
status, err = app.jf.SetDisplayPreferences(id, profile.Displayprefs)
|
status, err = app.jf.SetDisplayPreferences(id, profile.Displayprefs)
|
||||||
}
|
}
|
||||||
if !((status == 200 || status == 204) && err == nil) {
|
if !((status == 200 || status == 204) && err == nil) {
|
||||||
app.err.Printf("%s: Failed to set configuration template (%d): %s", req.Code, status, err)
|
app.err.Printf("%s: Failed to set configuration template (%d): %v", req.Code, status, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -438,11 +438,11 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
|||||||
app.debug.Printf("%s: Sending welcome email to %s", req.Username, req.Email)
|
app.debug.Printf("%s: Sending welcome email to %s", req.Username, req.Email)
|
||||||
msg, err := app.email.constructWelcome(req.Username, app, false)
|
msg, err := app.email.constructWelcome(req.Username, app, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("%s: Failed to construct welcome email: %s", req.Username, err)
|
app.err.Printf("%s: Failed to construct welcome email: %v", req.Username, err)
|
||||||
} else if err := app.email.send(msg, req.Email); err != nil {
|
} else if err := app.email.send(msg, req.Email); err != nil {
|
||||||
app.err.Printf("%s: Failed to send welcome email: %s", req.Username, err)
|
app.err.Printf("%s: Failed to send welcome email: %v", req.Username, err)
|
||||||
} else {
|
} else {
|
||||||
app.info.Printf("%s: Sent welcome email to %s", req.Username, req.Email)
|
app.info.Printf("%s: Sent welcome email to \"%s\"", req.Username, req.Email)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if invite.UserExpiry {
|
if invite.UserExpiry {
|
||||||
@ -450,7 +450,7 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
|||||||
app.storage.users[id] = expiry
|
app.storage.users[id] = expiry
|
||||||
err := app.storage.storeUsers()
|
err := app.storage.storeUsers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("Failed to store user duration: %s", err)
|
app.err.Printf("Failed to store user duration: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
success = true
|
success = true
|
||||||
@ -480,7 +480,7 @@ func (app *appContext) ExtendExpiry(gc *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := app.storage.storeUsers(); err != nil {
|
if err := app.storage.storeUsers(); err != nil {
|
||||||
app.err.Printf("Failed to store user duration: %s", err)
|
app.err.Printf("Failed to store user duration: %v", err)
|
||||||
respondBool(500, false, gc)
|
respondBool(500, false, gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -512,7 +512,7 @@ func (app *appContext) NewUser(gc *gin.Context) {
|
|||||||
}
|
}
|
||||||
if !valid {
|
if !valid {
|
||||||
// 200 bcs idk what i did in js
|
// 200 bcs idk what i did in js
|
||||||
app.info.Printf("%s New user failed: Invalid password", req.Code)
|
app.info.Printf("%s: New user failed: Invalid password", req.Code)
|
||||||
gc.JSON(200, validation)
|
gc.JSON(200, validation)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -556,11 +556,11 @@ func (app *appContext) Announce(gc *gin.Context) {
|
|||||||
}
|
}
|
||||||
msg, err := app.email.constructTemplate(req.Subject, req.Message, app)
|
msg, err := app.email.constructTemplate(req.Subject, req.Message, app)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("Failed to construct announcement emails: %s", err)
|
app.err.Printf("Failed to construct announcement emails: %v", err)
|
||||||
respondBool(500, false, gc)
|
respondBool(500, false, gc)
|
||||||
return
|
return
|
||||||
} else if err := app.email.send(msg, addresses...); err != nil {
|
} else if err := app.email.send(msg, addresses...); err != nil {
|
||||||
app.err.Printf("Failed to send announcement emails: %s", err)
|
app.err.Printf("Failed to send announcement emails: %v", err)
|
||||||
respondBool(500, false, gc)
|
respondBool(500, false, gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -590,15 +590,15 @@ func (app *appContext) DeleteUsers(gc *gin.Context) {
|
|||||||
if id, ok := ombiUser["id"]; ok {
|
if id, ok := ombiUser["id"]; ok {
|
||||||
status, err := app.ombi.DeleteUser(id.(string))
|
status, err := app.ombi.DeleteUser(id.(string))
|
||||||
if err != nil || status != 200 {
|
if err != nil || status != 200 {
|
||||||
app.err.Printf("Failed to delete ombi user (%d): %s", status, err)
|
app.err.Printf("Failed to delete ombi user (%d): %v", status, err)
|
||||||
errors[userID] = fmt.Sprintf("Ombi: %d %s, ", status, err)
|
errors[userID] = fmt.Sprintf("Ombi: %d %v, ", status, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status, err := app.jf.DeleteUser(userID)
|
status, err := app.jf.DeleteUser(userID)
|
||||||
if !(status == 200 || status == 204) || err != nil {
|
if !(status == 200 || status == 204) || err != nil {
|
||||||
msg := fmt.Sprintf("%d: %s", status, err)
|
msg := fmt.Sprintf("%d: %v", status, err)
|
||||||
if _, ok := errors[userID]; !ok {
|
if _, ok := errors[userID]; !ok {
|
||||||
errors[userID] = msg
|
errors[userID] = msg
|
||||||
} else {
|
} else {
|
||||||
@ -616,9 +616,9 @@ func (app *appContext) DeleteUsers(gc *gin.Context) {
|
|||||||
go func(reason string, addresses []string) {
|
go func(reason string, addresses []string) {
|
||||||
msg, err := app.email.constructDeleted(reason, app, false)
|
msg, err := app.email.constructDeleted(reason, app, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("Failed to construct account deletion emails: %s", err)
|
app.err.Printf("Failed to construct account deletion emails: %v", err)
|
||||||
} else if err := app.email.send(msg, addresses...); err != nil {
|
} else if err := app.email.send(msg, addresses...); err != nil {
|
||||||
app.err.Printf("Failed to send account deletion emails: %s", err)
|
app.err.Printf("Failed to send account deletion emails: %v", err)
|
||||||
} else {
|
} else {
|
||||||
app.info.Println("Sent account deletion emails")
|
app.info.Println("Sent account deletion emails")
|
||||||
}
|
}
|
||||||
@ -685,12 +685,12 @@ func (app *appContext) GenerateInvite(gc *gin.Context) {
|
|||||||
msg, err := app.email.constructInvite(inviteCode, invite, app, false)
|
msg, err := app.email.constructInvite(inviteCode, invite, app, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
invite.Email = fmt.Sprintf("Failed to send to %s", req.Email)
|
invite.Email = fmt.Sprintf("Failed to send to %s", req.Email)
|
||||||
app.err.Printf("%s: Failed to construct invite email: %s", inviteCode, err)
|
app.err.Printf("%s: Failed to construct invite email: %v", inviteCode, err)
|
||||||
} else if err := app.email.send(msg, req.Email); err != nil {
|
} else if err := app.email.send(msg, req.Email); err != nil {
|
||||||
invite.Email = fmt.Sprintf("Failed to send to %s", req.Email)
|
invite.Email = fmt.Sprintf("Failed to send to %s", req.Email)
|
||||||
app.err.Printf("%s: %s: %s", inviteCode, invite.Email, err)
|
app.err.Printf("%s: %s: %v", inviteCode, invite.Email, err)
|
||||||
} else {
|
} else {
|
||||||
app.info.Printf("%s: Sent invite email to %s", inviteCode, req.Email)
|
app.info.Printf("%s: Sent invite email to \"%s\"", inviteCode, req.Email)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if req.Profile != "" {
|
if req.Profile != "" {
|
||||||
@ -797,7 +797,7 @@ func (app *appContext) CreateProfile(gc *gin.Context) {
|
|||||||
app.jf.CacheExpiry = time.Now()
|
app.jf.CacheExpiry = time.Now()
|
||||||
user, status, err := app.jf.UserByID(req.ID, false)
|
user, status, err := app.jf.UserByID(req.ID, false)
|
||||||
if !(status == 200 || status == 204) || err != nil {
|
if !(status == 200 || status == 204) || err != nil {
|
||||||
app.err.Printf("Failed to get user from Jellyfin (%d): %s", status, err)
|
app.err.Printf("Failed to get user from Jellyfin (%d): %v", status, err)
|
||||||
respond(500, "Couldn't get user", gc)
|
respond(500, "Couldn't get user", gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -810,7 +810,7 @@ func (app *appContext) CreateProfile(gc *gin.Context) {
|
|||||||
profile.Configuration = user.Configuration
|
profile.Configuration = user.Configuration
|
||||||
profile.Displayprefs, status, err = app.jf.GetDisplayPreferences(req.ID)
|
profile.Displayprefs, status, err = app.jf.GetDisplayPreferences(req.ID)
|
||||||
if !(status == 200 || status == 204) || err != nil {
|
if !(status == 200 || status == 204) || err != nil {
|
||||||
app.err.Printf("Failed to get DisplayPrefs (%d): %s", status, err)
|
app.err.Printf("Failed to get DisplayPrefs (%d): %v", status, err)
|
||||||
respond(500, "Couldn't get displayprefs", gc)
|
respond(500, "Couldn't get displayprefs", gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1023,7 +1023,7 @@ func (app *appContext) GetUsers(gc *gin.Context) {
|
|||||||
resp.UserList = []respUser{}
|
resp.UserList = []respUser{}
|
||||||
users, status, err := app.jf.GetUsers(false)
|
users, status, err := app.jf.GetUsers(false)
|
||||||
if !(status == 200 || status == 204) || err != nil {
|
if !(status == 200 || status == 204) || err != nil {
|
||||||
app.err.Printf("Failed to get users from Jellyfin (%d): %s", status, err)
|
app.err.Printf("Failed to get users from Jellyfin (%d): %v", status, err)
|
||||||
respond(500, "Couldn't get users", gc)
|
respond(500, "Couldn't get users", gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1061,7 +1061,7 @@ func (app *appContext) OmbiUsers(gc *gin.Context) {
|
|||||||
app.debug.Println("Ombi users requested")
|
app.debug.Println("Ombi users requested")
|
||||||
users, status, err := app.ombi.GetUsers()
|
users, status, err := app.ombi.GetUsers()
|
||||||
if err != nil || status != 200 {
|
if err != nil || status != 200 {
|
||||||
app.err.Printf("Failed to get users from Ombi (%d): %s", status, err)
|
app.err.Printf("Failed to get users from Ombi (%d): %v", status, err)
|
||||||
respond(500, "Couldn't get users", gc)
|
respond(500, "Couldn't get users", gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1088,7 +1088,7 @@ func (app *appContext) SetOmbiDefaults(gc *gin.Context) {
|
|||||||
gc.BindJSON(&req)
|
gc.BindJSON(&req)
|
||||||
template, code, err := app.ombi.TemplateByID(req.ID)
|
template, code, err := app.ombi.TemplateByID(req.ID)
|
||||||
if err != nil || code != 200 || len(template) == 0 {
|
if err != nil || code != 200 || len(template) == 0 {
|
||||||
app.err.Printf("Couldn't get user from Ombi: %d %s", code, err)
|
app.err.Printf("Couldn't get user from Ombi (%d): %v", code, err)
|
||||||
respond(500, "Couldn't get user", gc)
|
respond(500, "Couldn't get user", gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1111,7 +1111,7 @@ func (app *appContext) ModifyEmails(gc *gin.Context) {
|
|||||||
app.debug.Println("Email modification requested")
|
app.debug.Println("Email modification requested")
|
||||||
users, status, err := app.jf.GetUsers(false)
|
users, status, err := app.jf.GetUsers(false)
|
||||||
if !(status == 200 || status == 204) || err != nil {
|
if !(status == 200 || status == 204) || err != nil {
|
||||||
app.err.Printf("Failed to get users from Jellyfin (%d): %s", status, err)
|
app.err.Printf("Failed to get users from Jellyfin (%d): %v", status, err)
|
||||||
respond(500, "Couldn't get users", gc)
|
respond(500, "Couldn't get users", gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1126,7 +1126,7 @@ func (app *appContext) ModifyEmails(gc *gin.Context) {
|
|||||||
ombiUser["emailAddress"] = address
|
ombiUser["emailAddress"] = address
|
||||||
code, err = app.ombi.ModifyUser(ombiUser)
|
code, err = app.ombi.ModifyUser(ombiUser)
|
||||||
if code != 200 || err != nil {
|
if code != 200 || err != nil {
|
||||||
app.err.Printf("%s: Failed to change ombi email address: %d %s", ombiUser["userName"].(string), code, err)
|
app.err.Printf("%s: Failed to change ombi email address (%d): %v", ombiUser["userName"].(string), code, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1155,6 +1155,7 @@ func (app *appContext) ApplySettings(gc *gin.Context) {
|
|||||||
var displayprefs map[string]interface{}
|
var displayprefs map[string]interface{}
|
||||||
if req.From == "profile" {
|
if req.From == "profile" {
|
||||||
app.storage.loadProfiles()
|
app.storage.loadProfiles()
|
||||||
|
// Check profile exists & isn't empty
|
||||||
if _, ok := app.storage.profiles[req.Profile]; !ok || app.storage.profiles[req.Profile].Policy.BlockedTags == nil {
|
if _, ok := app.storage.profiles[req.Profile]; !ok || app.storage.profiles[req.Profile].Policy.BlockedTags == nil {
|
||||||
app.err.Printf("Couldn't find profile \"%s\" or profile was empty", req.Profile)
|
app.err.Printf("Couldn't find profile \"%s\" or profile was empty", req.Profile)
|
||||||
respond(500, "Couldn't find profile", gc)
|
respond(500, "Couldn't find profile", gc)
|
||||||
@ -1175,7 +1176,7 @@ func (app *appContext) ApplySettings(gc *gin.Context) {
|
|||||||
app.jf.CacheExpiry = time.Now()
|
app.jf.CacheExpiry = time.Now()
|
||||||
user, status, err := app.jf.UserByID(req.ID, false)
|
user, status, err := app.jf.UserByID(req.ID, false)
|
||||||
if !(status == 200 || status == 204) || err != nil {
|
if !(status == 200 || status == 204) || err != nil {
|
||||||
app.err.Printf("Failed to get user from Jellyfin (%d): %s", status, err)
|
app.err.Printf("Failed to get user from Jellyfin (%d): %v", status, err)
|
||||||
respond(500, "Couldn't get user", gc)
|
respond(500, "Couldn't get user", gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1184,7 +1185,7 @@ func (app *appContext) ApplySettings(gc *gin.Context) {
|
|||||||
if req.Homescreen {
|
if req.Homescreen {
|
||||||
displayprefs, status, err = app.jf.GetDisplayPreferences(req.ID)
|
displayprefs, status, err = app.jf.GetDisplayPreferences(req.ID)
|
||||||
if !(status == 200 || status == 204) || err != nil {
|
if !(status == 200 || status == 204) || err != nil {
|
||||||
app.err.Printf("Failed to get DisplayPrefs (%d): %s", status, err)
|
app.err.Printf("Failed to get DisplayPrefs (%d): %v", status, err)
|
||||||
respond(500, "Couldn't get displayprefs", gc)
|
respond(500, "Couldn't get displayprefs", gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1314,7 +1315,7 @@ func (app *appContext) ModifyConfig(gc *gin.Context) {
|
|||||||
app.info.Println("Restarting...")
|
app.info.Println("Restarting...")
|
||||||
err := app.Restart()
|
err := app.Restart()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("Couldn't restart, try restarting manually. (%s)", err)
|
app.err.Printf("Couldn't restart, try restarting manually: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.loadConfig()
|
app.loadConfig()
|
||||||
@ -1480,7 +1481,7 @@ func (app *appContext) ApplyUpdate(gc *gin.Context) {
|
|||||||
}
|
}
|
||||||
err := app.update.update()
|
err := app.update.update()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("Failed to apply update: %s", err)
|
app.err.Printf("Failed to apply update: %v", err)
|
||||||
respondBool(500, false, gc)
|
respondBool(500, false, gc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1702,7 +1703,7 @@ func (app *appContext) restart(gc *gin.Context) {
|
|||||||
app.info.Println("Restarting...")
|
app.info.Println("Restarting...")
|
||||||
err := app.Restart()
|
err := app.Restart()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("Couldn't restart, try restarting manually. (%s)", err)
|
app.err.Printf("Couldn't restart, try restarting manually: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
go.mod
4
go.mod
@ -9,7 +9,6 @@ replace github.com/hrfee/jfa-go/common => ./common
|
|||||||
replace github.com/hrfee/jfa-go/ombi => ./ombi
|
replace github.com/hrfee/jfa-go/ombi => ./ombi
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
|
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||||
github.com/fatih/color v1.10.0
|
github.com/fatih/color v1.10.0
|
||||||
github.com/fsnotify/fsnotify v1.4.9
|
github.com/fsnotify/fsnotify v1.4.9
|
||||||
@ -26,14 +25,13 @@ require (
|
|||||||
github.com/hrfee/jfa-go/common v0.0.0-20210105184019-fdc97b4e86cc
|
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/docs v0.0.0-20201112212552-b6f3cd7c1f71
|
||||||
github.com/hrfee/jfa-go/ombi v0.0.0-20201112212552-b6f3cd7c1f71
|
github.com/hrfee/jfa-go/ombi v0.0.0-20201112212552-b6f3cd7c1f71
|
||||||
github.com/hrfee/mediabrowser v0.1.1
|
github.com/hrfee/mediabrowser v0.2.0
|
||||||
github.com/jordan-wright/email v4.0.1-0.20200917010138-e1c00e156980+incompatible
|
github.com/jordan-wright/email v4.0.1-0.20200917010138-e1c00e156980+incompatible
|
||||||
github.com/knz/strtime v0.0.0-20200924090105-187c67f2bf5e
|
github.com/knz/strtime v0.0.0-20200924090105-187c67f2bf5e
|
||||||
github.com/lithammer/shortuuid/v3 v3.0.4
|
github.com/lithammer/shortuuid/v3 v3.0.4
|
||||||
github.com/mailgun/mailgun-go/v4 v4.3.0
|
github.com/mailgun/mailgun-go/v4 v4.3.0
|
||||||
github.com/mailru/easyjson v0.7.7 // indirect
|
github.com/mailru/easyjson v0.7.7 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
|
||||||
github.com/smartystreets/goconvey v1.6.4 // indirect
|
github.com/smartystreets/goconvey v1.6.4 // indirect
|
||||||
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14
|
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14
|
||||||
github.com/swaggo/gin-swagger v1.3.0
|
github.com/swaggo/gin-swagger v1.3.0
|
||||||
|
13
go.sum
13
go.sum
@ -17,8 +17,6 @@ github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJ
|
|||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
|
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
|
||||||
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
|
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -84,7 +82,6 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/
|
|||||||
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||||
github.com/go-openapi/swag v0.19.11/go.mod h1:Uc0gKkdR+ojzsEpjh39QChyu92vPgIr72POcgHMAgSY=
|
github.com/go-openapi/swag v0.19.11/go.mod h1:Uc0gKkdR+ojzsEpjh39QChyu92vPgIr72POcgHMAgSY=
|
||||||
github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng=
|
|
||||||
github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||||
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
|
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
|
||||||
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||||
@ -130,8 +127,8 @@ github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
|
|||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/hrfee/mediabrowser v0.1.1 h1:d/Ha30GPpixCXtQXIeZT76MstPcfMU9auTVbKpB7fZQ=
|
github.com/hrfee/mediabrowser v0.2.0 h1:FaMEIs6I10rTUOdnF2VhDZDIr6T4RB3SJlDpQbygMz8=
|
||||||
github.com/hrfee/mediabrowser v0.1.1/go.mod h1:PnHZbdxmbv1wCVdAQyM7nwPwpVj9fdKx2EcET7sAk+U=
|
github.com/hrfee/mediabrowser v0.2.0/go.mod h1:PnHZbdxmbv1wCVdAQyM7nwPwpVj9fdKx2EcET7sAk+U=
|
||||||
github.com/jordan-wright/email v4.0.1-0.20200917010138-e1c00e156980+incompatible h1:CL0ooBNfbNyJTJATno+m0h+zM5bW6v7fKlboKUGP/dI=
|
github.com/jordan-wright/email v4.0.1-0.20200917010138-e1c00e156980+incompatible h1:CL0ooBNfbNyJTJATno+m0h+zM5bW6v7fKlboKUGP/dI=
|
||||||
github.com/jordan-wright/email v4.0.1-0.20200917010138-e1c00e156980+incompatible/go.mod h1:1c7szIrayyPPB/987hsnvNzLushdWf4o/79s3P08L8A=
|
github.com/jordan-wright/email v4.0.1-0.20200917010138-e1c00e156980+incompatible/go.mod h1:1c7szIrayyPPB/987hsnvNzLushdWf4o/79s3P08L8A=
|
||||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||||
@ -192,8 +189,6 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCb
|
|||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
|
||||||
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||||
@ -271,8 +266,6 @@ 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-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-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-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c h1:KHUzaHIpjWVlVVNh65G3hhuj3KB1HnjY6Cq5cTvRQT8=
|
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-20210331212208-0fccb6fa2b5c/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
||||||
@ -297,8 +290,6 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/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-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-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b h1:ggRgirZABFolTmi3sn6Ivd9SipZwLedQ5wR0aAKnFxU=
|
|
||||||
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/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 h1:rF3Ohx8DRyl8h2zw9qojyLHLhrJpEMgyPOImREEryf0=
|
||||||
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
8
main.go
8
main.go
@ -442,10 +442,13 @@ func start(asDaemon, firstCall bool) {
|
|||||||
timeoutHandler,
|
timeoutHandler,
|
||||||
cacheTimeout,
|
cacheTimeout,
|
||||||
)
|
)
|
||||||
|
if debugMode {
|
||||||
|
app.jf.Verbose = true
|
||||||
|
}
|
||||||
var status int
|
var status int
|
||||||
_, status, err = app.jf.Authenticate(app.config.Section("jellyfin").Key("username").String(), app.config.Section("jellyfin").Key("password").String())
|
_, status, err = app.jf.Authenticate(app.config.Section("jellyfin").Key("username").String(), app.config.Section("jellyfin").Key("password").String())
|
||||||
if status != 200 || err != nil {
|
if status != 200 || err != nil {
|
||||||
app.err.Fatalf("Failed to authenticate with Jellyfin @ %s: Code %d", server, status)
|
app.err.Fatalf("Failed to authenticate with Jellyfin @ %s (%d): %v", server, status, err)
|
||||||
}
|
}
|
||||||
app.info.Printf("Authenticated with %s", server)
|
app.info.Printf("Authenticated with %s", server)
|
||||||
/* A couple of unstable Jellyfin 10.7.0 releases decided to hyphenate user IDs.
|
/* A couple of unstable Jellyfin 10.7.0 releases decided to hyphenate user IDs.
|
||||||
@ -515,6 +518,9 @@ func start(asDaemon, firstCall bool) {
|
|||||||
} else {
|
} else {
|
||||||
app.debug.Println("Using Jellyfin for authentication")
|
app.debug.Println("Using Jellyfin for authentication")
|
||||||
app.authJf, _ = mediabrowser.NewServer(serverType, server, "jfa-go", app.version, "auth", "auth", timeoutHandler, cacheTimeout)
|
app.authJf, _ = mediabrowser.NewServer(serverType, server, "jfa-go", app.version, "auth", "auth", timeoutHandler, cacheTimeout)
|
||||||
|
if debugMode {
|
||||||
|
app.authJf.Verbose = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since email depends on language, the email reload in loadConfig won't work first time.
|
// Since email depends on language, the email reload in loadConfig won't work first time.
|
||||||
|
Loading…
Reference in New Issue
Block a user