webdav: improve docs, enforce supporter only access

This commit is contained in:
Kyle Drake 2025-02-08 11:59:20 -06:00
parent 6e49ac23cd
commit b21d15e285
5 changed files with 35 additions and 26 deletions

View file

@ -24,6 +24,24 @@ map '/webdav' do
request_method = env['REQUEST_METHOD'] request_method = env['REQUEST_METHOD']
path = env['PATH_INFO'] path = env['PATH_INFO']
unless @site.owner.supporter?
return [
402,
{
'Content-Type' => 'application/xml',
'X-Upgrade-Required' => 'https://neocities.org/supporter'
},
[
<<~XML
<?xml version="1.0" encoding="utf-8"?>
<error xmlns="DAV:">
<message>WebDAV access requires a supporter account.</message>
</error>
XML
]
]
end
case request_method case request_method
when 'OPTIONS' when 'OPTIONS'
return [200, {'Allow' => 'OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, MKCOL, MOVE', 'DAV' => '1,2'}, ['']] return [200, {'Allow' => 'OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, MKCOL, MOVE', 'DAV' => '1,2'}, ['']]

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View file

@ -10,42 +10,35 @@
<h1>About</h1> <h1>About</h1>
<p> <p>
Neocities supports <strong>WebDAV</strong>, which allows you to mount your Neocities share on your computer. Neocities supports <strong>WebDAV</strong>, which allows you to mount your Neocities share on your computer, or use a client on your computer to manage your site.
</p> </p>
<% if current_site.nil? %> <% if current_site.nil? || !current_site.supporter? %>
<p> <p>
This feature requires a supporter account. This feature requires a <a href="/supporter">supporter account</a>.
</p>
<% elsif !current_site.supporter? %>
<p>
This feature requires a supporter account. <a href="/supporter">Click here</a> to become a supporter.
</p> </p>
<% else %> <% else %>
<h2>Instructions per operating system</h2> <h2>Instructions</h2>
<h3>Windows</h3>
<p> <p>
Unfortunately, the WebDAV that comes with Windows file manager has issues with SSL, Due to the variable quality of other WebDAV clients, we strongly recommend using <a href="https://cyberduck.io">Cyberduck</a> or <a href="https://winscp.net/eng/index.php">WinSCP</a> for a WebDAV client, or <a href="https://mountainduck.io/">Mountain Duck</a> for mounting the site as a hard drive on your computer, and may not be able to provide support for other clients.
and the problem has not yet been fixed. We recommend using a client like <a href="https://cyberduck.io">Cyberduck</a> or <a href="https://winscp.net">WinSCP</a> with Windows, which is free and has
WebDAV support. You can also try <a href="https://mountainduck.io/">Mountain Duck</a>
which will allow you to mount your Neocities site as a hard drive on your computer.
</p> </p>
<h3>MacOS</h3> <h4>Cyberduck</h4>
<p> <p>
<a href="https://support.apple.com/en-us/guide/mac-help/connect-to-a-webdav-server-mchlp1546/mac">Use these instructions</a>, and use this URL to connect: <strong>https://neocities.org/webdav</strong> In Cyberduck, click "Open Connection", select "WebDAV (HTTPS), add neocities.org, username, and password. Then click "More Options", and add <code>/webdav</code> for the path.
<br> <br>
Enter login info when requested. <img src="/img/webdav/cyberduck.png" style="width: 30em;">
</p> </p>
<h4>WinSCP</h4>
<p> <p>
You can also try out <a href="https://cyberduck.io">Cyberduck</a> or <a href="https://mountainduck.io/">Mountain Duck</a> if you run into any issues. When creating a connetion, choose "WebDAV" for protocol, select "SSL" for encryption, then enter neocities.org for server name, port 443, username and password. Before connecting, click "Advanced", select "Directories" and add <code>/webdav</code> to the Remote directory input.
<br><br>
<img src="/img/webdav/winscp1.png" style="width: 30em;"><br><br><img src="/img/webdav/winscp2.png" style="width: 30em";>
</p> </p>
<h3>Linux (Gnome)</h3> <h3>Linux (GUI)</h3>
<p> <p>
<ol> <ol>
@ -56,6 +49,9 @@
</ol> </ol>
</p> </p>
<h4>Linux (command line)</h4>
<p><a href="https://manpages.ubuntu.com/manpages/en/man1/cadaver.1.html">cadaver</a> is an excellent command line client for WebDAV and is available through apt with Ubuntu.
<h4>Linux (mount as filesystem)</h4> <h4>Linux (mount as filesystem)</h4>
<p> <p>
@ -65,13 +61,8 @@
<h2>Accessing multiple sites</h2> <h2>Accessing multiple sites</h2>
<p> <p>
By default you can use your username/password combination to access your parent site via WebDAV (This is <code><%= current_site.parent? ? current_site.username : current_site.parent.username %></code>). 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). By default you can use your username/password combination to access your parent site via WebDAV. In case you want to access your child sites with WebDAV, you only need to use the site's subdomain name as the username (with the same password for your parent account).
</p> </p>
<p>
You can see a list of your sites in <a href="/settings">your settings page</a>.
</p>
<% end %> <% end %>
</article> </article>
</div> </div>