Download and attach icons for web apps
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
class AppCatalog::WebApp < ApplicationRecord
|
||||
|
||||
store :metadata, coder: JSON
|
||||
|
||||
has_one_attached :icon do |attachable|
|
||||
attachable.variant :medium, resize_to_limit: [128,128]
|
||||
attachable.variant :large, resize_to_limit: [256,256]
|
||||
end
|
||||
|
||||
has_one_attached :apple_touch_icon
|
||||
|
||||
validates :url, presence: true, uniqueness: true
|
||||
validates :url, format: { with: URI.regexp },
|
||||
if: Proc.new { |a| a.url.present? }
|
||||
|
||||
# before_create :update_metadata
|
||||
|
||||
def update_metadata
|
||||
AppCatalogManager::UpdateMetadata.call(self)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user