Skip to content

Add a Bearer-authenticated Latchshot bookmark preview provider #2483

Description

@BaiqingL

Add a Bearer-authenticated Latchshot bookmark preview provider

Disclosure: I directly maintain Latchshot, the service proposed below. This is a provider-fit question, not a claim of Nextcloud affiliation.

Is your feature request related to a problem? Please describe.

Bookmarks currently supports provider-specific Screeenly and ScreenshotMachine previewers plus a generic direct-image URL. The generic path is not a safe fit for APIs that require an Authorization: Bearer header: using it for Latchshot would require putting the API key in the configured URL, which I do not want to recommend.

Describe the solution you'd like

Would you accept a separate LatchshotBookmarkPreviewer, modeled after the existing provider-specific previewers while leaving them unchanged?

The proposed path would:

  • store one Latchshot key in a dedicated server-side app setting such as previews.latchshot.key and render it as a password field in admin settings;
  • call only fixed-origin POST https://latchshot.fly.dev/v1/render with Authorization: Bearer … and a JSON body;
  • request a public-page 800 × 800 JPEG with the existing two-second delay;
  • accept only HTTP 200 plus image/jpeg, reject bodies above 15 MB, and then return the existing Image('image/jpeg', $body) type;
  • reuse Bookmarks' existing one-month FileCache ownership and the admin test-preview route; and
  • expose no custom endpoint, checkout, plan-changing action, or credential in a URL.

The renderer intentionally accepts only public HTTP/HTTPS pages on ports 80/443. It does not support cookies or login state, arbitrary scripts/actions, private-network targets, proxy rotation, CAPTCHA solving, or anti-bot bypass. Those boundaries would be stated in the admin copy rather than presenting this as a general browser or a drop-in replacement for every previewer.

Latchshot provides 100 successful renders per UTC calendar month without a card; only successful renders consume quota. Payment and plan activation remain outside Bookmarks and are handled separately by the service owner.

I have not created a fork or implementation PR because this repository's checks require a Developer Certificate of Origin sign-off. I am asking for provider/design fit first; no DCO-signed commit or PR should be created until the Latchshot owner separately reviews and authorizes that legal attestation.

Describe alternatives you've considered

  • Keep using the existing ScreenshotMachine, Screeenly, Pageres, Webshot, or generic provider paths.
  • Put a Latchshot key in the generic URL. Rejected because URLs are routinely logged, cached, copied, and exposed in diagnostics; the key belongs in a header.
  • Add arbitrary headers to the generic provider. That is broader configuration and secret-handling surface than one fixed-origin provider, so I would not propose it unless maintainers prefer that abstraction.

Additional context

The fixed request would be equivalent to:

{
  "url": "https://example.com",
  "format": "jpeg",
  "quality": 85,
  "width": 800,
  "height": 800,
  "delay": 2000
}

If maintainers prefer the generic-provider abstraction or do not want another hosted preview service, that answer would avoid an unnecessary implementation and DCO-bound pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions