[bug/feature request] content negotiation is inconsistent between JSON and HTML, consider fixing
#2
Closed
opened 1 year ago by melvin
·
2 comments
No Branch/Tag Specified
feature/8296-invite_api
kosmos-production
master
v0.1.0
v0.1.1
v0.1.2
v0.6
v0.7
v0.8
v0.9
v0.9.9
v1.0
v1.1
v1.1.1
v1.1.2
v1.2
v1.2.1
v1.2.2
v1.3
v1.3.1
v1.3.2
v1.3.3
v1.4.1
v1.4.2
v1.4.3
v1.4.4
v1.4.5
v1.4.6
v1.4.7
v1.4rc1
v1.4rc2
v1.4rc3
v1.4rc4
v1.4rc5
v1.4rc6
v1.5.0
v1.5.0rc1
v1.5.0rc2
v1.5.0rc3
v1.5.1
v1.6.0
v1.6.0rc1
v1.6.0rc2
v1.6.0rc3
v1.6.0rc4
v1.6.0rc5
v1.6.1
v2.0.0
v2.0.0rc1
v2.0.0rc2
v2.0.0rc3
v2.0.0rc4
v2.1.0
v2.1.0rc1
v2.1.0rc2
v2.1.0rc3
v2.1.0rc4
v2.1.0rc5
v2.1.0rc6
v2.1.1
v2.1.2
v2.1.3
v2.2.0
v2.2.0rc1
v2.2.0rc2
v2.3.0
v2.3.0rc1
v2.3.0rc2
v2.3.0rc3
v2.3.1
v2.3.1rc1
v2.3.1rc2
v2.3.1rc3
v2.3.2
v2.3.2rc1
v2.3.2rc2
v2.3.2rc3
v2.3.2rc4
v2.3.2rc5
v2.4.0
v2.4.0rc1
v2.4.0rc2
v2.4.0rc3
v2.4.0rc4
v2.4.0rc5
v2.4.1
v2.4.1rc1
v2.4.1rc2
v2.4.1rc3
v2.4.1rc4
v2.4.2
v2.4.2rc1
v2.4.2rc2
v2.4.2rc3
v2.4.3
v2.4.3rc1
v2.4.3rc2
v2.4.3rc3
v2.4.4
v2.4.5
v2.5.0
v2.5.0rc1
v2.5.0rc2
v2.5.1
v2.5.2
v2.6.0
v2.6.0rc1
v2.6.0rc2
v2.6.0rc3
v2.6.0rc4
v2.6.1
v2.6.2
v2.6.3
v2.6.4
v2.6.5
v2.7.0
v2.7.0rc1
v2.7.0rc2
v2.7.0rc3
v2.7.1
v2.7.2
v2.7.3
v2.7.4
v2.8.0
v2.8.0rc1
v2.8.0rc2
v2.8.0rc3
v2.8.1
v2.8.2
v2.8.3
v2.8.4
v2.9.0
v2.9.0rc1
v2.9.0rc2
v2.9.1
v2.9.2
v2.9.3
v3.0.0
v3.0.0rc1
v3.0.0rc2
v3.0.0rc3
v3.0.1
Labels
Something is not working dev environment
Config, builds, CI, deployment, etc. duplicate
This issue or pull request already exists enhancement
Improving existing functionality feature
New functionality idea
Something to consider invalid
Not a bug kredits-1
Small contribution kredits-2
Medium contribution kredits-3
Large contribution question
Looking for an answer security
All your base are belong to us ui/ux
User interface, process design, etc. wontfix
This won't be fixed bug
Something is not working design
Graphic/visual design dev environment
Config, builds, CI, deployment, etc. docs
Documentation duplicate
This issue or pull request already exists enhancement
Improving existing functionality feature
New functionality good first issue
Dive in, and start contributing idea
Something to consider invalid
Not a bug kredits-1
Small contribution kredits-2
Medium contribution kredits-3
Large contribution on hold
Currently not actionable ops
Manual IT ops activities question
Looking for an answer security
All your base are belong to us ui/ux
User interface, process design, etc. wontfix
This won't be fixed
Apply labels
Clear labels
bug
Something is not working dev environment
Config, builds, CI, deployment, etc. duplicate
This issue or pull request already exists enhancement
Improving existing functionality feature
New functionality idea
Something to consider invalid
Not a bug kredits-1
Small contribution kredits-2
Medium contribution kredits-3
Large contribution question
Looking for an answer security
All your base are belong to us ui/ux
User interface, process design, etc. wontfix
This won't be fixed bug
Something is not working design
Graphic/visual design dev environment
Config, builds, CI, deployment, etc. docs
Documentation duplicate
This issue or pull request already exists enhancement
Improving existing functionality feature
New functionality good first issue
Dive in, and start contributing idea
Something to consider invalid
Not a bug kredits-1
Small contribution kredits-2
Medium contribution kredits-3
Large contribution on hold
Currently not actionable ops
Manual IT ops activities question
Looking for an answer security
All your base are belong to us ui/ux
User interface, process design, etc. wontfix
This won't be fixed
No Label
bug
dev environment
duplicate
enhancement
feature
idea
invalid
kredits-1
kredits-2
kredits-3
question
security
ui/ux
wontfix
bug
design
dev environment
docs
duplicate
enhancement
feature
good first issue
idea
invalid
kredits-1
kredits-2
kredits-3
on hold
ops
question
security
ui/ux
wontfix
Milestone
Set milestone
Clear milestone
No items
No Milestone
Assignees
Assign users
Clear assignees
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
This issue currently doesn't have any dependencies.
Reference in new issue
There is no content yet.
Delete Branch '%!s(MISSING)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
Pitch
When getting a user profile, it is possible to get a representation in both HTML or JSON. In the browser this can be done by adding .json onto the end of the profile. Using curl this can be done with the
Accept
header, and setting the mime type to either html of jsonNotes on conneg: https://www.w3.org/DesignIssues/Conneg
When dealing with data and profiles its generally a good idea to have each
variant
return the same data to the client. Otherwise, depending on which accept header is used, the interacting system my yield inconsistent resultsMotivation
Motivation for this is that it helps create more distributed and more decentralized systems. When building a tool that interacts with kosmos profiles the client doesnt need to know that the data in the JSON is much richer, or even different, to the the data in the HTML
This facilitates allowing more easily your kosmos profile to be an identity in hetrogenous systems. For example, by visiting a profile you may find public key material or a other cryptographic endpoints, that could be used for single sign on. So, for example, a kosmos user could sign in to a server providing solid storage solid apps, or unhosted apps in general, without necessarily needing to change the kosmos backend
Additionally, content negotiation is very hard to implement. Schema.org after many years dropped support for it. Deploying content negotiation to many other systems like nextcloud, or even dropbox, would be quite hard. However, deploying an HTML page to the cloud is relatively easy. In this way a data eco system can be created that interacts with kosmos.social, and that kosmos.social interacts with, where there is a low barrier to entry, leading to a greater network effect
Similarly it's easier to do things such as payments via profiles, which can be out of band, so creating projects like opentabs etc.
Solution
It has traditionally been quite hard to represent data in an HTML page. Firstly RDFa was tried, then RDFa lite and many other solutions. These never took off.
What has taken off is the schema.org pattern of using structured data islands.
What would be needed is a script tage that pulls in the relevent json in the html
It would look like
And you're done
Conclusion
Please consider this fix to data consistency across profile pages with different mime types
IMHO you'd attract more developers, more users, more apps, and importantly, more functionality into the eco system
Thanks for opening this issue. Unfortunately, it is not something we think should be changed only on kosmos.social. Please open an issue, or ideally a pull request, on the upstream Mastodon repo:
https://github.com/tootsuite/mastodon/
Thanks.
I just want to flag that this is actually a bug according to HTTP both the html and the json representation of a resource should contain the same data
I've raised an issue upstream for this, on the topic of building client to server apps, but it's considered too hard a problem, right now
Issue is that it might take a long time, even years to happen, and then more time elapsed for it to get downstream into kosmos
And it may never get fixed at all meaning that I would find it impractical to work on this system to build next gen dweb/social web/fediverse apps with new features ie such client to server, server to server, client to client (P2P), and single sign on
So during that waiting period it would be nice if there was something out there that can tie all these aspects together. The search goes on ...
I'll keep tabs on this issue and reopen if it gets fixed upstream