ensure useragent is not null
This commit is contained in:
parent
dac8ef2283
commit
43f3301237
@ -73,7 +73,7 @@ class ApplicationController < ActionController::Base
|
|||||||
APIUsage.create!(
|
APIUsage.create!(
|
||||||
user_id: CurrentUser.is_anonymous? ? nil : CurrentUser.id,
|
user_id: CurrentUser.is_anonymous? ? nil : CurrentUser.id,
|
||||||
api_key: @apikey.nil? || @apikey.is_anon? ? nil : @apikey,
|
api_key: @apikey.nil? || @apikey.is_anon? ? nil : @apikey,
|
||||||
user_agent: request.headers["user-agent"],
|
user_agent: request.headers["user-agent"] || "",
|
||||||
method: request.method,
|
method: request.method,
|
||||||
path: request.path,
|
path: request.path,
|
||||||
params: request.params.to_json,
|
params: request.params.to_json,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ExceptionsController < ApplicationController
|
class ExceptionsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@pagy, @exceptions = pagy(ExceptionLog.order(id: :desc), items: 25)
|
@pagy, @exceptions = pagy(ExceptionLog.order(id: :desc), items: 25)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module PoolIndex
|
module PoolIndex
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class APIImage < ApplicationRecord
|
|||||||
invalidate_cache
|
invalidate_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_header_info(file_path)
|
def file_header_info(file_path)
|
||||||
File.open(file_path) do |bin|
|
File.open(file_path) do |bin|
|
||||||
mime_type = Marcel::MimeType.for(bin)
|
mime_type = Marcel::MimeType.for(bin)
|
||||||
ext = case mime_type
|
ext = case mime_type
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module E621
|
module E621
|
||||||
class Pool < ApplicationRecord
|
class Pool < ApplicationRecord
|
||||||
self.table_name = "e621.pools"
|
self.table_name = "e621.pools"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module E621
|
module E621
|
||||||
class Post < ApplicationRecord
|
class Post < ApplicationRecord
|
||||||
self.table_name = "e621.posts"
|
self.table_name = "e621.posts"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module E621
|
module E621
|
||||||
class Tag < ApplicationRecord
|
class Tag < ApplicationRecord
|
||||||
self.table_name = "e621.tags"
|
self.table_name = "e621.tags"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module E621
|
module E621
|
||||||
class TagAlias < ApplicationRecord
|
class TagAlias < ApplicationRecord
|
||||||
self.table_name = "e621.tag_aliases"
|
self.table_name = "e621.tag_aliases"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module E621
|
module E621
|
||||||
class TagImplication < ApplicationRecord
|
class TagImplication < ApplicationRecord
|
||||||
self.table_name = "e621.tag_implications"
|
self.table_name = "e621.tag_implications"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module E621
|
module E621
|
||||||
class WikiPage < ApplicationRecord
|
class WikiPage < ApplicationRecord
|
||||||
self.table_name = "e621.wiki_pages"
|
self.table_name = "e621.wiki_pages"
|
||||||
|
@ -8,7 +8,7 @@ class ExceptionLog < ApplicationRecord
|
|||||||
host: Socket.gethostname,
|
host: Socket.gethostname,
|
||||||
params: request.filtered_parameters,
|
params: request.filtered_parameters,
|
||||||
referrer: request.referrer,
|
referrer: request.referrer,
|
||||||
user_agent: request.user_agent,
|
user_agent: request.user_agent || "",
|
||||||
}
|
}
|
||||||
|
|
||||||
# Required to unwrap exceptions that occur inside template rendering.
|
# Required to unwrap exceptions that occur inside template rendering.
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
def cache_store
|
def cache_store
|
||||||
[:memory_store, { size: 64.megabytes }]
|
[:memory_store, { size: 64.megabytes }]
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
#
|
|
||||||
Rails.configuration.to_prepare do
|
Rails.configuration.to_prepare do
|
||||||
GitHelper.init
|
GitHelper.init
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class CreateE621ExportTables < ActiveRecord::Migration[7.1]
|
class CreateE621ExportTables < ActiveRecord::Migration[7.1]
|
||||||
def change
|
def change
|
||||||
reversible do |r|
|
reversible do |r|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AddE621PoolsTagString < ActiveRecord::Migration[7.1]
|
class AddE621PoolsTagString < ActiveRecord::Migration[7.1]
|
||||||
def change
|
def change
|
||||||
add_column(:"e621.pools", :tag_string, :string, null: false, default: "")
|
add_column(:"e621.pools", :tag_string, :string, null: false, default: "")
|
||||||
|
Loading…
Reference in New Issue
Block a user