about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/about/index.html.haml3
-rw-r--r--app/views/home/index.html.haml3
-rw-r--r--app/views/home/initial_state.json.rabl24
3 files changed, 30 insertions, 0 deletions
diff --git a/app/views/about/index.html.haml b/app/views/about/index.html.haml
index b0260dc51..6bc416cbd 100644
--- a/app/views/about/index.html.haml
+++ b/app/views/about/index.html.haml
@@ -1,3 +1,6 @@
+- content_for :header_tags do
+  = javascript_include_tag 'application_public'
+
 - content_for :page_title do
   = Rails.configuration.x.local_domain
 
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
index 498fae105..730249129 100644
--- a/app/views/home/index.html.haml
+++ b/app/views/home/index.html.haml
@@ -1,4 +1,7 @@
 - content_for :header_tags do
+  :javascript
+    window.INITIAL_STATE = #{render(file: 'home/initial_state', formats: :json)}
+
   = javascript_include_tag 'application'
 
 = react_component 'Mastodon', default_props, class: 'app-holder', prerender: false
diff --git a/app/views/home/initial_state.json.rabl b/app/views/home/initial_state.json.rabl
new file mode 100644
index 000000000..0e9736f5f
--- /dev/null
+++ b/app/views/home/initial_state.json.rabl
@@ -0,0 +1,24 @@
+object false
+
+node(:meta) {
+  {
+    access_token: @token,
+    locale: I18n.locale,
+    me: current_account.id,
+  }
+}
+
+node(:compose) {
+  {
+    me: current_account.id,
+    private: current_account.locked?,
+  }
+}
+
+node(:accounts) {
+  {
+    current_account.id => partial('api/v1/accounts/show', object: current_account),
+  }
+}
+
+node(:settings) { @web_settings }