Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private HTML resources not displaying as expected #41

Open
jeswr opened this issue Jan 18, 2025 · 15 comments
Open

Private HTML resources not displaying as expected #41

jeswr opened this issue Jan 18, 2025 · 15 comments

Comments

@jeswr
Copy link

jeswr commented Jan 18, 2025

When you go to the URL of an HTML resource whilst authenticated, you get the SolidOS page in which you can view the HTML source - instead of the HTML page itself.

@bourgeoa
Copy link

Can you give more detail.
I tried it on my pod and don't have the issue.
https://bourgeoa.solidcommunity.net:8443
This is CSS PIVOT but should not make a difference.
What configuration are you using ?

@jeswr
Copy link
Author

jeswr commented Jan 18, 2025

Missed important detail in copying this from another channel:

The HTML page is displayed when the resource is public, however if the resource is private and the user is authenticated, you get the SolidOS page instead of the HTML page in your Pod.

This issue is observed on https://timbl.com, I would assume that it is the default mashlib configuration - but cannot guarantee. I will follow up.

cc @timbl

@jeswr
Copy link
Author

jeswr commented Jan 18, 2025

Can confirm this is an issue with the default maslib config here. If you follow the instructions in #43 and then go to the url for the myPage.html resource, you will go to a SolidOS page rather than seeing myPage.html

@bourgeoa
Copy link

bourgeoa commented Jan 19, 2025

@jeswr
I confirm the issue.
I think that text/html should be excluded from display with the dataBrowser.html

Could you try to add text/html in options_disabledMediaRanges line 55

"options_disabledMediaRanges": [
"image/*",
"application/pdf"
]

This should also resolve the dokieli issue #43

@bourgeoa
Copy link

@joachimvh

The good solution should be to replace disabledMediaRanges
by enabledMediaRanges with something like the following excluding text/html

const RDF_MIME_TYPES = new Set([
  'text/turtle', // .ttl
  'text/n3', // .n3
  // 'text/html', // RDFa
  'application/xhtml+xml', // RDFa
  'application/n3',
  'application/nquads',
  'application/n-quads',
  'application/rdf+xml', // .rdf
  'application/ld+json', // .jsonld
  'application/x-turtle'
])

@jeswr
Copy link
Author

jeswr commented Jan 19, 2025

@joachimvh
Copy link
Member

To clarify, is the request to change the config to have

    "options_enabledMediaRanges": [
        "text/turtle",
        "text/n3",
        "application/xhtml+xml",
        "application/n3",
        "application/nquads",
        "application/n-quads",
        "application/rdf+xml",
        "application/ld+json",
        "application/x-turtle"
      ]

instead of the current disabled media ranges. And this would also solve #43?

@bourgeoa
Copy link

Yes it was the idea but I tried it and it does not load mashlib as ui

@bourgeoa
Copy link

Yes it was the idea but I tried it and it does not load mashlib as ui

I was not detailed enough :

  • mashlib was not loaded on container
  • but was loaded on document

@bourgeoa
Copy link

Was not resolved in CommunitySolidServer/CommunitySolidServer#1983

@joachimvh
Copy link
Member

Thinking about this, I'm not sure how possible it actually is to do this. Since the resource is private, an authenticated fetch needs to take place in the JS code, so you can't just redirect the browser to the page to have the browser render it. Similar as discussed in CommunitySolidServer/CommunitySolidServer#1392

Only solution I can think of is mashlib rendering an iframe with the response HTML it gets from the authenticated request?

@timbl
Copy link

timbl commented Jan 30, 2025

Tried

      "options_disabledMediaRanges": [
        "image/*",
        "text/html",
        "application/pdf"
      ]

no effect on the issue.

@bourgeoa
Copy link

Thinking about this, I'm not sure how possible it actually is to do this. Since the resource is private, an authenticated fetch needs to take place in the JS code, so you can't just redirect the browser to the page to have the browser render it. Similar as discussed in CommunitySolidServer/CommunitySolidServer#1392

The strange thing is that private text/plain or private text/markdown don't have this issue

@joachimvh
Copy link
Member

But how does mashlib solve that situation then? As an authenticated fetch still has to happen at some point there.

@bourgeoa
Copy link

But how does mashlib solve that situation then? As an authenticated fetch still has to happen at some point there.

https://github.com/SolidOS/solid-panes/blob/4a21178a16fdbea8bde2b5e166c3a8a2c91b4773/src/humanReadablePane.js#L103-L121

Mashlib use an authenticated fetch and iFrame to resolve these issues CommunitySolidServer/CommunitySolidServer#1392

In the text/html case it does not work and we kept the former solution.
I tried it again and can confirm that it fails to resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants