aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-10-16 11:43:52 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2019-10-16 11:43:52 +0200
commit0c0b7cc82298e2d9fccae9336dd7aac55c7d87d2 (patch)
tree4c2ad0926182b66f33afab2f1aabe744af175426
parentFixed server-docker link in README.md (#4) (diff)
downloadferdium-server-0c0b7cc82298e2d9fccae9336dd7aac55c7d87d2.tar.gz
ferdium-server-0c0b7cc82298e2d9fccae9336dd7aac55c7d87d2.tar.zst
ferdium-server-0c0b7cc82298e2d9fccae9336dd7aac55c7d87d2.zip
Add announcements
-rw-r--r--.gitignore3
-rw-r--r--app/Controllers/Http/StaticController.js11
-rw-r--r--resources/announcements/version.json34
3 files changed, 47 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index d84ffad..f0a5147 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,6 @@ recipes/
17.DS_Store 17.DS_Store
18public/terms.html 18public/terms.html
19public/privacy.html 19public/privacy.html
20
21resources/announcements/*.json
22!resources/announcements/version.json \ No newline at end of file
diff --git a/app/Controllers/Http/StaticController.js b/app/Controllers/Http/StaticController.js
index b16e6cb..7041e83 100644
--- a/app/Controllers/Http/StaticController.js
+++ b/app/Controllers/Http/StaticController.js
@@ -2,6 +2,9 @@
2/** 2/**
3 * Controller for routes with static responses 3 * Controller for routes with static responses
4 */ 4 */
5const Helpers = use('Helpers');
6const fs = require('fs-extra');
7const path = require('path');
5 8
6class StaticController { 9class StaticController {
7 // Enable all features 10 // Enable all features
@@ -214,9 +217,15 @@ class StaticController {
214 } 217 }
215 218
216 // Show announcements 219 // Show announcements
217 announcement({ 220 async announcement({
218 response, 221 response,
222 params,
219 }) { 223 }) {
224 const announcement = path.join(Helpers.resourcesPath(), 'announcements', `${params.version}.json`);
225
226 if (await fs.pathExists(announcement)) {
227 return response.download(announcement);
228 }
220 return response.send('No announcement found.'); 229 return response.send('No announcement found.');
221 } 230 }
222} 231}
diff --git a/resources/announcements/version.json b/resources/announcements/version.json
new file mode 100644
index 0000000..79aabf3
--- /dev/null
+++ b/resources/announcements/version.json
@@ -0,0 +1,34 @@
1{
2 "main": {
3 "headline": "Example Accouncement",
4 "subHeadline": "Configure your announcement here",
5 "image": {
6 "light": "https://api.getferdi.com/assets/feature/light.png",
7 "dark": "https://api.getferdi.com/assets/feature/dark.png"
8 },
9 "text": "Long description here",
10 "cta": {
11 "label": "Click here to do something",
12 "href": "/settings/app",
13 "analytics": {
14 "category": "announcements-main",
15 "action": "event",
16 "label": "This does not get used"
17 }
18 }
19 },
20 "spotlight": {
21 "title": "Spotlight:",
22 "subject": "Show another feature",
23 "text": "Show another feature in the spotlight",
24 "cta": {
25 "label": "Click here to do something",
26 "href": "/settings/team",
27 "analytics": {
28 "category": "announcements-spotlight",
29 "action": "event",
30 "label": "This does not get used"
31 }
32 }
33 }
34} \ No newline at end of file