diff --git a/.env b/.env deleted file mode 100644 index 7bc3e94..0000000 --- a/.env +++ /dev/null @@ -1,5 +0,0 @@ -# This setting allows to fix the homeserver. -# If you set this setting, the user will not be able to select -# the server and have to use synapse-admin with this server. - -#REACT_APP_SERVER=https://yourmatrixserver.example.com \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index f936a8c..4e76929 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,12 @@ # Builder FROM node:lts as builder LABEL org.opencontainers.image.url=https://github.com/Awesome-Technologies/synapse-admin org.opencontainers.image.source=https://github.com/Awesome-Technologies/synapse-admin -ARG REACT_APP_SERVER WORKDIR /src COPY . /src RUN yarn --network-timeout=300000 install --immutable -RUN REACT_APP_SERVER=$REACT_APP_SERVER yarn build +RUN yarn build # App diff --git a/README.md b/README.md index 89211de..751f7d0 100644 --- a/README.md +++ b/README.md @@ -64,11 +64,6 @@ You have three options: - download dependencies: `yarn install` - start web server: `yarn start` -You can fix the homeserver, so that the user can no longer define it himself. -Either you define it at startup (e.g. `REACT_APP_SERVER=https://yourmatrixserver.example.com yarn start`) -or by editing it in the [.env](.env) file. See also the -[documentation](https://create-react-app.dev/docs/adding-custom-environment-variables/). - #### Steps for 3) - run the Docker container from the public docker registry: `docker run -p 8080:80 awesometechnologies/synapse-admin` or use the [docker-compose.yml](docker-compose.yml): `docker-compose up -d` @@ -76,8 +71,6 @@ or by editing it in the [.env](.env) file. See also the > note: if you're building on an architecture other than amd64 (for example a raspberry pi), make sure to define a maximum ram for node. otherwise the build will fail. ```yml - version: "3" - services: synapse-admin: container_name: synapse-admin @@ -88,7 +81,6 @@ or by editing it in the [.env](.env) file. See also the # - NODE_OPTIONS="--max_old_space_size=1024" # # see #266, PUBLIC_URL must be without surrounding quotation marks # - PUBLIC_URL=/synapse-admin - # - REACT_APP_SERVER="https://matrix.example.com" ports: - "8080:80" restart: unless-stopped @@ -96,6 +88,40 @@ or by editing it in the [.env](.env) file. See also the - browse to http://localhost:8080 +### Restricting available homeserver + +You can restrict the homeserver(s), so that the user can no longer define it himself. + +Edit `config.json` to restrict either to a single homeserver: + +```json +{ + "restrictBaseUrl": "https://your-matrixs-erver.example.com" +} +``` + +or to a list of homeservers: + +```json +{ + "restrictBaseUrl": [ + "https://your-first-matrix-server.example.com", + "https://your-second-matrix-server.example.com" + ] +} +``` + +The `config.json` can be injected into a Docker container using a bind mount. + +```yml +services: + synapse-admin: + ... + volumes: + ./config.json:/app/config.json + ... +``` + ## Screenshots ![Screenshots](./screenshots.jpg) diff --git a/docker-compose.yml b/docker-compose.yml index 6e07aa2..6b16162 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,10 @@ -version: "3" - services: synapse-admin: container_name: synapse-admin hostname: synapse-admin image: awesometechnologies/synapse-admin:latest # build: - # context: . + # context: . # to use the docker-compose as standalone without a local repo clone, # replace the context definition with this: @@ -18,9 +16,6 @@ services: # - NODE_OPTIONS="--max_old_space_size=1024" # default is . # - PUBLIC_URL=/synapse-admin - # You can use a fixed homeserver, so that the user can no longer - # define it himself - # - REACT_APP_SERVER="https://matrix.example.com" ports: - "8080:80" restart: unless-stopped diff --git a/public/config.json b/public/config.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/public/config.json @@ -0,0 +1 @@ +{} diff --git a/public/index.html b/public/index.html index 2b90907..3498b4c 100644 --- a/public/index.html +++ b/public/index.html @@ -24,10 +24,110 @@ Learn how to configure a non-root public URL by running `npm run build`. -->