aboutsummaryrefslogtreecommitdiffstats
path: root/src/internal-server
diff options
context:
space:
mode:
authorLibravatar kytwb <kytwb@pm.me>2022-01-05 17:10:50 +0100
committerLibravatar kytwb <kytwb@pm.me>2022-01-05 17:10:50 +0100
commitf8277e2e3a736a75e9174d55fec816dff04b2aae (patch)
tree1b9a4fcc5bac69c033911fb394faf65274257f4b /src/internal-server
parent5.6.9-nightly.0 [skip ci] (diff)
downloadferdium-app-f8277e2e3a736a75e9174d55fec816dff04b2aae.tar.gz
ferdium-app-f8277e2e3a736a75e9174d55fec816dff04b2aae.tar.zst
ferdium-app-f8277e2e3a736a75e9174d55fec816dff04b2aae.zip
Replace hard-coded popular services in internal server
Diffstat (limited to 'src/internal-server')
-rw-r--r--src/internal-server/app/Controllers/Http/RecipeController.js15
-rw-r--r--src/internal-server/app/Controllers/Http/StaticController.js165
-rw-r--r--src/internal-server/start/routes.js4
3 files changed, 17 insertions, 167 deletions
diff --git a/src/internal-server/app/Controllers/Http/RecipeController.js b/src/internal-server/app/Controllers/Http/RecipeController.js
index d7ca716bb..daa9356f6 100644
--- a/src/internal-server/app/Controllers/Http/RecipeController.js
+++ b/src/internal-server/app/Controllers/Http/RecipeController.js
@@ -85,6 +85,21 @@ class RecipeController {
85 return response.send(results); 85 return response.send(results);
86 } 86 }
87 87
88 // Return an empty array
89 update({
90 response,
91 }) {
92 return response.send([]);
93 }
94
95 async popularRecipes({
96 response,
97 }) {
98 const recipesUrlFetch = await fetch(`${RECIPES_URL}/popular`);
99 const featuredRecipes = JSON.parse(await recipesUrlFetch.text());
100 return response.send(featuredRecipes);
101 }
102
88 // Download a recipe 103 // Download a recipe
89 async download({ response, params }) { 104 async download({ response, params }) {
90 // Validate user input 105 // Validate user input
diff --git a/src/internal-server/app/Controllers/Http/StaticController.js b/src/internal-server/app/Controllers/Http/StaticController.js
index ef5764881..99723940a 100644
--- a/src/internal-server/app/Controllers/Http/StaticController.js
+++ b/src/internal-server/app/Controllers/Http/StaticController.js
@@ -19,171 +19,6 @@ class StaticController {
19 }); 19 });
20 } 20 }
21 21
22 // Return an empty array
23 emptyArray({
24 response,
25 }) {
26 return response.send([]);
27 }
28
29 // Return list of popular recipes (copy of the response Franz's API is returning)
30 popularRecipes({
31 response,
32 }) {
33 return response.send([{
34 // TODO: Why is this list hardcoded?
35 author: 'Stefan Malzner <stefan@adlk.io>',
36 featured: false,
37 id: 'slack',
38 name: 'Slack',
39 version: '1.0.4',
40 icons: {
41 png: 'https://cdn.franzinfra.com/recipes/dist/slack/src/icon.png',
42 svg: 'https://cdn.franzinfra.com/recipes/dist/slack/src/icon.svg',
43 },
44 }, {
45 author: 'Stefan Malzner <stefan@adlk.io>',
46 featured: false,
47 id: 'whatsapp',
48 name: 'WhatsApp',
49 version: '1.0.1',
50 icons: {
51 png: 'https://cdn.franzinfra.com/recipes/dist/whatsapp/src/icon.png',
52 svg: 'https://cdn.franzinfra.com/recipes/dist/whatsapp/src/icon.svg',
53 },
54 }, {
55 author: 'Stefan Malzner <stefan@adlk.io>',
56 featured: false,
57 id: 'messenger',
58 name: 'Messenger',
59 version: '1.0.6',
60 icons: {
61 png: 'https://cdn.franzinfra.com/recipes/dist/messenger/src/icon.png',
62 svg: 'https://cdn.franzinfra.com/recipes/dist/messenger/src/icon.svg',
63 },
64 }, {
65 author: 'Stefan Malzner <stefan@adlk.io>',
66 featured: false,
67 id: 'telegram',
68 name: 'Telegram',
69 version: '1.0.0',
70 icons: {
71 png: 'https://cdn.franzinfra.com/recipes/dist/telegram/src/icon.png',
72 svg: 'https://cdn.franzinfra.com/recipes/dist/telegram/src/icon.svg',
73 },
74 }, {
75 author: 'Stefan Malzner <stefan@adlk.io>',
76 featured: false,
77 id: 'gmail',
78 name: 'Gmail',
79 version: '1.0.0',
80 icons: {
81 png: 'https://cdn.franzinfra.com/recipes/dist/gmail/src/icon.png',
82 svg: 'https://cdn.franzinfra.com/recipes/dist/gmail/src/icon.svg',
83 },
84 }, {
85 author: 'Stefan Malzner <stefan@adlk.io>',
86 featured: false,
87 id: 'skype',
88 name: 'Skype',
89 version: '1.0.0',
90 icons: {
91 png: 'https://cdn.franzinfra.com/recipes/dist/skype/src/icon.png',
92 svg: 'https://cdn.franzinfra.com/recipes/dist/skype/src/icon.svg',
93 },
94 }, {
95 author: 'Stefan Malzner <stefan@adlk.io>',
96 featured: false,
97 id: 'hangouts',
98 name: 'Hangouts',
99 version: '1.0.0',
100 icons: {
101 png: 'https://cdn.franzinfra.com/recipes/dist/hangouts/src/icon.png',
102 svg: 'https://cdn.franzinfra.com/recipes/dist/hangouts/src/icon.svg',
103 },
104 }, {
105 author: 'Stefan Malzner <stefan@adlk.io>',
106 featured: false,
107 id: 'discord',
108 name: 'Discord',
109 version: '1.0.0',
110 icons: {
111 png: 'https://cdn.franzinfra.com/recipes/dist/discord/src/icon.png',
112 svg: 'https://cdn.franzinfra.com/recipes/dist/discord/src/icon.svg',
113 },
114 }, {
115 author: 'Stefan Malzner <stefan@adlk.io>',
116 featured: false,
117 id: 'tweetdeck',
118 name: 'Tweetdeck',
119 version: '1.0.1',
120 icons: {
121 png: 'https://cdn.franzinfra.com/recipes/dist/tweetdeck/src/icon.png',
122 svg: 'https://cdn.franzinfra.com/recipes/dist/tweetdeck/src/icon.svg',
123 },
124 }, {
125 author: 'Stefan Malzner <stefan@adlk.io>',
126 featured: false,
127 id: 'hipchat',
128 name: 'HipChat',
129 version: '1.0.1',
130 icons: {
131 png: 'https://cdn.franzinfra.com/recipes/dist/hipchat/src/icon.png',
132 svg: 'https://cdn.franzinfra.com/recipes/dist/hipchat/src/icon.svg',
133 },
134 }, {
135 author: 'Stefan Malzner <stefan@adlk.io>',
136 featured: false,
137 id: 'rocketchat',
138 name: 'Rocket.Chat',
139 version: '1.0.1',
140 icons: {
141 png: 'https://cdn.franzinfra.com/recipes/dist/rocketchat/src/icon.png',
142 svg: 'https://cdn.franzinfra.com/recipes/dist/rocketchat/src/icon.svg',
143 },
144 }, {
145 author: 'Brian Gilbert <brian@briangilbert.net>',
146 featured: false,
147 id: 'gitter',
148 name: 'Gitter',
149 version: '1.0.0',
150 icons: {
151 png: 'https://cdn.franzinfra.com/recipes/dist/gitter/src/icon.png',
152 svg: 'https://cdn.franzinfra.com/recipes/dist/gitter/src/icon.svg',
153 },
154 }, {
155 author: 'Stefan Malzner <stefan@adlk.io>',
156 featured: false,
157 id: 'mattermost',
158 name: 'Mattermost',
159 version: '1.0.0',
160 icons: {
161 png: 'https://cdn.franzinfra.com/recipes/dist/mattermost/src/icon.png',
162 svg: 'https://cdn.franzinfra.com/recipes/dist/mattermost/src/icon.svg',
163 },
164 }, {
165 author: 'Franz <recipe@meetfranz.com>',
166 featured: false,
167 id: 'toggl',
168 name: 'Toggl',
169 version: '1.0.0',
170 icons: {
171 png: 'https://cdn.franzinfra.com/recipes/dist/toggl/src/icon.png',
172 svg: 'https://cdn.franzinfra.com/recipes/dist/toggl/src/icon.svg',
173 },
174 }, {
175 author: 'Stuart Clark <stuart@realityloop.com>',
176 featured: false,
177 id: 'twist',
178 name: 'Twist',
179 version: '1.0.0',
180 icons: {
181 png: 'https://cdn.franzinfra.com/recipes/dist/twist/src/icon.png',
182 svg: 'https://cdn.franzinfra.com/recipes/dist/twist/src/icon.svg',
183 },
184 }]);
185 }
186
187 // Show announcements 22 // Show announcements
188 announcement({ 23 announcement({
189 response, 24 response,
diff --git a/src/internal-server/start/routes.js b/src/internal-server/start/routes.js
index 4a63b51f2..25ebed8ae 100644
--- a/src/internal-server/start/routes.js
+++ b/src/internal-server/start/routes.js
@@ -55,8 +55,8 @@ Route.group(() => {
55 Route.get('recipes', 'RecipeController.list'); 55 Route.get('recipes', 'RecipeController.list');
56 Route.get('recipes/download/:recipe', 'RecipeController.download'); 56 Route.get('recipes/download/:recipe', 'RecipeController.download');
57 Route.get('recipes/search', 'RecipeController.search'); 57 Route.get('recipes/search', 'RecipeController.search');
58 Route.get('recipes/popular', 'StaticController.popularRecipes'); 58 Route.get('recipes/popular', 'RecipeController.popularRecipes');
59 Route.get('recipes/update', 'StaticController.emptyArray'); 59 Route.get('recipes/update', 'RecipeController.update');
60 60
61 // Workspaces 61 // Workspaces
62 Route.put('workspace/:id', 'WorkspaceController.edit'); 62 Route.put('workspace/:id', 'WorkspaceController.edit');