icidasset / diffuse

A music player that connects to your cloud/distributed storage.
https://diffuse.sh
Other
809 stars 66 forks source link

WebDAV connected but no song loaded #374

Closed renmu123 closed 1 year ago

renmu123 commented 1 year ago

Hi, I tried diffuse.sh and successfully added my WebDAV server. But nothing shows.

I have configured CORS correctly.

I use the wsgidav as serve.

Here is the request from dev tools.

<?xml version="1.0" encoding="utf-8" ?>
<ns0:multistatus
    xmlns:ns0="DAV:">
    <ns0:response>
        <ns0:href>/music/</ns0:href>
        <ns0:propstat>
            <ns0:prop>
                <ns0:resourcetype>
                    <ns0:collection />
                </ns0:resourcetype>
                <ns0:creationdate>2022-12-08T15:22:13Z</ns0:creationdate>
                <ns0:getlastmodified>Thu, 08 Dec 2022 15:22:26 GMT</ns0:getlastmodified>
                <ns0:displayname>music</ns0:displayname>
                <ns0:lockdiscovery />
                <ns0:supportedlock>
                    <ns0:lockentry>
                        <ns0:lockscope>
                            <ns0:exclusive />
                        </ns0:lockscope>
                        <ns0:locktype>
                            <ns0:write />
                        </ns0:locktype>
                    </ns0:lockentry>
                    <ns0:lockentry>
                        <ns0:lockscope>
                            <ns0:shared />
                        </ns0:lockscope>
                        <ns0:locktype>
                            <ns0:write />
                        </ns0:locktype>
                    </ns0:lockentry>
                </ns0:supportedlock>
            </ns0:prop>
            <ns0:status>HTTP/1.1 200 OK</ns0:status>
        </ns0:propstat>
    </ns0:response>
    <ns0:response>
        <ns0:href>/music/aaa.mp3</ns0:href>
        <ns0:propstat>
            <ns0:prop>
                <ns0:resourcetype />
                <ns0:creationdate>2022-12-08T14:41:21Z</ns0:creationdate>
                <ns0:getcontentlength>9155491</ns0:getcontentlength>
                <ns0:getcontenttype>audio/mpeg</ns0:getcontenttype>
                <ns0:getlastmodified>Thu, 01 Dec 2022 13:08:04 GMT</ns0:getlastmodified>
                <ns0:displayname>aaa.mp3</ns0:displayname>
                <ns0:getetag>83faaa386595744d257bc07e75db0cd9-1669900084-9155491</ns0:getetag>
                <ns0:lockdiscovery />
                <ns0:supportedlock>
                    <ns0:lockentry>
                        <ns0:lockscope>
                            <ns0:exclusive />
                        </ns0:lockscope>
                        <ns0:locktype>
                            <ns0:write />
                        </ns0:locktype>
                    </ns0:lockentry>
                    <ns0:lockentry>
                        <ns0:lockscope>
                            <ns0:shared />
                        </ns0:lockscope>
                        <ns0:locktype>
                            <ns0:write />
                        </ns0:locktype>
                    </ns0:lockentry>
                </ns0:supportedlock>
            </ns0:prop>
            <ns0:status>HTTP/1.1 200 OK</ns0:status>
        </ns0:propstat>
    </ns0:response>
</ns0:multistatus>
icidasset commented 1 year ago

šŸ‘‹ Diffuse is configured to use the D: property namespace, not ns0:. I didn't realise different namespaces were actually used, I'll see if I can adjust the parser to deal with this. I'm working on a big PR at the moment, and don't have a lot of time in general to work on Diffuse so this could take a while. Maybe you can configure wsgidav to use the D: or d: namespace? šŸ¤”

Parser code lives here if you're interested: https://github.com/icidasset/diffuse/blob/main/src/Library/Sources/Services/WebDav/Parser.elm#L49

renmu123 commented 1 year ago

Thank for your help, can you recommand some webdav servers for me which support diffuse?

Netherquark commented 1 year ago

Hey, when I was trying to setup WebDAV with diffuse, icidasset recommended WebDAV go, a WebDAV server written in go as per the name

renmu123 commented 1 year ago

This is my config for webdav.

address: 0.0.0.0
port: 19000
auth: true
tls: false
prefix: /
debug: false

# Default user settings (will be merged)
scope: .
modify: true
rules: []

# CORS configuration
cors:
  enabled: true
  credentials: true
  allowed_hosts:
    - http://127.0.0.1:12345 # my local diffuse
  allowed_headers:
    - Depth
    - authorization
    - X-PINGOTHER
    - Content-Type
    - Range
    - Accept-Encoding
    - Origin
    - Host
    - Referer
  allowed_methods:
    - GET
    - PROPPATCH
    - PROPFIND
    - OPTIONS
  exposed_headers:
    - Content-Length
    - Content-Range
    - Allow
    - Content-Type
    - Origin

users:
  - username: admin
    password: admin
    scope: "" # path

l run local diffuse with caddy, this is my config

Caddyfile

:12345 {
        file_server
        encode zstd gzip
        try_files {path}  /index.html
}
icidasset commented 1 year ago

Glad you got it working! For other folks reading this, there's a few WebDAV tutorials for Diffuse here: https://github.com/icidasset/diffuse/discussions/328

Made an issue for the property namespaces in case anyone wants to track: https://github.com/icidasset/diffuse/issues/375