diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/api/apiBase.js | 1 | ||||
-rw-r--r-- | src/i18n/messages/src/components/layout/AppLayout.json | 16 | ||||
-rw-r--r-- | src/internal-server/app/Controllers/Http/RecipeController.js | 9 |
3 files changed, 17 insertions, 9 deletions
diff --git a/src/api/apiBase.js b/src/api/apiBase.js index ad37ca02c..2fad7eb21 100644 --- a/src/api/apiBase.js +++ b/src/api/apiBase.js | |||
@@ -12,6 +12,7 @@ import { | |||
12 | SERVER_NOT_LOADED, | 12 | SERVER_NOT_LOADED, |
13 | } from '../config'; | 13 | } from '../config'; |
14 | 14 | ||
15 | // Note: This cannot be used from the internal-server since we are not running within the context of a browser window | ||
15 | const apiBase = (withVersion = true) => { | 16 | const apiBase = (withVersion = true) => { |
16 | let url; | 17 | let url; |
17 | 18 | ||
diff --git a/src/i18n/messages/src/components/layout/AppLayout.json b/src/i18n/messages/src/components/layout/AppLayout.json index e3f5658b2..807490a4f 100644 --- a/src/i18n/messages/src/components/layout/AppLayout.json +++ b/src/i18n/messages/src/components/layout/AppLayout.json | |||
@@ -4,11 +4,11 @@ | |||
4 | "defaultMessage": "!!!Your services have been updated.", | 4 | "defaultMessage": "!!!Your services have been updated.", |
5 | "file": "src/components/layout/AppLayout.js", | 5 | "file": "src/components/layout/AppLayout.js", |
6 | "start": { | 6 | "start": { |
7 | "line": 29, | 7 | "line": 28, |
8 | "column": 19 | 8 | "column": 19 |
9 | }, | 9 | }, |
10 | "end": { | 10 | "end": { |
11 | "line": 32, | 11 | "line": 31, |
12 | "column": 3 | 12 | "column": 3 |
13 | } | 13 | } |
14 | }, | 14 | }, |
@@ -17,11 +17,11 @@ | |||
17 | "defaultMessage": "!!!Reload services", | 17 | "defaultMessage": "!!!Reload services", |
18 | "file": "src/components/layout/AppLayout.js", | 18 | "file": "src/components/layout/AppLayout.js", |
19 | "start": { | 19 | "start": { |
20 | "line": 33, | 20 | "line": 32, |
21 | "column": 24 | 21 | "column": 24 |
22 | }, | 22 | }, |
23 | "end": { | 23 | "end": { |
24 | "line": 36, | 24 | "line": 35, |
25 | "column": 3 | 25 | "column": 3 |
26 | } | 26 | } |
27 | }, | 27 | }, |
@@ -30,11 +30,11 @@ | |||
30 | "defaultMessage": "!!!Could not load services and user information", | 30 | "defaultMessage": "!!!Could not load services and user information", |
31 | "file": "src/components/layout/AppLayout.js", | 31 | "file": "src/components/layout/AppLayout.js", |
32 | "start": { | 32 | "start": { |
33 | "line": 37, | 33 | "line": 36, |
34 | "column": 26 | 34 | "column": 26 |
35 | }, | 35 | }, |
36 | "end": { | 36 | "end": { |
37 | "line": 40, | 37 | "line": 39, |
38 | "column": 3 | 38 | "column": 3 |
39 | } | 39 | } |
40 | }, | 40 | }, |
@@ -43,11 +43,11 @@ | |||
43 | "defaultMessage": "!!!There were errors while trying to perform an authenticated request. Please try logging out and back in if this error persists.", | 43 | "defaultMessage": "!!!There were errors while trying to perform an authenticated request. Please try logging out and back in if this error persists.", |
44 | "file": "src/components/layout/AppLayout.js", | 44 | "file": "src/components/layout/AppLayout.js", |
45 | "start": { | 45 | "start": { |
46 | "line": 41, | 46 | "line": 40, |
47 | "column": 21 | 47 | "column": 21 |
48 | }, | 48 | }, |
49 | "end": { | 49 | "end": { |
50 | "line": 45, | 50 | "line": 44, |
51 | "column": 3 | 51 | "column": 3 |
52 | } | 52 | } |
53 | } | 53 | } |
diff --git a/src/internal-server/app/Controllers/Http/RecipeController.js b/src/internal-server/app/Controllers/Http/RecipeController.js index 8a6b4f684..df889c7f4 100644 --- a/src/internal-server/app/Controllers/Http/RecipeController.js +++ b/src/internal-server/app/Controllers/Http/RecipeController.js | |||
@@ -6,8 +6,10 @@ const { | |||
6 | const Env = use('Env'); | 6 | const Env = use('Env'); |
7 | 7 | ||
8 | const fetch = require('node-fetch'); | 8 | const fetch = require('node-fetch'); |
9 | const debug = require('debug')('Ferdi:internalServer:RecipeController'); | ||
10 | const { LIVE_FERDI_API } = require('../../../../config'); | ||
9 | 11 | ||
10 | const RECIPES_URL = 'https://api.getferdi.com/v1/recipes'; | 12 | const RECIPES_URL = `${LIVE_FERDI_API}/v1/recipes`; |
11 | 13 | ||
12 | class RecipeController { | 14 | class RecipeController { |
13 | // List official and custom recipes | 15 | // List official and custom recipes |
@@ -64,6 +66,9 @@ class RecipeController { | |||
64 | if (Env.get('CONNECT_WITH_FRANZ') == 'true') { // eslint-disable-line eqeqeq | 66 | if (Env.get('CONNECT_WITH_FRANZ') == 'true') { // eslint-disable-line eqeqeq |
65 | remoteResults = JSON.parse(await (await fetch(`${RECIPES_URL}/search?needle=${encodeURIComponent(needle)}`)).text()); | 67 | remoteResults = JSON.parse(await (await fetch(`${RECIPES_URL}/search?needle=${encodeURIComponent(needle)}`)).text()); |
66 | } | 68 | } |
69 | |||
70 | debug('remoteResults:', remoteResults); | ||
71 | |||
67 | const localResultsArray = (await Recipe.query().where('name', 'LIKE', `%${needle}%`).fetch()).toJSON(); | 72 | const localResultsArray = (await Recipe.query().where('name', 'LIKE', `%${needle}%`).fetch()).toJSON(); |
68 | const localResults = localResultsArray.map(recipe => ({ | 73 | const localResults = localResultsArray.map(recipe => ({ |
69 | id: recipe.recipeId, | 74 | id: recipe.recipeId, |
@@ -71,6 +76,8 @@ class RecipeController { | |||
71 | ...JSON.parse(recipe.data), | 76 | ...JSON.parse(recipe.data), |
72 | })); | 77 | })); |
73 | 78 | ||
79 | debug('localResults:', localResults); | ||
80 | |||
74 | results = [ | 81 | results = [ |
75 | ...localResults, | 82 | ...localResults, |
76 | ...remoteResults || [], | 83 | ...remoteResults || [], |