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

Backend for reference metadata fetching #33494

Merged
merged 12 commits into from Aug 31, 2022
Merged

Backend for reference metadata fetching #33494

merged 12 commits into from Aug 31, 2022

Conversation

juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Aug 10, 2022

Summary

This is about showing a preview of links posted in Talk, like what is done when posting links on other chat platforms.

And this is the backend part, is not specific to Talk, and may not be specific to links in the future, which is what makes the original description convoluted.

This PR implements an API to be used to generate a rich preview rendering of references (which are links in the first iteration). The backend gathers additional metadata for references through different providers, which can be added by apps, but there is a fallback to an open graph provider by default. The open graph extraction can be turned off through config.php.

ToDo

Backend

  • Implement a provider based API to fetch metadata for a link reference
    • Fallback to open graph fetching for unknown link references
      • config option to disable opengraph
      • Cache images in app data
        • Limit to sane content types
        • Limit in size
    • Reference metadata is stored in memory cache only as a database might not bring much benefit here
    • Providers can expose how their metadata should be cached (globally or per unique cache key, e.g. the user id)
    • Allow provider registration through Bootstrap
    • rate limit for uncached references
  • OCS API endpoints for fetching the metadata from the frontend
  • OCP API for fetching the metadata in apps

Integration

  • Talk (vue-richtext)
  • Text (custom implementation but reusing vue-richtext components)
  • Comments (would need to migrate to vue-richtext)

Provider implementations

  • Server
    • Files
    • Profile
  • Talk conversation
  • Deck card

@juliushaertl juliushaertl force-pushed the enh/references branch 2 times, most recently from 4b2fb66 to 445ea5f Compare August 12, 2022 19:04
@juliushaertl juliushaertl self-assigned this Aug 25, 2022
@juliushaertl juliushaertl marked this pull request as ready for review August 29, 2022 06:00
@juliushaertl juliushaertl requested review from PVince81, nickvergessen, julien-nc, a team, icewind1991 and come-nc and removed request for a team August 29, 2022 06:00
@juliushaertl juliushaertl added enhancement 3. to review Waiting for reviews labels Aug 29, 2022
@juliushaertl juliushaertl added this to the Nextcloud 25 milestone Aug 29, 2022
@come-nc
Copy link
Contributor

come-nc commented Aug 29, 2022

It took me so long to understand what this is about, so, for other unaware reviewers:
This is about showing a preview of links posted in Talk, like what is done when posting links on other chat platforms.

And this is the backend part, is not specific to Talk, and may not be specific to links in the future, which is what makes the original description convoluted.

@juliushaertl
Copy link
Member Author

Sorry, should have clarified that a bit more, but I've taken your description for the first post in addition

core/Controller/ReferenceApiController.php Outdated Show resolved Hide resolved
core/Controller/ReferenceApiController.php Outdated Show resolved Hide resolved
core/Controller/ReferenceApiController.php Outdated Show resolved Hide resolved
core/Controller/ReferenceApiController.php Outdated Show resolved Hide resolved
core/Controller/ReferenceController.php Outdated Show resolved Hide resolved
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@nickvergessen nickvergessen added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 31, 2022
Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliushaertl
Copy link
Member Author

Failures unrelated

@juliushaertl juliushaertl merged commit b3eb0bf into master Aug 31, 2022
@juliushaertl juliushaertl deleted the enh/references branch August 31, 2022 18:12
Comment on lines +45 to +50
/**
* Return true if the reference metadata can be globally cached
*
* @since 25.0.0
*/
public function getCachePrefix(string $referenceId): string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phpdoc description is wrong

@juliushaertl
Copy link
Member Author

@juliushaertl juliushaertl removed the pending documentation This pull request needs an associated documentation update label Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants