Skip to content
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion public/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"save": "Save",
"cancel": "Cancel",
"enable": "Enable",
"disable": "Disable"
"disable": "Disable",
"import": "Import Key"
},
"edit": "Edit",
"visitService": "Visit service",
Expand Down
17 changes: 13 additions & 4 deletions src/bundles/ipns.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ const ipnsBundle = {
doRemoveIpnsKey: (name) => async ({ getIpfs, store }) => {
const ipfs = getIpfs()
await ipfs.key.rm(name)

store.doFetchIpnsKeys()
},

doRenameIpnsKey: (oldName, newName) => async ({ getIpfs, store }) => {
const ipfs = getIpfs()
await ipfs.key.rename(oldName, newName)

store.doFetchIpnsKeys()
},

Expand All @@ -63,9 +61,20 @@ const ipnsBundle = {
await ipfs.name.publish(cid, { key })
},

doImportIpnsKey: (file) => async ({ getIpfs, store }) => {
const ipfs = getIpfs()
const reader = new FileReader()
reader.onload = async (event) => {
const key = event.target.result
await ipfs.key.import(file.name, key)
store.doFetchIpnsKeys()
}
reader.readAsText(file)
},



doUpdateExpectedPublishTime: (time) => async ({ store, dispatch }) => {
// moderate expectation: publishing should take no longer than average
// between old expectation and the length of the last publish + some buffer
const oldExpectedTime = store.selectExpectedPublishTime()
const avg = Math.floor((time * 1.5 + oldExpectedTime) / 2)
await writeSetting('expectedPublishTime', avg)
Expand Down