pear-runtime-updater 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +9 -19
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -14,9 +14,8 @@ const host = platform + '-' + arch
|
|
|
14
14
|
module.exports = class PearRuntime extends ReadyResource {
|
|
15
15
|
constructor(config) {
|
|
16
16
|
super()
|
|
17
|
-
this.updates = !!config.update && config.updates !== false
|
|
18
17
|
if (!config.dir) throw new Error('dir required')
|
|
19
|
-
|
|
18
|
+
|
|
20
19
|
this.dir = config.dir
|
|
21
20
|
this.version = config.version || 0
|
|
22
21
|
this.storage = path.join(this.dir, 'app-storage')
|
|
@@ -24,23 +23,14 @@ module.exports = class PearRuntime extends ReadyResource {
|
|
|
24
23
|
this.name = this.app && path.basename(this.app)
|
|
25
24
|
this.bundled = config.bundled || !!this.app
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} else {
|
|
36
|
-
this.key = null
|
|
37
|
-
this.length = null
|
|
38
|
-
this.fork = null
|
|
39
|
-
this.link = null
|
|
40
|
-
this.store = null
|
|
41
|
-
this.drive = null
|
|
42
|
-
}
|
|
43
|
-
|
|
26
|
+
const { drive: upgrade } = link.parse(config.upgrade)
|
|
27
|
+
this.key = hid.decode(upgrade.key)
|
|
28
|
+
this.length = upgrade.length || 0
|
|
29
|
+
this.fork = upgrade.fork || 0
|
|
30
|
+
this.link = link.serialize({ drive: { fork: this.fork, length: this.length, key: this.key } })
|
|
31
|
+
this.store = new Corestore(path.join(this.dir, 'pear-runtime/corestore'))
|
|
32
|
+
this.drive = new Hyperdrive(this.store, this.key)
|
|
33
|
+
|
|
44
34
|
this.swarm = null
|
|
45
35
|
this.next = null
|
|
46
36
|
this.checkout = null
|