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 8, 2019
1 parent 6d69529 commit c8aada6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 30 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
9 changes: 5 additions & 4 deletions app/background-process/ui/view-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,19 +484,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 Expand Up @@ -629,7 +630,7 @@ class View {
this.donateLinkHref = _get(this, 'datInfo.links.payment.0.href')
if (this.previewMode) {
let archive = beakerCore.dat.library.getArchive(key)
let diff = await beakerCore.dat.library.getDaemon().fs_diffListing(archive, {compareContent: true, shallow: true})
let diff = [] // TODO await beakerCore.dat.library.getDaemon().fs_diffListing(archive, {compareContent: true, shallow: true})
this.uncommittedChanges = diff ? diff.length : 0
}
let userSession = getUserSessionFor(this.browserWindow.webContents)
Expand Down
20 changes: 0 additions & 20 deletions app/dat-daemon.js

This file was deleted.

0 comments on commit c8aada6

Please sign in to comment.