Skip to content

Commit

Permalink
fix: workaround for pdfs not loading over hyper://, also solve stopwa…
Browse files Browse the repository at this point in the history
…tch undefined when opening those pdfs

Add volta to sub projects, extends the top level.
Pdf workaround is there till electron/electron#24859 is resolved or another option is available.
  • Loading branch information
knownasilya committed Mar 25, 2022
1 parent 6963e98 commit 5b2c359
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 26 deletions.
10 changes: 6 additions & 4 deletions app/bg/web-apis/bg/peersockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,21 @@ export default {
},

async watch() {
var drive = await getSenderDrive(this.sender);
const drive = await getSenderDrive(this.sender);
const aliases = getAliases(this.sender);
var stream = new Readable();
var stopwatch = getClient().peers.watchPeers(drive.key, {
const stream = new Readable();
const stopWatch = await getClient().peers.watchPeers(drive.key, {
onjoin: async (peer) =>
stream.push(['join', { peerId: createAliasForPeer(aliases, peer) }]),
onleave: (peer) =>
stream.push(['leave', { peerId: createAliasForPeer(aliases, peer) }]),
});

stream.on('close', () => {
releaseAliases(this.sender, aliases);
stopwatch();
stopWatch();
});

return stream;
},
};
Expand Down
2 changes: 2 additions & 0 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ protocol.registerSchemesAsPrivileged([
supportFetchAPI: true,
corsEnabled: true,
stream: true,
// TODO: remove once https://github.com/electron/electron/issues/24859 is resolved
bypassCSP: true,
},
},
{
Expand Down
43 changes: 22 additions & 21 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,8 @@
"winston": "github:winstonjs/winston#b4ced895b3e1ead8a616590189b003cfd9d7acca",
"yazl": "^2.5.1",
"yo-yo": "^1.4.0"
},
"volta": {
"extends": "../package.json"
}
}
5 changes: 4 additions & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,8 @@
"bugs": {
"url": "https://github.com/knownasilya/nomad/issues"
},
"dependencies": {}
"dependencies": {},
"volta": {
"extends": "../package.json"
}
}

0 comments on commit 5b2c359

Please sign in to comment.