aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/fixtures/peertube-plugin-test
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/fixtures/peertube-plugin-test')
-rw-r--r--server/tests/fixtures/peertube-plugin-test/main.js39
-rw-r--r--server/tests/fixtures/peertube-plugin-test/package.json19
2 files changed, 58 insertions, 0 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js
new file mode 100644
index 000000000..fae0ef948
--- /dev/null
+++ b/server/tests/fixtures/peertube-plugin-test/main.js
@@ -0,0 +1,39 @@
1async function register ({ registerHook, registerSetting, settingsManager, storageManager }) {
2 const defaultAdmin = 'PeerTube admin'
3
4 registerHook({
5 target: 'action:application.listening',
6 handler: () => displayHelloWorld(settingsManager, defaultAdmin)
7 })
8
9 registerSetting({
10 name: 'admin-name',
11 label: 'Admin name',
12 type: 'input',
13 default: defaultAdmin
14 })
15
16 const value = await storageManager.getData('toto')
17 console.log(value)
18 console.log(value.coucou)
19
20 await storageManager.storeData('toto', { coucou: 'hello' + new Date() })
21}
22
23async function unregister () {
24 return
25}
26
27module.exports = {
28 register,
29 unregister
30}
31
32// ############################################################################
33
34async function displayHelloWorld (settingsManager, defaultAdmin) {
35 let value = await settingsManager.getSetting('admin-name')
36 if (!value) value = defaultAdmin
37
38 console.log('hello world ' + value)
39}
diff --git a/server/tests/fixtures/peertube-plugin-test/package.json b/server/tests/fixtures/peertube-plugin-test/package.json
new file mode 100644
index 000000000..9d6fe5c90
--- /dev/null
+++ b/server/tests/fixtures/peertube-plugin-test/package.json
@@ -0,0 +1,19 @@
1{
2 "name": "peertube-plugin-test",
3 "version": "0.0.1",
4 "description": "Plugin test",
5 "engine": {
6 "peertube": ">=1.3.0"
7 },
8 "keywords": [
9 "peertube",
10 "plugin"
11 ],
12 "homepage": "https://github.com/Chocobozzz/PeerTube",
13 "author": "Chocobozzz",
14 "bugs": "https://github.com/Chocobozzz/PeerTube/issues",
15 "library": "./main.js",
16 "staticDirs": {},
17 "css": [],
18 "clientScripts": []
19}