davis icon indicating copy to clipboard operation
davis copied to clipboard

Possibly FR or simple help request

Open SeLLeRoNe opened this issue 1 month ago • 5 comments

Hi there,

I've been using SabreDAV with a custom implementation done by the guys at myroundcube a very long time ago and decided it was time to do some maintainance.

I've installed latest SabreDav and Davis on a new test domain and I noticed that all the /addressboooks/ and /calendars/ are inside /dav/. So my question is, is there a way to have those available at the root of the domain?

Also, since I would like to use this using IMAP auth and be able to authenticate using different IMAP Server, is there a way to have the IMAP_AUTH_URL dynamically configured? (ex. mail.domain.tld where domain.tld comes directly from the email address used at login)? And, by extension on the above, have the MAILER_DSN dynamic in the same way?

Thanks for any feedback and for your work, much appreciated.

A

SeLLeRoNe avatar Nov 11 '25 20:11 SeLLeRoNe

Hi,

is there a way to have those available at the root of the domain?

Well I guess you can have a proxy in front that does that for you, but it will not be directly implemented in Davis. But why would you need that? Since you probably have to configure the principal address in the client and/or the client should honour the .well-known redirection, it shouldn't be a problem.

IMAP_AUTH_URL dynamically configured

For now it's not possible no sorry

tchapi avatar Nov 11 '25 20:11 tchapi

Well actually I found my answers.. I created a custom DAVController to just use / as prefix, would be good if that could be set via .env variable For the IMAP I changed file IMAPAuth.php

        // Extract the domain part from the username
        $domain = substr(strrchr($username, "@"), 1); // everything after the '@'
        $dynamicHost = 'mail.' . $domain;

        // Create a new instance of the IMAP client manually
        $client = $cm->make([
//            'host' => $this->IMAPHost,
            'host' => $dynamicHost,

Also this might be nice if there was a "DYNAMIC" option in the .env file to use this flow rather than hard-coding one entry

My next challenge is MAILER_DSN and a pre-set of calendars and addressbooks to be created :)

SeLLeRoNe avatar Nov 11 '25 20:11 SeLLeRoNe

Sorry, we responded at the same time, I need to be able to update my current DAV with the new one without causing issues to users, right now using autodiscovery all the clients have already automatically configured all the paths, so I cannot change it that simply.

I tried playing around with rewrite rules but without success, the changes made on my previous post made it work so that's ok for now :)

SeLLeRoNe avatar Nov 11 '25 20:11 SeLLeRoNe

Just for clarity and in case someone else needs/wants the / as root path, the change is basically just this: Copy src/Controller/DAVController.php to src/Controller/CustomDAVController.php And edit the new file src/Controller/CustomDAVController.php this wasy:

//        $this->baseUri = $router->generate('dav', ['path' => '']);
        $this->baseUri = '/';

With the addition of a route: config/routes/dav.yaml

dav_card_user:
    path: /addressbooks/{user}/{collection}/
    controller: App\Controller\CustomDAVController::dav
    methods: [PROPFIND, REPORT, GET, PUT, POST, DELETE, OPTIONS]

dav_cal_user:
    path: /calendars/{user}/{collection}/
    controller: App\Controller\CustomDAVController::dav
    methods: [PROPFIND, REPORT, GET, PUT, POST, DELETE, OPTIONS]

SeLLeRoNe avatar Nov 11 '25 20:11 SeLLeRoNe

Ok, never mind, the CustomAppController implementation worked fine while using a browser or cURL but the moment I try to use a client like Thundebird or DavX it doesn't seems to work properly

I've tried also the well-known suggestion on the .htaccess file but that also didn't work

I'll play around a bit more I guess :)

SeLLeRoNe avatar Nov 11 '25 21:11 SeLLeRoNe