mirror of
https://github.com/neocities/neocities.git
synced 2025-08-06 09:34:57 +02:00
supporters intelligence for proxy servers
This commit is contained in:
parent
f58aa79283
commit
5d4e5ec109
2 changed files with 19 additions and 5 deletions
20
Rakefile
20
Rakefile
|
@ -65,13 +65,27 @@ task :update_blocked_ips => [:environment] do
|
|||
end
|
||||
end
|
||||
|
||||
desc 'Compile domain map for nginx'
|
||||
task :compile_domain_map => [:environment] do
|
||||
desc 'Compile nginx mapfiles'
|
||||
task :compile_nginx_mapfiles => [:environment] do
|
||||
File.open('./files/map.txt', 'w') do |file|
|
||||
Site.exclude(domain: nil).exclude(domain: '').select(:username,:domain).all.collect do |site|
|
||||
Site.exclude(domain: nil).exclude(domain: '').select(:username,:domain).all.each do |site|
|
||||
file.write ".#{site.values[:domain]} #{site.username};\n"
|
||||
end
|
||||
end
|
||||
|
||||
File.open('./files/supporter-map.txt', 'w') do |file|
|
||||
file.write "hostnames;\n"
|
||||
file.write "default 0;\n"
|
||||
Site.select(:username, :domain).exclude(plan_type: 'free').exclude(plan_type: nil).all.each do |parent_site|
|
||||
sites = [parent_site] + parent_site.children
|
||||
sites.each do |site|
|
||||
file.write "#{site.username}.neocities.org 1;\n"
|
||||
unless site.host.match(/\.neocities\.org$/)
|
||||
file.write ".#{site.values[:domain]} 1;\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Produce SSL config package for proxy'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue