mobile_controller.rb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class MobileController < ApplicationController
  3. def index
  4. render(layout: 'layouts/mobile', locals: { locale: current_user&.preferences&.dig(:locale) })
  5. end
  6. def service_worker
  7. render(file: Rails.root.join("public/#{ViteRuby.config.public_output_dir}/sw.js"), layout: false)
  8. end
  9. def manifest
  10. name = Setting.get('organization').presence || Setting.get('product_name').presence || 'Zammad'
  11. render(
  12. layout: false,
  13. json: {
  14. id: '/mobile/',
  15. short_name: 'Zammad',
  16. name: name,
  17. # TODO
  18. # dir: "ltr",
  19. # lang: "en-US",
  20. orientation: 'portrait',
  21. background_color: '#191919',
  22. theme_color: '#191919',
  23. display: 'standalone',
  24. start_url: '/mobile/',
  25. icons: [
  26. # files are relative to manifest.webmanifest and are stored in public/assets/frontend
  27. { src: '../assets/frontend/app-icon-512.png', sizes: '512x512', type: 'image/png' },
  28. { src: '../assets/frontend/app-icon-192.png', sizes: '192x192', type: 'image/png' },
  29. ]
  30. },
  31. content_type: 'application/manifest+json'
  32. )
  33. end
  34. end