diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb
index abea2047..12e17907 100644
--- a/app/controllers/static_controller.rb
+++ b/app/controllers/static_controller.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
class StaticController < ApplicationController
+ include ThemeHelper
+
def index
if user_signed_in?
@timeline = current_user.cursored_timeline(last_id: params[:last_id])
@@ -53,4 +55,37 @@ class StaticController < ApplicationController
def terms
end
+
+ def webapp_manifest
+ render json: {
+ name: APP_CONFIG["site_name"],
+ description: t(".front.subtitle"),
+ start_url: root_url(source: "pwa"),
+ scope: root_url,
+ display: "standalone",
+ categories: %w[social],
+ lang: I18n.locale,
+ shortcuts: [
+ {
+ name: t('views.navigation.inbox'),
+ url: inbox_url,
+ icons: [
+ {
+ src: "/icons/shortcuts/inbox.svg",
+ sizes: "96x96"
+ }
+ ]
+ }
+ ],
+ icons: %i[1024 512 384 192 128 96 72 48].map do |size|
+ [
+ { src: "/icons/maskable_icon_x#{size}.webp", size: "#{size}x#{size}", type: "image/webp" },
+ { src: "/icons/maskable_icon_x#{size}.png", size: "#{size}x#{size}", type: "image/png" }
+ ]
+ end.flatten,
+ theme_color: theme_color,
+ background_color: mobile_theme_color,
+ orientation: "any"
+ }
+ end
end
diff --git a/app/views/layouts/base.haml b/app/views/layouts/base.haml
index b0e54017..90dde5cd 100644
--- a/app/views/layouts/base.haml
+++ b/app/views/layouts/base.haml
@@ -1,5 +1,5 @@
!!! 5
-%html{ lang: 'en', prefix: 'og: https://ogp.me/ns#' }
+%html{ lang: I18n.locale, prefix: 'og: https://ogp.me/ns#' }
%head
%meta{ charset: 'utf-8' }
%meta{ 'http-equiv': 'X-UA-Compatible', content: 'IE=edge' }
@@ -9,7 +9,9 @@
%meta{ name: 'theme-color', content: mobile_theme_color, media: '(max-width: 992px)' }
- else
%meta{ name: 'theme-color', content: theme_color }
+ %link{ rel: 'manifest', href: '/manifest.json', crossorigin: 'use-credentials' }
%link{ rel: 'apple-touch-icon', href: '/apple-touch-icon-precomposed.png' }
+ %link{ rel: 'mask-icon', href: '/icons/icon.svg', color: theme_color }
%link{ rel: 'icon', href: '/images/favicon/favicon-16.png', sizes: '16x16' }
%link{ rel: 'icon', href: '/icon-152.png', sizes: '152x152' }
%link{ rel: 'icon', href: '/images/favicon/favicon-32.png', sizes: '32x32' }
diff --git a/config/routes.rb b/config/routes.rb
index 37052e35..195b3762 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -42,6 +42,7 @@ Rails.application.routes.draw do
match '/privacy', to: 'static#privacy_policy', via: 'get', as: :privacy_policy
match '/terms', to: 'static#terms', via: 'get', as: :terms
match '/linkfilter', to: 'static#linkfilter', via: 'get', as: :linkfilter
+ match '/manifest.json', to: 'static#webapp_manifest', via: 'get', as: :webapp_manifest
# Devise routes
devise_for :users, path: 'user', skip: [:sessions, :registrations]
diff --git a/public/icons/icon.svg b/public/icons/icon.svg
new file mode 100644
index 00000000..e64ed124
--- /dev/null
+++ b/public/icons/icon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/public/icons/maskable_icon_x1024.png b/public/icons/maskable_icon_x1024.png
new file mode 100644
index 00000000..18ca2d63
Binary files /dev/null and b/public/icons/maskable_icon_x1024.png differ
diff --git a/public/icons/maskable_icon_x1024.webp b/public/icons/maskable_icon_x1024.webp
new file mode 100644
index 00000000..23d89cc5
Binary files /dev/null and b/public/icons/maskable_icon_x1024.webp differ
diff --git a/public/icons/maskable_icon_x128.png b/public/icons/maskable_icon_x128.png
new file mode 100644
index 00000000..cde536d6
Binary files /dev/null and b/public/icons/maskable_icon_x128.png differ
diff --git a/public/icons/maskable_icon_x128.webp b/public/icons/maskable_icon_x128.webp
new file mode 100644
index 00000000..14eb13d1
Binary files /dev/null and b/public/icons/maskable_icon_x128.webp differ
diff --git a/public/icons/maskable_icon_x192.png b/public/icons/maskable_icon_x192.png
new file mode 100644
index 00000000..6f9e273e
Binary files /dev/null and b/public/icons/maskable_icon_x192.png differ
diff --git a/public/icons/maskable_icon_x192.webp b/public/icons/maskable_icon_x192.webp
new file mode 100644
index 00000000..75e356ab
Binary files /dev/null and b/public/icons/maskable_icon_x192.webp differ
diff --git a/public/icons/maskable_icon_x384.png b/public/icons/maskable_icon_x384.png
new file mode 100644
index 00000000..4fa5712a
Binary files /dev/null and b/public/icons/maskable_icon_x384.png differ
diff --git a/public/icons/maskable_icon_x384.webp b/public/icons/maskable_icon_x384.webp
new file mode 100644
index 00000000..5afc57de
Binary files /dev/null and b/public/icons/maskable_icon_x384.webp differ
diff --git a/public/icons/maskable_icon_x48.png b/public/icons/maskable_icon_x48.png
new file mode 100644
index 00000000..0901988f
Binary files /dev/null and b/public/icons/maskable_icon_x48.png differ
diff --git a/public/icons/maskable_icon_x48.webp b/public/icons/maskable_icon_x48.webp
new file mode 100644
index 00000000..4cab6b1b
Binary files /dev/null and b/public/icons/maskable_icon_x48.webp differ
diff --git a/public/icons/maskable_icon_x512.png b/public/icons/maskable_icon_x512.png
new file mode 100644
index 00000000..231e17cd
Binary files /dev/null and b/public/icons/maskable_icon_x512.png differ
diff --git a/public/icons/maskable_icon_x512.webp b/public/icons/maskable_icon_x512.webp
new file mode 100644
index 00000000..9d92bb96
Binary files /dev/null and b/public/icons/maskable_icon_x512.webp differ
diff --git a/public/icons/maskable_icon_x72.png b/public/icons/maskable_icon_x72.png
new file mode 100644
index 00000000..feba0723
Binary files /dev/null and b/public/icons/maskable_icon_x72.png differ
diff --git a/public/icons/maskable_icon_x72.webp b/public/icons/maskable_icon_x72.webp
new file mode 100644
index 00000000..b37fa2d6
Binary files /dev/null and b/public/icons/maskable_icon_x72.webp differ
diff --git a/public/icons/maskable_icon_x96.png b/public/icons/maskable_icon_x96.png
new file mode 100644
index 00000000..8f76ce20
Binary files /dev/null and b/public/icons/maskable_icon_x96.png differ
diff --git a/public/icons/maskable_icon_x96.webp b/public/icons/maskable_icon_x96.webp
new file mode 100644
index 00000000..e8b6ab7c
Binary files /dev/null and b/public/icons/maskable_icon_x96.webp differ
diff --git a/public/icons/shortcuts/inbox.svg b/public/icons/shortcuts/inbox.svg
new file mode 100644
index 00000000..e4ae6418
--- /dev/null
+++ b/public/icons/shortcuts/inbox.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file