liberapay.com icon indicating copy to clipboard operation
liberapay.com copied to clipboard

Widgets performance and scaling

Open Changaco opened this issue 5 months ago • 0 comments

Widgets should be generated at the edge with Cloudflare Workers. The response times would be lower and there would be no risk of a surge of legitimate requests for widgets affecting the response times of other requests.

  • [ ] Write the JavaScript (or TypeScript) code. It will go into a new directory (edge/?) or repository (liberapay.com-edge?). A new component will be added for it in Weblate (https://hosted.weblate.org/projects/liberapay/), with a JSON-based translations file format.
    • [ ] Write a function to generate donate buttons equivalent to what ~/widgets/button.js.spt generates.
    • [ ] Write a function to generate “giving” and “receiving” widgets equivalent to what ~/widgets/%type.spt generates.
      • [ ] Fetch the giving or receiving amount from ~/public.json, turn it into text using Intl.NumberFormat, and interpolate that into the translation.
  • [ ] Deploy the workers on temporary paths and test them.

(Previous issue: #360.)

Changaco avatar Jan 21 '24 21:01 Changaco