diff --git a/migrations/125_sites_stats_bigint.rb b/migrations/125_sites_stats_bigint.rb new file mode 100644 index 00000000..efb229ed --- /dev/null +++ b/migrations/125_sites_stats_bigint.rb @@ -0,0 +1,15 @@ +Sequel.migration do + up { + alter_table(:sites) do + set_column_type :hits, :bigint + set_column_type :views, :bigint + end + } + + down { + alter_table(:sites) do + set_column_type :hits, Integer + set_column_type :views, Integer + end + } +end diff --git a/models/site.rb b/models/site.rb index 0874fbe1..7366eafa 100644 --- a/models/site.rb +++ b/models/site.rb @@ -8,10 +8,9 @@ class Site < Sequel::Model include Sequel::ParanoidDelete VALID_MIME_TYPES = %w{ + application/atom+xml application/epub application/epub+zip - application/font-sfnt - application/javascript application/json application/octet-stream application/opensearchdescription+xml @@ -21,10 +20,13 @@ class Site < Sequel::Model application/rss+xml application/vnd.ms-fontobject application/vnd.ms-opentype - application/x-elc - application/x-font-ttf application/xml audio/midi + font/otf + font/sfnt + font/ttf + font/woff + font/woff2 image/apng image/avif image/gif @@ -38,10 +40,10 @@ class Site < Sequel::Model image/x-xcf message/rfc822 text/cache-manifest - text/cache-manifest text/css text/csv text/html + text/javascript text/plain text/tsv text/xml @@ -77,8 +79,8 @@ class Site < Sequel::Model INDEX_HTML_REGEX = /\/?index.html$/ ROOT_INDEX_HTML_REGEX = /^\/?index.html$/ MAX_COMMENT_SIZE = 420 # Used to be the limit for Facebook.. no comment (PUN NOT INTENDED). - MAX_FOLLOWS = 1000 - + MAX_FOLLOWS = 2000 + BROWSE_MINIMUM_VIEWS = 100 BROWSE_MINIMUM_FOLLOWER_VIEWS = 10_000 diff --git a/sass/_project-sass/_project-Main.scss b/sass/_project-sass/_project-Main.scss index eca73666..e8994455 100644 --- a/sass/_project-sass/_project-Main.scss +++ b/sass/_project-sass/_project-Main.scss @@ -2316,7 +2316,6 @@ pre, code { .chat-box { height: calc(100vh - 180px); overflow-y: scroll; - padding: 10px; background-color: #1d1f21; font-weight: 300; font-size: 13.5px; diff --git a/views/_follows.erb b/views/_follows.erb index 851257e7..05b1e5dc 100644 --- a/views/_follows.erb +++ b/views/_follows.erb @@ -1,22 +1,26 @@ -<% site_followings = site.followings_dataset.count %> -<% if (!is_current_site && site_followings > 0) || is_current_site %> +<% site_followings_count = site.followings_dataset.count %> +<% if (!is_current_site && site_followings_count > 0) || is_current_site %>

<%= is_current_site ? 'Sites you follow' : 'This site follows' %>

- <% if site_followings == 0 %> + <% if site_followings_count == 0 %>

You are not following any sites yet. Add some by browsing sites or looking at your tags. <% else %> - <% site.followings_dataset.select(:site_id).all.each do |following| %> + <% site.followings_dataset.select(:site_id).limit(Site::MAX_DISPLAY_FOLLOWS).each do |following| %> <% end %> + + <% if Site::MAX_DISPLAY_FOLLOWS < site_followings_count %> + see more + <% end %> <% end %>

<% end %> -<% site_follows = site.follows_dataset.count %> -<% if (!is_current_site && site_follows > 0) || is_current_site %> +<% site_follows_count = site.follows_dataset.count %> +<% if (!is_current_site && site_follows_count > 0) || is_current_site %>

Followers

- <% if site_follows == 0 %> + <% if site_follows_count == 0 %> No followers yet. <% else %> <% site_profile_follows_actioning_ids = site.profile_follows_actioning_ids %> diff --git a/views/site_files/text_editor.erb b/views/site_files/text_editor.erb index 6327713a..90c66585 100644 --- a/views/site_files/text_editor.erb +++ b/views/site_files/text_editor.erb @@ -111,10 +111,10 @@
-
+

Loading...

-
+
diff --git a/views/tutorial/html/6.erb b/views/tutorial/html/6.erb index ea978cca..a70148f7 100644 --- a/views/tutorial/html/6.erb +++ b/views/tutorial/html/6.erb @@ -7,8 +7,8 @@
Your Neocities web directory already includes an image called neocities.png.
-
- Add it to your page like so:
<img src="/neocities.png">
+
+ Add it to your page:
<img src="/neocities.png">
That's it! No closing tag needed for images. diff --git a/views/tutorial/html/9.erb b/views/tutorial/html/9.erb index d6928d71..289713f7 100644 --- a/views/tutorial/html/9.erb +++ b/views/tutorial/html/9.erb @@ -18,23 +18,40 @@ $('h3#sitePreview').css('display', 'none') $('.preview').css('margin-top', '20px') - $('#saveToSite').on('click', function() { + $('#saveToSite').on('click', function(event) { + event.preventDefault() + + var formData = new FormData() + var fileContent = sessionStorage.getItem('tutorialHtml') + formData.append('index.html', new File([fileContent], 'index.html', { type: 'text/html' })) + formData.append('csrf_token', '<%= escape_javascript csrf_token %>') + formData.append('username', '<%= escape_javascript current_site.username %>') + $.ajax({ - url: '/site_files/upload?csrf_token=<%= Rack::Utils.escape csrf_token %>&filename=<%= Rack::Utils.escape 'index.html' %>&site_id=<%= current_site.id %>', - data: sessionStorage.getItem('tutorialHtml'), + url: '/api/upload', + data: formData, processData: false, contentType: false, type: 'POST', error: function(jqXHR, textStatus, errorThrown) { - alert('There has been an error saving your file, please try again. If it continues to fail, make a copy of the file locally so you don\'t lose your changes!') + var errorMessage = 'There has been an error saving your file, please try again. If it continues to fail, make a copy of the file locally so you don\'t lose your changes!' + + if(jqXHR.responseText) { + try { + // Attempt to parse the JSON responseText to get the error message + var parsedResponse = JSON.parse(jqXHR.responseText); + errorMessage += ' ERROR MESSAGE: ' + parsedResponse.message; + alert(errorMessage) + } catch (error) { + } + } + + alert(errorMessage) }, - success: function(response){ + success: function(response, textStatus, xhr){ window.location = '/tutorial/html/10' } }) - - return false }) - })