-
Notifications
You must be signed in to change notification settings - Fork 21
Description
This issue is intended to gather feedback and implementation ideas.
Currently, responses by the link resolver are raw HTML which is sent to clients with the intent to be rendered directly without any additional logic performed by the Chatterino client. This approach has pros and cons.
Pros & Cons
Pros:
- New providers can be added without the need for user interaction (i.e., only requiring a server-side update).
- Existing providers can be changed without the need for user interaction (i.e., only requiring a server-side update).
Cons:
- Clients have little control over the rendering of the information. This hinders ideas such as Add option for embedded inline link previews chatterino2#4695 from being implemented.
- Using the link information for purposes other than rendering is very hard (the only option would be parsing the HTML response which is generally unstructured and error-prone). One can imagine use cases for which easy access to the link info is useful, e.g., imagine a filter or search predicate for YouTube videos from a certain channel.
(I probably missed some important aspects in this section, feel free to expand on these in the comments.)
Migration
-
Ideally, we would like to migrate without crippling older versions. The easiest approach would probably be serving the new responses over a separate API endpoint.
a. How does this impact caching of responses in the database?
b. Can we share cached responses between both endpoints?
c. Would it even be a problem to duplicate the data during the migration period? -
How can we share JSON schemas between the server and clients in a reliable manner?
a. Do we even want to?
b. Can we share schemas for the possible link info responses via an API endpoint as well? -
At the client, "views" for the different response types must be implemented.
a. What would be a good approach to keep code duplication and boilerplate to a minimum?
b. Can we even provide a rendering information via the API as well (e.g. by exposing QML over a separate endpoint)? If implemented properly, this might allow us to provide link info for new providers without user interaction.
Migrating to JSON responses would require us to impose stricter requirements on the response schemas than what was necessary for HTML responses. Specification of such guidelines would be a good first step towards the implementation.