Skip to content

Commit c0b6361

Browse files
committed
ipfs fix for apple m1:
- add arm64 prebuilds for leveldown (for now) - ui: fix progress update for ipfs sharing for electron app - store ipfs in <profile-dir>/js-ipfs - update to replaywebpage 1.5.2 bump to 0.7.1
1 parent 85db416 commit c0b6361

File tree

10 files changed

+123
-2109
lines changed

10 files changed

+123
-2109
lines changed
615 KB
Binary file not shown.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "archiveweb.page",
3-
"version": "0.7.0",
3+
"version": "0.7.1",
44
"main": "index.js",
55
"description": "Create Web Archives directly in your browser",
66
"repository": "https://github.com/webrecorder/archiveweb.page",
@@ -18,9 +18,9 @@
1818
"ipfs-http-client": "^52.0.3",
1919
"jszip": "^3.7.0",
2020
"keyword-mark-element": "^0.1.2",
21-
"node-fetch": "^3.0.0",
21+
"node-fetch": "2.6.2",
2222
"pretty-bytes": "^5.6.0",
23-
"replaywebpage": "^1.5.1",
23+
"replaywebpage": "^1.5.2",
2424
"uuid": "^8.3.2",
2525
"warcio": "^1.4.7"
2626
},

src/electron/electron-rec-preload.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ contextBridge.exposeInMainWorld("archivewebpage", {
1717
ipcRenderer.send("start-rec", opts);
1818
},
1919

20-
ipfsPin: (collId) => {
21-
return handleIpfsPin(collId);
20+
ipfsPin: (collId, callback) => {
21+
return handleIpfsPin(collId, callback);
2222
},
2323

2424
ipfsUnpin: (collId) => {
@@ -73,14 +73,23 @@ ipcRenderer.on("inc-sizes", async (event, totalSize, writtenSize, collId) => {
7373

7474

7575
// ===========================================================================
76-
async function handleIpfsPin(collId) {
76+
async function handleIpfsPin(collId, callback) {
7777
const reqId = "pin-" + collId + (100 * Math.random());
7878

7979
const coll = await getColl(collId);
8080

81-
const dl = new Downloader({coll});
81+
const filename = "webarchive.wacz";
8282

83-
const resp = await dl.download();
83+
const dl = new Downloader({coll, filename});
84+
85+
let size = 0;
86+
87+
const resp = await dl.download((incSize) => {
88+
size += incSize;
89+
if (callback && size) {
90+
callback({size});
91+
}
92+
});
8493

8594
ipcRenderer.send("ipfs-pin", reqId, resp.filename);
8695

@@ -112,7 +121,11 @@ async function handleIpfsPin(collId) {
112121

113122
ipcRenderer.send(reqId, null);
114123

115-
return await getHash;
124+
const result = await getHash;
125+
if (callback) {
126+
callback({});
127+
}
128+
return result;
116129
}
117130

118131
// ===========================================================================

src/ui/coll-info.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,23 @@ class WrRecCollInfo extends CollInfo
365365
}
366366

367367
ipfsApi(collId, pin) {
368+
this.dispatchEvent(new CustomEvent("ipfs-share", {detail: {pending: true}}));
369+
368370
if (window.archivewebpage) {
371+
const progressCallback = (message) => {
372+
if (message.size) {
373+
this.shareProgress = message.size;
374+
} else {
375+
this.shareProgress = 0;
376+
this.dispatchEvent(new CustomEvent("ipfs-share", {detail: {pending: false}}));
377+
}
378+
};
379+
369380
return (pin ?
370-
window.archivewebpage.ipfsPin(this.coll.id) :
381+
window.archivewebpage.ipfsPin(this.coll.id, progressCallback) :
371382
window.archivewebpage.ipfsUnpin(this.coll.id));
372383
}
373384

374-
this.dispatchEvent(new CustomEvent("ipfs-share", {detail: {pending: true}}));
375-
376385
return new Promise((resolve) => {
377386
const port = chrome.runtime.connect({name: "share-port"});
378387
port.onMessage.addListener((message) => {

webpack.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ const electronMainConfig = (/*env, argv*/) => {
5656
alias: {
5757
"abort-controller": "abort-controller/dist/abort-controller.js",
5858
"dlv": "dlv/dist/dlv.js",
59-
"bignumber.js": "bignumber.js/bignumber.js"
59+
"bignumber.js": "bignumber.js/bignumber.js",
60+
"multiformats/hashes/sha2": "multiformats/cjs/src/hashes/sha2.js"
6061
}
6162
},
6263
output: {
@@ -75,8 +76,8 @@ const electronMainConfig = (/*env, argv*/) => {
7576
{ from: "wr-ext/replay/", to: "replay/" },
7677
{ from: "wr-ext/ruffle/", to: "ruffle/" },
7778
{ from: "wr-ext/pdf/", to: "pdf/" },
78-
{ from: "node_modules/bcrypto/build/Release/bcrypto.node", to: "build" },
7979
{ from: "node_modules/leveldown/prebuilds/", to: "prebuilds" },
80+
{ from: "build/extra_prebuilds/", to: "prebuilds" },
8081
],
8182
}),
8283
],

wr-ext/bg.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wr-ext/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Webrecorder ArchiveWeb.page",
33
"description": "Create high-fidelity web archives directly in your browser",
4-
"version": "0.7.0",
4+
"version": "0.7.1",
55
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
66
"permissions": [
77
"debugger",

wr-ext/replay/sw.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wr-ext/replay/ui.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)