diff --git a/README.md b/README.md index 6231d11..dd1c22c 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Now, download/copy the following configuration files (and tweak their contents a - [`docker-compose.yml`](/docker-compose.yml) - [`.env.sample`](/.env.sample) and save it as `.env` - [`bewcloud.config.sample.ts`](/bewcloud.config.sample.ts) and save it as `bewcloud.config.ts` -- [`radicale-config/config`](/radicale-config/config) and save it as `radicale-config/config` (if you're using CalDav/CardDav) +- [`radicale-config/config`](/radicale-config/config) and save it as `radicale-config/config` (if you're using CalDav/CardDav/Contacts) Finally, run these commands: diff --git a/bewcloud.config.sample.ts b/bewcloud.config.sample.ts index 130a7c8..0e80a1a 100644 --- a/bewcloud.config.sample.ts +++ b/bewcloud.config.sample.ts @@ -34,11 +34,11 @@ const config: PartialDeep = { // }, // contacts: { // enableCardDavServer: true, - // cardDavUrl: 'http://127.0.0.1:5232', + // cardDavUrl: 'http://radicale:5232', // }, // calendar: { // enableCalDavServer: true, - // calDavUrl: 'http://127.0.0.1:5232', + // calDavUrl: 'http://radicale:5232', // }, }; diff --git a/docker-compose.yml b/docker-compose.yml index a7add64..c5b8860 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: website: - image: ghcr.io/bewcloud/bewcloud:v2.4.4 + image: ghcr.io/bewcloud/bewcloud:v2.4.5 restart: always ports: - 127.0.0.1:8000:8000 @@ -32,8 +32,8 @@ services: # NOTE: If you don't want to use the CardDav/CalDav servers, you can comment/remove this service. radicale: image: tomsquest/docker-radicale:3.5.4.0 - ports: - - 127.0.0.1:5232:5232 + # ports: + # - 127.0.0.1:5232:5232 init: true read_only: true security_opt: diff --git a/lib/config.ts b/lib/config.ts index 46afaa7..53da908 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -38,11 +38,11 @@ export class AppConfig { }, contacts: { enableCardDavServer: true, - cardDavUrl: 'http://127.0.0.1:5232', + cardDavUrl: 'http://radicale:5232', }, calendar: { enableCalDavServer: true, - calDavUrl: 'http://127.0.0.1:5232', + calDavUrl: 'http://radicale:5232', }, }; } diff --git a/lib/models/contacts.ts b/lib/models/contacts.ts index a3ae6f8..0ccca51 100644 --- a/lib/models/contacts.ts +++ b/lib/models/contacts.ts @@ -135,32 +135,7 @@ export class ContactModel { ): Promise { const client = await getClient(userId); - let davAddressBooks: DAVObject[] = []; - - try { - davAddressBooks = await client.fetchAddressBooks(); - } catch (_error) { - // It's possible the user doesn't exist in Radicale yet, so try creating it by doing a simple PROPFIND request for the main addressbook's address (Radicale will automatically create the user) - const userUrl = `${contactsConfig.cardDavUrl}/${userId}/`; - - const xmlBody = ` - - - - -`; - - await fetch(userUrl, { - method: 'PROPFIND', - headers: { - 'Content-Type': 'application/xml; charset=utf-8', - 'X-Remote-User': userId, - }, - body: xmlBody, - }); - - davAddressBooks = await client.fetchAddressBooks(); - } + const davAddressBooks: DAVObject[] = await client.fetchAddressBooks(); const addressBooks: AddressBook[] = davAddressBooks.map((davAddressBook) => { const uid = davAddressBook.url.split('/').filter(Boolean).pop()!;