Skip to content

WIP: Data injection for index.html

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

This is a WIP MR for injecting initial data into the index.html for speed up initial page display and reduce network fetches.

the data is a JSON encoded Map with the keys representing the endpoint urls usually hit and the values being the returned data. It takes the shape of this redacted snippet:

  "/api/v1/instance": %{
    avatar_upload_limit: 2000000,
    background_upload_limit: 4000000,
    ......
  },
  "/instance/panel.html": "<div style=\"margin-left:12px; margin-right:12px\"><p><a href=\"/main/all\">Pleroma FE</a> | <a href=\"/web\">Mastodon FE</a></p>",
  "/nodeinfo/2.0": %{
    metadata: %{
      accountActivationRequired: false,
      features: ["pleroma_api", "mastodon_api", "mastodon_api_streaming",
       "polls", "pleroma_explicit_addressing", "shareable_emoji_packs",
       "multifetch", "pleroma:api/v1/notifications:include_types_filter",
       "chat", "relay"],
      federation: %{
        enabled: true,
        exclusions: false,
        mrf_policies: ["NoOpPolicy"],
        quarantined_instances: []
      },
      .....
    },
    usage: %{localPosts: nil, users: %{total: 0}},
    version: "2.0"
  },
  "api/v1/accounts": %{
    acct: "nick1179",
    avatar: "http://localhost:4001/images/avi.png",
    avatar_static: "http://localhost:4001/images/avi.png",
    bot: false,
    created_at: "2020-04-06T13:17:03.000Z",
    display_name: "Test テスト User 1179",
    ........
    url: "http://localhost:4001/users/nick1179",
    username: "nick1179"
  },
  "api/v1/accounts/relationships": [
    %{
      blocked_by: false,
      blocking: false,
      .......
      requested: false,
      showing_reblogs: true,
      subscribing: false
    }
  ]
}

Please comment on data shape or which additional calls should be included.

Edited by Steven Fuchs

Merge request reports