application_build_checksum.rb 616 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class ApplicationBuildChecksum < BaseQuery
  4. description 'Checksum of the currently built front-end application. If this changes, the front-end(s) should reload.'
  5. type String, null: false
  6. def resolve(...)
  7. # Use a stable identifier for the development environment, as we use hot reloading there instead.
  8. return 'development-auto-build' if Rails.env.development?
  9. filename = Rails.public_path.join('vite/manifest.json')
  10. Digest::MD5.hexdigest(File.read(filename))
  11. end
  12. end
  13. end