Files: dfac8271fd4cbc8e4306787a6b5ed36a4b975ede / backup / html / backup.js
1123 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, Value, resolve } = require('mutant') |
3 | const { dialog } = require('electron').remote; |
4 | const path = require('path') |
5 | const fs = require('fs') |
6 | |
7 | exports.gives = nest({ |
8 | 'backup.html': ['exportIdentityButton'] |
9 | }) |
10 | |
11 | exports.needs = nest({ |
12 | 'app.html.lightbox': 'first', |
13 | 'keys.sync.id': 'first', |
14 | 'translations.sync.strings': 'first', |
15 | 'backup.async.exportIdentity': 'first' |
16 | }) |
17 | |
18 | exports.create = (api) => { |
19 | return nest('backup.html.exportIdentityButton', () => { |
20 | |
21 | const strings = api.translations.sync.strings() |
22 | |
23 | function exportAction() { |
24 | let feedFragment = api.keys.sync.id().slice(1, 6) |
25 | dialog.showSaveDialog( |
26 | { |
27 | title: strings.backup.export.dialog.title, |
28 | butttonLabel: strings.backup.export.dialog.label, |
29 | defaultPath: `ticktack-identity-${feedFragment}.backup`, |
30 | }, |
31 | (filename) => api.backup.async.exportIdentity(filename, () => console.log('exported')) |
32 | ) |
33 | } |
34 | |
35 | return h('div.backupKeys', [ |
36 | h('Button -backup', { 'ev-click': exportAction }, strings.backup.export.exportAction) |
37 | ]) |
38 | }) |
39 | } |
40 |
Built with git-ssb-web