2024-02-02 09:05:04 -06:00
|
|
|
class ApplicationController < ActionController::Base
|
2024-02-05 06:05:13 +11:00
|
|
|
include Authentication
|
2024-03-08 15:11:58 -05:00
|
|
|
include Pagy::Backend
|
2024-02-05 06:05:13 +11:00
|
|
|
|
2024-04-04 23:00:12 +02:00
|
|
|
before_action :sync_accounts
|
|
|
|
|
2024-02-09 15:29:31 +00:00
|
|
|
default_form_builder ApplicationFormBuilder
|
|
|
|
|
2024-02-02 09:05:04 -06:00
|
|
|
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
|
|
|
allow_browser versions: :modern
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2024-02-02 17:49:28 -06:00
|
|
|
def hosted_app?
|
|
|
|
ENV["HOSTED"] == "true"
|
|
|
|
end
|
|
|
|
helper_method :hosted_app?
|
2024-04-04 23:00:12 +02:00
|
|
|
|
|
|
|
def sync_accounts
|
|
|
|
return if Current.user.blank?
|
|
|
|
|
|
|
|
if Current.user.last_login_at.nil? || Current.user.last_login_at.before?(Date.current.beginning_of_day)
|
|
|
|
Current.family.sync_accounts
|
|
|
|
end
|
|
|
|
end
|
2024-02-02 09:05:04 -06:00
|
|
|
end
|