Merge branch 'master' of github.com:neocities/neocities

This commit is contained in:
Victoria Wang 2016-04-15 10:29:18 -07:00
commit 939cfb44bc
5 changed files with 33 additions and 7 deletions

View file

@ -65,13 +65,25 @@ 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|
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'

View file

@ -1052,7 +1052,7 @@ class Site < Sequel::Model
((total_space_used.to_f / maximum_space) * 100).round(1)
end
# Note: Change Stat#prune! if you change this business logic.
# Note: Change Stat#prune! and the nginx map compiler if you change this business logic.
def supporter?
owner.plan_type != 'free'
end
@ -1078,7 +1078,7 @@ class Site < Sequel::Model
!values[:plan_type].match(/plan_/).nil?
end
# Note: Change Stat#prune! if you change this business logic.
# Note: Change Stat#prune! and the nginx map compiler if you change this business logic.
def plan_type
return 'supporter' if owner.values[:paypal_active] == true
return 'free' if owner.values[:plan_type].nil?

View file

@ -172,7 +172,7 @@
<% if file[:is_directory] %>
<a class="link-overlay" href="?dir=<%= Rack::Utils.escape file[:path] %>" title="View <%= file[:path] %>"></a>
<% else %>
<a class="link-overlay" href="http://<%= current_site.username %>.neocities.org<%= file[:path] %>" title="View <%= file[:path] %>" target="_blank"></a>
<a class="link-overlay" href="http://<%= current_site.username %>.neocities.org<%= file[:path] == '/index.html' ? '/' : file[:path] %>" title="View <%= file[:path] == '/index.html' ? 'your site' : file[:path] %>" target="_blank"></a>
<% end %>
</div>
</div>

View file

@ -141,6 +141,20 @@
<td></td>
<td><i class="fa fa-check"></i></td>
</tr>
<tr>
<td class="feature-column">
<span data-original-title="This allows you to embed files and images on web sites not hosted by Neocities.">Hotlinking Support</span>
</td>
<td></td>
<td><i class="fa fa-check"></i></td>
</tr>
<tr>
<td class="feature-column">
<span data-original-title="This allows other web sites to load and embed files or data (such as JSON config files) from your web site hosted on Neocities.">Cross Origin (CORS) Support</span>
</td>
<td></td>
<td><i class="fa fa-check"></i></td>
</tr>
</table>
<script>

View file

@ -76,7 +76,7 @@
</div>
<a id="saveButton" class="btn-Action" href="#" onclick="saveTextFile(false); return false" style="opacity: 0.5"><span class="hide-on-mobile"><i class="fa fa-save"></i></span>Save</a>
<span class="hide-on-mobile">
<a class="btn-Action" href="<%= current_site.uri %>/<%= @filename %>" target="_blank">View</a>
<a class="btn-Action" href="<%= current_site.uri %>/<%= @filename == 'index.html' ? '' : @filename %>" target="_blank">View</a>
<a href="#" id="shareButton" class="btn-Action" data-container="body" data-toggle="popover" data-placement="bottom" data-content='<%== erb :'_share', layout: false, locals: {site: current_site, page_uri: "#{current_site.uri}/#{@filename}"} %>'>Share</a>
</span>
<!-- <a id="saveAndExitButton" class="btn-Action" href="#" onclick="saveTextFile(true); return false" style="opacity: 0.5"><i class="fa fa-save"></i>&nbsp;&nbsp;Save and Exit</a> -->