diff --git a/.gitignore b/.gitignore
index 0d19f0bc..6fd2737a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,4 @@ files/map.txt
files/sslsites.zip
.tm_properties
./black_box.rb
+.vagrant
diff --git a/Gemfile b/Gemfile
index 3f3cf2a9..6abc37bd 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,4 +1,3 @@
-source 'https://code.stripe.com'
source 'https://rubygems.org'
gem 'sinatra'
@@ -16,7 +15,7 @@ gem 'mail'
gem 'google-api-client', require: 'google/api_client'
gem 'tilt'
gem 'erubis'
-gem 'stripe'
+gem 'stripe', source: 'https://code.stripe.com/'
gem 'screencap'
gem 'cocaine'
gem 'zipruby'
@@ -63,7 +62,6 @@ group :test do
gem 'mocha', require: nil
gem 'rake', require: nil
gem 'poltergeist'
- gem 'phantomjs', require: 'phantomjs/poltergeist'
gem 'capybara_minitest_spec'
gem 'rack_session_access', require: nil
gem 'webmock', require: nil
diff --git a/Gemfile.lock b/Gemfile.lock
index 2000c14d..fd90fb5b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,6 +1,6 @@
GEM
- remote: https://code.stripe.com/
remote: https://rubygems.org/
+ remote: https://code.stripe.com/
specs:
activesupport (4.1.4)
i18n (~> 0.6, >= 0.6.9)
@@ -154,7 +154,7 @@ GEM
netrc (~> 0.7)
retriable (1.4.1)
rmagick (2.13.3)
- safe_yaml (1.0.1)
+ safe_yaml (1.0.4)
sass (3.3.8)
screencap (0.1.1)
phantomjs
@@ -246,7 +246,6 @@ DEPENDENCIES
minitest-reporters
mocha
pg
- phantomjs
poltergeist
pry
pry-byebug
@@ -271,7 +270,7 @@ DEPENDENCIES
sinatra
sinatra-flash
sinatra-xsendfile
- stripe
+ stripe!
stripe-ruby-mock (~> 2.0.1)
thread
tilt
diff --git a/README.md b/README.md
index bdc39371..5397c713 100644
--- a/README.md
+++ b/README.md
@@ -4,42 +4,23 @@
The web site for NeoCities! It's open source. Want a feature on the site? Send a pull request!
-## Installation (OSX)
+## Getting Started
-Install homebrew:
-```
-ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
-```
-
-Install deps:
-```
-$ brew install redis postgresql phantomjs libmagic imagemagick
-```
-
-Fork the repository on Github.
-Clone the forked repo to your local machine: git clone git@github.com:YOURUSERNAME/neocities.git
-Install deps:
+Neocities can be quickly launched in development mode with (Vagrant)[https://www.vagrantup.com]. Vagrant builds a virtual machine that automatically installs everything you need to run Neocities as a developer. Install Vagrant, then from the command line:
```
-$ cd neocities
-$ gem install bundler
-$ bundle install
+vagrant up --provision
```
-Create postgres databases:
+
```
-createdb neocities_test
-createdb neocities_dev
+vagrant ssh
+cd /vagrant
+bundle exec rackup
```
-Copy config.yml.template to config.yml.
-
-Run the tests to see if they work:
-
-```
- bundle exec rake test
-```
+Now you can access the running site from your browser: http://127.0.0.1:9292
## Want to contribute?
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 00000000..59a70b4d
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,12 @@
+VAGRANTFILE_API_VERSION = '2'
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+ config.vm.box = 'ubuntu/trusty64'
+ config.vm.provision :shell, path: './vagrant/development.sh'
+ config.vm.network :forwarded_port, guest: 9292, host: 9292
+
+ config.vm.provider :virtualbox do |vb|
+ vb.customize ['modifyvm', :id, '--memory', '1536']
+ vb.name = 'neocities'
+ end
+end
\ No newline at end of file
diff --git a/app/browse.rb b/app/browse.rb
index bc747283..b380e2f2 100644
--- a/app/browse.rb
+++ b/app/browse.rb
@@ -28,16 +28,21 @@ def browse_sites_dataset
case params[:sort_by]
when 'hits'
+ site_dataset.where!{views > 100}
site_dataset.order!(:hits.desc, :site_updated_at.desc)
when 'views'
+ site_dataset.where!{views > 100}
site_dataset.order!(:views.desc, :site_updated_at.desc)
when 'newest'
site_dataset.order!(:created_at.desc, :views.desc)
when 'oldest'
+ site_dataset.where!{views > 100}
site_dataset.order!(:created_at, :views.desc)
when 'random'
+ site_dataset.where!{views > 100}
site_dataset.where! 'random() < 0.01'
when 'last_updated'
+ site_dataset.where!{views > 100}
params[:sort_by] = 'last_updated'
site_dataset.order!(:site_updated_at.desc, :views.desc)
else
@@ -46,6 +51,7 @@ def browse_sites_dataset
site_dataset.order!(:views.desc, :site_updated_at.desc)
else
params[:sort_by] = 'last_updated'
+ site_dataset.where!{views > 100}
site_dataset.order!(:site_updated_at.desc, :views.desc)
end
end
diff --git a/app/plan.rb b/app/plan.rb
index f3924892..9d944716 100644
--- a/app/plan.rb
+++ b/app/plan.rb
@@ -4,6 +4,12 @@ get '/plan/?' do
if parent_site && parent_site.unconverted_legacy_supporter?
customer = Stripe::Customer.retrieve(parent_site.stripe_customer_id)
subscription = customer.subscriptions.first
+
+ # Subscription was deleted, add to free plan.
+ if subscription.nil?
+ subscription = customer.subscriptions.create plan: 'free'
+ end
+
parent_site.stripe_subscription_id = subscription.id
parent_site.plan_type = subscription.plan.id
parent_site.save_changes
diff --git a/app/stats.rb b/app/stats.rb
index 487563af..0af92978 100644
--- a/app/stats.rb
+++ b/app/stats.rb
@@ -23,7 +23,7 @@ get '/stats/?' do
now = Date.today
- while runner.to_time < now.to_time
+ while Date.new(runner.year, runner.month, 1) <= Date.new(now.year, now.month, 1)
monthly_stats.push(
date: runner,
sites_created: Site.where(created_at: runner..runner.next_month).count,
diff --git a/config.yml.template b/config.yml.template
index b939c853..9eaa29a9 100644
--- a/config.yml.template
+++ b/config.yml.template
@@ -1,24 +1,24 @@
development:
- database: 'postgres://neocities@127.0.0.1/neocities'
+ database: 'postgres://neocities@localhost/neocities'
database_pool: 1
- session_secret: SECRET GOES HERE
- recaptcha_public_key: ENTER PUBLIC KEY HERE
- recaptcha_private_key: ENTER PRIVATE KEY HERE
- sidekiq_user: ENTER USER HERE
- sidekiq_pass: ENTER PASS HERE
- stripe_publishable_key: fillout
- stripe_api_key: fillout
+ session_secret: "SECRET GOES HERE"
+ recaptcha_public_key: "ENTER PUBLIC KEY HERE"
+ recaptcha_private_key: "ENTER PRIVATE KEY HERE"
+ sidekiq_user: "ENTER USER HERE"
+ sidekiq_pass: "ENTER PASS HERE"
+ stripe_publishable_key: "ENTER KEY HERE"
+ stripe_api_key: "ENTER KEY HERE"
ip_hash_salt: "400$8$1$fc21863da5d531c1"
proxy_pass: 'somethinglongandrandom'
test:
- database: 'postgres://neocities@127.0.0.1/neocities_test'
+ database: 'postgres://neocities@localhost/neocities_test'
database_pool: 1
- session_secret: SECRET GOES HERE
- recaptcha_public_key: ENTER PUBLIC KEY HERE
- recaptcha_private_key: ENTER PRIVATE KEY HERE
- sidekiq_user: ENTER USER HERE
- sidekiq_pass: ENTER PASS HERE
- stripe_publishable_key: fillout
- stripe_api_key: fillout
+ session_secret: "SECRET GOES HERE"
+ recaptcha_public_key: "ENTER PUBLIC KEY HERE"
+ recaptcha_private_key: "ENTER PRIVATE KEY HERE"
+ sidekiq_user: "ENTER USER HERE"
+ sidekiq_pass: "ENTER PASS HERE"
+ stripe_publishable_key: "ENTER KEY HERE"
+ stripe_api_key: "ENTER KEY HERE"
ip_hash_salt: "400$8$1$fc21863da5d531c1"
proxy_pass: 'somethinglongandrandom'
\ No newline at end of file
diff --git a/config.yml.travis b/config.yml.travis
index 8db3f55c..627467e9 100644
--- a/config.yml.travis
+++ b/config.yml.travis
@@ -5,4 +5,5 @@ recaptcha_public_key: '1234'
recaptcha_private_key: '5678'
phantomjs_url:
- http://localhost:8910
-ip_hash_salt: "400$8$1$fc21863da5d531c1"
\ No newline at end of file
+ip_hash_salt: "400$8$1$fc21863da5d531c1"
+email_unsubscribe_token: "somethingrandomderrrrp"
\ No newline at end of file
diff --git a/ext/phantomjs.rb b/ext/phantomjs.rb
new file mode 100644
index 00000000..10407891
--- /dev/null
+++ b/ext/phantomjs.rb
@@ -0,0 +1,6 @@
+module Phantomjs
+ # Workaround for vagrant bug.
+ def self.path
+ '/usr/local/bin/phantomjs'
+ end
+end
\ No newline at end of file
diff --git a/models/site.rb b/models/site.rb
index 135483b0..b26c7ef8 100644
--- a/models/site.rb
+++ b/models/site.rb
@@ -509,7 +509,7 @@ class Site < Sequel::Model
# clamdscan doesn't work on travis for testing
return true if ENV['TRAVIS'] == 'true'
- File.chmod 0640, uploaded_file[:tempfile].path
+ File.chmod 0666, uploaded_file[:tempfile].path
line = Cocaine::CommandLine.new(
"clamdscan", "-i --remove=no --no-summary --stdout :path",
expected_outcodes: [0, 1]
diff --git a/public/img/cat-larger.png b/public/img/cat-larger.png
index 21973263..2a3bb9cd 100644
Binary files a/public/img/cat-larger.png and b/public/img/cat-larger.png differ
diff --git a/sass/_project-sass/_project-Website-Gallery.scss b/sass/_project-sass/_project-Website-Gallery.scss
index d943be08..32f39743 100644
--- a/sass/_project-sass/_project-Website-Gallery.scss
+++ b/sass/_project-sass/_project-Website-Gallery.scss
@@ -104,6 +104,21 @@
padding: 4% 2%;
}
}
+
+ .admin {
+ font-size: 80%;
+ form {
+ display: inline;
+ padding-right: 10px;
+ }
+
+ button {
+ background:none!important;
+ border:none;
+ padding:0!important;
+ cursor: pointer;
+ }
+ }
}
.neo-SS, .z{
diff --git a/tests/acceptance/signup_tests.rb b/tests/acceptance/signup_tests.rb
index 59566676..b0ad9ed6 100644
--- a/tests/acceptance/signup_tests.rb
+++ b/tests/acceptance/signup_tests.rb
@@ -38,10 +38,8 @@ describe 'signup' do
click_signup_button
site_created?.must_equal true
- assert_equal(
- true,
- File.exist?(File.join(Site::SITE_FILES_ROOT, @site[:username], 'index.html'))
- )
+ index_file_path = File.join Site::SITE_FILES_ROOT, @site[:username], 'index.html'
+ File.exist?(index_file_path).must_equal true
site = Site[username: @site[:username]]
site.site_files.length.must_equal 4
diff --git a/tests/api_tests.rb b/tests/api_tests.rb
index 16c8f421..02b327cf 100644
--- a/tests/api_tests.rb
+++ b/tests/api_tests.rb
@@ -170,6 +170,7 @@ describe 'api upload' do
post '/api/upload', {
'' => Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
}
+
res[:error_type].must_equal 'missing_files'
end
diff --git a/vagrant/common.sh b/vagrant/common.sh
new file mode 100644
index 00000000..65153ca2
--- /dev/null
+++ b/vagrant/common.sh
@@ -0,0 +1,23 @@
+# Quiets the TTY error message
+#sed -i 's/^mesg n$/tty -s \&\& mesg n/g' /root/.profile
+
+DEBIAN_FRONTEND=noninteractive
+
+apt-get -y update
+apt-get -y upgrade
+apt-get install -y openntpd htop autossh sshfs vim
+
+echo 'UTC' | tee /etc/timezone
+dpkg-reconfigure -f noninteractive tzdata
+
+update-alternatives --set editor /usr/bin/vim.basic
+
+ufw allow ssh
+ufw --force enable
+ufw logging off
+
+sed -i 's|[#]*PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config
+sed -i 's|UsePAM yes|UsePAM no|g' /etc/ssh/sshd_config
+#sed -i 's|[#]*PermitRootLogin yes|PermitRootLogin no|g' /etc/ssh/sshd_config
+
+service ssh restart
diff --git a/vagrant/database.sh b/vagrant/database.sh
new file mode 100644
index 00000000..461dab13
--- /dev/null
+++ b/vagrant/database.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+DEBIAN_FRONTEND=noninteractive
+
+apt-get -y install postgresql postgresql-contrib libpq-dev
\ No newline at end of file
diff --git a/vagrant/development.sh b/vagrant/development.sh
new file mode 100644
index 00000000..30061fc4
--- /dev/null
+++ b/vagrant/development.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+DEBIAN_FRONTEND=noninteractive
+. /vagrant/vagrant/common.sh
+. /vagrant/vagrant/database.sh
+. /vagrant/vagrant/ruby.sh
+. /vagrant/vagrant/webapp.sh
+
+ufw allow 9292
+
+sudo su postgres -c "createuser -d vagrant"
+sudo su vagrant -c "createdb neocities"
+sudo su vagrant -c "createdb neocities_test"
\ No newline at end of file
diff --git a/vagrant/phantomjs.sh b/vagrant/phantomjs.sh
new file mode 100644
index 00000000..0e578661
--- /dev/null
+++ b/vagrant/phantomjs.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+DEBIAN_FRONTEND=noninteractive
+
+wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
+bzip2 -dc phantomjs-1.9.8-linux-x86_64.tar.bz2 | tar xf -
+cp phantomjs-1.9.8-linux-x86_64/bin/phantomjs /usr/local/bin/
\ No newline at end of file
diff --git a/vagrant/redis.sh b/vagrant/redis.sh
new file mode 100644
index 00000000..9cb659a1
--- /dev/null
+++ b/vagrant/redis.sh
@@ -0,0 +1,6 @@
+apt-get install -y redis-server
+
+#sed -i 's|[#]*appendfsync everysec|appendfsync always|g' /etc/redis/redis.conf
+sed -i 's|[#]*appendonly no|appendonly yes|g' /etc/redis/redis.conf
+
+service redis-server restart
\ No newline at end of file
diff --git a/vagrant/ruby.sh b/vagrant/ruby.sh
new file mode 100644
index 00000000..853c0120
--- /dev/null
+++ b/vagrant/ruby.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+apt-get -y install python-software-properties
+apt-add-repository -y ppa:brightbox/ruby-ng
+apt-get -y update
+apt-get -y install ruby2.2 ruby2.2-dev
+gem install bundler --no-rdoc --no-ri
\ No newline at end of file
diff --git a/vagrant/webapp.sh b/vagrant/webapp.sh
new file mode 100644
index 00000000..1687177b
--- /dev/null
+++ b/vagrant/webapp.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+DEBIAN_FRONTEND=noninteractive
+
+. /vagrant/vagrant/phantomjs.sh
+. /vagrant/vagrant/redis.sh
+
+apt-get install -y git curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev libpq-dev libmagickwand-dev imagemagick libmagickwand-dev libmagic-dev file clamav-daemon
+
+sed -i 's|[#]*DetectPUA false|DetectPUA true|g' /etc/clamav/clamd.conf
+
+freshclam
+service clamav-freshclam start
+service clamav-daemon start
+
+usermod -G vagrant clamav
+
+cd /vagrant
+bundle install
\ No newline at end of file
diff --git a/views/about.erb b/views/about.erb
index bfae797f..8d0db3cc 100644
--- a/views/about.erb
+++ b/views/about.erb
@@ -1,12 +1,12 @@
About Neocities
-
Your free web page is waiting… once again.
+
Your free web page is waiting… once again.
-
+
Neocities is bringing back the fun, creativity and independence that made the web great.
@@ -18,7 +18,7 @@
That's where Neocities comes in. We provide a canvas for people to make any web site they want.
Whether it be a web site about something they're good at, something they love, something they hate, or
- their own completely customized profile where they can introduce themselves in a way that actually matters to them.
+ their own completely customized profile where they can introduce themselves in a way that actually matters to them.
We can do this without selling out to the marketing industry, and we're going to prove it.
@@ -42,7 +42,7 @@
Anti lock-in. Redirecting to new sites, easy site downloading, and support for custom domains.
Sustainable. We want to grow, but that growth cannot risk the site (or compromise our principles).
-
+
If you share our values, we would love your support. Spread the word! We also have a supporter plan to help pay for the site, and we accept donations through multiple options (including Bitcoin... and Dogecoin).
-
\ No newline at end of file
+
diff --git a/views/browse.erb b/views/browse.erb
index 29b17357..940afbab 100644
--- a/views/browse.erb
+++ b/views/browse.erb
@@ -17,7 +17,7 @@
We have automatically been notified of the problem.
If you need to add any special information or if this error has not been resolved after a few days, contact us and report the problem. Thank you, and our apologies for the inconvenience.
-
\ No newline at end of file
+
diff --git a/views/home_mockup.erb b/views/home_mockup.erb
index 23c1e8f1..ae182b90 100644
--- a/views/home_mockup.erb
+++ b/views/home_mockup.erb
@@ -19,11 +19,11 @@
Welcome to your Neocities news feed!
You aren't following any websites yet! Once you do, updates will show up here and you can like and comment on them. Here are some website suggestions based on your tags, or check out all the sites on Neocities!
Your site is amazing. Very helpful information. Would love to see more updates if you have time. Your site is amazing. Very helpful information. Would love to see more updates if you have time.
@@ -209,11 +209,11 @@
victoria Indeed, it's great!Apr 7