A platform for community discussion. Free, open, simple.
FEATURE: Update the webmanifest
Rafael dos Santos Silva8fc08aad09d0
diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rbindex e123b7c5352..7dcea154b46 100644--- a/app/controllers/metadata_controller.rb+++ b/app/controllers/metadata_controller.rb@@ -3,7 +3,7 @@ class MetadataController < ApplicationControllerskip_before_action :preload_json, :check_xhr, :redirect_to_login_if_requireddef manifest- render json: default_manifest.to_json+ render json: default_manifest.to_json, content_type: 'application/manifest+json'enddef opensearch@@ -23,11 +23,8 @@ class MetadataController < ApplicationControllername: SiteSetting.title,short_name: SiteSetting.title,display: 'standalone',- orientation: 'natural',+ orientation: 'any',start_url: "#{Discourse.base_uri}/",- share_target: {- url_template: 'new-topic?title={title}&body={text}%0A%0A{url}'- },background_color: "##{ColorScheme.hex_for_name('secondary')}",theme_color: "##{ColorScheme.hex_for_name('header_background')}",icons: [diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erbindex 58fff0c1a15..60d30d0fd49 100644--- a/app/views/layouts/application.html.erb+++ b/app/views/layouts/application.html.erb@@ -46,7 +46,7 @@<%= render_google_tag_manager_head_code %><%= render_google_universal_analytics_code %>- <link rel="manifest" href="<%= Discourse.base_uri %>/manifest.json">+ <link rel="manifest" href="<%= Discourse.base_uri %>/manifest.webmanifest"><%- if SiteSetting.native_app_install_banner? %><meta name="apple-itunes-app" content="app-id=1173672076">diff --git a/config/routes.rb b/config/routes.rbindex 1a1d68ee7c2..b81b84283e8 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -747,7 +747,8 @@ Discourse::Application.routes.draw doget "robots.txt" => "robots_txt#index"get "robots-builder.json" => "robots_txt#builder"get "offline.html" => "offline#index"- get "manifest.json" => "metadata#manifest", as: :manifest+ get "manifest.webmanifest" => "metadata#manifest", as: :manifest+ get "manifest.json" => "metadata#manifest"get "opensearch" => "metadata#opensearch", format: :xmlscope "/tags" dodiff --git a/spec/requests/metadata_controller_spec.rb b/spec/requests/metadata_controller_spec.rbindex 7018e09c20f..de317972d63 100644--- a/spec/requests/metadata_controller_spec.rb+++ b/spec/requests/metadata_controller_spec.rb@@ -1,15 +1,15 @@require 'rails_helper'RSpec.describe MetadataController do- describe 'manifest.json' do+ describe 'manifest.webmanifest' doit 'returns the right output' dotitle = 'MyApp'SiteSetting.title = titleSiteSetting.large_icon_url = "http://big.square/png"- get "/manifest.json"+ get "/manifest.webmanifest"expect(response.status).to eq(200)- expect(response.content_type).to eq('application/json')+ expect(response.content_type).to eq('application/manifest+json')manifest = JSON.parse(response.body)expect(manifest["name"]).to eq(title)@@ -18,7 +18,7 @@ RSpec.describe MetadataController doit 'can guess mime types' doSiteSetting.large_icon_url = "http://big.square/ico.jpg"- get "/manifest.json"+ get "/manifest.webmanifest"expect(response.status).to eq(200)manifest = JSON.parse(response.body)expect(manifest["icons"].first["type"]).to eq("image/jpeg")@@ -26,7 +26,7 @@ RSpec.describe MetadataController doit 'defaults to png' doSiteSetting.large_icon_url = "http://big.square/noidea.bogus"- get "/manifest.json"+ get "/manifest.webmanifest"expect(response.status).to eq(200)manifest = JSON.parse(response.body)expect(manifest["icons"].first["type"]).to eq("image/png")