diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-22 10:55:28 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-22 10:55:28 +0200 |
commit | 302eba0d898e38dca14739486441c27c0be6c62f (patch) | |
tree | 280d18bfe2ad1b16248277371e609c31d6b3aaa4 /server/tests/fixtures/peertube-plugin-test-six/main.js | |
parent | 3e0e8d4afded28559b7c473061bbdc31ab542e1c (diff) | |
download | PeerTube-302eba0d898e38dca14739486441c27c0be6c62f.tar.gz PeerTube-302eba0d898e38dca14739486441c27c0be6c62f.tar.zst PeerTube-302eba0d898e38dca14739486441c27c0be6c62f.zip |
Add data directory for plugins and some helpers
Diffstat (limited to 'server/tests/fixtures/peertube-plugin-test-six/main.js')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test-six/main.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-six/main.js b/server/tests/fixtures/peertube-plugin-test-six/main.js index bb9aaffa7..858bdb2df 100644 --- a/server/tests/fixtures/peertube-plugin-test-six/main.js +++ b/server/tests/fixtures/peertube-plugin-test-six/main.js | |||
@@ -1,6 +1,10 @@ | |||
1 | const fs = require('fs') | ||
2 | const path = require('path') | ||
3 | |||
1 | async function register ({ | 4 | async function register ({ |
2 | storageManager, | 5 | storageManager, |
3 | peertubeHelpers | 6 | peertubeHelpers, |
7 | getRouter | ||
4 | }) { | 8 | }) { |
5 | const { logger } = peertubeHelpers | 9 | const { logger } = peertubeHelpers |
6 | 10 | ||
@@ -11,6 +15,18 @@ async function register ({ | |||
11 | const result = await storageManager.getData('superkey') | 15 | const result = await storageManager.getData('superkey') |
12 | logger.info('superkey stored value is %s', result.value) | 16 | logger.info('superkey stored value is %s', result.value) |
13 | } | 17 | } |
18 | |||
19 | { | ||
20 | getRouter().get('/create-file', async (req, res) => { | ||
21 | const basePath = peertubeHelpers.plugin.getDataDirectoryPath() | ||
22 | |||
23 | fs.writeFile(path.join(basePath, 'Aladdin.txt'), 'Prince Ali', function (err) { | ||
24 | if (err) return res.sendStatus(500) | ||
25 | |||
26 | res.sendStatus(200) | ||
27 | }) | ||
28 | }) | ||
29 | } | ||
14 | } | 30 | } |
15 | 31 | ||
16 | async function unregister () { | 32 | async function unregister () { |