git ssb

2+

mixmix / ticktack



Tree: dc5f4dc6989f09141fae9235f7690c01ebdc9e74

Files: dc5f4dc6989f09141fae9235f7690c01ebdc9e74 / backup / html / backup.js

1123 bytesRaw
1const nest = require('depnest')
2const { h, Value, resolve } = require('mutant')
3const { dialog } = require('electron').remote;
4const path = require('path')
5const fs = require('fs')
6
7exports.gives = nest({
8 'backup.html': ['exportIdentityButton']
9})
10
11exports.needs = nest({
12 'app.html.lightbox': 'first',
13 'keys.sync.id': 'first',
14 'translations.sync.strings': 'first',
15 'backup.async.exportIdentity': 'first'
16})
17
18exports.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