Fix for initial/clean Radicale setup
This fixes a problem with the contacts app displaying an error on a clean install, due to the fact that `tsdav`'s address book listing didn't ask for a main address first, so Radicale wouldn't create the user directory. It also upgrades `deno`'s version.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
FROM denoland/deno:ubuntu-2.4.4
|
FROM denoland/deno:ubuntu-2.4.5
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|||||||
24
README.md
24
README.md
@@ -18,21 +18,31 @@ If you're looking for the mobile app, it's at [`bewcloud-mobile`](https://github
|
|||||||
|
|
||||||
[-51a4fb?style=for-the-badge)](https://buy.stripe.com/fZu8wOb5RfIydj56FA1gs0J)
|
[-51a4fb?style=for-the-badge)](https://buy.stripe.com/fZu8wOb5RfIydj56FA1gs0J)
|
||||||
|
|
||||||
Or on your own machine:
|
Or on your own machine, start with these commands:
|
||||||
|
|
||||||
Download/copy [`docker-compose.yml`](/docker-compose.yml), [`.env.sample`](/.env.sample) as `.env`, [`bewcloud.config.sample.ts`](/bewcloud.config.sample.ts) as `bewcloud.config.ts`, and [`radicale-config/config`](/radicale-config/config) as `radicale-config/config` (if you're using CalDav/CardDav).
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> `1993:1993` below comes from deno's [docker image](https://github.com/denoland/deno_docker/blob/2abfe921484bdc79d11c7187a9d7b59537457c31/ubuntu.dockerfile#L20-L22) where `1993` is the default user id in it. It might change in the future since I don't control it.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ mkdir data-files data-radicale # local directories for storing user-uploaded files and radicale data
|
$ mkdir data-files data-radicale # local directories for storing user-uploaded files and radicale data
|
||||||
$ sudo chown -R 1993:1993 data-files # solves permission-related issues in the container with uploading files
|
$ sudo chown -R 1993:1993 data-files # solves permission-related issues in the container with uploading files
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> `1993:1993` below comes from deno's [docker image](https://github.com/denoland/deno_docker/blob/2abfe921484bdc79d11c7187a9d7b59537457c31/ubuntu.dockerfile#L20-L22) where `1993` is the default user id in it. It might change in the future since I don't control it.
|
||||||
|
|
||||||
|
Now, download/copy the following configuration files (and tweak their contents as necessary, though no changes should yield a working — but very unsafe — setup):
|
||||||
|
|
||||||
|
- [`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)
|
||||||
|
|
||||||
|
Finally, run these commands:
|
||||||
|
|
||||||
|
```sh
|
||||||
$ docker compose up -d # makes the app available at http://localhost:8000
|
$ docker compose up -d # makes the app available at http://localhost:8000
|
||||||
$ docker compose run --rm website bash -c "cd /app && make migrate-db" # initializes/updates the database (only needs to be executed the first time and on any data updates)
|
$ docker compose run --rm website bash -c "cd /app && make migrate-db" # initializes/updates the database (only needs to be executed the first time and on any data updates)
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, check the [Development section below](#development).
|
If you're interested in building/contributing, check the [Development section below](#development).
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> Even with signups disabled (`config.auth.allowSignups=false`), the first signup will work and become an admin.
|
> Even with signups disabled (`config.auth.allowSignups=false`), the first signup will work and become an admin.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
website:
|
website:
|
||||||
image: ghcr.io/bewcloud/bewcloud:v2.4.3
|
image: ghcr.io/bewcloud/bewcloud:v2.4.4
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 127.0.0.1:8000:8000
|
- 127.0.0.1:8000:8000
|
||||||
|
|||||||
@@ -135,7 +135,32 @@ export class ContactModel {
|
|||||||
): Promise<AddressBook[]> {
|
): Promise<AddressBook[]> {
|
||||||
const client = await getClient(userId);
|
const client = await getClient(userId);
|
||||||
|
|
||||||
const davAddressBooks: DAVObject[] = await client.fetchAddressBooks();
|
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 = `<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<propfind xmlns="DAV:" xmlns:card="urn:ietf:params:xml:ns:carddav">
|
||||||
|
<prop>
|
||||||
|
<card:addressbook-home-set/>
|
||||||
|
</prop>
|
||||||
|
</propfind>`;
|
||||||
|
|
||||||
|
await fetch(userUrl, {
|
||||||
|
method: 'PROPFIND',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/xml; charset=utf-8',
|
||||||
|
'X-Remote-User': userId,
|
||||||
|
},
|
||||||
|
body: xmlBody,
|
||||||
|
});
|
||||||
|
|
||||||
|
davAddressBooks = await client.fetchAddressBooks();
|
||||||
|
}
|
||||||
|
|
||||||
const addressBooks: AddressBook[] = davAddressBooks.map((davAddressBook) => {
|
const addressBooks: AddressBook[] = davAddressBooks.map((davAddressBook) => {
|
||||||
const uid = davAddressBook.url.split('/').filter(Boolean).pop()!;
|
const uid = davAddressBook.url.split('/').filter(Boolean).pop()!;
|
||||||
|
|||||||
Reference in New Issue
Block a user