A lot :)
This commit is contained in:
parent
aad67af0d1
commit
63fc206c27
153 changed files with 2043 additions and 646 deletions
|
|
@ -1,7 +1,11 @@
|
|||
require 'net/http'
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "net/http"
|
||||
|
||||
class Link < ApplicationRecord
|
||||
belongs_to :link_category
|
||||
has_and_belongs_to_many :checks
|
||||
|
||||
has_rich_text :description_html
|
||||
|
||||
validates :url, :text, presence: true
|
||||
|
|
@ -10,13 +14,21 @@ class Link < ApplicationRecord
|
|||
|
||||
before_validation :ensure_absolute_url
|
||||
|
||||
def t_text
|
||||
text
|
||||
end
|
||||
|
||||
def ok?
|
||||
fail_count == 0
|
||||
fail_count.zero?
|
||||
end
|
||||
|
||||
def to_s
|
||||
"#{text} (#{url})"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0'
|
||||
USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0"
|
||||
|
||||
def check_url(input = url, add_error = true)
|
||||
response = begin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue