MystenLabs / walrus-sites

Walrus Sites: Decentralized Websites using Sui and Walrus.
https://docs.walrus.site/walrus-sites/intro.html
Apache License 2.0
21 stars 17 forks source link

[Feature]: Include more http representation headers in site::Resource #171

Open Tzal3x opened 1 month ago

Tzal3x commented 1 month ago

Description

Identify any useful headers that could be added to the site::Resource sui object's metadata.

So far only the Content-Encoding and Content-Type representation headers are included to the site::Resource object.

e.g.

"content_encoding":string"plaintext"
"content_type":string"text/css"

We should enrich this.

TBD: There is also the option to support any header, but that would make testing harder.

Component

portal

Code of Conduct

Tzal3x commented 1 month ago

We should start from representation headers.

Representation headers include:

Tzal3x commented 1 month ago

Our use case matches nicely with the agent-driven content negotiation.

Upon a client request (browser), the portal (agent) fetches all the resources from sui + walrus as usual.

Then, the portal could return a 300 Multiple Choices and let the browser choose the right content representation of the site as shown in the attached image:

image

The server in this case is the server-side portal that has already fetched the site resources.

Tzal3x commented 1 month ago

After having a short discussion we concluded that it would be best allowing any type of header under the site::Resource. This could be implemented with a verctor of tuples (key-value header pairs) in the walrus sites smart contract.