diff --git a/app/controllers/pwa_controller.rb b/app/controllers/pwa_controller.rb new file mode 100644 index 00000000..d1d4e4f3 --- /dev/null +++ b/app/controllers/pwa_controller.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +class PwaController < ActionController::Base +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 590e0b23..df578657 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,6 +2,9 @@
<%= render 'layouts/head_tags' %> + <% if Docuseal.enable_pwa? %> + + <% end %> <%= csrf_meta_tags %> <%= csp_meta_tag %> diff --git a/app/views/pwa/manifest.json.erb b/app/views/pwa/manifest.json.erb new file mode 100644 index 00000000..3049f743 --- /dev/null +++ b/app/views/pwa/manifest.json.erb @@ -0,0 +1,25 @@ +{ + "name": "<%= Docuseal.product_name %>", + "short_name": "<%= Docuseal.product_name %>", + "id": "/", + "icons": [ + { + "src": "/logo.svg", + "type": "image/svg+xml", + "sizes": "any" + }, + { + "src": "/apple-touch-icon.png", + "type": "image/png", + "sizes": "192x192" + } + ], + "start_url": "/", + "display": "standalone", + "scope": "/", + "orientation": "natural", + "description": "<%= Docuseal.product_name %> is an open source platform that provides secure and efficient digital document signing and processing.", + "categories": ["productivity", "utilities"], + "theme_color": "#FAF7F4", + "background_color": "#FAF7F4" +} diff --git a/config/routes.rb b/config/routes.rb index b2f84549..0223f234 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,6 +12,7 @@ Rails.application.routes.draw do root 'dashboard#index' get 'up' => 'rails/health#show' + get 'manifest' => 'pwa#manifest' devise_for :users, path: '/', only: %i[sessions passwords omniauth_callbacks], diff --git a/lib/docuseal.rb b/lib/docuseal.rb index 4e08d724..f74b99d1 100644 --- a/lib/docuseal.rb +++ b/lib/docuseal.rb @@ -69,6 +69,10 @@ module Docuseal @default_pkcs ||= GenerateCertificate.load_pkcs(Docuseal::CERTS) end + def enable_pwa? + true + end + def trusted_certs @trusted_certs ||= ENV['TRUSTED_CERTS'].to_s.gsub('\\n', "\n").split("\n\n").map do |base64| diff --git a/public/apple-icon-180x180.png b/public/apple-icon-180x180.png index bc23cb2c..deb9f313 100644 Binary files a/public/apple-icon-180x180.png and b/public/apple-icon-180x180.png differ diff --git a/public/service-worker.js b/public/service-worker.js new file mode 100644 index 00000000..3334a5ae --- /dev/null +++ b/public/service-worker.js @@ -0,0 +1,11 @@ +self.addEventListener('install', () => { + console.log('DocuSeal App installed') +}) + +self.addEventListener('activate', () => { + console.log('DocuSeal App activated') +}) + +self.addEventListener('fetch', (event) => { + event.respondWith(fetch(event.request)) +})