From 7d17202f392e6d634dd1cef5e8553277872443a7 Mon Sep 17 00:00:00 2001
From: Kyle Drake
Date: Sun, 21 May 2017 15:37:50 -0500
Subject: [PATCH] add WebDAV windows alt; restrict zipball downloads44444444
for large sites
---
models/site.rb | 5 +++++
views/dashboard.erb | 6 ++++--
views/site_files/mount_info.erb | 24 ++++++++++++++----------
3 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/models/site.rb b/models/site.rb
index d59b5b9e..cf3ce200 100644
--- a/models/site.rb
+++ b/models/site.rb
@@ -70,6 +70,7 @@ class Site < Sequel::Model
THUMBNAIL_RESOLUTIONS = ['210x158']
MAX_FILE_SIZE = 10**8 # 100 MB
+ MAX_SITE_DOWNLOAD_SIZE = 2_000_000_000 # 2GB
CLAMAV_THREAT_MATCHES = [
/^VBS/,
@@ -1135,6 +1136,10 @@ class Site < Sequel::Model
((total_space_used.to_f / maximum_space) * 100).round(1)
end
+ def too_big_to_download?
+ space_used > MAX_SITE_DOWNLOAD_SIZE
+ end
+
# Note: Change Stat#prune! and the nginx map compiler if you change this business logic.
def supporter?
owner.plan_type != 'free'
diff --git a/views/dashboard.erb b/views/dashboard.erb
index 0a9685d8..b2c6fdbf 100644
--- a/views/dashboard.erb
+++ b/views/dashboard.erb
@@ -190,9 +190,11 @@
<% if !current_site.plan_feature(:no_file_restrictions) %>
Allowed file types |
<% end %>
- Download entire site
+ <% unless current_site.too_big_to_download? %>
+ Download entire site |
+ <% end %>
<% unless is_education? %>
- | Mount your site as a drive on your computer!
+ Mount your site as a drive on your computer
<% end %>
diff --git a/views/site_files/mount_info.erb b/views/site_files/mount_info.erb
index c3015a9e..4b9e6f20 100644
--- a/views/site_files/mount_info.erb
+++ b/views/site_files/mount_info.erb
@@ -1,7 +1,7 @@
@@ -10,7 +10,7 @@
About
- Neocities now supports WebDAV, which allows you to mount your Neocities share on your computer. Now you can access and change your files on your own computer's file manager!
+ Neocities supports WebDAV, which allows you to mount your Neocities share on your computer.
<% if current_site.nil? %>
@@ -22,20 +22,24 @@
This feature requires a supporter account. Click here to become a supporter.
<% else %>
- Instructions for Windows 7
+ Instructions for Windows
- Use these instructions, except use this URL to connect: https://neocities.org/webdav
-
- Enter your login info when requested.
-
+ Unfortunately, the WebDAV that comes with Windows file manager has issues with SSL,
+ and the problem has not yet been fixed. We recommend using a client like Cyberduck with Windows, which is free and has
+ WebDAV support. You can also try Mountain Duck
+ which will allow you to mount your Neocities site as a hard drive on your computer.
Instructions for OSX
- Use these instructions, and use this URL to connect: https://neocities.org/webdav
-
- Enter login info when requested.
+ Use these instructions, and use this URL to connect: https://neocities.org/webdav
+
+ Enter login info when requested.
+
+
+
+ You can also try out Cyberduck or Mountain Duck if you run into any issues.
Instructions for Linux (Ubuntu)