Disable v6 check for trumpplan, tempfix for purge cache, uncomment

manifest entries
This commit is contained in:
Kyle Drake 2017-05-05 14:27:29 -07:00
parent d0a59f5de1
commit d2fc7a3a16
4 changed files with 12 additions and 7 deletions

View file

@ -67,12 +67,13 @@ def trump_plan_eligible?
ranges = [] ranges = []
if File.exist? trumpplan_path if File.exist? trumpplan_path
parsed_ip = IPAddress.parse request.ip
return false if parsed_ip.ipv6? # NOT EXCLUSIVE ENOUGH
File.readlines(trumpplan_path).each do |range| File.readlines(trumpplan_path).each do |range|
ranges << IPAddress.parse(range.strip) ranges << IPAddress.parse(range.strip)
end end
parsed_ip = IPAddress.parse(request.ip)
matched_ip = false matched_ip = false
ranges.each do |range| ranges.each do |range|
if range.include? parsed_ip if range.include? parsed_ip

View file

@ -4,7 +4,7 @@
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]--> <!--[if (gt IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="manifest" href="/manifest.json"> <!-- <link rel="manifest" href="/manifest.json"> -->
<title>Neocities: Create your own free website!</title> <title>Neocities: Create your own free website!</title>
<meta itemprop="name" content="Neocities" /> <meta itemprop="name" content="Neocities" />

View file

@ -3,7 +3,7 @@
<head> <head>
<title><%= title %></title> <title><%= title %></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="manifest" href="/manifest.json"> <!-- <link rel="manifest" href="/manifest.json"> -->
<meta itemprop="name" content="Neocities.org"> <meta itemprop="name" content="Neocities.org">
<meta itemprop="description" content="Free web hosting and tools that allow anyone to create a website. Join our community today!"> <meta itemprop="description" content="Free web hosting and tools that allow anyone to create a website. Join our community today!">
<meta name="description" content="Free web hosting and tools that allow anyone to create a website. Join our community today!"> <meta name="description" content="Free web hosting and tools that allow anyone to create a website. Join our community today!">

View file

@ -1,7 +1,7 @@
require 'open-uri' require 'open-uri'
class PurgeCacheWorker class PurgeCacheWorker
HTTP_TIMEOUT = 3 HTTP_TIMEOUT = 10
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options queue: :purgecache, retry: 2, backtrace: false, average_scheduled_poll_interval: 1 sidekiq_options queue: :purgecache, retry: 2, backtrace: false, average_scheduled_poll_interval: 1
@ -22,9 +22,13 @@ class PurgeCacheWorker
retry_encoded = false retry_encoded = false
begin begin
HTTP.timeout(read: 10, write: 10, connect: 2). #cmd = %{timeout 5 curl -k -I -H "Host: #{URI::encode("#{username}.neocities.org")}" -H "Cache-Purge: 1" "#{url}"}
#`#{cmd}`
ctx = OpenSSL::SSL::SSLContext.new
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
HTTP.follow.timeout(read: 10, write: 10, connect: 5).
headers(host: URI::encode("#{username}.neocities.org"), cache_purge: '1'). headers(host: URI::encode("#{username}.neocities.org"), cache_purge: '1').
head(url) head(url, ssl_context: ctx)
rescue URI::InvalidURIError rescue URI::InvalidURIError
raise if retry_encoded == true raise if retry_encoded == true
url = URI.encode url url = URI.encode url