diff --git a/Makefile b/Makefile index 3076bace..744e0921 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ build: linux linux-arm darwin run: @ go generate - @ go run main.go + @ go run main.go -debug clean: @ rm -f $(APP)-* diff --git a/config/config.go b/config/config.go index bf4f43d5..7788a381 100644 --- a/config/config.go +++ b/config/config.go @@ -55,7 +55,11 @@ func (c *Config) HasDebugMode() bool { // BaseURL returns the application base URL. func (c *Config) BaseURL() string { - return c.get("BASE_URL", defaultBaseURL) + baseURL := c.get("BASE_URL", defaultBaseURL) + if baseURL[len(baseURL)-1:] == "/" { + baseURL = baseURL[:len(baseURL)-1] + } + return baseURL } // DatabaseURL returns the database URL. diff --git a/config/config_test.go b/config/config_test.go new file mode 100644 index 00000000..4c01bc5e --- /dev/null +++ b/config/config_test.go @@ -0,0 +1,39 @@ +// Copyright 2017 Frédéric Guillot. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package config + +import ( + "os" + "testing" +) + +func TestGetCustomBaseURL(t *testing.T) { + os.Clearenv() + os.Setenv("BASE_URL", "http://example.org") + cfg := NewConfig() + + if cfg.BaseURL() != "http://example.org" { + t.Fatalf(`Unexpected base URL, got "%s"`, cfg.BaseURL()) + } +} + +func TestGetCustomBaseURLWithTrailingSlash(t *testing.T) { + os.Clearenv() + os.Setenv("BASE_URL", "http://example.org/folder/") + cfg := NewConfig() + + if cfg.BaseURL() != "http://example.org/folder" { + t.Fatalf(`Unexpected base URL, got "%s"`, cfg.BaseURL()) + } +} + +func TestGetDefaultBaseURL(t *testing.T) { + os.Clearenv() + cfg := NewConfig() + + if cfg.BaseURL() != "http://localhost" { + t.Fatalf(`Unexpected base URL, got "%s"`, cfg.BaseURL()) + } +} diff --git a/daemon/routes.go b/daemon/routes.go index 216cdb8a..6b44fb4b 100644 --- a/daemon/routes.go +++ b/daemon/routes.go @@ -45,7 +45,7 @@ func routes(cfg *config.Config, store *storage.Storage, feedHandler *feed.Handle middleware.NewSessionMiddleware(cfg, store).Handler, )) - router.Handle("/fever/", feverHandler.Use(feverController.Handler)) + router.Handle("/fever/", feverHandler.Use(feverController.Handler)).Name("feverEndpoint") router.Handle("/v1/users", apiHandler.Use(apiController.CreateUser)).Methods("POST") router.Handle("/v1/users", apiHandler.Use(apiController.Users)).Methods("GET") diff --git a/locale/translations.go b/locale/translations.go index f49f1d5c..f19bbe5e 100644 --- a/locale/translations.go +++ b/locale/translations.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// 2018-01-20 00:27:28.368359 +0100 CET m=+0.034072224 +// 2018-01-31 21:53:31.21983716 -0800 PST m=+0.044009238 package locale @@ -430,7 +430,11 @@ var translations = map[string]string{ "Logged as %s": "Connecté en tant que %s", "Unread Items": "Éléments non lus", "Change entry status": "Changer le statut de l'élément", - "Read": "Lu" + "Read": "Lu", + "Fever API endpoint:": "Point de terminaison de l'API Fever :", + "Miniflux API": "API de Miniflux", + "API Endpoint": "Point de terminaison de l'API", + "Your account password": "Le mot de passe de votre compte" } `, } @@ -438,5 +442,5 @@ var translations = map[string]string{ var translationsChecksums = map[string]string{ "de_DE": "c518cb7782b391da612d7d8d72fc746aa5ae25e107afc995d29b85990e2f07e8", "en_US": "6fe95384260941e8a5a3c695a655a932e0a8a6a572c1e45cb2b1ae8baa01b897", - "fr_FR": "776658a9a09c49d25f1f259fea794b48c4fa39b92024318d0f223bafb9164aad", + "fr_FR": "e6305fd54508a4f54d630e3ef231a8eadc2335ed0ffac7b5266b2ec751824e28", } diff --git a/locale/translations/fr_FR.json b/locale/translations/fr_FR.json index fecc78b0..f7aa94d9 100644 --- a/locale/translations/fr_FR.json +++ b/locale/translations/fr_FR.json @@ -204,5 +204,9 @@ "Logged as %s": "Connecté en tant que %s", "Unread Items": "Éléments non lus", "Change entry status": "Changer le statut de l'élément", - "Read": "Lu" + "Read": "Lu", + "Fever API endpoint:": "Point de terminaison de l'API Fever :", + "Miniflux API": "API de Miniflux", + "API Endpoint": "Point de terminaison de l'API", + "Your account password": "Le mot de passe de votre compte" } diff --git a/reader/feed/handler.go b/reader/feed/handler.go index 4801d128..26f48f46 100644 --- a/reader/feed/handler.go +++ b/reader/feed/handler.go @@ -180,7 +180,7 @@ func (h *Handler) RefreshFeed(userID, feedID int64) error { logger.Debug("[Handler:RefreshFeed] Looking for feed icon") icon, err := icon.FindIcon(originalFeed.SiteURL) if err != nil { - logger.Error("[Handler:RefreshFeed] %v", err) + logger.Debug("[Handler:RefreshFeed] %v", err) } else { h.store.CreateFeedIcon(originalFeed, icon) } diff --git a/sql/sql.go b/sql/sql.go index 36f344e9..e3448f9b 100644 --- a/sql/sql.go +++ b/sql/sql.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// 2018-01-02 21:59:10.075345511 -0800 PST m=+0.002720840 +// 2018-01-31 21:53:31.179267411 -0800 PST m=+0.003439489 package sql diff --git a/template/common.go b/template/common.go index 798f8ff0..2d284071 100644 --- a/template/common.go +++ b/template/common.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// 2018-01-18 20:15:20.47432327 -0800 PST m=+0.053802055 +// 2018-01-31 21:53:31.216689995 -0800 PST m=+0.040862073 package template diff --git a/template/html/integrations.html b/template/html/integrations.html index 5005d688..8c597eef 100644 --- a/template/html/integrations.html +++ b/template/html/integrations.html @@ -39,6 +39,8 @@ + +
{{ t "Fever API endpoint:" }} {{ baseURL }}{{ route "feverEndpoint" }}
{{ t "This special link allows you to subscribe to a website directly by using a bookmark in your web browser." }}
{{ t "Fever API endpoint:" }} {{ baseURL }}{{ route "feverEndpoint" }}
{{ t "This special link allows you to subscribe to a website directly by using a bookmark in your web browser." }}