diff --git a/app/settings.rb b/app/settings.rb index 4f2b3761..c10096ff 100644 --- a/app/settings.rb +++ b/app/settings.rb @@ -52,7 +52,8 @@ post '/settings/:username/profile' do @site.update( profile_comments_enabled: params[:site][:profile_comments_enabled], - profile_enabled: params[:site][:profile_enabled] + profile_enabled: params[:site][:profile_enabled], + archiving_disabled: params[:site][:archiving_disabled] ) flash[:success] = 'Profile settings changed.' redirect "/settings/#{@site.username}#profile" diff --git a/app/site.rb b/app/site.rb index a59d0656..e6f711ec 100644 --- a/app/site.rb +++ b/app/site.rb @@ -38,11 +38,9 @@ get '/site/:username/?' do |username| end get '/site/:username/archives' do - require_login @site = Site[username: params[:username]] @title = "Site archives for #{@site.title}" - not_found if @site.nil? - redirect request.referrer unless current_site.id == @site.id + not_found if @site.nil? || @site.archiving_disabled @archives = @site.archives_dataset.limit(300).order(:updated_at.desc).all diff --git a/models/archive.rb b/models/archive.rb index 7516475f..e8a11b89 100644 --- a/models/archive.rb +++ b/models/archive.rb @@ -5,7 +5,7 @@ class Archive < Sequel::Model set_primary_key [:site_id, :ipfs_hash] unrestrict_primary_key MAXIMUM_ARCHIVES_PER_SITE = 100 - ARCHIVE_WAIT_TIME = 1.hour + ARCHIVE_WAIT_TIME = 10.minutes def before_destroy unpin diff --git a/models/site.rb b/models/site.rb index a5aa42ff..18fcc392 100644 --- a/models/site.rb +++ b/models/site.rb @@ -1530,7 +1530,9 @@ class Site < Sequel::Model ] sql.first - ArchiveWorker.perform_in Archive::ARCHIVE_WAIT_TIME, self.id + unless archiving_disabled + ArchiveWorker.perform_in Archive::ARCHIVE_WAIT_TIME, self.id + end end reload diff --git a/views/settings/site/profile.erb b/views/settings/site/profile.erb index 4fdbd903..9789c880 100644 --- a/views/settings/site/profile.erb +++ b/views/settings/site/profile.erb @@ -1,20 +1,37 @@ -

Site Profile

+

General Settings

+
<%== csrf_token_input_html %> -

- - checked<% end %> - > Disable Site Profile Comments -

-

- - checked<% end %> - > Disable Site Profile -

- +

Site Profile

+ +
+
+ + checked<% end %> + > Disable Site Profile Comments +
+ + + checked<% end %> + > Disable Site Profile +
+
+ +

IPFS Archiving

+ +
+ + checked<% end %> + > Disable IPFS Archiving +
+
+ + +
diff --git a/views/site.erb b/views/site.erb index caa1c0c2..42ddb111 100644 --- a/views/site.erb +++ b/views/site.erb @@ -37,7 +37,7 @@ Edit Site <% end %> - <% if current_site && current_site.id == site.id && site.latest_archive %> + <% if site.latest_archive && !site.archiving_disabled %> Archives <% end %> @@ -45,12 +45,10 @@ <% is_following = current_site.is_following?(site) %> - Unfollow - Following - Follow + Unfollow + Following + Follow - - <% end %> '> Share diff --git a/views/site/archives.erb b/views/site/archives.erb index ffd2de4f..ae0b47b9 100644 --- a/views/site/archives.erb +++ b/views/site/archives.erb @@ -1,6 +1,6 @@
-

Permanent Web Archives

+

IPFS Archives

@@ -23,10 +23,10 @@

- This is a very early, experimental preview release of a new technology! We're still figuring things out. We may stop hosting archives without notice. Learn how you can host your own copies of these archives. + This is a preview release of a new technology. We're still figuring things out, and may stop hosting archives without notice. Learn how you can host your own copies of these archives.

- Archives are captured once every 24 hours, so if you don't see your latest changes, check back later. + Archives are captured once every <%= Archive::ARCHIVE_WAIT_TIME / 60 %> minutes, so if you don't see your latest changes, check back later.

The URLs are using hshca, a standard for using cryptographic hashes with subdomains.