From 976a9728b395324aec3d67c2aa640aa7423cf0aa Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Mon, 6 Apr 2015 17:16:15 -0700 Subject: [PATCH 001/157] Update stats to show site hits and views --- app/stats.rb | 2 ++ ext/numeric.rb | 6 +++++- views/stats.erb | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/stats.rb b/app/stats.rb index f3868a8b..02101bd9 100644 --- a/app/stats.rb +++ b/app/stats.rb @@ -2,6 +2,8 @@ get '/stats/?' do # expires 14400, :public, :must_revalidate if self.class.production? # 4 hours @stats = { + total_hosted_site_hits: DB['SELECT SUM(hits) FROM sites'].first[:sum], + total_hosted_site_views: DB['SELECT SUM(views) FROM sites'].first[:sum], total_sites: Site.count, total_unbanned_sites: Site.where(is_banned: false).count, total_banned_sites: Site.where(is_banned: true).count, diff --git a/ext/numeric.rb b/ext/numeric.rb index 347c7178..88535856 100644 --- a/ext/numeric.rb +++ b/ext/numeric.rb @@ -21,6 +21,10 @@ class Numeric end end + def to_comma_separated + self.to_s.chars.to_a.reverse.each_slice(3).map(&:join).join(",").reverse + end + def format_large_number if self > 9999 if self > 999999999 @@ -33,7 +37,7 @@ class Numeric unit_char = 'K' #thousand unit_amount = 1000.0 end - + self_divided = self.to_f / unit_amount self_rounded = self_divided.round(1) diff --git a/views/stats.erb b/views/stats.erb index 5a435cd7..a7f2f8d9 100644 --- a/views/stats.erb +++ b/views/stats.erb @@ -6,7 +6,7 @@
-

Why our finances are open

+

Why our growth statistics and finances are open

Neocities is an Open Company startup, and are committed to openness as a defining element in how we create value. @@ -17,11 +17,11 @@

- Despite this, most companies today still treat their backend infrastructure and business finances as proprietary. The result is an erosion of user trust, where users become dependant on proprietary services that have bugs they can't help fix, financial sustainability problems they can't discover, and limitations they can't understand. We believe this is the biggest problem facing startups today. + Despite this, most companies today still treat their backend infrastructure and business operations as proprietary. The result is an erosion of user trust, where users become dependant on proprietary services that have bugs they can't help fix, financial sustainability problems they can't discover, and limitations they can't understand. We believe this is the biggest problem facing startups today.

- We do not feel that opening of our finances is as risky as is currently believed, and that the increased trust we gain from doing it more than makes up for the risk. So we have decided to open our finances. + We do not feel that opening of our finances is as risky as is currently believed, and that the increased trust we gain from doing it more than makes up for the risk. So we have decided to open our growth statistics and finances.

@@ -29,7 +29,7 @@

- Note that we do not disclose everything publicly. For example, we do not reveal the locations of our servers, the identities of our users, investors (if they choose to be anonymous) or any salaries or dividends we choose to issue. There are very legitimate security and privacy considerations to consider when providing open data, and we understand and respect that. + Note that we do not disclose everything publicly. For example, we do not currently reveal the locations of our servers, the identities of our users, investors (if they choose to be anonymous) or any salaries or dividends (in our case, member ownership percentages) we choose to issue. There are very legitimate security and privacy considerations to consider when providing open data, and we understand and respect that.

@@ -40,7 +40,15 @@ - + + + + + + + + + From 93397a41761394e7d45da73f97e63009a9f4b633 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Wed, 8 Apr 2015 10:34:57 -0700 Subject: [PATCH 002/157] add XML to allowed file types list --- app/browse.rb | 3 +++ app/index.rb | 1 + app/signin.rb | 3 ++- app/surf.rb | 1 + views/site_files/allowed_types.erb | 1 + views/surf.erb | 6 +----- views/terms.erb | 10 ++++++++-- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/browse.rb b/app/browse.rb index f3f64097..87d1f86a 100644 --- a/app/browse.rb +++ b/app/browse.rb @@ -4,6 +4,9 @@ get '/browse/?' do site_dataset = site_dataset.paginate @current_page, Site::BROWSE_PAGINATION_LENGTH @page_count = site_dataset.page_count || 1 @sites = site_dataset.all + if params[:tag] + @title = "Sites tagged #{params[:tag]}" + end erb :browse end diff --git a/app/index.rb b/app/index.rb index 0ad58bce..bb2eff39 100644 --- a/app/index.rb +++ b/app/index.rb @@ -68,5 +68,6 @@ get '/press' do end get '/legal/?' do + @title = 'Legal Guide to Neocities' erb :'legal' end diff --git a/app/signin.rb b/app/signin.rb index 2f265f69..a2da5d98 100644 --- a/app/signin.rb +++ b/app/signin.rb @@ -1,5 +1,6 @@ get '/signin/?' do dashboard_if_signed_in + @title = 'Sign In' erb :'signin' end @@ -47,4 +48,4 @@ end def signout session[:id] = nil -end \ No newline at end of file +end diff --git a/app/surf.rb b/app/surf.rb index f4639c5c..a02ad46e 100644 --- a/app/surf.rb +++ b/app/surf.rb @@ -5,6 +5,7 @@ get '/surf/?' do @page_count = site_dataset.page_count || 1 @site = site_dataset.first redirect "/browse?#{Rack::Utils.build_query params}" if @site.nil? + @title = "Surf Mode - #{@site.title}" erb :'surf', layout: false end diff --git a/views/site_files/allowed_types.erb b/views/site_files/allowed_types.erb index 8d7c0bab..d48d0849 100644 --- a/views/site_files/allowed_types.erb +++ b/views/site_files/allowed_types.erb @@ -13,6 +13,7 @@
  • JavaScript (.js, .json, .geojson)
  • CSS (.css)
  • Text (.txt, .text, .csv, .tsv)
  • +
  • XML (.xml)
  • Web Fonts (.eot, .ttf, .woff, .woff2, .svg)
  • MIDI Files (.mid, .midi)
  • diff --git a/views/surf.erb b/views/surf.erb index 041e19f1..6776a450 100644 --- a/views/surf.erb +++ b/views/surf.erb @@ -2,11 +2,7 @@ - <% if @title %> - <%= @title %> - Neocities - <% else %> - Neocities - <% end %> + <%= title %>
    Total SitesTotal Hits (sites hosted on Neocities)<%= @stats[:total_hosted_site_hits].to_comma_separated %>
    Total Views (sites hosted on Neocities)<%= @stats[:total_hosted_site_views].to_comma_separated %>
    Total Sites <%= @stats[:total_sites] %>