Closed ikreymer closed 1 year ago
I was thinking the algo could look something like this:
This makes it easy to swap out templates by the user, or even taking templates from existing archives. It also involves a minimal amount of copying stuff in memory since we can upload the wacz to IPFS once using a streaming API of some sort, and then just need to upload the single block for the new root. We can assume that the template already exists somewhere or attempt to resolve it / reupload if it's not resolvable.
Yes, a pre-made 'template' of replayweb.page could make sense, though need to figure out how to set that up. Would we create one for each release of replayweb.page (with just sw.js and ui.js?). The index.html may or may not be part of the template, depending on if we want to be able to customize the filename of the wacz... Would this library also auto-create the template and/or keep track of existing templates? Could also add that as a second pass..
Actually, we could extend the idea of a template to having a template for web-replay-gen and just upload WACZ files and create the static site with a new json file!
New plan is to support uploading of multiple WACZ files, which could then get added to a web-replay-gen 'template' under the archives directory!
Started working on the backend here: https://github.com/webrecorder/wacz-uploader/blob/initial/archivewrapper.js
Gonna write some rudementary tests, and make sure that we can download raw blocks from auto-js-ipfs, then I'll start working on the barebones of the UI. 😁
I think I'll wire stuff up with web components and rollup to start, but it should be easy enough to port whatever I do to React components and webpack.
Started working on the backend here: https://github.com/webrecorder/wacz-uploader/blob/initial/archivewrapper.js
Gonna write some rudementary tests, and make sure that we can download raw blocks from auto-js-ipfs, then I'll start working on the barebones of the UI. 😁
Need raw blocks to get the directory entry, right? Does it make sense to handle it via downloading CAR files, or easier to just do a raw block if really just one block?
I think I'll wire stuff up with web components and rollup to start, but it should be easy enough to port whatever I do to React components and webpack.
Would you mind trying to do it with Lit library? https://lit.dev/docs/components/ This is what we're using in general, not React, and it's just a wrapper around webcomponnents, will be even easier to pick up from there.. happy to answer any questions about it!
This is done in the latest version. We can do followups in separate issues.
This library should expose an API for uploading a WACZ file to IPFS in the following structure:
The index.html will contain the
<replay-web-page>
embed code to usewebarchive.wacz
file, along with the locally ui.js and replay/sw.js from a release of replayweb.pageSome options for this:
Later: