diff --git a/Makefile b/Makefile index 3076bace40f31ad670544204b75730f2682cc5e2..744e0921ed57bac25051d595fa38bca5892bfc2a 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 bf4f43d54075b70973907dd8c497bc66529ec1d8..7788a381492e1e57048926cc05fa57ef39c2e165 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 0000000000000000000000000000000000000000..4c01bc5ee41715384a7fa591cbdfce04cc6cceba --- /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 216cdb8a969eb8937cd30d14db3572273fc1a3a4..6b44fb4b0a4e0502d4f450404825f9a954951211 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 f49f1d5c518d0a45e45f55babb275eee24fc5084..f19bbe5ed5877aed293ef55f6e63c2dfc29ee2c4 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 fecc78b0e4c2990d33e563fd574476d2e4a7a1e2..f7aa94d9cbaa9b8aa6577f122385d7a80cc87393 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 4801d12872b774d20fe48d2f1175daeb1a87dd0a..26f48f46bee698ce74d8ff4e20b3061ed79a8a61 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 36f344e98a5af497cd916df3b1bc327e4edf7369..e3448f9bd42c1b2f62435c39ddfe8cd2f0cea7ba 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 798f8ff01d6f48a3a09a79c7f0651f41b9910b00..2d2840717d8b79794596ed34ce44bcb153d96c51 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 5005d688e68bda5b8a986e093da6ea96dd2f0b92..8c597eeff3f0d0422c000c1911809cc71acbe48a 100644 --- a/template/html/integrations.html +++ b/template/html/integrations.html @@ -39,6 +39,8 @@ <label for="form-fever-password">{{ t "Fever Password" }}</label> <input type="password" name="fever_password" id="form-fever-password" value="{{ .form.FeverPassword }}"> + + <p>{{ t "Fever API endpoint:" }} <strong>{{ baseURL }}{{ route "feverEndpoint" }}</strong></p> </div> <h3>Pinboard</h3> @@ -98,8 +100,23 @@ </div> </form> +<h3>{{ t "Miniflux API" }}</h3> +<div class="panel"> + <ul> + <li> + {{ t "API Endpoint" }} = <strong>{{ baseURL }}/v1/</strong> + </li> + <li> + {{ t "Username" }} = <strong>{{ .user.Username }}</strong> + </li> + <li> + {{ t "Password" }} = <strong>{{ t "Your account password" }}</strong> + </li> + </ul> +</div> + +<h3>{{ t "Bookmarklet" }}</h3> <div class="panel"> - <h3>{{ t "Bookmarklet" }}</h3> <p>{{ t "This special link allows you to subscribe to a website directly by using a bookmark in your web browser." }}</p> <div class="bookmarklet"> diff --git a/template/views.go b/template/views.go index 76d05a4bb92d7386506e9c0aba4fcb40ab1cd637..1409c0cf1732bba9d8eb3f046ebb8b8120836f2c 100644 --- a/template/views.go +++ b/template/views.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// 2018-01-18 20:15:20.459420484 -0800 PST m=+0.038899269 +// 2018-01-31 21:53:31.195099265 -0800 PST m=+0.019271343 package template @@ -808,6 +808,8 @@ var templateViewsMap = map[string]string{ <label for="form-fever-password">{{ t "Fever Password" }}</label> <input type="password" name="fever_password" id="form-fever-password" value="{{ .form.FeverPassword }}"> + + <p>{{ t "Fever API endpoint:" }} <strong>{{ baseURL }}{{ route "feverEndpoint" }}</strong></p> </div> <h3>Pinboard</h3> @@ -867,8 +869,23 @@ var templateViewsMap = map[string]string{ </div> </form> +<h3>{{ t "Miniflux API" }}</h3> +<div class="panel"> + <ul> + <li> + {{ t "API Endpoint" }} = <strong>{{ baseURL }}/v1/</strong> + </li> + <li> + {{ t "Username" }} = <strong>{{ .user.Username }}</strong> + </li> + <li> + {{ t "Password" }} = <strong>{{ t "Your account password" }}</strong> + </li> + </ul> +</div> + +<h3>{{ t "Bookmarklet" }}</h3> <div class="panel"> - <h3>{{ t "Bookmarklet" }}</h3> <p>{{ t "This special link allows you to subscribe to a website directly by using a bookmark in your web browser." }}</p> <div class="bookmarklet"> @@ -1196,7 +1213,7 @@ var templateViewsMapChecksums = map[string]string{ "feeds": "65b0a47c4438810b9d51c60f3f3b2519690e56ff74029e6296c68626b83a470b", "history": "d2476fd727e4f53428b5ed1f3f9423063583337ec8cfe1dd9c931fcb03852a20", "import": "73b5112e20bfd232bf73334544186ea419505936bc237d481517a8622901878f", - "integrations": "3c14d7de904911aad7f3ebec6d1a20b50843287f58125c526e167f429f3d455d", + "integrations": "a677434e9a8be1f80cfbc1d04828dacc7abcec2a22b45c80594d49cc2ba7c0e5", "login": "7d83c3067c02f1f6aafdd8816c7f97a4eb5a5a4bdaaaa4cc1e2fbb9c17ea65e8", "sessions": "9a3609c52b071a280b85fd886f15d4b91c76bb0ab93a99ad132c695a216ac5cf", "settings": "ea2505b9d0a6d6bb594dba87a92079de19baa6d494f0651693a7685489fb7de9",