Files: deef6f4525d00a84b10de760ede55bf07c561630 / app / sync / initialise / settings.js
982 bytesRaw
1 | const nest = require('depnest') |
2 | const merge = require('lodash/merge') |
3 | |
4 | exports.gives = nest('app.sync.initialise') |
5 | |
6 | exports.needs = nest({ |
7 | 'settings.sync.set': 'first', |
8 | 'settings.sync.get': 'first' |
9 | }) |
10 | |
11 | const defaults = { |
12 | patchbay: { |
13 | defaultTabs: ['/public', '/inbox', '/notifications'], |
14 | accessibility: { |
15 | invert: false, |
16 | saturation: 100, |
17 | brightness: 100, |
18 | contrast: 100 |
19 | } |
20 | }, |
21 | filter: { |
22 | exclude: { |
23 | channels: '' |
24 | }, |
25 | only: { |
26 | peopleIFollow: false |
27 | }, |
28 | show: { |
29 | post: true, |
30 | vote: false, // a.k.a. like |
31 | about: true, |
32 | contact: false, |
33 | channel: false, |
34 | pub: false, |
35 | chess: false |
36 | } |
37 | } |
38 | } |
39 | |
40 | exports.create = function (api) { |
41 | return nest('app.sync.initialise', initialiseSettings) |
42 | |
43 | function initialiseSettings () { |
44 | const { get, set } = api.settings.sync |
45 | const settings = merge({}, defaults, get()) |
46 | settings.filter.defaults = defaults.filter |
47 | |
48 | set(settings) |
49 | } |
50 | } |
51 |
Built with git-ssb-web