Skip to content

Public installs as JSON that any website can read - #40

Merged
MCCProgrammer merged 1 commit into
mainfrom
feat/public-installs-json
Oct 29, 2026
Merged

MCCProgrammer merged 1 commit into
mainfrom
feat/public-installs-json

Conversation

@MCCProgrammer

Copy link
Copy Markdown
Owner

Adds GET /p/{slug}/installs.json: the exact installs of each extension on a public page and their total.

{ "installs": 28311, "extensions": [ { "id": 1, "name": "Debug Data Structures Visualizer", "installs": 20163 } ] }

Why: the badges only carry a rounded string (20.2k) and are images, so a portfolio site can't show the numbers in its own style. My site (mccprogrammer.com) will read this endpoint so its project cards stay current without editing them by hand.

Details

  • Access-Control-Allow-Origin: *: the data is public, read-only and served without cookies, so letting any origin read it from the browser exposes nothing new. A simple GET needs no preflight, so no Spring CORS configuration is involved.
  • Same rules as the badges: 404 until the account chooses an address, cached for an hour (numbers change once a day).
  • README: the endpoint is listed with the public page and badges.

Tests: PublicPagesTests.exactInstallsComeAsJsonThatAnyWebsiteMayRead (404 before the address is chosen; header, cache, totals, per-extension numbers, no email). Removing the CORS header makes it fail. ./mvnw verify: 183 tests pass.

@sonarqubecloud

Copy link
Copy Markdown

@MCCProgrammer
MCCProgrammer merged commit 2d6e3aa into main Oct 29, 2026
10 checks passed
@MCCProgrammer
MCCProgrammer deleted the feat/public-installs-json branch October 29, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant