Code Monkey home page Code Monkey logo

Comments (7)

TessavWalstijn avatar TessavWalstijn commented on September 26, 2024 1

Yeah the origin is indeed an authentication header.

However I can fetch the manifest beforehand without any issues.
That is how I stranded here with my insights

I would need to look into the service worker to intercept specific requests made by UV.
That is currently outside of my current knowledge.

Again thanks for the quick responses!

from user-stories.

Conal-Tuohy avatar Conal-Tuohy commented on September 26, 2024

Can you use a data: URI for the manifest? i.e. Base64-encode the JSON and stick data:application/json;base64, on the front of it? I don't know if UV is able to handle the data: URI scheme, but if not, it would probably not be hard to add, and it seems to me it would be a nicely standards-compliant way to load such data into UV.

from user-stories.

TessavWalstijn avatar TessavWalstijn commented on September 26, 2024

I have been looking in to something like this.

However in IIIFContentHandler.ts#L295 UV uses manifold. Looking in to them I see on @iiif/manifold/src/Bootstrapper.ts#L45 that the manifest is loaded in to the _loaded function witch is private. I think we might need to open the feature request there.

However I will not be doing that due to the lack of my understanding of UV

Where we then can potentially use it something like this:

import { loadManifest, IManifoldOptions } from "@iiif/manifold";

await loadManifest({
  manifestData: data.iiifManifestData, // comming from the options then in UV
  collectionIndex: data.collectionIndex,
  manifestIndex: data.manifestIndex || 0,
  canvasId: data.canvasId,
  canvasIndex: data.canvasIndex || 0,
  rangeId: data.rangeId,
  locale: data.locales ? data.locales[0].name : undefined,
} as IManifoldOptions)

from user-stories.

demiankatz avatar demiankatz commented on September 26, 2024

@TessavWalstijn, did you try @Conal-Tuohy's suggestion of using a data URI to carry the manifest? I haven't had time to try this myself, but a quick investigation suggests to me that there's a good chance it will work. The manifold Bootstrapper is being fed by the manifesto Utils.loadManifest method, which uses fetch() to retrieve the data. As far as I can tell, fetch() should support data URIs.

from user-stories.

TessavWalstijn avatar TessavWalstijn commented on September 26, 2024

Yes I have tried the solution of @Conal-Tuohy
Also thanks for the really quick response!

However I keep getting the alert

Unable to load manifest

For more context my Stack Overflow question might be helpful
However my second proposal in that question would be a new feature request I think (being able to add headers to the requests UV does).

Sadly I do not have the capacity in this moment to create a minimal reproducible repository.

from user-stories.

Conal-Tuohy avatar Conal-Tuohy commented on September 26, 2024

I have had mixed success with data: URIs: some have worked and others cause UV to throw an exception in obfuscated JavaScript which I'm not going to attempt to decode. Perhaps the length of the URI exceeds some expectation in the code somewhere? Because a data: URI is by definition longer than the content of the manifest itself, there's no upper limit to its length. I am just guessing that length is the issue, but if so it might be preferable to use a blob: URI which would be a lot shorter.

from user-stories.

Conal-Tuohy avatar Conal-Tuohy commented on September 26, 2024

For more context my Stack Overflow question might be helpful
However my second proposal in that question would be a new feature request I think (being able to add headers to the requests UV does).

Having read your Stack Overflow post, I now see that your use case is different to the one originally raised in this issue:
it's actually about authentication is it not?

A Service Worker might be a good way to intercept and authenticate the HTTPS requests made by UV

from user-stories.

Related Issues (20)

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.