Git Product home page Git Product logo

Comments (8)

hayatoito avatar hayatoito commented on July 28, 2024 1

Quick update: I've confirmed that webbundle crate produces a broken bundle if it contains a primary-url. I'm afraid this bug has been there since we supported b2 version format, where a primary-url became optional.

Let me fix that.

from webbundle.

antonispoulakis avatar antonispoulakis commented on July 28, 2024 1

Sorry for the late reply; the newest version works, thanks!

from webbundle.

hayatoito avatar hayatoito commented on July 28, 2024

Thanks for filing an issue. Ack.
Let me take a look closely this week and try to provide working examples.
(Or fix a bug and release a new version).

from webbundle.

hayatoito avatar hayatoito commented on July 28, 2024

I guess you are trying "Navigate-to-Bundle" feature (e.g. Drag and drop a created wbn to a browser's window), which is explained in https://web.dev/web-bundles/.

This feature, "Navigate-to-Bundle", requires an absolute URL for each resource in Web Bundle.

Unfortunately, it seems I dropped "absolute URL" support from webbundle::Builder::exchange_from_dir() in version 0.32 or later. Now that only supports a "relative URL".

That's a reason Chrome complains because "Navigate-to-Support" requires an absolute URL.

As a workaround, to create a web bundle where each resource has an absolute URL:

from webbundle.

antonispoulakis avatar antonispoulakis commented on July 28, 2024

Hi @hayatoito, thanks for your reply. I'm only really interested in creating the .wbn file from the webbundle crate using the remove urls and the exchange()

I have tried using exchange(), but I still get the error I describe above in the second section.

Here's the snippet I'm using:

  let primary_url = "https://www.google.com/".parse::<Uri>().unwrap();
  let ex_req = Request::from("https://www.google.com/".to_string());
  let ex_res = reqwest::get("https://www.google.com/").await?.bytes().await?.to_vec();

  let write = BufWriter::new(File::create("./google.wbn")?);

  Bundle::builder()
  .version(Version::VersionB2)
  .primary_url(primary_url)
  .exchange((ex_req, ex_res, ContentType::html()).into())
  .build()?
  .write_to(write)?;

Maybe I'm passing something wrong to the exchange function?

from webbundle.

hayatoito avatar hayatoito commented on July 28, 2024

Thanks for trying it. My expectation is "That should work". But I'm afraid something is wrong.

Let me add some examples to webbundle/webbundle/examples directory and confirm the created bundle is surely loaded in Chrome. That's my TODO. Noted!

from webbundle.

hayatoito avatar hayatoito commented on July 28, 2024

Fixed the issue: 631f6a8

webbundle v0.5.0 shouldn't have an issue, I think.

I've confirmed that a bundle generated by https://github.com/google/webbundle/blob/main/webbundle/examples/create-webbundle.rs is successully loaded in Chrome (by drag & drop).

I appreciate if you can confirm it. Thanks!

from webbundle.

hayatoito avatar hayatoito commented on July 28, 2024

Thanks!

from webbundle.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.