FEATURE: Allow users to fetch a customized manifest on PWA install

FEATURE: Allow users to fetch a customized manifest on PWA install

This will allow users installing a Discourse PWA to use their active theme colors on the generated app. Thanks for @mgiuca for the tip.

Also makes the share_target config explicit to silence Chrome warnings

diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rb
index bbe977b..c508df5 100644
--- a/app/controllers/metadata_controller.rb
+++ b/app/controllers/metadata_controller.rb
@@ -40,6 +40,8 @@ class MetadataController < ApplicationController
       ],
       share_target: {
         action: "/new-topic",
+        method: "GET",
+        enctype: "application/x-www-form-urlencoded",
         params: {
           title: "title",
           text: "body"
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index a01460c..e12c493 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -44,7 +44,7 @@
 
     <%= render_google_tag_manager_head_code %>
     <%= render_google_universal_analytics_code %>
-    <link rel="manifest" href="<%= Discourse.base_uri %>/manifest.webmanifest">
+    <link rel="manifest" href="<%= Discourse.base_uri %>/manifest.webmanifest" crossorigin="use-credentials">
 
     <%- if SiteSetting.native_app_install_banner? %>
         <meta name="apple-itunes-app" content="app-id=1173672076">

GitHub sha: 8ce20090

1 Like