fix for .htm indexes

This commit is contained in:
Kyle Drake 2024-12-12 15:33:25 -06:00
parent aae94f2078
commit 40bef7d125

View file

@ -121,6 +121,7 @@ end
get '/browse/search' do get '/browse/search' do
if params[:q] if params[:q]
@title = 'Search Results'
query_count = $redis_cache.get("search_query_count").to_i query_count = $redis_cache.get("search_query_count").to_i
if query_count >= $config['google_custom_search_query_limit'] if query_count >= $config['google_custom_search_query_limit']
halt 429, "Query limit reached. Please try again tomorrow." halt 429, "Query limit reached. Please try again tomorrow."
@ -152,14 +153,12 @@ get '/browse/search' do
site = Site[username: username] site = Site[username: username]
next if site.nil? || site.is_deleted || site.is_nsfw next if site.nil? || site.is_deleted || site.is_nsfw
if link.path[-1] == '/' link.path << 'index' if link.path[-1] == '/'
link.path << 'index.html'
else ['.html', '.htm'].each do |ext|
['.html', '.htm'].each do |ext| if site.screenshot_exists?(link.path + ext, '540x405')
if site.screenshot_exists?(link.path + ext, '540x405') link.path += ext
link.path += ext break
break
end
end end
end end