A lot :)
Some checks failed
/ Run tests (push) Successful in 8m56s
/ Run system tests (push) Failing after 1h0m48s
/ Build, push and deploy image (push) Successful in 7m47s

This commit is contained in:
david 2024-09-05 22:54:38 +02:00
parent aad67af0d1
commit 63fc206c27
153 changed files with 2043 additions and 646 deletions

View file

@ -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