mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
ssl sites bundler
This commit is contained in:
parent
3d32e616da
commit
8cd61a06f2
3 changed files with 27 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -28,3 +28,4 @@ public/site_thumbnails_test
|
||||||
files/map.txt
|
files/map.txt
|
||||||
.sass-cache
|
.sass-cache
|
||||||
.sass-cache/*
|
.sass-cache/*
|
||||||
|
files/sslsites.zip
|
||||||
|
|
24
Rakefile
24
Rakefile
|
@ -88,3 +88,27 @@ desc 'Compile domain map for nginx'
|
||||||
task :compile_domain_map => [:environment] do
|
task :compile_domain_map => [:environment] do
|
||||||
File.open('./files/map.txt', 'w'){|f| Site.exclude(domain: nil).exclude(domain: '').select(:username,:domain).all.collect {|s| f.write "#{s.domain} #{s.username};\n" }}
|
File.open('./files/map.txt', 'w'){|f| Site.exclude(domain: nil).exclude(domain: '').select(:username,:domain).all.collect {|s| f.write "#{s.domain} #{s.username};\n" }}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'Produce SSL config package for proxy'
|
||||||
|
task :buildssl => [:environment] do
|
||||||
|
sites = Site.select(:id, :username, :domain, :ssl_key, :ssl_cert, :ssl_cert_intermediate).
|
||||||
|
exclude(domain: nil).
|
||||||
|
exclude(ssl_key: nil).
|
||||||
|
exclude(ssl_cert: nil).
|
||||||
|
exclude(ssl_cert_intermediate: nil).
|
||||||
|
all
|
||||||
|
|
||||||
|
payload = []
|
||||||
|
|
||||||
|
Zip::Archive.open('./files/sslsites.zip', Zip::CREATE) do |ar|
|
||||||
|
ar.add_dir 'ssl'
|
||||||
|
|
||||||
|
sites.each do |site|
|
||||||
|
ar.add_buffer "ssl/#{site.username}.key", site.ssl_key
|
||||||
|
ar.add_buffer "ssl/#{site.username}.crt", "#{site.ssl_cert_intermediate}\n\n#{site.ssl_cert}"
|
||||||
|
payload << {username: site.username, domain: site.domain}
|
||||||
|
end
|
||||||
|
|
||||||
|
ar.add_buffer 'sslsites.json', payload.to_json
|
||||||
|
end
|
||||||
|
end
|
|
@ -46,7 +46,7 @@
|
||||||
<article>
|
<article>
|
||||||
<h2>Add SSL Certificate</h2>
|
<h2>Add SSL Certificate</h2>
|
||||||
<p>
|
<p>
|
||||||
This allows you to add an SSL private key and certificate for your domain, enabling encryption for your site (https). It can take up to 5-30 minutes for the changes to go live, so please be patient.
|
This allows you to add an SSL key and certificate for your domain, enabling encryption for your site (https). It can take up to 5-30 minutes for the changes to go live, so please be patient.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<% if current_site.domain.nil? || current_site.domain.empty? %>
|
<% if current_site.domain.nil? || current_site.domain.empty? %>
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Private key (yourdomain.com.key):
|
SSL Key (yourdomain.com.key):
|
||||||
<input name="key" type="file">
|
<input name="key" type="file">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue