From 6a647f6f63e983ccee028fb7b10cb1a3668a6fb6 Mon Sep 17 00:00:00 2001 From: Umputun Date: Tue, 20 Mar 2018 01:54:21 -0500 Subject: [PATCH] fix incorrect default avatar url --- app/main.go | 1 - app/rest/auth/auth.go | 8 +++----- app/rest/auth/avatar.go | 2 +- remark.rest | 3 +++ 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/main.go b/app/main.go index c496fa83..709bdbc4 100644 --- a/app/main.go +++ b/app/main.go @@ -123,7 +123,6 @@ func main() { SessionStore: sessionStore, Providers: makeAuthProviders(sessionStore, avatarProxy), AvatarProxy: avatarProxy, - DevEnabled: opts.DevPasswd != "", DevPasswd: opts.DevPasswd, }, Cache: rest.NewLoadingCache(4*time.Hour, 15*time.Minute, postFlushFn), diff --git a/app/rest/auth/auth.go b/app/rest/auth/auth.go index 00afc74f..375f0dff 100644 --- a/app/rest/auth/auth.go +++ b/app/rest/auth/auth.go @@ -20,15 +20,13 @@ type Authenticator struct { Admins []string Providers []Provider - DevEnabled bool - DevPasswd string + DevPasswd string } var devUser = store.User{ ID: "dev", Name: "developer one", - Picture: "https://friends.radio-t.com/resources/images/rt_logo_64.png", - Profile: "https://radio-t.com/info/", + Profile: "https://remark42.com", Admin: true, } @@ -106,7 +104,7 @@ func (a *Authenticator) AdminOnly(next http.Handler) http.Handler { func (a *Authenticator) basicDevUser(w http.ResponseWriter, r *http.Request) bool { - if a.DevPasswd == "" || !a.DevEnabled { + if a.DevPasswd == "" { return false } diff --git a/app/rest/auth/avatar.go b/app/rest/auth/avatar.go index abae9eba..dea01442 100644 --- a/app/rest/auth/avatar.go +++ b/app/rest/auth/avatar.go @@ -126,7 +126,7 @@ func (p *AvatarProxy) Routes() (string, chi.Router) { // Default returns full default avatar url func (p *AvatarProxy) Default() string { - return path.Join(p.RemarkURL, p.RoutePath, p.DefaultAvatar) + return strings.TrimRight(p.RemarkURL, "/") + p.RoutePath + "/" + p.DefaultAvatar } // get location for user id by adding partion to final path in order to keep files diff --git a/remark.rest b/remark.rest index 3861d293..a52a2126 100644 --- a/remark.rest +++ b/remark.rest @@ -102,6 +102,9 @@ PUT {{host}}/api/v1/notify?site=remark&url=https://radio-t.com/p/2017/12/16/podc ### subscribtion status GET {{host}}/api/v1/notify?site=remark&url=https://radio-t.com/p/2017/12/16/podcast-576/ +### get default avatar +GET {{host}}/api/v1/avatar/blah + ### ping GET {{host}}/ping