2019-08-01 19:17:24 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# The base controller for all ActiveStorage controllers.
|
|
|
|
module ActiveStorage
|
2019-10-03 17:00:59 +08:00
|
|
|
class CustomBaseController < ApplicationController
|
2020-10-23 23:54:25 +08:00
|
|
|
include TokenAuthentication
|
2019-09-12 23:21:48 +08:00
|
|
|
include ActiveStorage::SetCurrent
|
2020-10-23 23:54:25 +08:00
|
|
|
|
|
|
|
prepend_before_action :authenticate_request!, if: -> { request.headers['Authorization'].present? }
|
|
|
|
skip_before_action :authenticate_user!, if: -> { current_user.present? }
|
2021-01-28 21:43:45 +08:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def stream(_blob)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
2019-08-01 19:17:24 +08:00
|
|
|
end
|
|
|
|
end
|