From 4140232aca0f3719211d4eea02c6707bda0b8d59 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 4 Oct 2019 01:43:15 +0200 Subject: [PATCH 1/5] feat: add precache dir to chromium bundle For now we add a TAR with Web UI as a PoC. Next step is to make it more generic. There should be a list of CIDs that should be recursively precached and added to node during the boot. --- package.json | 14 ++++--- yarn.lock | 104 ++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 96 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 5843a4101..567af68c0 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "clean:dist": "shx rm -rf add-on/dist", "clean:ui-kit": "shx rm -rf add-on/ui-kit", "clean:webui": "shx rm -rf add-on/webui", + "clean:precache": "shx rm -rf add-on/dist/precache", "build": "run-s clean build:*", "build:copy": "run-s build:copy:*", "build:copy:src": "shx mkdir -p add-on/dist && shx cp -R add-on/src/* add-on/dist", @@ -28,20 +29,21 @@ "build:minimize-dist": "shx rm -rf add-on/dist/lib add-on/dist/contentScripts/ add-on/dist/bundles/ipfsProxyContentScriptPayload.bundle.js", "build:bundle-all": "cross-env RELEASE_CHANNEL=${RELEASE_CHANNEL:=dev} run-s bundle:chromium bundle:brave:$RELEASE_CHANNEL bundle:firefox:$RELEASE_CHANNEL", "build:rename-artifacts": "./scripts/rename-artifacts.js", + "precache:webui": "shx mkdir -p add-on/dist/precache && ipfs-or-gateway -c QmPURAjo3oneGH53ovt68UZEBvsc8nNmEhQZEpsVEQUMZE -p add-on/dist/precache/webui.tar --archive", "bundle": "run-s bundle:*", - "bundle:chromium": "shx cat add-on/manifest.common.json add-on/manifest.chromium.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/chromium && run-s build:rename-artifacts", - "bundle:firefox": "shx cat add-on/manifest.common.json add-on/manifest.firefox.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", + "bundle:chromium": "run-s precache:webui && shx cat add-on/manifest.common.json add-on/manifest.chromium.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/chromium && run-s build:rename-artifacts", + "bundle:firefox": "run-s clean:precache && shx cat add-on/manifest.common.json add-on/manifest.firefox.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", "bundle:firefox:dev": "npm run bundle:firefox", "bundle:firefox:stable": "npm run bundle:firefox", - "bundle:firefox:beta": "shx cat add-on/manifest.common.json add-on/manifest.firefox.json add-on/manifest.firefox-beta.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", + "bundle:firefox:beta": "run-s clean:precache && shx cat add-on/manifest.common.json add-on/manifest.firefox.json add-on/manifest.firefox-beta.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", "bundle:fennec": "npm run bundle:firefox", "bundle:fennec:dev": "npm run bundle:firefox:dev", "bundle:fennec:stable": "npm run bundle:firefox:stable", "bundle:fennec:beta": "npm run bundle:firefox:beta", - "bundle:brave": "shx cat add-on/manifest.common.json add-on/manifest.chromium.json add-on/manifest.brave.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/brave/ && run-s build:rename-artifacts", + "bundle:brave": "run-s precache:webui && shx cat add-on/manifest.common.json add-on/manifest.chromium.json add-on/manifest.brave.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/brave/ && run-s build:rename-artifacts", "bundle:brave:dev": "npm run bundle:brave", "bundle:brave:stable": "npm run bundle:brave", - "bundle:brave:beta": "shx cat add-on/manifest.common.json add-on/manifest.chromium.json add-on/manifest.brave.json add-on/manifest.brave-beta.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/brave/ && run-s build:rename-artifacts", + "bundle:brave:beta": "run-s precache:webui && shx cat add-on/manifest.common.json add-on/manifest.chromium.json add-on/manifest.brave.json add-on/manifest.brave-beta.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/brave/ && run-s build:rename-artifacts", "watch": "npm-run-all build:copy --parallel watch:*", "watch:js": "run-p watch:js:*", "watch:js:webpack": "webpack --watch --progress -d --devtool inline-source-map --config ./webpack.config.js", @@ -93,6 +95,7 @@ "get-firefox": "2.2.1", "husky": "3.0.8", "ignore-styles": "5.0.1", + "ipfs-or-gateway": "https://github.com/ipfs-shipyard/ipfs-or-gateway/tarball/03a882be31d1c4967eaf17cd05903a2d3d95a7f6/ipfs-or-gateway.tar.gz", "json": "9.0.6", "mem-storage-area": "1.0.3", "mocha": "6.2.1", @@ -151,6 +154,7 @@ "pull-file-reader": "1.0.2", "readable-stream": "3.4.0", "tachyons": "4.11.1", + "tar-stream": "2.1.0", "timers-browserify-full": "0.0.1", "uri-to-multiaddr": "3.0.1", "webextension-polyfill": "0.5.0", diff --git a/yarn.lock b/yarn.lock index 4196ffdb4..4fac2268e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2782,7 +2782,7 @@ byteman@^1.3.5: resolved "https://registry.yarnpkg.com/byteman/-/byteman-1.3.5.tgz#d6061f7536c7e7c4bcb756037ef9c4c266ec51fd" integrity sha512-FzWDstifFRxtHX234b93AGa1b77dA6NUFpEXe+AoG1NydGN//XDZLMXxRNUoMf7SYYhVxfpwUEUgQOziearJvA== -bytes@3.1.0: +bytes@3.1.0, bytes@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== @@ -3251,6 +3251,11 @@ cli-cursor@^3.1.0: dependencies: restore-cursor "^3.1.0" +cli-spinners@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.2.0.tgz#e8b988d9206c692302d8ee834e7a85c0144d8f77" + integrity sha512-tgU3fKwzYjiLEQgPMD9Jt+JjHVL9kW93FiIMX/l7rivvOD4/LL0Mf7gda3+4U2KJBloybwgj5KEoQgGRioMiKQ== + cli-truncate@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" @@ -3797,7 +3802,7 @@ datastore-pubsub@^0.2.1: interface-datastore "~0.7.0" multibase "~0.6.0" -date-fns@^1.27.2: +date-fns@^1.27.2, date-fns@^1.30.1: version "1.30.1" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== @@ -5716,7 +5721,7 @@ fs-extra@^2.0.0: graceful-fs "^4.1.2" jsonfile "^2.1.0" -fs-extra@^8.1.0: +fs-extra@^8.0.1, fs-extra@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== @@ -7035,6 +7040,19 @@ ipfs-multipart@^0.2.0, ipfs-multipart@~0.2.0: "@hapi/content" "^4.1.0" it-multipart "~0.0.2" +"ipfs-or-gateway@https://github.com/ipfs-shipyard/ipfs-or-gateway/tarball/03a882be31d1c4967eaf17cd05903a2d3d95a7f6/ipfs-or-gateway.tar.gz": + version "2.0.1" + resolved "https://github.com/ipfs-shipyard/ipfs-or-gateway/tarball/03a882be31d1c4967eaf17cd05903a2d3d95a7f6/ipfs-or-gateway.tar.gz#f8d6f9ab51f5414d366217f15c195a72c88c6c0a" + dependencies: + abort-controller "^3.0.0" + fs-extra "^8.0.1" + node-fetch "^2.3.0" + node-fetch-progress "^1.0.2" + ora "^3.4.0" + pretty-bytes "^5.3.0" + tar "^4.4.8" + yargs "^13.2.1" + ipfs-postmsg-proxy@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/ipfs-postmsg-proxy/-/ipfs-postmsg-proxy-3.1.1.tgz#7f14fcaecddcd1ca41d2ee077757efe234c92ac0" @@ -9318,7 +9336,7 @@ lodash@^4.17.14, lodash@^4.17.15: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== -log-symbols@2.2.0: +log-symbols@2.2.0, log-symbols@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== @@ -9821,6 +9839,14 @@ minipass@^2.2.1, minipass@^2.3.5: safe-buffer "^5.1.2" yallist "^3.0.0" +minipass@^2.8.6: + version "2.9.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + minipass@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.0.0.tgz#adb830268348df8b32217ceda3fc48684faff232" @@ -10441,6 +10467,15 @@ node-environment-flags@1.0.5: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" +node-fetch-progress@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/node-fetch-progress/-/node-fetch-progress-1.0.2.tgz#2e1f072d1bbe60bfe7676e151eefc58ae5feff7b" + integrity sha512-SHU7Ye0zcN/GHnjp2FMOLbJeJQ4ji68nicY6yF13VAmEZZKcbkjl3btkYmmtbVaL3gKoQxxba7WfTM6zOMUMyg== + dependencies: + bytes "^3.0.0" + date-fns "^1.30.1" + throttle-debounce "^2.1.0" + node-fetch@^2.2.0, node-fetch@^2.3.0, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" @@ -10910,6 +10945,18 @@ options@>=0.0.5: resolved "https://registry.yarnpkg.com/options/-/options-0.0.6.tgz#ec22d312806bb53e731773e7cdaefcf1c643128f" integrity sha1-7CLTEoBrtT5zF3Pnza788cZDEo8= +ora@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/ora/-/ora-3.4.0.tgz#bf0752491059a3ef3ed4c85097531de9fdbcd318" + integrity sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg== + dependencies: + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-spinners "^2.0.0" + log-symbols "^2.2.0" + strip-ansi "^5.2.0" + wcwidth "^1.0.1" + os-browserify@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" @@ -11640,6 +11687,11 @@ prepost@^1.1.0: resolved "https://registry.yarnpkg.com/prepost/-/prepost-1.1.0.tgz#6131567ab6fe3007b50762679f4b500e93e8ccbf" integrity sha512-HhwOYePY0JXrbqAHm0fGWdSBFqGAMCJvdTaKGxO7uO6S0cbdxXeTnMWDkgAJDS+6kXATaV3n0C0EGI6tR+nqQA== +pretty-bytes@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.3.0.tgz#f2849e27db79fb4d6cfe24764fc4134f165989f2" + integrity sha512-hjGrh+P926p4R4WbaB6OckyRtO0F0/lQBiT+0gnxjV+5kjPBrfVBFCsCLbMqVQeydvIoouYTCmmEURiH3R1Bdg== + pretty-hrtime@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" @@ -13864,6 +13916,17 @@ tapable@^1.0.0, tapable@^1.1.3: resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== +tar-stream@2.1.0, tar-stream@^2.0.0, tar-stream@^2.0.1: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.1.0.tgz#d1aaa3661f05b38b5acc9b7020efdca5179a2cc3" + integrity sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw== + dependencies: + bl "^3.0.0" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + tar-stream@^1.5.0, tar-stream@^1.5.2: version "1.6.2" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555" @@ -13877,17 +13940,6 @@ tar-stream@^1.5.0, tar-stream@^1.5.2: to-buffer "^1.1.1" xtend "^4.0.0" -tar-stream@^2.0.0, tar-stream@^2.0.1: - version "2.1.0" - resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.1.0.tgz#d1aaa3661f05b38b5acc9b7020efdca5179a2cc3" - integrity sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw== - dependencies: - bl "^3.0.0" - end-of-stream "^1.4.1" - fs-constants "^1.0.0" - inherits "^2.0.3" - readable-stream "^3.1.1" - tar@5.0.5: version "5.0.5" resolved "https://registry.yarnpkg.com/tar/-/tar-5.0.5.tgz#03fcdb7105bc8ea3ce6c86642b9c942495b04f93" @@ -13913,6 +13965,19 @@ tar@^4: safe-buffer "^5.1.2" yallist "^3.0.3" +tar@^4.4.8: + version "4.4.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== + dependencies: + chownr "^1.1.1" + fs-minipass "^1.2.5" + minipass "^2.8.6" + minizlib "^1.2.1" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.3" + taskcluster-client@^11.0.4: version "11.0.4" resolved "https://registry.yarnpkg.com/taskcluster-client/-/taskcluster-client-11.0.4.tgz#ea8df77d78ac72de5fb087bb6b884a25f33c90ee" @@ -14029,6 +14094,11 @@ thenify-all@^1.0.0, thenify-all@^1.6.0: dependencies: any-promise "^1.0.0" +throttle-debounce@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-2.1.0.tgz#257e648f0a56bd9e54fe0f132c4ab8611df4e1d5" + integrity sha512-AOvyNahXQuU7NN+VVvOOX+uW6FPaWdAOdRP5HfwYxAfCzXTFKRMoIMk+n+po318+ktcChx+F1Dd91G3YHeMKyg== + throttleit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c" @@ -14703,7 +14773,7 @@ wayfarer@^7.0.0: resolved "https://registry.yarnpkg.com/wayfarer/-/wayfarer-7.0.0.tgz#ae65e759628e5042bdaa380aa47bb736ca07380c" integrity sha512-mKF6pIaNHTdmwWjzrjbIWDnlgFFPC7MuQ+gbUVjBLpXp40mYmiP3Eb7qtO0rgAcsj3kuzGu3sN2Ya6GqOYiTwQ== -wcwidth@^1.0.0: +wcwidth@^1.0.0, wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= @@ -15124,7 +15194,7 @@ yargs@13.2.4, yargs@^13.2.2: y18n "^4.0.0" yargs-parser "^13.1.0" -yargs@13.3.0, yargs@^13.3.0: +yargs@13.3.0, yargs@^13.2.1, yargs@^13.3.0: version "13.3.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== From f2759d4287fa3491b6b978b0bc09e27dbf87dc6c Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 4 Oct 2019 22:52:03 +0200 Subject: [PATCH 2/5] feat(precache): import TAR archives on boot - async import of TAR archives - streaming where possible - makes webui open instantly in Chromium Known Issue: /api/v0/add does not work with latest js-ipfs, needs to be addressed before merging this to master. --- .../embedded-chromesockets/config.js | 1 - add-on/src/lib/ipfs-client/index.js | 13 +- add-on/src/lib/precache.js | 104 ++++++++ package.json | 9 +- yarn.lock | 229 ++++++++++++++++-- 5 files changed, 325 insertions(+), 31 deletions(-) create mode 100644 add-on/src/lib/precache.js diff --git a/add-on/src/lib/ipfs-client/embedded-chromesockets/config.js b/add-on/src/lib/ipfs-client/embedded-chromesockets/config.js index b8d23e338..dacb06f52 100644 --- a/add-on/src/lib/ipfs-client/embedded-chromesockets/config.js +++ b/add-on/src/lib/ipfs-client/embedded-chromesockets/config.js @@ -25,7 +25,6 @@ const chromeDefaultOpts = { Swarm: [ // optional ws-star signaling provides a backup for non-LAN peer discovery // (this will be removed when autorelay and DHT are stable in js-ipfs) - '/dns4/ws-star1.par.dwebops.pub.com/tcp/443/wss/p2p-websocket-star', '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star' ], // Delegated Content and Peer Routing: https://github.com/ipfs/js-ipfs/pull/2195 diff --git a/add-on/src/lib/ipfs-client/index.js b/add-on/src/lib/ipfs-client/index.js index c7b69ecae..ce10d0075 100644 --- a/add-on/src/lib/ipfs-client/index.js +++ b/add-on/src/lib/ipfs-client/index.js @@ -10,7 +10,7 @@ const browser = require('webextension-polyfill') const external = require('./external') const embedded = require('./embedded') const embeddedWithChromeSockets = require('./embedded-chromesockets') -const { webuiCid } = require('../state') +const precache = require('../precache') let client @@ -70,15 +70,8 @@ async function _reloadIpfsClientDependents (instance, opts) { } // online only if (client && instance) { - if (webuiCid && instance.refs) { - // Optimization: preload the root CID to speed up the first time - // Web UI is opened. If embedded js-ipfs is used it will trigger - // remote (always recursive) preload of entire DAG to one of preload nodes. - // This way when embedded node wants to load resource related to webui - // it will get it fast from preload nodes. - log(`preloading webui root at ${webuiCid}`) - instance.refs(webuiCid, { recursive: false }) - } + // add important data to local ipfs repo for instant load + precache(instance) } } diff --git a/add-on/src/lib/precache.js b/add-on/src/lib/precache.js new file mode 100644 index 000000000..d96de27c5 --- /dev/null +++ b/add-on/src/lib/precache.js @@ -0,0 +1,104 @@ +'use strict' +/* eslint-env browser, webextensions */ +const pull = require('pull-stream/pull') +const drain = require('pull-stream/sinks/drain') +const toStream = require('it-to-stream') +const tar = require('tar-stream') +const { webuiCid } = require('./state') + +const debug = require('debug') +const log = debug('ipfs-companion:precache') +log.error = debug('ipfs-companion:precache:error') + +const PRECACHE_ARCHIVES = [ + { tarPath: '/dist/precache/webui.tar', cid: webuiCid } +] + +/** + * Adds important assets such as Web UI to the local js-ipfs-repo. + * This ensures they load instantly, even in offline environments. + */ +module.exports = async (ipfs) => { + for (const { cid, tarPath } of PRECACHE_ARCHIVES) { + if (!await inRepo(ipfs, cid)) { + await importTar(ipfs, tarPath, cid) + } else { + log(`${cid} already in local repo, skipping import`) + } + } +} + +async function inRepo (ipfs, cid) { + return new Promise((resolve, reject) => { + let local = false + pull( + ipfs.refs.localPullStream(), + drain(block => { + if (block.ref === cid) { + local = true + return false // abort stream + } + }, () => resolve(local)) + ) + }) +} + +async function importTar (ipfs, tarPath, expectedCid) { + const stream = toStream.readable(streamTar(tarPath)) + // TODO: HTTP 404 means precache is disabled in the current runtime + // (eg. in Firefox, due to https://github.com/ipfs-shipyard/ipfs-webui/issues/959) + const untarAndAdd = tar.extract() + + const files = [] + + untarAndAdd.on('entry', (header, stream, next) => { + // header is the tar header + // stream is the content body (might be an empty stream) + // call next when you are done with this entry + + if (header.type !== 'file') { + // skip non-files + stream.on('end', next) + stream.resume() // drain stream + return + } + + files.push(new Promise((resolve, reject) => { + let chunks = [] + stream.on('data', data => chunks.push(data)) + stream.on('end', () => { + resolve({ path: header.name, content: Buffer.concat(chunks) }) + chunks = null + next() + }) + })) + }) + + untarAndAdd.on('finish', async () => { + const results = await ipfs.add(await Promise.all(files), { pin: false }) + const root = results.find(e => e.hash === expectedCid) + if (root) { + log(`${tarPath} successfully precached`, root) + } else { + log.error('imported CID does not match expected one (requires new release with updated package.json)') + } + }) + + log(`importing ${tarPath} to js-ipfs-repo`) + stream.pipe(untarAndAdd) +} + +async function * streamTar (repoPath) { + const response = await fetch(repoPath) + const reader = response.body.getReader() + try { + while (true) { + const { done, value } = await reader.read() + if (done) return + yield value + } + } finally { + // Firefox only? https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/releaseLock + if (typeof reader.releaseLock === 'function') reader.releaseLock() + } +} diff --git a/package.json b/package.json index 567af68c0..dbae12a4e 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "clean:dist": "shx rm -rf add-on/dist", "clean:ui-kit": "shx rm -rf add-on/ui-kit", "clean:webui": "shx rm -rf add-on/webui", - "clean:precache": "shx rm -rf add-on/dist/precache", "build": "run-s clean build:*", "build:copy": "run-s build:copy:*", "build:copy:src": "shx mkdir -p add-on/dist && shx cp -R add-on/src/* add-on/dist", @@ -29,13 +28,14 @@ "build:minimize-dist": "shx rm -rf add-on/dist/lib add-on/dist/contentScripts/ add-on/dist/bundles/ipfsProxyContentScriptPayload.bundle.js", "build:bundle-all": "cross-env RELEASE_CHANNEL=${RELEASE_CHANNEL:=dev} run-s bundle:chromium bundle:brave:$RELEASE_CHANNEL bundle:firefox:$RELEASE_CHANNEL", "build:rename-artifacts": "./scripts/rename-artifacts.js", + "precache:clean": "shx rm -rf add-on/dist/precache", "precache:webui": "shx mkdir -p add-on/dist/precache && ipfs-or-gateway -c QmPURAjo3oneGH53ovt68UZEBvsc8nNmEhQZEpsVEQUMZE -p add-on/dist/precache/webui.tar --archive", "bundle": "run-s bundle:*", "bundle:chromium": "run-s precache:webui && shx cat add-on/manifest.common.json add-on/manifest.chromium.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/chromium && run-s build:rename-artifacts", - "bundle:firefox": "run-s clean:precache && shx cat add-on/manifest.common.json add-on/manifest.firefox.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", + "bundle:firefox": "run-s precache:clean && shx cat add-on/manifest.common.json add-on/manifest.firefox.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", "bundle:firefox:dev": "npm run bundle:firefox", "bundle:firefox:stable": "npm run bundle:firefox", - "bundle:firefox:beta": "run-s clean:precache && shx cat add-on/manifest.common.json add-on/manifest.firefox.json add-on/manifest.firefox-beta.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", + "bundle:firefox:beta": "run-s precache:clean && shx cat add-on/manifest.common.json add-on/manifest.firefox.json add-on/manifest.firefox-beta.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", "bundle:fennec": "npm run bundle:firefox", "bundle:fennec:dev": "npm run bundle:firefox:dev", "bundle:fennec:stable": "npm run bundle:firefox:stable", @@ -95,7 +95,7 @@ "get-firefox": "2.2.1", "husky": "3.0.8", "ignore-styles": "5.0.1", - "ipfs-or-gateway": "https://github.com/ipfs-shipyard/ipfs-or-gateway/tarball/03a882be31d1c4967eaf17cd05903a2d3d95a7f6/ipfs-or-gateway.tar.gz", + "ipfs-or-gateway": "2.1.0", "json": "9.0.6", "mem-storage-area": "1.0.3", "mocha": "6.2.1", @@ -141,6 +141,7 @@ "is-fqdn": "1.0.1", "is-ipfs": "0.6.1", "is-svg": "4.2.0", + "it-to-stream": "0.1.1", "lru-cache": "5.1.1", "merge-options": "1.0.1", "mime-types": "2.1.24", diff --git a/yarn.lock b/yarn.lock index 4fac2268e..96a641006 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1472,7 +1472,11 @@ abstract-leveldown@^5.0.0, abstract-leveldown@~5.0.0: dependencies: xtend "~4.0.0" +<<<<<<< HEAD abstract-leveldown@^6.2.1, abstract-leveldown@~6.2.1: +======= +abstract-leveldown@^6.1.1: +>>>>>>> feat(precache): import TAR archives on boot version "6.2.1" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.2.1.tgz#37b655151e13c3d9b20fa3a04ce63ccaa345fce4" integrity sha512-zUgomHedGBCThDkUtc1bfilu2jEhRZ7Dk3RePhtMma/akw7UK2Upm2R5Dd8ynRBEt3uscwbWO0VQNx22/7RtWg== @@ -1503,6 +1507,17 @@ abstract-leveldown@~6.0.1, abstract-leveldown@~6.0.3: level-concat-iterator "~2.0.0" xtend "~4.0.0" +<<<<<<< HEAD +======= +abstract-leveldown@~6.1.0: + version "6.1.1" + resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.1.1.tgz#f44bad5862d71c7b418110d7698ac25bedf24396" + integrity sha512-7fK/KySVqzKIomdhkSWzX4YBQhzkzEMbWSiaB6mSN9e+ZdV3KEeKxia/8xQzCkATA5xnnukdP88cFR0D2FsFXw== + dependencies: + level-concat-iterator "~2.0.0" + xtend "~4.0.0" + +>>>>>>> feat(precache): import TAR archives on boot abstract-logging@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/abstract-logging/-/abstract-logging-1.0.0.tgz#8b7deafd310559bc28f77724dd1bb30177278c1b" @@ -3251,7 +3266,7 @@ cli-cursor@^3.1.0: dependencies: restore-cursor "^3.1.0" -cli-spinners@^2.0.0: +cli-spinners@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.2.0.tgz#e8b988d9206c692302d8ee834e7a85c0144d8f77" integrity sha512-tgU3fKwzYjiLEQgPMD9Jt+JjHVL9kW93FiIMX/l7rivvOD4/LL0Mf7gda3+4U2KJBloybwgj5KEoQgGRioMiKQ== @@ -4006,12 +4021,21 @@ deferred-leveldown@~4.0.0: abstract-leveldown "~5.0.0" inherits "^2.0.3" +<<<<<<< HEAD deferred-leveldown@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz#27a997ad95408b61161aa69bd489b86c71b78058" integrity sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw== dependencies: abstract-leveldown "~6.2.1" +======= +deferred-leveldown@~5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-5.2.1.tgz#8da87909cd3269c2d6aff67b1e607f93e4d96c15" + integrity sha512-PwXZRn5EmW+IKYVAYVc7G9FsRkShr0myPubPuq+mtLhDq9xSUqfvTlNZKoeQGeXACHXkeCFurKrz5oo6TZ3qwg== + dependencies: + abstract-leveldown "~6.1.0" +>>>>>>> feat(precache): import TAR archives on boot inherits "^2.0.3" define-properties@^1.1.2, define-properties@^1.1.3: @@ -4108,11 +4132,14 @@ detect-node@^2.0.4: resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c" integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw== +<<<<<<< HEAD diff-match-patch@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.4.tgz#6ac4b55237463761c4daf0dc603eb869124744b1" integrity sha512-Uv3SW8bmH9nAtHKaKSanOQmj2DnlH65fUpcrMdfdaOxUG02QQ4YGZ8AE7kKOMisF7UqvOlGKVYWRvezdncW9lg== +======= +>>>>>>> feat(precache): import TAR archives on boot diff@3.5.0, diff@^3.5.0: version "3.5.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" @@ -4382,12 +4409,21 @@ encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= +<<<<<<< HEAD encoding-down@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/encoding-down/-/encoding-down-6.3.0.tgz#b1c4eb0e1728c146ecaef8e32963c549e76d082b" integrity sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw== dependencies: abstract-leveldown "^6.2.1" +======= +encoding-down@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/encoding-down/-/encoding-down-6.2.0.tgz#7ca52446dac6e0fd09ad3584a7359809ea1a4844" + integrity sha512-XlIoQMBMbU4aE01uSKpAix0sXBJWK8YPhuOdvKa1CroThZyUpj0zWzt+bbe7g1KWsdhNFFzHkQHSdDymVtpJ1w== + dependencies: + abstract-leveldown "^6.1.1" +>>>>>>> feat(precache): import TAR archives on boot inherits "^2.0.3" level-codec "^9.0.0" level-errors "^2.0.0" @@ -5721,7 +5757,7 @@ fs-extra@^2.0.0: graceful-fs "^4.1.2" jsonfile "^2.1.0" -fs-extra@^8.0.1, fs-extra@^8.1.0: +fs-extra@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== @@ -6990,6 +7026,75 @@ ipfs-http-client@^33.1.0: tar-stream "^2.0.1" through2 "^3.0.1" +<<<<<<< HEAD +======= +ipfs-http-client@^38.0.0: + version "38.0.1" + resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-38.0.1.tgz#c74c121755456d10d179207168be147e99add21d" + integrity sha512-1R/qR2kpZz23jBdm+Mdje8h8GDynZVDXAIoCL4xchfeFsH7VdwWTbyhieaAsynYX5f6/KTfk1LZuulaVoJ5Fgw== + dependencies: + abort-controller "^3.0.0" + async "^2.6.1" + async-iterator-all "^1.0.0" + async-iterator-to-pull-stream "^1.3.0" + bignumber.js "^9.0.0" + bl "^3.0.0" + bs58 "^4.0.1" + buffer "^5.4.2" + cids "~0.7.1" + concat-stream "github:hugomrdias/concat-stream#feat/smaller" + debug "^4.1.0" + delay "^4.3.0" + detect-node "^2.0.4" + end-of-stream "^1.4.1" + err-code "^2.0.0" + explain-error "^1.0.4" + flatmap "0.0.3" + form-data "^2.5.1" + fs-extra "^8.1.0" + glob "^7.1.3" + ipfs-block "~0.8.1" + ipfs-utils "^0.4.0" + ipld-dag-cbor "~0.15.0" + ipld-dag-pb "^0.18.1" + ipld-raw "^4.0.0" + is-ipfs "~0.6.1" + is-pull-stream "0.0.0" + is-stream "^2.0.0" + iso-stream-http "~0.1.2" + iso-url "~0.4.6" + it-glob "0.0.4" + it-to-stream "^0.1.1" + iterable-ndjson "^1.1.0" + just-kebab-case "^1.1.0" + just-map-keys "^1.1.0" + kind-of "^6.0.2" + ky "^0.14.0" + ky-universal "^0.3.0" + lru-cache "^5.1.1" + merge-options "^1.0.1" + multiaddr "^6.0.6" + multibase "~0.6.0" + multicodec "~0.5.1" + multihashes "~0.4.14" + ndjson "github:hugomrdias/ndjson#feat/readable-stream3" + once "^1.4.0" + peer-id "~0.12.3" + peer-info "~0.15.1" + promise-nodeify "^3.0.1" + promisify-es6 "^1.0.3" + pull-defer "~0.2.3" + pull-stream "^3.6.9" + pull-stream-to-async-iterator "^1.0.2" + pull-to-stream "~0.1.1" + pump "^3.0.0" + qs "^6.5.2" + readable-stream "^3.1.1" + stream-to-pull-stream "^1.7.2" + tar-stream "^2.0.1" + through2 "^3.0.1" + +>>>>>>> feat(precache): import TAR archives on boot ipfs-http-response@0.3.1, ipfs-http-response@~0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/ipfs-http-response/-/ipfs-http-response-0.3.1.tgz#5cc351f8abf5f77dae47a41781fd7bc0c88fcaf8" @@ -7040,15 +7145,16 @@ ipfs-multipart@^0.2.0, ipfs-multipart@~0.2.0: "@hapi/content" "^4.1.0" it-multipart "~0.0.2" -"ipfs-or-gateway@https://github.com/ipfs-shipyard/ipfs-or-gateway/tarball/03a882be31d1c4967eaf17cd05903a2d3d95a7f6/ipfs-or-gateway.tar.gz": - version "2.0.1" - resolved "https://github.com/ipfs-shipyard/ipfs-or-gateway/tarball/03a882be31d1c4967eaf17cd05903a2d3d95a7f6/ipfs-or-gateway.tar.gz#f8d6f9ab51f5414d366217f15c195a72c88c6c0a" +ipfs-or-gateway@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/ipfs-or-gateway/-/ipfs-or-gateway-2.1.0.tgz#9f39d7da5916409f80b7301f9b4908fcc667c51e" + integrity sha512-bWSCVm2tah2ktciX1WOJtipiXcsCRR06VRSdZTT970RFVjw1pHV5DKdPZx9mMgjZuun/ss5J7pnYvyeLehnH3w== dependencies: abort-controller "^3.0.0" - fs-extra "^8.0.1" - node-fetch "^2.3.0" + fs-extra "^8.1.0" + node-fetch "^2.6.0" node-fetch-progress "^1.0.2" - ora "^3.4.0" + ora "^4.0.2" pretty-bytes "^5.3.0" tar "^4.4.8" yargs "^13.2.1" @@ -7168,9 +7274,15 @@ ipfs-utils@~0.0.3: kind-of "^6.0.2" readable-stream "^3.3.0" +<<<<<<< HEAD "ipfs@https://github.com/ipfs/js-ipfs/tarball/d9986ee4d7945f6a5d77dc7a2db4863d06971eb9/js-ipfs.tar.gz": version "0.38.0" resolved "https://github.com/ipfs/js-ipfs/tarball/d9986ee4d7945f6a5d77dc7a2db4863d06971eb9/js-ipfs.tar.gz#588eee8495676459592227a515eb2dd17c000d74" +======= +"ipfs@https://github.com/ipfs/js-ipfs/tarball/1dca93dda4b70264657cafe1893212368351f102/js-ipfs.tar.gz": + version "0.38.0" + resolved "https://github.com/ipfs/js-ipfs/tarball/1dca93dda4b70264657cafe1893212368351f102/js-ipfs.tar.gz#db038c7cb94b5619f69b3742a76809f4407ef3c4" +>>>>>>> feat(precache): import TAR archives on boot dependencies: "@hapi/ammo" "^3.1.1" "@hapi/boom" "^7.4.3" @@ -7212,7 +7324,11 @@ ipfs-utils@~0.0.3: ipfs-bitswap "^0.26.0" ipfs-block "~0.8.1" ipfs-block-service "~0.16.0" +<<<<<<< HEAD ipfs-http-client ipfs/js-ipfs-http-client#add-async-iterator-methods +======= + ipfs-http-client "^38.0.0" +>>>>>>> feat(precache): import TAR archives on boot ipfs-http-response "~0.3.1" ipfs-mfs "^0.13.0" ipfs-multipart "^0.2.0" @@ -7237,7 +7353,10 @@ ipfs-utils@~0.0.3: iso-url "~0.4.6" it-pipe "^1.0.1" it-to-stream "^0.1.1" +<<<<<<< HEAD jsondiffpatch "~0.3.11" +======= +>>>>>>> feat(precache): import TAR archives on boot just-safe-set "^2.1.0" kind-of "^6.0.2" ky "^0.14.0" @@ -7689,6 +7808,11 @@ is-installed-globally@^0.1.0: global-dirs "^0.1.0" is-path-inside "^1.0.0" +is-interactive@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" + integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== + is-ip@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ip/-/is-ip-2.0.0.tgz#68eea07e8a0a0a94c2d080dd674c731ab2a461ab" @@ -8042,7 +8166,11 @@ it-pipe@^1.0.1: resolved "https://registry.yarnpkg.com/it-pipe/-/it-pipe-1.0.1.tgz#6443f12e2a24dd71728c172eb58a159bb957095e" integrity sha512-clx7NMIf4eXe3rp4dKLmT5vMYv/hvZv4lNi1/xx4ZJ8CFmpGod9rTKisyBNBTurbCEa3a7503COankdBj/uUCA== +<<<<<<< HEAD it-to-stream@^0.1.1: +======= +it-to-stream@0.1.1, it-to-stream@^0.1.1: +>>>>>>> feat(precache): import TAR archives on boot version "0.1.1" resolved "https://registry.yarnpkg.com/it-to-stream/-/it-to-stream-0.1.1.tgz#3fb4a9c4df868cd8f4aaf2071eba5ada5a3fad2a" integrity sha512-QQx/58JBvT189imr6fD234F8aVf8EdyQHJR0MxXAOShEWK1NWyahPYIQt/tQG7PId0ZG/6/3tUiVCfw2cq+e1w== @@ -8552,12 +8680,21 @@ level-mem@^3.0.1: memdown "~3.0.0" level-packager@^5.0.0: +<<<<<<< HEAD version "5.1.0" resolved "https://registry.yarnpkg.com/level-packager/-/level-packager-5.1.0.tgz#9c01c6c8e2380d3196d61e56bd79c2eff4a9d5c3" integrity sha512-3pbJmDgGvp/lUQNULPoYQZtUbhMI8KoViYDw7Sa0kWl1mPeHWWJF7T/9upWI/NTMuEikkEE/cd6wBvmrW1+ZnQ== dependencies: encoding-down "^6.3.0" levelup "^4.3.2" +======= + version "5.0.3" + resolved "https://registry.yarnpkg.com/level-packager/-/level-packager-5.0.3.tgz#e22bc9887663d0808ab092453d691bc319b7e5a2" + integrity sha512-Ut62o3nvUNCxYldM5+13+0sYow6ifKj2C26/0ToB7zKgdypF5wRKcVkcztQVwsQi+ZnrmDzhimp7FKP5Ynv6Rg== + dependencies: + encoding-down "^6.2.0" + levelup "^4.2.0" +>>>>>>> feat(precache): import TAR archives on boot level-packager@~4.0.0: version "4.0.1" @@ -8568,9 +8705,15 @@ level-packager@~4.0.0: levelup "^3.0.0" level-supports@~1.0.0: +<<<<<<< HEAD version "1.0.1" resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-1.0.1.tgz#2f530a596834c7301622521988e2c36bb77d122d" integrity sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg== +======= + version "1.0.0" + resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-1.0.0.tgz#376f3f2339c23be0ba2fe62b0fa0e3ac7d6d9988" + integrity sha512-01PKZumFhgysuHUbRz4c9DyA1egmcHJBAsZbm0Vf5agojC3uWOvAnhOD4swNUgHlfJBymXLi/xkBaEckeNRSvA== +>>>>>>> feat(precache): import TAR archives on boot dependencies: xtend "^4.0.2" @@ -8633,12 +8776,21 @@ levelup@^3.0.0: level-iterator-stream "~3.0.0" xtend "~4.0.0" +<<<<<<< HEAD levelup@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/levelup/-/levelup-4.3.2.tgz#31c5b1b29f146d1d35d692e01a6da4d28fa55ebd" integrity sha512-cRTjU4ktWo59wf13PHEiOayHC3n0dOh4i5+FHr4tv4MX9+l7mqETicNq3Aj07HKlLdk0z5muVoDL2RD+ovgiyA== dependencies: deferred-leveldown "~5.3.0" +======= +levelup@^4.2.0: + version "4.3.1" + resolved "https://registry.yarnpkg.com/levelup/-/levelup-4.3.1.tgz#ac740019789de1a2987e109b00fcbdad9ddc6ac9" + integrity sha512-vXRqqNDSZxbY4atrfz+yXS2fdfq027chwvc6ihX/pQYplYdFoppkfHFaF0V3PDe2mCnhtyieaizRBzTpmL5wAg== + dependencies: + deferred-leveldown "~5.2.1" +>>>>>>> feat(precache): import TAR archives on boot level-errors "~2.0.0" level-iterator-stream "~4.0.0" level-supports "~1.0.0" @@ -8774,20 +8926,34 @@ libp2p-crypto@~0.16.0, libp2p-crypto@~0.16.1: tweetnacl "^1.0.0" ursa-optional "~0.9.10" +<<<<<<< HEAD libp2p-delegated-content-routing@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/libp2p-delegated-content-routing/-/libp2p-delegated-content-routing-0.3.1.tgz#45e1711074a68d457c9b4bd92682ad06fb8857c8" integrity sha512-GgEj1FHzNFH6nL0fQ5sFZWcskfWkwVLL+GtY5wZbe9izXftyg5QDVdoKSlYWQUrEjaaAJE+T4KjvtK83T/C7Yg== +======= +libp2p-delegated-content-routing@0.2.4, libp2p-delegated-content-routing@^0.3.1: + version "0.2.4" + resolved "https://registry.yarnpkg.com/libp2p-delegated-content-routing/-/libp2p-delegated-content-routing-0.2.4.tgz#2627f09f59a38829eef291693482dd9e15c815bd" + integrity sha512-VgupHN9DhoNIJmnoe5H1Qb+AeG+Z7A4Yc8p/8jNNuRq61Jn7uzs03k1WWFRt/+Xnb9FlnHrBo1vrp8NqXdq9NQ== +>>>>>>> feat(precache): import TAR archives on boot dependencies: debug "^4.1.1" ipfs-http-client "^33.1.0" multiaddr "^6.1.0" p-queue "^6.1.0" +<<<<<<< HEAD libp2p-delegated-peer-routing@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/libp2p-delegated-peer-routing/-/libp2p-delegated-peer-routing-0.3.1.tgz#331d129559b2b257cef5e13260d7ac50d4731768" integrity sha512-WAN2rBsuiS1xqrAaZthKX9vVtXar0nH7ACAWoTNsk2BaAhhds0Shri48NB5jN//kxLo+vC7+WVn4Rgdg3Dp2sA== +======= +libp2p-delegated-peer-routing@0.2.4, libp2p-delegated-peer-routing@^0.3.1: + version "0.2.4" + resolved "https://registry.yarnpkg.com/libp2p-delegated-peer-routing/-/libp2p-delegated-peer-routing-0.2.4.tgz#18ee245585e2737a4f875cd6bc5e106d8ad1e95b" + integrity sha512-uL6QumPoXG5LhFPQaDtcW4k83LlTJEDNqqv3DnM9RG3/d+N6/yHBNqQpRmvgR4gBeaDOEpdAyK3FSa9IWNpEFA== +>>>>>>> feat(precache): import TAR archives on boot dependencies: debug "^4.1.1" ipfs-http-client "^33.1.0" @@ -8810,6 +8976,25 @@ libp2p-floodsub@^0.18.0: pull-pushable "^2.2.0" pull-stream "^3.6.9" +<<<<<<< HEAD +======= +libp2p-floodsub@^0.18.0: + version "0.18.0" + resolved "https://registry.yarnpkg.com/libp2p-floodsub/-/libp2p-floodsub-0.18.0.tgz#49efd1a9936e898f62abbf041fa2f62049b796e0" + integrity sha512-4OihLP5A4LsxNPlfb0mq6vkjAaNu4YxuyYeoj2nNgrRSzr4H8Dz0YtA+DzEDXIgP2RBANSzS+KG9oDeUXDHa/Q== + dependencies: + async "^2.6.2" + bs58 "^4.0.1" + debug "^4.1.1" + length-prefixed-stream "^2.0.0" + libp2p-crypto "~0.16.1" + libp2p-pubsub "~0.2.0" + protons "^1.0.1" + pull-length-prefixed "^1.3.2" + pull-pushable "^2.2.0" + pull-stream "^3.6.9" + +>>>>>>> feat(precache): import TAR archives on boot libp2p-floodsub@~0.17.1: version "0.17.2" resolved "https://registry.yarnpkg.com/libp2p-floodsub/-/libp2p-floodsub-0.17.2.tgz#c789bcd55cfb513a4d2f5291bd28d6aa2be271d1" @@ -9336,7 +9521,7 @@ lodash@^4.17.14, lodash@^4.17.15: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== -log-symbols@2.2.0, log-symbols@^2.2.0: +log-symbols@2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== @@ -9350,6 +9535,13 @@ log-symbols@^1.0.2: dependencies: chalk "^1.0.0" +log-symbols@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4" + integrity sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ== + dependencies: + chalk "^2.4.2" + log-update@2.3.x, log-update@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/log-update/-/log-update-2.3.0.tgz#88328fd7d1ce7938b29283746f0b1bc126b24708" @@ -10945,15 +11137,16 @@ options@>=0.0.5: resolved "https://registry.yarnpkg.com/options/-/options-0.0.6.tgz#ec22d312806bb53e731773e7cdaefcf1c643128f" integrity sha1-7CLTEoBrtT5zF3Pnza788cZDEo8= -ora@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/ora/-/ora-3.4.0.tgz#bf0752491059a3ef3ed4c85097531de9fdbcd318" - integrity sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg== +ora@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/ora/-/ora-4.0.2.tgz#0e1e68fd45b135d28648b27cf08081fa6e8a297d" + integrity sha512-YUOZbamht5mfLxPmk4M35CD/5DuOkAacxlEUbStVXpBAt4fyhBf+vZHI/HRkI++QUp3sNoeA2Gw4C+hi4eGSig== dependencies: chalk "^2.4.2" - cli-cursor "^2.1.0" - cli-spinners "^2.0.0" - log-symbols "^2.2.0" + cli-cursor "^3.1.0" + cli-spinners "^2.2.0" + is-interactive "^1.0.0" + log-symbols "^3.0.0" strip-ansi "^5.2.0" wcwidth "^1.0.1" @@ -11461,7 +11654,11 @@ peer-info@^0.14.1: multiaddr "^4.0.0" peer-id "~0.10.7" +<<<<<<< HEAD peer-info@~0.15.1: +======= +peer-info@^0.15.1, peer-info@~0.15.1: +>>>>>>> feat(precache): import TAR archives on boot version "0.15.1" resolved "https://registry.yarnpkg.com/peer-info/-/peer-info-0.15.1.tgz#21254a7c516d0dd046b150120b9aaf1b9ad02146" integrity sha512-Y91Q2tZRC0CpSTPd1UebhGqniOrOAk/aj60uYUcWJXCoLTAnGu+4LJGoiay8ayudS6ice7l3SKhgL/cS62QacA== From 073f058cd6268ff4c995835048449cd66c4389c0 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 11 Oct 2019 18:38:01 +0200 Subject: [PATCH 3/5] fix: precache webui 2.5.7 --- add-on/src/lib/precache.js | 5 +- package.json | 2 +- yarn.lock | 175 ------------------------------------- 3 files changed, 5 insertions(+), 177 deletions(-) diff --git a/add-on/src/lib/precache.js b/add-on/src/lib/precache.js index d96de27c5..b300ffcbf 100644 --- a/add-on/src/lib/precache.js +++ b/add-on/src/lib/precache.js @@ -4,6 +4,7 @@ const pull = require('pull-stream/pull') const drain = require('pull-stream/sinks/drain') const toStream = require('it-to-stream') const tar = require('tar-stream') +const CID = require('cids') const { webuiCid } = require('./state') const debug = require('debug') @@ -75,7 +76,9 @@ async function importTar (ipfs, tarPath, expectedCid) { }) untarAndAdd.on('finish', async () => { - const results = await ipfs.add(await Promise.all(files), { pin: false }) + const { version } = new CID(expectedCid) + const opts = { cidVersion: version, pin: false, preload: false } + const results = await ipfs.add(await Promise.all(files), opts) const root = results.find(e => e.hash === expectedCid) if (root) { log(`${tarPath} successfully precached`, root) diff --git a/package.json b/package.json index dbae12a4e..9933ff886 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "build:bundle-all": "cross-env RELEASE_CHANNEL=${RELEASE_CHANNEL:=dev} run-s bundle:chromium bundle:brave:$RELEASE_CHANNEL bundle:firefox:$RELEASE_CHANNEL", "build:rename-artifacts": "./scripts/rename-artifacts.js", "precache:clean": "shx rm -rf add-on/dist/precache", - "precache:webui": "shx mkdir -p add-on/dist/precache && ipfs-or-gateway -c QmPURAjo3oneGH53ovt68UZEBvsc8nNmEhQZEpsVEQUMZE -p add-on/dist/precache/webui.tar --archive", + "precache:webui": "shx mkdir -p add-on/dist/precache && ipfs-or-gateway -c QmeSXt32frzhvewLKwA1dePTSjkTfGVwTh55ZcsJxrCSnk -p add-on/dist/precache/webui.tar --archive", "bundle": "run-s bundle:*", "bundle:chromium": "run-s precache:webui && shx cat add-on/manifest.common.json add-on/manifest.chromium.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/chromium && run-s build:rename-artifacts", "bundle:firefox": "run-s precache:clean && shx cat add-on/manifest.common.json add-on/manifest.firefox.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", diff --git a/yarn.lock b/yarn.lock index 96a641006..d3b662c84 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1472,11 +1472,7 @@ abstract-leveldown@^5.0.0, abstract-leveldown@~5.0.0: dependencies: xtend "~4.0.0" -<<<<<<< HEAD -abstract-leveldown@^6.2.1, abstract-leveldown@~6.2.1: -======= abstract-leveldown@^6.1.1: ->>>>>>> feat(precache): import TAR archives on boot version "6.2.1" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.2.1.tgz#37b655151e13c3d9b20fa3a04ce63ccaa345fce4" integrity sha512-zUgomHedGBCThDkUtc1bfilu2jEhRZ7Dk3RePhtMma/akw7UK2Upm2R5Dd8ynRBEt3uscwbWO0VQNx22/7RtWg== @@ -1507,8 +1503,6 @@ abstract-leveldown@~6.0.1, abstract-leveldown@~6.0.3: level-concat-iterator "~2.0.0" xtend "~4.0.0" -<<<<<<< HEAD -======= abstract-leveldown@~6.1.0: version "6.1.1" resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.1.1.tgz#f44bad5862d71c7b418110d7698ac25bedf24396" @@ -1517,7 +1511,6 @@ abstract-leveldown@~6.1.0: level-concat-iterator "~2.0.0" xtend "~4.0.0" ->>>>>>> feat(precache): import TAR archives on boot abstract-logging@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/abstract-logging/-/abstract-logging-1.0.0.tgz#8b7deafd310559bc28f77724dd1bb30177278c1b" @@ -4021,21 +4014,12 @@ deferred-leveldown@~4.0.0: abstract-leveldown "~5.0.0" inherits "^2.0.3" -<<<<<<< HEAD -deferred-leveldown@~5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz#27a997ad95408b61161aa69bd489b86c71b78058" - integrity sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw== - dependencies: - abstract-leveldown "~6.2.1" -======= deferred-leveldown@~5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-5.2.1.tgz#8da87909cd3269c2d6aff67b1e607f93e4d96c15" integrity sha512-PwXZRn5EmW+IKYVAYVc7G9FsRkShr0myPubPuq+mtLhDq9xSUqfvTlNZKoeQGeXACHXkeCFurKrz5oo6TZ3qwg== dependencies: abstract-leveldown "~6.1.0" ->>>>>>> feat(precache): import TAR archives on boot inherits "^2.0.3" define-properties@^1.1.2, define-properties@^1.1.3: @@ -4132,14 +4116,11 @@ detect-node@^2.0.4: resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c" integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw== -<<<<<<< HEAD diff-match-patch@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/diff-match-patch/-/diff-match-patch-1.0.4.tgz#6ac4b55237463761c4daf0dc603eb869124744b1" integrity sha512-Uv3SW8bmH9nAtHKaKSanOQmj2DnlH65fUpcrMdfdaOxUG02QQ4YGZ8AE7kKOMisF7UqvOlGKVYWRvezdncW9lg== -======= ->>>>>>> feat(precache): import TAR archives on boot diff@3.5.0, diff@^3.5.0: version "3.5.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" @@ -4409,21 +4390,12 @@ encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= -<<<<<<< HEAD -encoding-down@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/encoding-down/-/encoding-down-6.3.0.tgz#b1c4eb0e1728c146ecaef8e32963c549e76d082b" - integrity sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw== - dependencies: - abstract-leveldown "^6.2.1" -======= encoding-down@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/encoding-down/-/encoding-down-6.2.0.tgz#7ca52446dac6e0fd09ad3584a7359809ea1a4844" integrity sha512-XlIoQMBMbU4aE01uSKpAix0sXBJWK8YPhuOdvKa1CroThZyUpj0zWzt+bbe7g1KWsdhNFFzHkQHSdDymVtpJ1w== dependencies: abstract-leveldown "^6.1.1" ->>>>>>> feat(precache): import TAR archives on boot inherits "^2.0.3" level-codec "^9.0.0" level-errors "^2.0.0" @@ -7026,75 +6998,6 @@ ipfs-http-client@^33.1.0: tar-stream "^2.0.1" through2 "^3.0.1" -<<<<<<< HEAD -======= -ipfs-http-client@^38.0.0: - version "38.0.1" - resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-38.0.1.tgz#c74c121755456d10d179207168be147e99add21d" - integrity sha512-1R/qR2kpZz23jBdm+Mdje8h8GDynZVDXAIoCL4xchfeFsH7VdwWTbyhieaAsynYX5f6/KTfk1LZuulaVoJ5Fgw== - dependencies: - abort-controller "^3.0.0" - async "^2.6.1" - async-iterator-all "^1.0.0" - async-iterator-to-pull-stream "^1.3.0" - bignumber.js "^9.0.0" - bl "^3.0.0" - bs58 "^4.0.1" - buffer "^5.4.2" - cids "~0.7.1" - concat-stream "github:hugomrdias/concat-stream#feat/smaller" - debug "^4.1.0" - delay "^4.3.0" - detect-node "^2.0.4" - end-of-stream "^1.4.1" - err-code "^2.0.0" - explain-error "^1.0.4" - flatmap "0.0.3" - form-data "^2.5.1" - fs-extra "^8.1.0" - glob "^7.1.3" - ipfs-block "~0.8.1" - ipfs-utils "^0.4.0" - ipld-dag-cbor "~0.15.0" - ipld-dag-pb "^0.18.1" - ipld-raw "^4.0.0" - is-ipfs "~0.6.1" - is-pull-stream "0.0.0" - is-stream "^2.0.0" - iso-stream-http "~0.1.2" - iso-url "~0.4.6" - it-glob "0.0.4" - it-to-stream "^0.1.1" - iterable-ndjson "^1.1.0" - just-kebab-case "^1.1.0" - just-map-keys "^1.1.0" - kind-of "^6.0.2" - ky "^0.14.0" - ky-universal "^0.3.0" - lru-cache "^5.1.1" - merge-options "^1.0.1" - multiaddr "^6.0.6" - multibase "~0.6.0" - multicodec "~0.5.1" - multihashes "~0.4.14" - ndjson "github:hugomrdias/ndjson#feat/readable-stream3" - once "^1.4.0" - peer-id "~0.12.3" - peer-info "~0.15.1" - promise-nodeify "^3.0.1" - promisify-es6 "^1.0.3" - pull-defer "~0.2.3" - pull-stream "^3.6.9" - pull-stream-to-async-iterator "^1.0.2" - pull-to-stream "~0.1.1" - pump "^3.0.0" - qs "^6.5.2" - readable-stream "^3.1.1" - stream-to-pull-stream "^1.7.2" - tar-stream "^2.0.1" - through2 "^3.0.1" - ->>>>>>> feat(precache): import TAR archives on boot ipfs-http-response@0.3.1, ipfs-http-response@~0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/ipfs-http-response/-/ipfs-http-response-0.3.1.tgz#5cc351f8abf5f77dae47a41781fd7bc0c88fcaf8" @@ -7274,15 +7177,9 @@ ipfs-utils@~0.0.3: kind-of "^6.0.2" readable-stream "^3.3.0" -<<<<<<< HEAD "ipfs@https://github.com/ipfs/js-ipfs/tarball/d9986ee4d7945f6a5d77dc7a2db4863d06971eb9/js-ipfs.tar.gz": version "0.38.0" resolved "https://github.com/ipfs/js-ipfs/tarball/d9986ee4d7945f6a5d77dc7a2db4863d06971eb9/js-ipfs.tar.gz#588eee8495676459592227a515eb2dd17c000d74" -======= -"ipfs@https://github.com/ipfs/js-ipfs/tarball/1dca93dda4b70264657cafe1893212368351f102/js-ipfs.tar.gz": - version "0.38.0" - resolved "https://github.com/ipfs/js-ipfs/tarball/1dca93dda4b70264657cafe1893212368351f102/js-ipfs.tar.gz#db038c7cb94b5619f69b3742a76809f4407ef3c4" ->>>>>>> feat(precache): import TAR archives on boot dependencies: "@hapi/ammo" "^3.1.1" "@hapi/boom" "^7.4.3" @@ -7324,11 +7221,7 @@ ipfs-utils@~0.0.3: ipfs-bitswap "^0.26.0" ipfs-block "~0.8.1" ipfs-block-service "~0.16.0" -<<<<<<< HEAD ipfs-http-client ipfs/js-ipfs-http-client#add-async-iterator-methods -======= - ipfs-http-client "^38.0.0" ->>>>>>> feat(precache): import TAR archives on boot ipfs-http-response "~0.3.1" ipfs-mfs "^0.13.0" ipfs-multipart "^0.2.0" @@ -7353,10 +7246,7 @@ ipfs-utils@~0.0.3: iso-url "~0.4.6" it-pipe "^1.0.1" it-to-stream "^0.1.1" -<<<<<<< HEAD jsondiffpatch "~0.3.11" -======= ->>>>>>> feat(precache): import TAR archives on boot just-safe-set "^2.1.0" kind-of "^6.0.2" ky "^0.14.0" @@ -8166,11 +8056,7 @@ it-pipe@^1.0.1: resolved "https://registry.yarnpkg.com/it-pipe/-/it-pipe-1.0.1.tgz#6443f12e2a24dd71728c172eb58a159bb957095e" integrity sha512-clx7NMIf4eXe3rp4dKLmT5vMYv/hvZv4lNi1/xx4ZJ8CFmpGod9rTKisyBNBTurbCEa3a7503COankdBj/uUCA== -<<<<<<< HEAD -it-to-stream@^0.1.1: -======= it-to-stream@0.1.1, it-to-stream@^0.1.1: ->>>>>>> feat(precache): import TAR archives on boot version "0.1.1" resolved "https://registry.yarnpkg.com/it-to-stream/-/it-to-stream-0.1.1.tgz#3fb4a9c4df868cd8f4aaf2071eba5ada5a3fad2a" integrity sha512-QQx/58JBvT189imr6fD234F8aVf8EdyQHJR0MxXAOShEWK1NWyahPYIQt/tQG7PId0ZG/6/3tUiVCfw2cq+e1w== @@ -8680,21 +8566,12 @@ level-mem@^3.0.1: memdown "~3.0.0" level-packager@^5.0.0: -<<<<<<< HEAD - version "5.1.0" - resolved "https://registry.yarnpkg.com/level-packager/-/level-packager-5.1.0.tgz#9c01c6c8e2380d3196d61e56bd79c2eff4a9d5c3" - integrity sha512-3pbJmDgGvp/lUQNULPoYQZtUbhMI8KoViYDw7Sa0kWl1mPeHWWJF7T/9upWI/NTMuEikkEE/cd6wBvmrW1+ZnQ== - dependencies: - encoding-down "^6.3.0" - levelup "^4.3.2" -======= version "5.0.3" resolved "https://registry.yarnpkg.com/level-packager/-/level-packager-5.0.3.tgz#e22bc9887663d0808ab092453d691bc319b7e5a2" integrity sha512-Ut62o3nvUNCxYldM5+13+0sYow6ifKj2C26/0ToB7zKgdypF5wRKcVkcztQVwsQi+ZnrmDzhimp7FKP5Ynv6Rg== dependencies: encoding-down "^6.2.0" levelup "^4.2.0" ->>>>>>> feat(precache): import TAR archives on boot level-packager@~4.0.0: version "4.0.1" @@ -8705,15 +8582,9 @@ level-packager@~4.0.0: levelup "^3.0.0" level-supports@~1.0.0: -<<<<<<< HEAD - version "1.0.1" - resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-1.0.1.tgz#2f530a596834c7301622521988e2c36bb77d122d" - integrity sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg== -======= version "1.0.0" resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-1.0.0.tgz#376f3f2339c23be0ba2fe62b0fa0e3ac7d6d9988" integrity sha512-01PKZumFhgysuHUbRz4c9DyA1egmcHJBAsZbm0Vf5agojC3uWOvAnhOD4swNUgHlfJBymXLi/xkBaEckeNRSvA== ->>>>>>> feat(precache): import TAR archives on boot dependencies: xtend "^4.0.2" @@ -8776,21 +8647,12 @@ levelup@^3.0.0: level-iterator-stream "~3.0.0" xtend "~4.0.0" -<<<<<<< HEAD -levelup@^4.3.2: - version "4.3.2" - resolved "https://registry.yarnpkg.com/levelup/-/levelup-4.3.2.tgz#31c5b1b29f146d1d35d692e01a6da4d28fa55ebd" - integrity sha512-cRTjU4ktWo59wf13PHEiOayHC3n0dOh4i5+FHr4tv4MX9+l7mqETicNq3Aj07HKlLdk0z5muVoDL2RD+ovgiyA== - dependencies: - deferred-leveldown "~5.3.0" -======= levelup@^4.2.0: version "4.3.1" resolved "https://registry.yarnpkg.com/levelup/-/levelup-4.3.1.tgz#ac740019789de1a2987e109b00fcbdad9ddc6ac9" integrity sha512-vXRqqNDSZxbY4atrfz+yXS2fdfq027chwvc6ihX/pQYplYdFoppkfHFaF0V3PDe2mCnhtyieaizRBzTpmL5wAg== dependencies: deferred-leveldown "~5.2.1" ->>>>>>> feat(precache): import TAR archives on boot level-errors "~2.0.0" level-iterator-stream "~4.0.0" level-supports "~1.0.0" @@ -8926,34 +8788,20 @@ libp2p-crypto@~0.16.0, libp2p-crypto@~0.16.1: tweetnacl "^1.0.0" ursa-optional "~0.9.10" -<<<<<<< HEAD libp2p-delegated-content-routing@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/libp2p-delegated-content-routing/-/libp2p-delegated-content-routing-0.3.1.tgz#45e1711074a68d457c9b4bd92682ad06fb8857c8" integrity sha512-GgEj1FHzNFH6nL0fQ5sFZWcskfWkwVLL+GtY5wZbe9izXftyg5QDVdoKSlYWQUrEjaaAJE+T4KjvtK83T/C7Yg== -======= -libp2p-delegated-content-routing@0.2.4, libp2p-delegated-content-routing@^0.3.1: - version "0.2.4" - resolved "https://registry.yarnpkg.com/libp2p-delegated-content-routing/-/libp2p-delegated-content-routing-0.2.4.tgz#2627f09f59a38829eef291693482dd9e15c815bd" - integrity sha512-VgupHN9DhoNIJmnoe5H1Qb+AeG+Z7A4Yc8p/8jNNuRq61Jn7uzs03k1WWFRt/+Xnb9FlnHrBo1vrp8NqXdq9NQ== ->>>>>>> feat(precache): import TAR archives on boot dependencies: debug "^4.1.1" ipfs-http-client "^33.1.0" multiaddr "^6.1.0" p-queue "^6.1.0" -<<<<<<< HEAD libp2p-delegated-peer-routing@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/libp2p-delegated-peer-routing/-/libp2p-delegated-peer-routing-0.3.1.tgz#331d129559b2b257cef5e13260d7ac50d4731768" integrity sha512-WAN2rBsuiS1xqrAaZthKX9vVtXar0nH7ACAWoTNsk2BaAhhds0Shri48NB5jN//kxLo+vC7+WVn4Rgdg3Dp2sA== -======= -libp2p-delegated-peer-routing@0.2.4, libp2p-delegated-peer-routing@^0.3.1: - version "0.2.4" - resolved "https://registry.yarnpkg.com/libp2p-delegated-peer-routing/-/libp2p-delegated-peer-routing-0.2.4.tgz#18ee245585e2737a4f875cd6bc5e106d8ad1e95b" - integrity sha512-uL6QumPoXG5LhFPQaDtcW4k83LlTJEDNqqv3DnM9RG3/d+N6/yHBNqQpRmvgR4gBeaDOEpdAyK3FSa9IWNpEFA== ->>>>>>> feat(precache): import TAR archives on boot dependencies: debug "^4.1.1" ipfs-http-client "^33.1.0" @@ -8976,25 +8824,6 @@ libp2p-floodsub@^0.18.0: pull-pushable "^2.2.0" pull-stream "^3.6.9" -<<<<<<< HEAD -======= -libp2p-floodsub@^0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/libp2p-floodsub/-/libp2p-floodsub-0.18.0.tgz#49efd1a9936e898f62abbf041fa2f62049b796e0" - integrity sha512-4OihLP5A4LsxNPlfb0mq6vkjAaNu4YxuyYeoj2nNgrRSzr4H8Dz0YtA+DzEDXIgP2RBANSzS+KG9oDeUXDHa/Q== - dependencies: - async "^2.6.2" - bs58 "^4.0.1" - debug "^4.1.1" - length-prefixed-stream "^2.0.0" - libp2p-crypto "~0.16.1" - libp2p-pubsub "~0.2.0" - protons "^1.0.1" - pull-length-prefixed "^1.3.2" - pull-pushable "^2.2.0" - pull-stream "^3.6.9" - ->>>>>>> feat(precache): import TAR archives on boot libp2p-floodsub@~0.17.1: version "0.17.2" resolved "https://registry.yarnpkg.com/libp2p-floodsub/-/libp2p-floodsub-0.17.2.tgz#c789bcd55cfb513a4d2f5291bd28d6aa2be271d1" @@ -11654,11 +11483,7 @@ peer-info@^0.14.1: multiaddr "^4.0.0" peer-id "~0.10.7" -<<<<<<< HEAD peer-info@~0.15.1: -======= -peer-info@^0.15.1, peer-info@~0.15.1: ->>>>>>> feat(precache): import TAR archives on boot version "0.15.1" resolved "https://registry.yarnpkg.com/peer-info/-/peer-info-0.15.1.tgz#21254a7c516d0dd046b150120b9aaf1b9ad02146" integrity sha512-Y91Q2tZRC0CpSTPd1UebhGqniOrOAk/aj60uYUcWJXCoLTAnGu+4LJGoiay8ayudS6ice7l3SKhgL/cS62QacA== From 417e4e8358505a2a932fb02e84596419ef7a938c Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 16 Oct 2019 02:35:00 +0200 Subject: [PATCH 4/5] refactor: reuse webui's CID from config --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 819d6a981..3b51c0fe8 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "build:bundle-all": "cross-env RELEASE_CHANNEL=${RELEASE_CHANNEL:=dev} run-s bundle:chromium bundle:brave:$RELEASE_CHANNEL bundle:firefox:$RELEASE_CHANNEL", "build:rename-artifacts": "./scripts/rename-artifacts.js", "precache:clean": "shx rm -rf add-on/dist/precache", - "precache:webui": "shx mkdir -p add-on/dist/precache && ipfs-or-gateway -c QmeSXt32frzhvewLKwA1dePTSjkTfGVwTh55ZcsJxrCSnk -p add-on/dist/precache/webui.tar --archive", + "precache:webui:cid": "shx grep 'const webuiCid' add-on/src/lib/state.js | shx sed \"s/^const webuiCid = '//\" | shx sed \"s/'.*$//\"", + "precache:webui": "shx mkdir -p add-on/dist/precache && ipfs-or-gateway -c $(npm run -s precache:webui:cid) -p add-on/dist/precache/webui.tar --archive", "bundle": "run-s bundle:*", "bundle:chromium": "run-s precache:webui && shx cat add-on/manifest.common.json add-on/manifest.chromium.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/chromium && run-s build:rename-artifacts", "bundle:firefox": "run-s precache:clean && shx cat add-on/manifest.common.json add-on/manifest.firefox.json | json --deep-merge > add-on/manifest.json && web-ext build -a build/firefox/ && run-s build:rename-artifacts", From 625a82695ba53cf68f8587359c55da8ac03b12c4 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 16 Oct 2019 12:07:48 +0200 Subject: [PATCH 5/5] fix(ci): run regular build on osx and windows --- .travis.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 080252a2e..65860b768 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,9 +19,12 @@ addons: install: - npm run ci:install script: - - npm run ci:build - - npm run ci:test - - npm run ci:lint + - npm run build + - npm run test + - npm run lint after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov notifications: - email: false + email: + if: branch = master + on_success: never + on_failure: always