From 24d8caaf3e982f8d1840c6d9750a1a57075ee352 Mon Sep 17 00:00:00 2001
From: ed 
Date: Mon, 20 Mar 2023 21:45:52 +0000
Subject: [PATCH] switch rclone to owncloud mode so it sends lastmod
---
 copyparty/web/svcs.html |  4 ++--
 docs/rclone.md          | 25 +++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/copyparty/web/svcs.html b/copyparty/web/svcs.html
index b55460b8..cb0d87e8 100644
--- a/copyparty/web/svcs.html
+++ b/copyparty/web/svcs.html
@@ -46,7 +46,7 @@
             
note: rclone-FTP is a bit faster, so {% if args.ftp or args.ftps %}try that first{% else %}consider enabling FTP in server settings{% endif %}
if you can, install winfsp+rclone and then paste this in cmd:
-                rclone config create {{ aname }}-dav webdav url=http{{ s }}://{{ rip }}{{ hport }} vendor=other{% if accs %} user=k pass={{ pw }}{% endif %}
+                rclone config create {{ aname }}-dav webdav url=http{{ s }}://{{ rip }}{{ hport }} vendor=owncloud{% if accs %} user=k pass={{ pw }}{% endif %}
                 rclone mount --vfs-cache-mode writes --dir-cache-time 5s {{ aname }}-dav:{{ rvp }} W:
             
             {% if s %}
@@ -71,7 +71,7 @@
             
             or you can use rclone instead, which is much slower but doesn't require root:
-                rclone config create {{ aname }}-dav webdav url=http{{ s }}://{{ rip }}{{ hport }} vendor=other{% if accs %} user=k pass={{ pw }}{% endif %}
+                rclone config create {{ aname }}-dav webdav url=http{{ s }}://{{ rip }}{{ hport }} vendor=owncloud{% if accs %} user=k pass={{ pw }}{% endif %}
                 rclone mount --vfs-cache-mode writes --dir-cache-time 5s {{ aname }}-dav:{{ rvp }} mp
             
             {% if s %}
diff --git a/docs/rclone.md b/docs/rclone.md
index cd3fd6e5..75ba5bad 100644
--- a/docs/rclone.md
+++ b/docs/rclone.md
@@ -22,7 +22,7 @@ replace `hunter2` with your password, or remove the `hunter2` lines if you allow
 (
 echo [cpp-rw]
 echo type = webdav
-echo vendor = other
+echo vendor = owncloud
 echo url = http://127.0.0.1:3923/
 echo headers = Cookie,cppwd=hunter2
 echo(
@@ -41,7 +41,7 @@ also install the windows dependencies: [winfsp](https://github.com/billziss-gh/w
 cat > ~/.config/rclone/rclone.conf <<'EOF'
 [cpp-rw]
 type = webdav
-vendor = other
+vendor = owncloud
 url = http://127.0.0.1:3923/
 headers = Cookie,cppwd=hunter2
 
@@ -70,3 +70,24 @@ feels out of place but is too good not to mention
 rclone.exe serve http --read-only .
 rclone.exe serve webdav .
 ```
+
+
+# devnotes
+
+copyparty supports and expects [the following](https://github.com/rclone/rclone/blob/46484022b08f8756050aa45505ea0db23e62df8b/backend/webdav/webdav.go#L575-L578) from rclone,
+
+```go
+case "owncloud":
+    f.canStream = true
+    f.precision = time.Second
+    f.useOCMtime = true
+    f.hasOCMD5 = true
+    f.hasOCSHA1 = true
+```
+
+notably,
+* `useOCMtime` enables the `x-oc-mtime` header to retain mtime of uploads from rclone
+* `canStream` is supported but not required by us
+* `hasOCMD5` / `hasOCSHA1` is conveniently dontcare on both ends
+
+there's a scary comment mentioning PROPSET of lastmodified which is not something we wish to support