Skip to content

Preload data into index.html

Steven Fuchs requested to merge stwf/pleroma:preload-data into develop

This MR addresses some performance issues by inserting data into script tags into the served index.html file. This will allow FE developers to bypass several data fetches.

The data will be represented by a map, with the keys being the url the data resides at. And the values being the encoded data. The encoding is JSON encoding followed by Base64 encoding. This was the best combination we could find to eliminate leakage from the structure as well as produce valid JSON when decoded.

The tag looks like this.

<script id="initial-results" type="application/json">
{
  "/api/v1/instance":"eyJhdmF0Y...XJfdXBsb2Fk=",
  "/api/v1/timelines/public":"cGZfc3R3Zl8yP...C9zcGFuPjwvYT=",
  "/instance/panel.html":"IjxkaXYgc3R5bG...U9XCJtYXJnaW=",
  "/nodeinfo/2.0":"eyJtZ...XRhZGF=",
  "/status_net/config":"Ijxjb25ma...Wc+XG4="
}
</script>

Closes: #1660 (closed)

Edited by Haelwenn

Merge request reports