mirror of
https://github.com/neocities/neocities.git
synced 2025-06-13 16:04:31 +02:00
add htm to uri, use site.uri for screenshot
This commit is contained in:
parent
0e827319cd
commit
3a41029313
3 changed files with 4 additions and 4 deletions
|
@ -1438,7 +1438,7 @@ class Site < Sequel::Model
|
||||||
return uri unless path
|
return uri unless path
|
||||||
|
|
||||||
path = '' if path == '/' || path =~ ROOT_INDEX_HTML_REGEX
|
path = '' if path == '/' || path =~ ROOT_INDEX_HTML_REGEX
|
||||||
path = path.sub(%r{^/}, '').sub(%r{/index\.html$}, '/').sub(/\.html$/, '')
|
path = path.sub(%r{^/}, '').sub(%r{/index\.html?$}, '/').sub(/\.html?$/, '')
|
||||||
|
|
||||||
unless path.empty?
|
unless path.empty?
|
||||||
escaped_path = self.class.escape_path path
|
escaped_path = self.class.escape_path path
|
||||||
|
|
|
@ -12,7 +12,7 @@ describe ScreenshotWorker do
|
||||||
base_host += ":#{uri.port}"
|
base_host += ":#{uri.port}"
|
||||||
end
|
end
|
||||||
|
|
||||||
stub_request(:get, "#{base_host}/?url=#{site.uri}/#{path}&wait_time=#{ScreenshotWorker::PAGE_WAIT_TIME}").
|
stub_request(:get, "#{base_host}/?url=#{site.uri(path)}&wait_time=#{ScreenshotWorker::PAGE_WAIT_TIME}").
|
||||||
with(basic_auth: [uri.user, uri.password]).
|
with(basic_auth: [uri.user, uri.password]).
|
||||||
to_return(status: 200, headers: {}, body: File.read('tests/files/img/screenshot.png'))
|
to_return(status: 200, headers: {}, body: File.read('tests/files/img/screenshot.png'))
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,11 @@ class ScreenshotWorker
|
||||||
|
|
||||||
uri = Addressable::URI.parse $config['screenshot_urls'].sample
|
uri = Addressable::URI.parse $config['screenshot_urls'].sample
|
||||||
api_user, api_password = uri.user, uri.password
|
api_user, api_password = uri.user, uri.password
|
||||||
|
|
||||||
uri = "#{uri.scheme}://#{uri.host}:#{uri.port}" + '?' + Rack::Utils.build_query(
|
uri = "#{uri.scheme}://#{uri.host}:#{uri.port}" + '?' + Rack::Utils.build_query(
|
||||||
url: Site.select(:username,:domain).where(username: username).first.uri + path,
|
url: site.uri(path),
|
||||||
wait_time: PAGE_WAIT_TIME
|
wait_time: PAGE_WAIT_TIME
|
||||||
)
|
)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
base_image_tmpfile_path = "/tmp/#{SecureRandom.uuid}.png"
|
base_image_tmpfile_path = "/tmp/#{SecureRandom.uuid}.png"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue