lib/jekyll-chatgpt-translate/ping.rb in jekyll-chatgpt-translate-0.0.6 vs lib/jekyll-chatgpt-translate/ping.rb in jekyll-chatgpt-translate-0.0.7

- old
+ new

@@ -38,18 +38,19 @@ # Author:: Yegor Bugayenko (yegor256@gmail.com) # Copyright:: Copyright (c) 2023 Yegor Bugayenko # License:: MIT class GptTranslate::Ping # Ctor. - def initialize(site, link) + def initialize(site, path) @site = site - @link = link + raise 'Permalink must start with a slash' unless path.start_with?('/') + @path = path end def exists? home = @site.config['url'] return false if home.nil? - uri = Iri.new(home).path(@link) + uri = Iri.new(home).path(@path) before = Net::HTTP.get_response(URI(uri.to_s)) if before.is_a?(Net::HTTPSuccess) && before.body.include?("/#{GptTranslate::VERSION}") Jekyll.logger.info("No need to translate, page exists at #{uri} (#{before.body.split.count} words)") return true end