From 8d0e339f72c63b612921d928ad3197297be74db2 Mon Sep 17 00:00:00 2001
From: valtron
Date: Wed, 23 Jan 2019 17:56:47 -0700
Subject: [PATCH 1/5] api: include file sha1 hash in /api/list (#252)
---
app/api.rb | 1 +
tests/api_tests.rb | 1 +
views/api.erb | 12 ++++++++----
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/app/api.rb b/app/api.rb
index 60884132..95129827 100644
--- a/app/api.rb
+++ b/app/api.rb
@@ -32,6 +32,7 @@ get '/api/list' do
new_file[:is_directory] = file[:is_directory]
new_file[:size] = file[:size] unless file[:is_directory]
new_file[:updated_at] = file[:updated_at].rfc2822
+ new_file[:sha1_hash] = file[:sha1_hash] unless file[:is_directory]
files << new_file
end
diff --git a/tests/api_tests.rb b/tests/api_tests.rb
index a2aa1365..5dcc0be8 100644
--- a/tests/api_tests.rb
+++ b/tests/api_tests.rb
@@ -37,6 +37,7 @@ describe 'api list' do
site_file[:is_directory].must_equal file[:is_directory]
site_file[:size].must_equal file[:size]
site_file[:updated_at].rfc2822.must_equal file[:updated_at]
+ site_file[:sha1_hash].must_equal file[:sha1_hash]
end
end
diff --git a/views/api.erb b/views/api.erb
index bc5bd8d6..8c2a95da 100644
--- a/views/api.erb
+++ b/views/api.erb
@@ -110,13 +110,15 @@ api.delete(['img1.jpg', 'img2.jpg'], function(resp) {
"path": "index.html",
"is_directory": false,
"size": 1023,
- "updated_at": "Sat, 13 Feb 2016 03:04:00 -0000"
+ "updated_at": "Sat, 13 Feb 2016 03:04:00 -0000",
+ "sha1_hash": "c8aac06f343c962a24a7eb111aad739ff48b7fb1"
},
{
"path": "not_found.html",
"is_directory": false,
"size": 271,
- "updated_at": "Sat, 13 Feb 2016 03:04:00 -0000"
+ "updated_at": "Sat, 13 Feb 2016 03:04:00 -0000",
+ "sha1_hash": "cfdf0bda2557c322be78302da23c32fec72ffc0b"
},
{
"path": "images",
@@ -127,7 +129,8 @@ api.delete(['img1.jpg', 'img2.jpg'], function(resp) {
"path": "images/cat.png",
"is_directory": false,
"size": 16793,
- "updated_at": "Sat, 13 Feb 2016 03:04:00 -0000"
+ "updated_at": "Sat, 13 Feb 2016 03:04:00 -0000",
+ "sha1_hash": "41fe08fc0dd44e79f799d03ece903e62be25dc7d"
}
]
}
@@ -141,7 +144,8 @@ api.delete(['img1.jpg', 'img2.jpg'], function(resp) {
"path": "images/cat.png",
"is_directory": false,
"size": 16793,
- "updated_at": "Sat, 13 Feb 2016 03:04:00 -0000"
+ "updated_at": "Sat, 13 Feb 2016 03:04:00 -0000",
+ "sha1_hash": "41fe08fc0dd44e79f799d03ece903e62be25dc7d"
}
]
}
From 449e16e099639c605fbef3f9d9f1ffb819605263 Mon Sep 17 00:00:00 2001
From: Felipe Martin
Date: Mon, 11 Mar 2019 21:26:07 +0100
Subject: [PATCH 2/5] Updated WebDAV documentation
---
views/site_files/mount_info.erb | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/views/site_files/mount_info.erb b/views/site_files/mount_info.erb
index 4b9e6f20..2612bb43 100644
--- a/views/site_files/mount_info.erb
+++ b/views/site_files/mount_info.erb
@@ -22,15 +22,18 @@
This feature requires a supporter account. Click here to become a supporter.
<% else %>
- Instructions for Windows
+ Instructions per operating system
+
+ Windows
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
+ macOS
Use these instructions, and use this URL to connect: https://neocities.org/webdav
@@ -42,22 +45,33 @@
You can also try out Cyberduck or Mountain Duck if you run into any issues.
- Instructions for Linux (Ubuntu)
+ Linux (Gnome)
- Open Nautilus.
- - Press ALT-L to show the location bar.
- - Type davs://neocities.org/webdav into location bar.
+ - Press CTRL-L to show the location bar.
+ - Type
davs://neocities.org/webdav
into location bar.
- Enter your login into the popup.
- Instructions for Linux (command line)
+ Linux (mount as filesystem)
- For command line, use the davfs2 package.
+ To mount the WebDAV as a folder in your filesystem use the davfs2 package.
+
+ Accessing multiple sites
+
+
+ By default you can use your username/password combination to access your parent site via WebDAV (This is <%= current_site.parent? ? current_site.username : current_site.parent.username %>
). In case you want to access any other sites you only need to use the site's subdomain name as the username (with the same password for your account).
+
+
+
+ You can see a list of your sites in your settings page.
+
+
<% end %>
From 16f7e90938c3177b4016a4e45c8f5cb16eede7d1 Mon Sep 17 00:00:00 2001
From: Felipe Martin
Date: Mon, 11 Mar 2019 21:46:34 +0100
Subject: [PATCH 3/5] Updated provision script with auto cd and blacklist
creation
---
vagrant/development.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/vagrant/development.sh b/vagrant/development.sh
index 48b79513..c4bff3be 100644
--- a/vagrant/development.sh
+++ b/vagrant/development.sh
@@ -17,3 +17,16 @@ sudo sh -c 'echo "local all all trust" >> /etc/postgresql/9.3/main/pg_hba.conf'
sudo sh -c 'echo "host all all 127.0.0.1/32 trust" >> /etc/postgresql/9.3/main/pg_hba.conf'
sudo sh -c 'echo "host all all ::1/128 trust" >> /etc/postgresql/9.3/main/pg_hba.conf'
sudo service postgresql restart
+
+# Create empty file for disposable email accounts
+DISPOSABLE_EMAIL_PATH=/vagrant/files/disposable_email_blacklist.conf
+if [ ! -f $DISPOSABLE_EMAIL_PATH ]; then
+ sudo su vagrant -c "touch $DISPOSABLE_EMAIL_PATH"
+fi
+
+# Automatically enter the project path on vagrant ssh
+if grep -qv "cd /vagrant" /home/vagrant/.bashrc
+then
+ sudo su vagrant -c "echo 'cd /vagrant' >> ~/.bashrc"
+fi
+
From 10b9b0c9a07c4e6d46663f5348f52028d6f12e55 Mon Sep 17 00:00:00 2001
From: Felipe Martin
Date: Mon, 11 Mar 2019 21:46:57 +0100
Subject: [PATCH 4/5] Updated README
---
README.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/README.md b/README.md
index b38dd81b..15d8d0a5 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,6 @@ vagrant up --provision
```
vagrant ssh
-cd /vagrant
bundle exec rackup -o 0.0.0.0
```
From daff8628f9ff240959933296b6dcb9f32ef693a2 Mon Sep 17 00:00:00 2001
From: Felipe Martin
Date: Mon, 11 Mar 2019 21:55:07 +0100
Subject: [PATCH 5/5] Updated macOS webdav support page
---
views/site_files/mount_info.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/views/site_files/mount_info.erb b/views/site_files/mount_info.erb
index 2612bb43..2f48a6b0 100644
--- a/views/site_files/mount_info.erb
+++ b/views/site_files/mount_info.erb
@@ -36,7 +36,7 @@
macOS
- Use these instructions, and use this URL to connect: https://neocities.org/webdav
+ Use these instructions, and use this URL to connect: https://neocities.org/webdav
Enter login info when requested.