Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
WIP - Move to the new hyperdrive daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee committed Aug 16, 2019
1 parent e5e61e9 commit e50431d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 29 deletions.
6 changes: 1 addition & 5 deletions app/background-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ app.on('open-file', (e, filepath) => {
})

app.on('ready', async function () {
// start the daemon process
var datDaemonProcess = await childProcesses.spawn('dat-daemon', './dat-daemon.js')

portForwarder.setup()

// setup core
Expand All @@ -109,8 +106,7 @@ app.on('ready', async function () {
},
rpcAPI: rpc,
downloadsWebAPI: downloads.WEBAPI,
browserWebAPI: beakerBrowser.WEBAPI,
datDaemonProcess
browserWebAPI: beakerBrowser.WEBAPI
})

// base
Expand Down
2 changes: 1 addition & 1 deletion app/background-process/ui/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export async function checkLabsPerm ({perm, labApi, apiDocsUrl, sender}) {
let isOptedIn = false
let archive = dat.library.getArchive(key)
if (archive) {
let {checkoutFS} = dat.library.getArchiveCheckout(archive, urlp.version)
let {checkoutFS} = await dat.library.getArchiveCheckout(archive, urlp.version)
let manifest = await pda.readManifest(checkoutFS).catch(_ => {})
let apis = _get(manifest, 'experimental.apis')
if (apis && Array.isArray(apis)) {
Expand Down
7 changes: 4 additions & 3 deletions app/background-process/ui/view-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,19 +489,20 @@ class View {
// live reloading
// =

toggleLiveReloading (enable) {

async toggleLiveReloading (enable) {
if (typeof enable === 'undefined') {
enable = !this.liveReloadEvents
}
if (!enable) {
if (this.liveReloadEvents) {
this.liveReloadEvents.close()
this.liveReloadEvents = false
} else if (this.datInfo) {
let archive = beakerCore.dat.library.getArchive(this.datInfo.key)
if (!archive) return

let {version} = parseDatURL(this.url)
let {checkoutFS} = beakerCore.dat.library.getArchiveCheckout(archive, version)
let {checkoutFS} = await beakerCore.dat.library.getArchiveCheckout(archive, version)
this.liveReloadEvents = checkoutFS.pda.watch()

let event = (this.datInfo.isOwner) ? 'changed' : 'invalidated'
Expand Down
20 changes: 0 additions & 20 deletions app/dat-daemon.js

This file was deleted.

0 comments on commit e50431d

Please sign in to comment.