Files: da9874091b96fecd45b20584dccc1c6f14280539 / app / obs / pluginsOk.js
834 bytesRaw
1 | const nest = require('depnest') |
2 | const { onceTrue, Value } = require('mutant') |
3 | |
4 | exports.gives = nest('app.obs.pluginsOk') |
5 | |
6 | exports.needs = nest({ |
7 | 'sbot.obs.connection': 'first' |
8 | }) |
9 | |
10 | exports.create = (api) => { |
11 | // TODO - differentiate and enable / disable based on channel || ticktack plugin missing |
12 | var ok = Value() |
13 | |
14 | return nest('app.obs.pluginsOk', function pluginsOk () { |
15 | if (ok() === null) checkForTrouble() |
16 | |
17 | return ok |
18 | }) |
19 | |
20 | function checkForTrouble () { |
21 | onceTrue( |
22 | api.sbot.obs.connection, |
23 | sbot => { |
24 | if (!sbot.channel) console.log('> channel plugin missing!') |
25 | if (!sbot.tickack) console.log('> ticktack plugin missing!') |
26 | |
27 | if (!sbot.channel || !sbot.ticktack) ok.set(false) // TODO could build a list of missing plugins + effects |
28 | else ok.set(true) |
29 | } |
30 | ) |
31 | } |
32 | } |
33 |
Built with git-ssb-web