diff options
author | vantezzen <hello@vantezzen.io> | 2019-10-16 11:43:52 +0200 |
---|---|---|
committer | vantezzen <hello@vantezzen.io> | 2019-10-16 11:43:52 +0200 |
commit | 0c0b7cc82298e2d9fccae9336dd7aac55c7d87d2 (patch) | |
tree | 4c2ad0926182b66f33afab2f1aabe744af175426 | |
parent | Fixed server-docker link in README.md (#4) (diff) | |
download | ferdium-server-0c0b7cc82298e2d9fccae9336dd7aac55c7d87d2.tar.gz ferdium-server-0c0b7cc82298e2d9fccae9336dd7aac55c7d87d2.tar.zst ferdium-server-0c0b7cc82298e2d9fccae9336dd7aac55c7d87d2.zip |
Add announcements
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | app/Controllers/Http/StaticController.js | 11 | ||||
-rw-r--r-- | resources/announcements/version.json | 34 |
3 files changed, 47 insertions, 1 deletions
@@ -17,3 +17,6 @@ recipes/ | |||
17 | .DS_Store | 17 | .DS_Store |
18 | public/terms.html | 18 | public/terms.html |
19 | public/privacy.html | 19 | public/privacy.html |
20 | |||
21 | resources/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 | */ |
5 | const Helpers = use('Helpers'); | ||
6 | const fs = require('fs-extra'); | ||
7 | const path = require('path'); | ||
5 | 8 | ||
6 | class StaticController { | 9 | class 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 | ||