mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-27 12:19:10 +00:00
Compare commits
214 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc9dedb91b | |||
| 3da3641a19 | |||
| 21626b4c4c | |||
| f16cedf5a5 | |||
| 00e4679dc5 | |||
| f76e7f0e51 | |||
| b9ffbd179c | |||
| a3ef1d4a26 | |||
| d11bcc5de9 | |||
| 412914cf01 | |||
| d511aedd39 | |||
| 7edf7d194b | |||
| 6324608a4a | |||
| a402c2f46f | |||
| e21858febe | |||
| 3d615fa582 | |||
| 4293444d3e | |||
| a55a4d5b5d | |||
| dd9a87a33b | |||
| 24242ef01a | |||
| b537cdfd93 | |||
| 80cc7c723f | |||
| e9210213b1 | |||
| 634f1924be | |||
| 4e175a8361 | |||
| c5ce32ef79 | |||
| aaf6b03a25 | |||
| 66bc739411 | |||
| 1b48fa256e | |||
| 053c4a40e9 | |||
| 53d732d802 | |||
| 26ca81db40 | |||
| e6e6a3bde7 | |||
| 26fdaac589 | |||
| 1fd1cb71ba | |||
| c8023573c6 | |||
| 584be7e65b | |||
| 59ec88e84a | |||
| 1b2e0ad431 | |||
| 20464a2845 | |||
| ece6284de2 | |||
| 82e994e5b1 | |||
| 85aa7a7251 | |||
| c4ececd03a | |||
| 57bba04cf3 | |||
| 11e162dbd4 | |||
| e06e9d1496 | |||
| c8cc9909ba | |||
| c218a1f7a2 | |||
| 490aaba30a | |||
| 790d37569c | |||
| 1e140a01b5 | |||
| 4ecb7202ec | |||
| 4b7419fe4a | |||
| 44d3c738d7 | |||
| 888c66a218 | |||
| 86641bd160 | |||
| 3d91af23cc | |||
| 2d0d30ce01 | |||
| 98ae9af84a | |||
| 3dda12ada6 | |||
| 8b2750c413 | |||
| c16c27fa50 | |||
| b3ef57e1b6 | |||
| b554a6a542 | |||
| 574fd6dc89 | |||
| 8d77332a0a | |||
| 0e2c805b41 | |||
| 9782eb8c7c | |||
| f6bc57ba91 | |||
| 4d5aec9a49 | |||
| 74b296aa37 | |||
| 88fadd1d61 | |||
| cac58f49d3 | |||
| 12c27eedac | |||
| 6a7ec95493 | |||
| e41656a760 | |||
| eb90c0f28c | |||
| f3c4b0ac40 | |||
| 038e6368e4 | |||
| 028f20375f | |||
| ccc23ff46a | |||
| e3b7a1f77b | |||
| 69a8eea1ce | |||
| 20493edd07 | |||
| 79f7fcab6e | |||
| ce3a6dab12 | |||
| 1b57dd0ecf | |||
| c6318910c2 | |||
| 03b3630611 | |||
| 5b8c8d493a | |||
| b12fb6bf48 | |||
| a8f64f5a36 | |||
| 6ab5b3300a | |||
| 6189e6454d | |||
| a8b2c56f4b | |||
| b472220151 | |||
| 223cee3828 | |||
| 101be503bf | |||
| 47e2d85471 | |||
| 16321b3cb0 | |||
| 144cb56cda | |||
| e6a15e36b4 | |||
| 3541af5992 | |||
| 68f0ea3639 | |||
| 925eb92c60 | |||
| d965ee7060 | |||
| aef85bb1ab | |||
| 8f59b08088 | |||
| 366998b3d6 | |||
| c8ad0ab24f | |||
| d2bbcb0f51 | |||
| 40457bd68a | |||
| c21c5f604b | |||
| 66350b8fb5 | |||
| 378cc3a651 | |||
| 28f43fb2c0 | |||
| 37eea16a50 | |||
| fe8ed43aae | |||
| 671aa68804 | |||
| 6449aaf7ea | |||
| f8fff3dbdf | |||
| 1715ec10dd | |||
| 8c7aed4b00 | |||
| 217b19e42a | |||
| bd26a0abc1 | |||
| abb708aa49 | |||
| 5d35161ae3 | |||
| 0b6f58bf9c | |||
| 79519fef26 | |||
| d7b1fbaf28 | |||
| 26bc67d1b4 | |||
| b783a8bac6 | |||
| e7dc54d6c5 | |||
| 9a07fba991 | |||
| ca3b1f0297 | |||
| 01390b12fb | |||
| df1eca7c34 | |||
| b529e9c848 | |||
| 23a2d3bcac | |||
| 55749a9565 | |||
| 8115a39538 | |||
| 2416ca1127 | |||
| 1971f594cf | |||
| fb0ee9e8f6 | |||
| b261f2ee5b | |||
| aa54075e6b | |||
| 271b598cee | |||
| fc232759fb | |||
| a992aa8898 | |||
| 1b8b91a44d | |||
| 63c6f5a8a1 | |||
| 1970a4d6b1 | |||
| d406f31bd8 | |||
| 4a011024dd | |||
| 59b23ad1b9 | |||
| 93be2881d2 | |||
| daa125edf3 | |||
| c93e770704 | |||
| 1f57adc4da | |||
| 952e6970f0 | |||
| af0746eac1 | |||
| 62492d1411 | |||
| 34e21b77b5 | |||
| 9edb9c2f57 | |||
| ee1abbed04 | |||
| ed52123733 | |||
| a7739efb70 | |||
| 72ef3c8bb0 | |||
| e9ef2bc4ae | |||
| 8587574fcd | |||
| c3617fc005 | |||
| 8f81318ecf | |||
| afd2f9a299 | |||
| fff5740b14 | |||
| 7545f94bbd | |||
| edb90327e5 | |||
| fdff5092b0 | |||
| 234116163a | |||
| 2a8027deb0 | |||
| d167490c09 | |||
| e7ea700c3d | |||
| edf19c8f1e | |||
| e6feed2086 | |||
| dbd9ac6eea | |||
| 86b03a3d47 | |||
| 2c2b4edc84 | |||
| 4be2d16483 | |||
| ccd0cb4641 | |||
| 561ea346db | |||
| 13bd195b22 | |||
| a35a4ffbec | |||
| 668523aa8b | |||
| d15fb0a19b | |||
| d6502f0739 | |||
| 504b851731 | |||
| cb6a81715a | |||
| 47c133cc64 | |||
| c0d490f549 | |||
| 41ad15e20b | |||
| 0707ac2cd4 | |||
| 5ce63d937d | |||
| 50791c945d | |||
| 1fb37f2f8e | |||
| eab64b7197 | |||
| 786cd3e4c7 | |||
| c8f96b1f22 | |||
| df5f0dbf9f | |||
| dc67d7c190 | |||
| 82208c220a | |||
| 2e081e5e1e | |||
| 57b8a15642 | |||
| b03bfe94a4 | |||
| a2774eb888 |
@@ -21,7 +21,7 @@ jobs:
|
|||||||
repositories: "meet,secrets"
|
repositories: "meet,secrets"
|
||||||
-
|
-
|
||||||
name: Checkout repository
|
name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
repositories: "meet,secrets"
|
repositories: "meet,secrets"
|
||||||
-
|
-
|
||||||
name: Checkout repository
|
name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
@@ -72,7 +72,7 @@ jobs:
|
|||||||
repositories: "meet,secrets"
|
repositories: "meet,secrets"
|
||||||
-
|
-
|
||||||
name: Checkout repository
|
name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
@@ -122,7 +122,7 @@ jobs:
|
|||||||
repositories: "meet,secrets"
|
repositories: "meet,secrets"
|
||||||
-
|
-
|
||||||
name: Checkout repository
|
name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
|
|||||||
+22
-10
@@ -14,7 +14,7 @@ jobs:
|
|||||||
if: github.event_name == 'pull_request' # Makes sense only for pull requests
|
if: github.event_name == 'pull_request' # Makes sense only for pull requests
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: show
|
- name: show
|
||||||
@@ -77,9 +77,9 @@ jobs:
|
|||||||
working-directory: src/backend
|
working-directory: src/backend
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
- name: Install Python
|
- name: Install Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
- name: Install development dependencies
|
- name: Install development dependencies
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
- name: Lint code with ruff
|
- name: Lint code with ruff
|
||||||
run: ~/.local/bin/ruff check .
|
run: ~/.local/bin/ruff check .
|
||||||
- name: Lint code with pylint
|
- name: Lint code with pylint
|
||||||
run: ~/.local/bin/pylint .
|
run: ~/.local/bin/pylint meet demo core
|
||||||
|
|
||||||
test-back:
|
test-back:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -122,9 +122,6 @@ jobs:
|
|||||||
DB_PASSWORD: pass
|
DB_PASSWORD: pass
|
||||||
DB_PORT: 5432
|
DB_PORT: 5432
|
||||||
STORAGES_STATICFILES_BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
|
STORAGES_STATICFILES_BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
|
||||||
AWS_S3_ENDPOINT_URL: http://localhost:9000
|
|
||||||
AWS_S3_ACCESS_KEY_ID: impress
|
|
||||||
AWS_S3_SECRET_ACCESS_KEY: password
|
|
||||||
LIVEKIT_API_SECRET: secret
|
LIVEKIT_API_SECRET: secret
|
||||||
LIVEKIT_API_KEY: devkey
|
LIVEKIT_API_KEY: devkey
|
||||||
|
|
||||||
@@ -145,7 +142,7 @@ jobs:
|
|||||||
key: mail-templates-${{ hashFiles('src/mail/mjml') }}
|
key: mail-templates-${{ hashFiles('src/mail/mjml') }}
|
||||||
|
|
||||||
- name: Install Python
|
- name: Install Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
|
|
||||||
@@ -163,6 +160,21 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: ~/.local/bin/pytest -n 2
|
run: ~/.local/bin/pytest -n 2
|
||||||
|
|
||||||
|
lint-front:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: cd src/frontend/ && npm ci
|
||||||
|
|
||||||
|
- name: Check linting
|
||||||
|
run: cd src/frontend/ && npm run lint
|
||||||
|
|
||||||
|
- name: Check format
|
||||||
|
run: cd src/frontend/ && npm run check
|
||||||
|
|
||||||
i18n-crowdin:
|
i18n-crowdin:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -176,7 +188,7 @@ jobs:
|
|||||||
repositories: "infrastructure,secrets"
|
repositories: "infrastructure,secrets"
|
||||||
-
|
-
|
||||||
name: Checkout repository
|
name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
@@ -193,7 +205,7 @@ jobs:
|
|||||||
sudo apt-get install -y gettext
|
sudo apt-get install -y gettext
|
||||||
|
|
||||||
- name: Install Python
|
- name: Install Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
|
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ node_modules
|
|||||||
# Mails
|
# Mails
|
||||||
src/backend/core/templates/mail/
|
src/backend/core/templates/mail/
|
||||||
|
|
||||||
# Typescript client
|
|
||||||
src/frontend/tsclient
|
|
||||||
|
|
||||||
# Swagger
|
# Swagger
|
||||||
**/swagger.json
|
**/swagger.json
|
||||||
|
|
||||||
|
|||||||
@@ -62,12 +62,17 @@ words=wip
|
|||||||
# For example, use the following regex if you only want to allow email addresses from foo.com
|
# For example, use the following regex if you only want to allow email addresses from foo.com
|
||||||
# regex=[^@]+@foo.com
|
# regex=[^@]+@foo.com
|
||||||
|
|
||||||
[ignore-by-title]
|
[ignore-by-title:bots]
|
||||||
# Allow empty body & wrong title pattern only when bots (pyup/greenkeeper)
|
# Allow empty body & wrong title pattern only when bots (pyup/greenkeeper)
|
||||||
# upgrade dependencies
|
# upgrade dependencies
|
||||||
regex=^(⬆️.*|Update (.*) from (.*) to (.*)|(chore|fix)\(package\): update .*)$
|
regex=^(⬆️.*|Update (.*) from (.*) to (.*)|(chore|fix)\(package\): update .*)$
|
||||||
ignore=B6,UC1
|
ignore=B6,UC1
|
||||||
|
|
||||||
|
[ignore-by-title:releases]
|
||||||
|
# Allow empty body for release commits
|
||||||
|
regex=^🔖.*$
|
||||||
|
ignore=B6
|
||||||
|
|
||||||
# [ignore-by-body]
|
# [ignore-by-body]
|
||||||
# Ignore certain rules for commits of which the body has a line that matches a regex
|
# Ignore certain rules for commits of which the body has a line that matches a regex
|
||||||
# E.g. Match bodies that have a line that that contain "release"
|
# E.g. Match bodies that have a line that that contain "release"
|
||||||
|
|||||||
@@ -48,8 +48,7 @@ WAIT_DB = @$(COMPOSE_RUN) dockerize -wait tcp://$(DB_HOST):$(DB_PORT
|
|||||||
|
|
||||||
# -- Backend
|
# -- Backend
|
||||||
MANAGE = $(COMPOSE_RUN_APP) python manage.py
|
MANAGE = $(COMPOSE_RUN_APP) python manage.py
|
||||||
MAIL_YARN = $(COMPOSE_RUN) -w /app/src/mail node yarn # FIXME : use npm
|
MAIL_NPM = $(COMPOSE_RUN) -w /app/src/mail node npm
|
||||||
TSCLIENT_YARN = $(COMPOSE_RUN) -w /app/src/tsclient node yarn # FIXME : use npm
|
|
||||||
|
|
||||||
# -- Frontend
|
# -- Frontend
|
||||||
PATH_FRONT = ./src/frontend
|
PATH_FRONT = ./src/frontend
|
||||||
@@ -142,7 +141,7 @@ lint-ruff-check: ## lint back-end python sources with ruff
|
|||||||
|
|
||||||
lint-pylint: ## lint back-end python sources with pylint only on changed files from main
|
lint-pylint: ## lint back-end python sources with pylint only on changed files from main
|
||||||
@echo 'lint:pylint started…'
|
@echo 'lint:pylint started…'
|
||||||
bin/pylint --diff-only=origin/main
|
@$(COMPOSE_RUN_APP) pylint meet demo core
|
||||||
.PHONY: lint-pylint
|
.PHONY: lint-pylint
|
||||||
|
|
||||||
test: ## run project tests
|
test: ## run project tests
|
||||||
@@ -260,32 +259,21 @@ i18n-generate-and-upload: \
|
|||||||
# -- Mail generator
|
# -- Mail generator
|
||||||
|
|
||||||
mails-build: ## Convert mjml files to html and text
|
mails-build: ## Convert mjml files to html and text
|
||||||
@$(MAIL_YARN) build
|
@$(MAIL_NPM) run build
|
||||||
.PHONY: mails-build
|
.PHONY: mails-build
|
||||||
|
|
||||||
mails-build-html-to-plain-text: ## Convert html files to text
|
mails-build-html-to-plain-text: ## Convert html files to text
|
||||||
@$(MAIL_YARN) build-html-to-plain-text
|
@$(MAIL_NPM) run build-html-to-plain-text
|
||||||
.PHONY: mails-build-html-to-plain-text
|
.PHONY: mails-build-html-to-plain-text
|
||||||
|
|
||||||
mails-build-mjml-to-html: ## Convert mjml files to html and text
|
mails-build-mjml-to-html: ## Convert mjml files to html and text
|
||||||
@$(MAIL_YARN) build-mjml-to-html
|
@$(MAIL_NPM) run build-mjml-to-html
|
||||||
.PHONY: mails-build-mjml-to-html
|
.PHONY: mails-build-mjml-to-html
|
||||||
|
|
||||||
mails-install: ## install the mail generator
|
mails-install: ## install the mail generator
|
||||||
@$(MAIL_YARN) install
|
@$(MAIL_NPM) install
|
||||||
.PHONY: mails-install
|
.PHONY: mails-install
|
||||||
|
|
||||||
# -- TS client generator
|
|
||||||
|
|
||||||
# FIXME : adapt this command
|
|
||||||
tsclient-install: ## Install the Typescript API client generator
|
|
||||||
@$(TSCLIENT_YARN) install
|
|
||||||
.PHONY: tsclient-install
|
|
||||||
|
|
||||||
# FIXME : adapt this command
|
|
||||||
tsclient: tsclient-install ## Generate a Typescript API client
|
|
||||||
@$(TSCLIENT_YARN) generate:api:client:local ../frontend/tsclient
|
|
||||||
.PHONY: tsclient-install
|
|
||||||
|
|
||||||
# -- Misc
|
# -- Misc
|
||||||
clean: ## restore repository state as it was freshly cloned
|
clean: ## restore repository state as it was freshly cloned
|
||||||
|
|||||||
@@ -94,6 +94,56 @@ You first need to create a superuser account:
|
|||||||
$ make superuser
|
$ make superuser
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Run application on local Kubernetes
|
||||||
|
|
||||||
|
The application is deployed across staging, preprod, and production environments using Kubernetes (K8s).
|
||||||
|
Reproducing environment conditions locally is crucial for developing new features or debugging issues.
|
||||||
|
|
||||||
|
This is facilitated by [Tilt](https://tilt.dev/) ("Kubernetes for Prod, Tilt for Dev"). Tilt enables smart rebuilds and live updates for services running locally in Kubernetes. We defined our services in a Tiltfile located at `bin/Tiltfile`.
|
||||||
|
|
||||||
|
|
||||||
|
#### Getting Started
|
||||||
|
|
||||||
|
Make sure you have installed:
|
||||||
|
- kubectl
|
||||||
|
- helm
|
||||||
|
- helmfile
|
||||||
|
- tilt
|
||||||
|
|
||||||
|
To build and start the Kubernetes cluster using Kind:
|
||||||
|
```shell
|
||||||
|
$ make build-k8s-cluster
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the Kubernetes cluster is ready, start the application stack locally:
|
||||||
|
```shell
|
||||||
|
$ make start-tilt
|
||||||
|
```
|
||||||
|
These commands set up and run your application environment using Tilt for local Kubernetes development.
|
||||||
|
|
||||||
|
You can monitor Tilt's at `http://localhost:10350/`. After Tilt actions finish, you can access the app at `https://meet.127.0.0.1.nip.io/`.
|
||||||
|
|
||||||
|
#### Debugging frontend
|
||||||
|
|
||||||
|
Tilt deploys the `meet-dev` for the frontend by default, to benefit from Vite.js hot reloading while developing.
|
||||||
|
To troubleshoot production issues, please modify the Tiltfile, switch frontend's target to `frontend-production`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
|
||||||
|
docker_build(
|
||||||
|
'localhost:5001/meet-frontend:latest',
|
||||||
|
context='..',
|
||||||
|
dockerfile='../src/frontend/Dockerfile',
|
||||||
|
only=['./src/frontend', './docker', './.dockerignore'],
|
||||||
|
target='frontend-production', # Update this line when needed
|
||||||
|
live_update=[
|
||||||
|
sync('../src/frontend', '/home/frontend'),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
This project is intended to be community-driven, so please, do not hesitate to
|
This project is intended to be community-driven, so please, do not hesitate to
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ set -eo pipefail
|
|||||||
REPO_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd)"
|
REPO_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd)"
|
||||||
UNSET_USER=0
|
UNSET_USER=0
|
||||||
|
|
||||||
TERRAFORM_DIRECTORY="./env.d/terraform"
|
|
||||||
COMPOSE_FILE="${REPO_DIR}/docker-compose.yml"
|
COMPOSE_FILE="${REPO_DIR}/docker-compose.yml"
|
||||||
COMPOSE_PROJECT="meet"
|
COMPOSE_PROJECT="meet"
|
||||||
|
|
||||||
@@ -92,66 +91,3 @@ function _dc_exec() {
|
|||||||
function _django_manage() {
|
function _django_manage() {
|
||||||
_dc_run "app-dev" python manage.py "$@"
|
_dc_run "app-dev" python manage.py "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# _set_openstack_project: select an OpenStack project from the openrc files defined in the
|
|
||||||
# terraform directory.
|
|
||||||
#
|
|
||||||
# usage: _set_openstack_project
|
|
||||||
#
|
|
||||||
# If necessary the script will prompt the user to choose a project from those available
|
|
||||||
function _set_openstack_project() {
|
|
||||||
|
|
||||||
declare prompt
|
|
||||||
declare -a projects
|
|
||||||
declare -i default=1
|
|
||||||
declare -i choice=0
|
|
||||||
declare -i n_projects
|
|
||||||
|
|
||||||
# List projects by looking in the "./env.d/terraform" directory
|
|
||||||
# and store them in an array
|
|
||||||
read -r -a projects <<< "$(
|
|
||||||
find "${TERRAFORM_DIRECTORY}" -maxdepth 1 -mindepth 1 -type d |
|
|
||||||
sed 's|'"${TERRAFORM_DIRECTORY}\/"'||' |
|
|
||||||
xargs
|
|
||||||
)"
|
|
||||||
nb_projects=${#projects[@]}
|
|
||||||
|
|
||||||
if [[ ${nb_projects} -le 0 ]]; then
|
|
||||||
echo "There are no OpenStack projects defined..." >&2
|
|
||||||
echo "To add one, create a subdirectory in \"${TERRAFORM_DIRECTORY}\" with the name" \
|
|
||||||
"of your project and copy your \"openrc.sh\" file into it." >&2
|
|
||||||
exit 10
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${nb_projects} -gt 1 ]]; then
|
|
||||||
prompt="Select an OpenStack project to target:\\n"
|
|
||||||
for (( i=0; i<nb_projects; i++ )); do
|
|
||||||
prompt+="[$((i+1))] ${projects[$i]}"
|
|
||||||
if [[ $((i+1)) -eq ${default} ]]; then
|
|
||||||
prompt+=" (default)"
|
|
||||||
fi
|
|
||||||
prompt+="\\n"
|
|
||||||
done
|
|
||||||
prompt+="If your OpenStack project is not listed, add it to the \"env.d/terraform\" directory.\\n"
|
|
||||||
prompt+="Your choice: "
|
|
||||||
read -r -p "$(echo -e "${prompt}")" choice
|
|
||||||
|
|
||||||
if [[ ${choice} -gt nb_projects ]]; then
|
|
||||||
(>&2 echo "Invalid choice ${choice} (should be <= ${nb_projects})")
|
|
||||||
exit 11
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${choice} -le 0 ]]; then
|
|
||||||
choice=${default}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
project=${projects[$((choice-1))]}
|
|
||||||
# Check that the openrc.sh file exists for this project
|
|
||||||
if [ ! -f "${TERRAFORM_DIRECTORY}/${project}/openrc.sh" ]; then
|
|
||||||
(>&2 echo "Missing \"openrc.sh\" file in \"${TERRAFORM_DIRECTORY}/${project}\". Check documentation.")
|
|
||||||
exit 12
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "${project}"
|
|
||||||
}
|
|
||||||
|
|||||||
-38
@@ -1,38 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# shellcheck source=bin/_config.sh
|
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/_config.sh"
|
|
||||||
|
|
||||||
declare diff_from
|
|
||||||
declare -a paths
|
|
||||||
declare -a args
|
|
||||||
|
|
||||||
# Parse options
|
|
||||||
for arg in "$@"
|
|
||||||
do
|
|
||||||
case $arg in
|
|
||||||
--diff-only=*)
|
|
||||||
diff_from="${arg#*=}"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-*)
|
|
||||||
args+=("$arg")
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
paths+=("$arg")
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -n "${diff_from}" ]]; then
|
|
||||||
# Run pylint only on modified files located in src/backend
|
|
||||||
# (excluding deleted files and migration files)
|
|
||||||
# shellcheck disable=SC2207
|
|
||||||
paths=($(git diff "${diff_from}" --name-only --diff-filter=d -- src/backend ':!**/migrations/*.py' | grep -E '^src/backend/.*\.py$'))
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Fix docker vs local path when project sources are mounted as a volume
|
|
||||||
read -ra paths <<< "$(echo "${paths[@]}" | sed "s|src/backend/||g")"
|
|
||||||
_dc_run app-dev pylint "${paths[@]}" "${args[@]}"
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -eo pipefail
|
|
||||||
|
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/_config.sh"
|
|
||||||
|
|
||||||
project=$(_set_openstack_project)
|
|
||||||
echo "Using \"${project}\" project..."
|
|
||||||
|
|
||||||
source "${TERRAFORM_DIRECTORY}/${project}/openrc.sh"
|
|
||||||
|
|
||||||
# Run Terraform commands in the Hashicorp docker container via docker compose
|
|
||||||
# shellcheck disable=SC2068
|
|
||||||
DOCKER_USER="$(id -u):$(id -g)" \
|
|
||||||
PROJECT="${project}" \
|
|
||||||
docker compose run --rm \
|
|
||||||
-e OS_AUTH_URL \
|
|
||||||
-e OS_IDENTITY_API_VERSION \
|
|
||||||
-e OS_USER_DOMAIN_NAME \
|
|
||||||
-e OS_PROJECT_DOMAIN_NAME \
|
|
||||||
-e OS_TENANT_ID \
|
|
||||||
-e OS_TENANT_NAME \
|
|
||||||
-e OS_USERNAME \
|
|
||||||
-e OS_PASSWORD \
|
|
||||||
-e OS_REGION_NAME \
|
|
||||||
terraform-state "$@"
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -eo pipefail
|
|
||||||
|
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/_config.sh"
|
|
||||||
|
|
||||||
project=$(_set_openstack_project)
|
|
||||||
echo "Using \"${project}\" project..."
|
|
||||||
|
|
||||||
source "${TERRAFORM_DIRECTORY}/${project}/openrc.sh"
|
|
||||||
|
|
||||||
# Run Terraform commands in the Hashicorp docker container via docker compose
|
|
||||||
# shellcheck disable=SC2068
|
|
||||||
DOCKER_USER="$(id -u):$(id -g)" \
|
|
||||||
PROJECT="${project}" \
|
|
||||||
docker compose run --rm \
|
|
||||||
-e OS_AUTH_URL \
|
|
||||||
-e OS_IDENTITY_API_VERSION \
|
|
||||||
-e OS_USER_DOMAIN_NAME \
|
|
||||||
-e OS_PROJECT_DOMAIN_NAME \
|
|
||||||
-e OS_TENANT_ID \
|
|
||||||
-e OS_TENANT_NAME \
|
|
||||||
-e OS_USERNAME \
|
|
||||||
-e OS_PASSWORD \
|
|
||||||
-e OS_REGION_NAME \
|
|
||||||
-e TF_VAR_user_name \
|
|
||||||
terraform "$@"
|
|
||||||
+58
-32
@@ -1,39 +1,65 @@
|
|||||||
# Releasing new version
|
# Releasing a new version
|
||||||
|
|
||||||
Whenever we are cooking a new release (e.g. `4.18.1`) we should follow a standard procedure described below:
|
Whenever we are cooking a new release (e.g. `4.18.1`) we should follow a standard procedure described below:
|
||||||
|
|
||||||
1. Create a new branch named: `release/4.18.1`.
|
1. Create a new branch named: `release/4.18.1`.
|
||||||
2. Bump the release number in the appropriate file, i.e. for backend in the `pyproject.toml` and `package.json` for node-based projects (tips: find and replace all occurrences of the previous version number to ensure consistency across files).
|
2. Bump the release number for backend project, frontend projects, and Helm files:
|
||||||
3. Update the project's `Changelog` following the [keepachangelog](https://keepachangelog.com/en/0.3.0/) recommendations.
|
|
||||||
4. Update Docker image tag in Helm values files located at `src/helm/env.d` for both `preprod` and `production` environments:
|
|
||||||
```yaml
|
|
||||||
image:
|
|
||||||
repository: lasuite/meet-backend
|
|
||||||
pullPolicy: Always
|
|
||||||
tag: "v4.18.1" # Replace with the latest Docker image tag.
|
|
||||||
```
|
|
||||||
5. Commit your changes with a structured message:
|
|
||||||
- Add a title including the version of the release and respecting the above described format using the 🔖 release emoji.
|
|
||||||
- Paste in the body all changes from the changelog concerned by this release, removing only the Markdown tags and making sure that lines are shorter than 74 characters.
|
|
||||||
|
|
||||||
```
|
- for backend, update the version number by hand in `pyproject.toml`,
|
||||||
|
- for each frontend projects (`src/frontend`, `src/mail`), run `npm version 4.18.1` in their directory. This will update both their `package.json` and `package-lock.json` for you,
|
||||||
|
- for Helm, update Docker image tag in files located at `src/helm/env.d` for both `preprod` and `production` environments:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
image:
|
||||||
|
repository: lasuite/meet-backend
|
||||||
|
pullPolicy: Always
|
||||||
|
tag: "v4.18.1" # Replace with your new version number, without forgetting the "v" prefix
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image:
|
||||||
|
repository: lasuite/meet-frontend
|
||||||
|
pullPolicy: Always
|
||||||
|
tag: "v4.18.1" # Replace with your new version number, without forgetting the "v" prefix
|
||||||
|
```
|
||||||
|
|
||||||
|
The new images don't exist _yet_: they will be created automatically later in the process.
|
||||||
|
|
||||||
|
3. ~~Update the project's `Changelog` following the [keepachangelog](https://keepachangelog.com/en/0.3.0/) recommendations~~ _we don't keep a changelog yet for now as the project is still in its infancy. Soon™!_
|
||||||
|
4. Commit your changes with the following format: the 🔖 release emoji, the type of release (patch/minor/patch) and the release version:
|
||||||
|
|
||||||
|
```text
|
||||||
🔖(minor) bump release to 4.18.0
|
🔖(minor) bump release to 4.18.0
|
||||||
|
|
||||||
Added:
|
|
||||||
|
|
||||||
- Implement base CLI commands (list, extract, fetch & push) for supported backends
|
|
||||||
- Support for ElasticSearch database backend
|
|
||||||
|
|
||||||
Changed:
|
|
||||||
|
|
||||||
- Replace LDP storage backend by FS storage backend`
|
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Open a pull request.
|
5. Open a pull request, wait for an approval from your peers and merge it.
|
||||||
7. Wait for an approval from your peers.
|
6. Checkout and pull changes from the `main` branch to ensure you have the latest updates.
|
||||||
8. Merge your pull request.
|
7. Tag and push your commit:
|
||||||
9. Checkout and pull changes from the `main` branch to ensure you have the latest updates.
|
|
||||||
10. Tag & push your commit: `git tag v4.18.1 && git push origin --tags`
|
```bash
|
||||||
11. Manually release your version on GitHub.
|
git tag v4.18.1 && git push origin --tags
|
||||||
12. Ensure that the CI Docker job has successfully pushed the newly built Docker images to Docker Hub with the appropriate tags.
|
```
|
||||||
13. To deploy using ArgoCD, you need to update the `production` or `pre-production` tags. ArgoCD will automatically detect and deploy the new tag.
|
|
||||||
|
Doing this triggers the CI and tells it to build the new Docker image versions that you targeted earlier in the Helm files.
|
||||||
|
|
||||||
|
8. Ensure the new [backend](https://hub.docker.com/r/lasuite/meet-frontend/tags) and [frontend](https://hub.docker.com/r/lasuite/meet-frontend/tags) image tags are on Docker Hub.
|
||||||
|
9. The release is now done!
|
||||||
|
|
||||||
|
# Deploying
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> The `staging` platform is deployed automatically with every update of the `main` branch.
|
||||||
|
|
||||||
|
Making a new release doesn't publish it automatically in production.
|
||||||
|
|
||||||
|
Deployment is done by ArgoCD. ArgoCD checks for the `production` tag and automatically deploys the production platform with the targeted commit.
|
||||||
|
|
||||||
|
To publish, we mark the commit we want with the `production` tag. ArgoCD is then notified that the tag has changed. It then deploys the Docker image tags specified in the Helm files of the targeted commit.
|
||||||
|
|
||||||
|
To publish the release you just made:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git tag --force production v4.18.1
|
||||||
|
git push --force origin production
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
# Api client TypeScript
|
|
||||||
|
|
||||||
The backend application can automatically create a TypeScript client to be used in frontend
|
|
||||||
applications. It is used in the Meet front application itself.
|
|
||||||
|
|
||||||
This client is made with [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen)
|
|
||||||
and Meet's backend OpenAPI schema (available [here](http://localhost:8071/v1.0/swagger/) if you have the backend running).
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
We'll need the online OpenAPI schema generated by swagger. Therefore you will first need to
|
|
||||||
install the backend application.
|
|
||||||
|
|
||||||
## Install openApiClientJs
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ cd src/tsclient
|
|
||||||
$ yarn install
|
|
||||||
```
|
|
||||||
|
|
||||||
## Generate the client
|
|
||||||
|
|
||||||
```sh
|
|
||||||
yarn generate:api:client:local <output_path_for_generated_client>
|
|
||||||
```
|
|
||||||
@@ -18,9 +18,6 @@ MEET_BASE_URL="http://localhost:8072"
|
|||||||
|
|
||||||
# Media
|
# Media
|
||||||
STORAGES_STATICFILES_BACKEND=django.contrib.staticfiles.storage.StaticFilesStorage
|
STORAGES_STATICFILES_BACKEND=django.contrib.staticfiles.storage.StaticFilesStorage
|
||||||
AWS_S3_ENDPOINT_URL=http://minio:9000
|
|
||||||
AWS_S3_ACCESS_KEY_ID=meet
|
|
||||||
AWS_S3_SECRET_ACCESS_KEY=password
|
|
||||||
|
|
||||||
# OIDC
|
# OIDC
|
||||||
OIDC_OP_JWKS_ENDPOINT=http://nginx:8083/realms/meet/protocol/openid-connect/certs
|
OIDC_OP_JWKS_ENDPOINT=http://nginx:8083/realms/meet/protocol/openid-connect/certs
|
||||||
@@ -44,3 +41,4 @@ OIDC_AUTH_REQUEST_EXTRA_PARAMS={"acr_values": "eidas1"}
|
|||||||
LIVEKIT_API_SECRET=secret
|
LIVEKIT_API_SECRET=secret
|
||||||
LIVEKIT_API_KEY=devkey
|
LIVEKIT_API_KEY=devkey
|
||||||
LIVEKIT_API_URL=http://localhost:7880
|
LIVEKIT_API_URL=http://localhost:7880
|
||||||
|
ALLOW_UNREGISTERED_ROOMS=False
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
find . -name "*.enc.*" -exec sops updatekeys -y {} \;
|
|
||||||
+1
-1
Submodule secrets updated: 9da011f5c2...f5fbc16e6e
@@ -1,4 +1,5 @@
|
|||||||
"""Admin classes and registrations for core app."""
|
"""Admin classes and registrations for core app."""
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth import admin as auth_admin
|
from django.contrib.auth import admin as auth_admin
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
"""
|
||||||
|
Meet analytics class.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
from june import analytics as jAnalytics
|
||||||
|
|
||||||
|
|
||||||
|
class Analytics:
|
||||||
|
"""Analytics integration
|
||||||
|
|
||||||
|
This class wraps the June analytics code to avoid coupling our code directly
|
||||||
|
with this third-party library. By doing so, we create a generic interface
|
||||||
|
for analytics that can be easily modified or replaced in the future.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
key = getattr(settings, "ANALYTICS_KEY", None)
|
||||||
|
|
||||||
|
if key is not None:
|
||||||
|
jAnalytics.write_key = key
|
||||||
|
|
||||||
|
self._enabled = key is not None
|
||||||
|
|
||||||
|
def _is_anonymous_user(self, user):
|
||||||
|
"""Check if the user is anonymous."""
|
||||||
|
return user is None or user.is_anonymous
|
||||||
|
|
||||||
|
def identify(self, user, **kwargs):
|
||||||
|
"""Identify a user"""
|
||||||
|
|
||||||
|
if self._is_anonymous_user(user) or not self._enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
traits = kwargs.pop("traits", {})
|
||||||
|
traits.update({"email": user.email_anonymized})
|
||||||
|
|
||||||
|
jAnalytics.identify(user_id=user.sub, traits=traits, **kwargs)
|
||||||
|
|
||||||
|
def track(self, user, **kwargs):
|
||||||
|
"""Track an event"""
|
||||||
|
|
||||||
|
if not self._enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
event_data = {}
|
||||||
|
if self._is_anonymous_user(user):
|
||||||
|
event_data["anonymous_id"] = str(uuid.uuid4())
|
||||||
|
else:
|
||||||
|
event_data["user_id"] = user.sub
|
||||||
|
|
||||||
|
jAnalytics.track(**event_data, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
analytics = Analytics()
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
"""Meet core API endpoints"""
|
"""Meet core API endpoints"""
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
@@ -22,6 +23,8 @@ def exception_handler(exc, context):
|
|||||||
detail = exc.message
|
detail = exc.message
|
||||||
elif hasattr(exc, "messages"):
|
elif hasattr(exc, "messages"):
|
||||||
detail = exc.messages
|
detail = exc.messages
|
||||||
|
else:
|
||||||
|
detail = ""
|
||||||
|
|
||||||
exc = drf_exceptions.ValidationError(detail=detail)
|
exc = drf_exceptions.ValidationError(detail=detail)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""Permission handlers for the Meet core app."""
|
"""Permission handlers for the Meet core app."""
|
||||||
|
|
||||||
from rest_framework import permissions
|
from rest_framework import permissions
|
||||||
|
|
||||||
from ..models import RoleChoices
|
from ..models import RoleChoices
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""Client serializers for the Meet core app."""
|
"""Client serializers for the Meet core app."""
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ class RoomSerializer(serializers.ModelSerializer):
|
|||||||
if role is not None or instance.is_public:
|
if role is not None or instance.is_public:
|
||||||
slug = f"{instance.id!s}".replace("-", "")
|
slug = f"{instance.id!s}".replace("-", "")
|
||||||
|
|
||||||
username = request.GET.get("username", None)
|
username = request.query_params.get("username", None)
|
||||||
|
|
||||||
output["livekit"] = {
|
output["livekit"] = {
|
||||||
"url": settings.LIVEKIT_CONFIGURATION["url"],
|
"url": settings.LIVEKIT_CONFIGURATION["url"],
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""API endpoints"""
|
"""API endpoints"""
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -19,6 +20,7 @@ from rest_framework import (
|
|||||||
|
|
||||||
from core import models, utils
|
from core import models, utils
|
||||||
|
|
||||||
|
from ..analytics import analytics
|
||||||
from . import permissions, serializers
|
from . import permissions, serializers
|
||||||
|
|
||||||
# pylint: disable=too-many-ancestors
|
# pylint: disable=too-many-ancestors
|
||||||
@@ -184,6 +186,13 @@ class RoomViewSet(
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
instance = self.get_object()
|
instance = self.get_object()
|
||||||
|
|
||||||
|
analytics.track(
|
||||||
|
user=self.request.user,
|
||||||
|
event="Get Room",
|
||||||
|
properties={"slug": instance.slug},
|
||||||
|
)
|
||||||
|
|
||||||
except Http404:
|
except Http404:
|
||||||
if not settings.ALLOW_UNREGISTERED_ROOMS:
|
if not settings.ALLOW_UNREGISTERED_ROOMS:
|
||||||
raise
|
raise
|
||||||
@@ -232,6 +241,14 @@ class RoomViewSet(
|
|||||||
role=models.RoleChoices.OWNER,
|
role=models.RoleChoices.OWNER,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
analytics.track(
|
||||||
|
user=self.request.user,
|
||||||
|
event="Create Room",
|
||||||
|
properties={
|
||||||
|
"slug": room.slug,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ResourceAccessListModelMixin:
|
class ResourceAccessListModelMixin:
|
||||||
"""List mixin for resource access API."""
|
"""List mixin for resource access API."""
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ from mozilla_django_oidc.auth import (
|
|||||||
|
|
||||||
from core.models import User
|
from core.models import User
|
||||||
|
|
||||||
|
from ..analytics import analytics
|
||||||
|
|
||||||
|
|
||||||
class OIDCAuthenticationBackend(MozillaOIDCAuthenticationBackend):
|
class OIDCAuthenticationBackend(MozillaOIDCAuthenticationBackend):
|
||||||
"""Custom OpenID Connect (OIDC) Authentication Backend.
|
"""Custom OpenID Connect (OIDC) Authentication Backend.
|
||||||
@@ -79,6 +81,7 @@ class OIDCAuthenticationBackend(MozillaOIDCAuthenticationBackend):
|
|||||||
else:
|
else:
|
||||||
user = None
|
user = None
|
||||||
|
|
||||||
|
analytics.identify(user=user)
|
||||||
return user
|
return user
|
||||||
|
|
||||||
def create_user(self, claims):
|
def create_user(self, claims):
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
"""Authentication Views for the People core app."""
|
"""Authentication Views for the People core app."""
|
||||||
|
|
||||||
|
import copy
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
from django.contrib import auth
|
from django.contrib import auth
|
||||||
@@ -11,10 +12,18 @@ from django.utils import crypto
|
|||||||
from mozilla_django_oidc.utils import (
|
from mozilla_django_oidc.utils import (
|
||||||
absolutify,
|
absolutify,
|
||||||
)
|
)
|
||||||
|
from mozilla_django_oidc.views import (
|
||||||
|
OIDCAuthenticationCallbackView as MozillaOIDCAuthenticationCallbackView,
|
||||||
|
)
|
||||||
|
from mozilla_django_oidc.views import (
|
||||||
|
OIDCAuthenticationRequestView as MozillaOIDCAuthenticationRequestView,
|
||||||
|
)
|
||||||
from mozilla_django_oidc.views import (
|
from mozilla_django_oidc.views import (
|
||||||
OIDCLogoutView as MozillaOIDCOIDCLogoutView,
|
OIDCLogoutView as MozillaOIDCOIDCLogoutView,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from ..analytics import analytics
|
||||||
|
|
||||||
|
|
||||||
class OIDCLogoutView(MozillaOIDCOIDCLogoutView):
|
class OIDCLogoutView(MozillaOIDCOIDCLogoutView):
|
||||||
"""Custom logout view for handling OpenID Connect (OIDC) logout flow.
|
"""Custom logout view for handling OpenID Connect (OIDC) logout flow.
|
||||||
@@ -91,6 +100,10 @@ class OIDCLogoutView(MozillaOIDCOIDCLogoutView):
|
|||||||
|
|
||||||
logout_url = self.redirect_url
|
logout_url = self.redirect_url
|
||||||
|
|
||||||
|
analytics.track(
|
||||||
|
user=request.user,
|
||||||
|
event="Signed Out",
|
||||||
|
)
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
logout_url = self.construct_oidc_logout_url(request)
|
logout_url = self.construct_oidc_logout_url(request)
|
||||||
|
|
||||||
@@ -135,3 +148,40 @@ class OIDCLogoutCallbackView(MozillaOIDCOIDCLogoutView):
|
|||||||
auth.logout(request)
|
auth.logout(request)
|
||||||
|
|
||||||
return HttpResponseRedirect(self.redirect_url)
|
return HttpResponseRedirect(self.redirect_url)
|
||||||
|
|
||||||
|
|
||||||
|
class OIDCAuthenticationCallbackView(MozillaOIDCAuthenticationCallbackView):
|
||||||
|
"""Custom callback view for handling the silent loging flow."""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def failure_url(self):
|
||||||
|
"""Override the failure URL property to handle silent login flow
|
||||||
|
|
||||||
|
A silent login failure (e.g., no active user session) should not be
|
||||||
|
considered as an authentication failure.
|
||||||
|
"""
|
||||||
|
if self.request.session.get("silent", None):
|
||||||
|
del self.request.session["silent"]
|
||||||
|
self.request.session.save()
|
||||||
|
return self.success_url
|
||||||
|
return super().failure_url
|
||||||
|
|
||||||
|
|
||||||
|
class OIDCAuthenticationRequestView(MozillaOIDCAuthenticationRequestView):
|
||||||
|
"""Custom authentication view for handling the silent loging flow."""
|
||||||
|
|
||||||
|
def get_extra_params(self, request):
|
||||||
|
"""Handle 'prompt' extra parameter for the silent login flow
|
||||||
|
|
||||||
|
This extra parameter is necessary to distinguish between a standard
|
||||||
|
authentication flow and the silent login flow.
|
||||||
|
"""
|
||||||
|
extra_params = self.get_settings("OIDC_AUTH_REQUEST_EXTRA_PARAMS", None)
|
||||||
|
if extra_params is None:
|
||||||
|
extra_params = {}
|
||||||
|
if request.GET.get("silent") == "true":
|
||||||
|
extra_params = copy.deepcopy(extra_params)
|
||||||
|
extra_params.update({"prompt": "none"})
|
||||||
|
request.session["silent"] = True
|
||||||
|
request.session.save()
|
||||||
|
return extra_params
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Core application enums declaration
|
Core application enums declaration
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf import global_settings, settings
|
from django.conf import global_settings, settings
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"""
|
"""
|
||||||
Core application factories
|
Core application factories
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.hashers import make_password
|
from django.contrib.auth.hashers import make_password
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.0.7 on 2024-08-07 14:38
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('core', '0002_create_pg_trgm_extension'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='room',
|
||||||
|
name='configuration',
|
||||||
|
field=models.JSONField(blank=True, default=dict, help_text='Values for Visio parameters to configure the room.', verbose_name='Visio room configuration'),
|
||||||
|
)
|
||||||
|
]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.0.7 on 2024-08-07 14:39
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('core', '0003_alter_room_configuration'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='user',
|
||||||
|
name='language',
|
||||||
|
field=models.CharField(choices="(('en-us', 'English'), ('fr-fr', 'French'))", default='en-us', help_text='The language in which the user wants to see the interface.', max_length=10, verbose_name='language'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Declare and configure the models for the Meet core application
|
Declare and configure the models for the Meet core application
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
@@ -162,6 +163,13 @@ class User(AbstractBaseUser, BaseModel, auth_models.PermissionsMixin):
|
|||||||
"""
|
"""
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@property
|
||||||
|
def email_anonymized(self):
|
||||||
|
"""Anonymize the email address by replacing the local part with asterisks."""
|
||||||
|
if not self.email:
|
||||||
|
return ""
|
||||||
|
return f"***@{self.email.split('@')[1]}"
|
||||||
|
|
||||||
|
|
||||||
class Resource(BaseModel):
|
class Resource(BaseModel):
|
||||||
"""Model to define access control"""
|
"""Model to define access control"""
|
||||||
@@ -288,7 +296,7 @@ class Room(Resource):
|
|||||||
|
|
||||||
configuration = models.JSONField(
|
configuration = models.JSONField(
|
||||||
blank=True,
|
blank=True,
|
||||||
default={},
|
default=dict,
|
||||||
verbose_name=_("Visio room configuration"),
|
verbose_name=_("Visio room configuration"),
|
||||||
help_text=_("Values for Visio parameters to configure the room."),
|
help_text=_("Values for Visio parameters to configure the room."),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -92,9 +92,12 @@ def test_models_oidc_user_getter_invalid_token(django_assert_num_queries, monkey
|
|||||||
|
|
||||||
monkeypatch.setattr(OIDCAuthenticationBackend, "get_userinfo", get_userinfo_mocked)
|
monkeypatch.setattr(OIDCAuthenticationBackend, "get_userinfo", get_userinfo_mocked)
|
||||||
|
|
||||||
with django_assert_num_queries(0), pytest.raises(
|
with (
|
||||||
SuspiciousOperation,
|
django_assert_num_queries(0),
|
||||||
match="User info contained no recognizable user identification",
|
pytest.raises(
|
||||||
|
SuspiciousOperation,
|
||||||
|
match="User info contained no recognizable user identification",
|
||||||
|
),
|
||||||
):
|
):
|
||||||
klass.get_or_create_user(access_token="test-token", id_token=None, payload=None)
|
klass.get_or_create_user(access_token="test-token", id_token=None, payload=None)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,13 @@ import pytest
|
|||||||
from rest_framework.test import APIClient
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
from core import factories
|
from core import factories
|
||||||
from core.authentication.views import OIDCLogoutCallbackView, OIDCLogoutView
|
from core.authentication.views import (
|
||||||
|
MozillaOIDCAuthenticationCallbackView,
|
||||||
|
OIDCAuthenticationCallbackView,
|
||||||
|
OIDCAuthenticationRequestView,
|
||||||
|
OIDCLogoutCallbackView,
|
||||||
|
OIDCLogoutView,
|
||||||
|
)
|
||||||
|
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
@@ -229,3 +235,125 @@ def test_view_logout_callback():
|
|||||||
|
|
||||||
assert response.status_code == 302
|
assert response.status_code == 302
|
||||||
assert response.url == "/example-logout"
|
assert response.url == "/example-logout"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("mocked_extra_params_setting", [{"foo": 123}, {}, None])
|
||||||
|
def test_view_authentication_default(settings, mocked_extra_params_setting):
|
||||||
|
"""By default, authentication request should not trigger silent login."""
|
||||||
|
|
||||||
|
settings.OIDC_AUTH_REQUEST_EXTRA_PARAMS = mocked_extra_params_setting
|
||||||
|
|
||||||
|
user = factories.UserFactory()
|
||||||
|
|
||||||
|
request = RequestFactory().request()
|
||||||
|
request.user = user
|
||||||
|
request.GET = {}
|
||||||
|
|
||||||
|
view = OIDCAuthenticationRequestView()
|
||||||
|
extra_params = view.get_extra_params(request)
|
||||||
|
|
||||||
|
assert extra_params == (mocked_extra_params_setting or {})
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("mocked_extra_params_setting", [{"foo": 123}, {}, None])
|
||||||
|
def test_view_authentication_silent_false(settings, mocked_extra_params_setting):
|
||||||
|
"""Ensure setting 'silent' parameter to a random value doesn't trigger the silent login flow."""
|
||||||
|
|
||||||
|
settings.OIDC_AUTH_REQUEST_EXTRA_PARAMS = mocked_extra_params_setting
|
||||||
|
|
||||||
|
user = factories.UserFactory()
|
||||||
|
|
||||||
|
request = RequestFactory().request()
|
||||||
|
request.user = user
|
||||||
|
request.GET = {"silent": "foo"}
|
||||||
|
|
||||||
|
middleware = SessionMiddleware(get_response=lambda x: x)
|
||||||
|
middleware.process_request(request)
|
||||||
|
|
||||||
|
view = OIDCAuthenticationRequestView()
|
||||||
|
extra_params = view.get_extra_params(request)
|
||||||
|
|
||||||
|
assert extra_params == (mocked_extra_params_setting or {})
|
||||||
|
assert not request.session.get("silent")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("mocked_extra_params_setting", [{"foo": 123}, {}, None])
|
||||||
|
def test_view_authentication_silent_true(settings, mocked_extra_params_setting):
|
||||||
|
"""If 'silent' parameter is set to True, the silent login should be triggered."""
|
||||||
|
settings.OIDC_AUTH_REQUEST_EXTRA_PARAMS = mocked_extra_params_setting
|
||||||
|
|
||||||
|
user = factories.UserFactory()
|
||||||
|
|
||||||
|
request = RequestFactory().request()
|
||||||
|
request.user = user
|
||||||
|
request.GET = {"silent": "true"}
|
||||||
|
|
||||||
|
middleware = SessionMiddleware(get_response=lambda x: x)
|
||||||
|
middleware.process_request(request)
|
||||||
|
|
||||||
|
view = OIDCAuthenticationRequestView()
|
||||||
|
extra_params = view.get_extra_params(request)
|
||||||
|
expected_params = {"prompt": "none"}
|
||||||
|
|
||||||
|
assert (
|
||||||
|
extra_params == {**mocked_extra_params_setting, **expected_params}
|
||||||
|
if mocked_extra_params_setting
|
||||||
|
else expected_params
|
||||||
|
)
|
||||||
|
assert request.session.get("silent") is True
|
||||||
|
|
||||||
|
|
||||||
|
@mock.patch.object(
|
||||||
|
MozillaOIDCAuthenticationCallbackView,
|
||||||
|
"failure_url",
|
||||||
|
new_callable=mock.PropertyMock,
|
||||||
|
return_value="foo",
|
||||||
|
)
|
||||||
|
def test_view_callback_failure_url(mocked_failure_url):
|
||||||
|
"""Test default behavior of the 'failure_url' property"""
|
||||||
|
|
||||||
|
user = factories.UserFactory()
|
||||||
|
|
||||||
|
request = RequestFactory().request()
|
||||||
|
request.user = user
|
||||||
|
|
||||||
|
middleware = SessionMiddleware(get_response=lambda x: x)
|
||||||
|
middleware.process_request(request)
|
||||||
|
|
||||||
|
view = OIDCAuthenticationCallbackView()
|
||||||
|
view.request = request
|
||||||
|
|
||||||
|
returned_url = view.failure_url
|
||||||
|
|
||||||
|
mocked_failure_url.assert_called_once()
|
||||||
|
assert returned_url == "foo"
|
||||||
|
|
||||||
|
|
||||||
|
@mock.patch.object(
|
||||||
|
OIDCAuthenticationCallbackView,
|
||||||
|
"success_url",
|
||||||
|
new_callable=mock.PropertyMock,
|
||||||
|
return_value="foo",
|
||||||
|
)
|
||||||
|
def test_view_callback_failure_url_silent_login(mocked_success_url):
|
||||||
|
"""If a silent login was initiated and failed, it should not be treated as a failure."""
|
||||||
|
|
||||||
|
user = factories.UserFactory()
|
||||||
|
|
||||||
|
request = RequestFactory().request()
|
||||||
|
request.user = user
|
||||||
|
|
||||||
|
middleware = SessionMiddleware(get_response=lambda x: x)
|
||||||
|
middleware.process_request(request)
|
||||||
|
|
||||||
|
request.session["silent"] = True
|
||||||
|
request.session.save()
|
||||||
|
|
||||||
|
view = OIDCAuthenticationCallbackView()
|
||||||
|
view.request = request
|
||||||
|
|
||||||
|
returned_url = view.failure_url
|
||||||
|
|
||||||
|
mocked_success_url.assert_called_once()
|
||||||
|
assert returned_url == "foo"
|
||||||
|
assert not request.session.get("silent")
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""Fixtures for tests in the Meet core application"""
|
"""Fixtures for tests in the Meet core application"""
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Test rooms API endpoints in the Meet core app: create.
|
Test rooms API endpoints in the Meet core app: create.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from rest_framework.test import APIClient
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Test rooms API endpoints in the Meet core app: delete.
|
Test rooms API endpoints in the Meet core app: delete.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from rest_framework.test import APIClient
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Test rooms API endpoints in the Meet core app: list.
|
Test rooms API endpoints in the Meet core app: list.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Test rooms API endpoints in the Meet core app: retrieve.
|
Test rooms API endpoints in the Meet core app: retrieve.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ def test_api_rooms_retrieve_anonymous_unregistered_not_allowed():
|
|||||||
response = client.get("/api/v1.0/rooms/unregistered-room/")
|
response = client.get("/api/v1.0/rooms/unregistered-room/")
|
||||||
|
|
||||||
assert response.status_code == 404
|
assert response.status_code == 404
|
||||||
assert response.json() == {"detail": "Not found."}
|
assert response.json() == {"detail": "No Room matches the given query."}
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("core.utils.generate_token", return_value="foo")
|
@mock.patch("core.utils.generate_token", return_value="foo")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Test rooms API endpoints in the Meet core app: update.
|
Test rooms API endpoints in the Meet core app: update.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Test suite for generated openapi schema.
|
Test suite for generated openapi schema.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
"""
|
||||||
|
Test for the Analytics class.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# pylint: disable=W0212
|
||||||
|
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from django.contrib.auth.models import AnonymousUser
|
||||||
|
from django.test.utils import override_settings
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from core.analytics import Analytics
|
||||||
|
from core.factories import UserFactory
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(name="mock_june_analytics")
|
||||||
|
def _mock_june_analytics():
|
||||||
|
with patch("core.analytics.jAnalytics") as mock:
|
||||||
|
yield mock
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY="test_key")
|
||||||
|
def test_analytics_init_enabled(mock_june_analytics):
|
||||||
|
"""Should enable analytics and set the write key correctly when ANALYTICS_KEY is set."""
|
||||||
|
analytics = Analytics()
|
||||||
|
assert analytics._enabled is True
|
||||||
|
assert mock_june_analytics.write_key == "test_key"
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY=None)
|
||||||
|
def test_analytics_init_disabled():
|
||||||
|
"""Should disable analytics when ANALYTICS_KEY is not set."""
|
||||||
|
analytics = Analytics()
|
||||||
|
assert analytics._enabled is False
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY="test_key")
|
||||||
|
def test_analytics_identify_user(mock_june_analytics):
|
||||||
|
"""Should identify a user with the correct traits when analytics is enabled."""
|
||||||
|
user = UserFactory(sub="12345", email="user@example.com")
|
||||||
|
analytics = Analytics()
|
||||||
|
analytics.identify(user)
|
||||||
|
mock_june_analytics.identify.assert_called_once_with(
|
||||||
|
user_id="12345", traits={"email": "***@example.com"}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY="test_key")
|
||||||
|
def test_analytics_identify_user_with_traits(mock_june_analytics):
|
||||||
|
"""Should identify a user with additional traits when analytics is enabled."""
|
||||||
|
user = UserFactory(sub="12345", email="user@example.com")
|
||||||
|
analytics = Analytics()
|
||||||
|
analytics.identify(user, traits={"email": "user@example.com", "foo": "foo"})
|
||||||
|
mock_june_analytics.identify.assert_called_once_with(
|
||||||
|
user_id="12345", traits={"email": "***@example.com", "foo": "foo"}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY=None)
|
||||||
|
def test_analytics_identify_not_enabled(mock_june_analytics):
|
||||||
|
"""Should not call identify when analytics is not enabled."""
|
||||||
|
user = UserFactory(sub="12345", email="user@example.com")
|
||||||
|
analytics = Analytics()
|
||||||
|
analytics.identify(user)
|
||||||
|
mock_june_analytics.identify.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY="test_key")
|
||||||
|
def test_analytics_identify_no_user(mock_june_analytics):
|
||||||
|
"""Should not call identify when the user is None."""
|
||||||
|
analytics = Analytics()
|
||||||
|
analytics.identify(None)
|
||||||
|
mock_june_analytics.identify.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY="test_key")
|
||||||
|
def test_analytics_identify_anonymous_user(mock_june_analytics):
|
||||||
|
"""Should not call identify when the user is anonymous."""
|
||||||
|
user = AnonymousUser()
|
||||||
|
analytics = Analytics()
|
||||||
|
analytics.identify(user)
|
||||||
|
mock_june_analytics.identify.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY="test_key")
|
||||||
|
def test_analytics_track_event(mock_june_analytics):
|
||||||
|
"""Should track an event with the correct user and event details when analytics is enabled."""
|
||||||
|
user = UserFactory(sub="12345")
|
||||||
|
analytics = Analytics()
|
||||||
|
analytics.track(user, event="test_event", foo="foo")
|
||||||
|
mock_june_analytics.track.assert_called_once_with(
|
||||||
|
user_id="12345", event="test_event", foo="foo"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY=None)
|
||||||
|
def test_analytics_track_event_not_enabled(mock_june_analytics):
|
||||||
|
"""Should not call track when analytics is not enabled."""
|
||||||
|
user = UserFactory(sub="12345")
|
||||||
|
analytics = Analytics()
|
||||||
|
analytics.track(user, event="test_event", foo="foo")
|
||||||
|
|
||||||
|
mock_june_analytics.track.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY="test_key")
|
||||||
|
@patch("uuid.uuid4", return_value="test_uuid4")
|
||||||
|
def test_analytics_track_event_no_user(mock_uuid4, mock_june_analytics):
|
||||||
|
"""Should track an event with a random anonymous user ID when the user is None."""
|
||||||
|
analytics = Analytics()
|
||||||
|
analytics.track(None, event="test_event", foo="foo")
|
||||||
|
mock_june_analytics.track.assert_called_once_with(
|
||||||
|
anonymous_id="test_uuid4", event="test_event", foo="foo"
|
||||||
|
)
|
||||||
|
mock_uuid4.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ANALYTICS_KEY="test_key")
|
||||||
|
@patch("uuid.uuid4", return_value="test_uuid4")
|
||||||
|
def test_analytics_track_event_anonymous_user(mock_uuid4, mock_june_analytics):
|
||||||
|
"""Should track an event with a random anonymous user ID when the user is anonymous."""
|
||||||
|
user = AnonymousUser()
|
||||||
|
analytics = Analytics()
|
||||||
|
analytics.track(user, event="test_event", foo="foo")
|
||||||
|
mock_june_analytics.track.assert_called_once_with(
|
||||||
|
anonymous_id="test_uuid4", event="test_event", foo="foo"
|
||||||
|
)
|
||||||
|
mock_uuid4.assert_called_once()
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Test resource accesses API endpoints in the Meet core app.
|
Test resource accesses API endpoints in the Meet core app.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Test users API endpoints in the Meet core app.
|
Test users API endpoints in the Meet core app.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from rest_framework.test import APIClient
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Unit tests for the ResourceAccess model with user
|
Unit tests for the ResourceAccess model with user
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Unit tests for the Room model
|
Unit tests for the Room model
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.contrib.auth.models import AnonymousUser
|
from django.contrib.auth.models import AnonymousUser
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Unit tests for the User model
|
Unit tests for the User model
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
@@ -43,3 +44,12 @@ def test_models_users_send_mail_main_missing():
|
|||||||
user.email_user("my subject", "my message")
|
user.email_user("my subject", "my message")
|
||||||
|
|
||||||
assert str(excinfo.value) == "User has no email address."
|
assert str(excinfo.value) == "User has no email address."
|
||||||
|
|
||||||
|
|
||||||
|
def test_models_users_email_anonymized():
|
||||||
|
"""The user's email should be anonymized if it exists."""
|
||||||
|
user = factories.UserFactory(email="john.doe@world.com")
|
||||||
|
assert user.email_anonymized == "***@world.com"
|
||||||
|
|
||||||
|
user = factories.UserFactory(email=None)
|
||||||
|
assert user.email_anonymized == ""
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""URL configuration for the core app."""
|
"""URL configuration for the core app."""
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
|
|
||||||
|
|||||||
+44
-10
@@ -1,6 +1,12 @@
|
|||||||
"""
|
"""
|
||||||
Utils functions used in the core app
|
Utils functions used in the core app
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# ruff: noqa:S311
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import random
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
@@ -9,8 +15,30 @@ from django.conf import settings
|
|||||||
from livekit.api import AccessToken, VideoGrants
|
from livekit.api import AccessToken, VideoGrants
|
||||||
|
|
||||||
|
|
||||||
|
def generate_color(identity: str) -> str:
|
||||||
|
"""Generates a consistent HSL color based on a given identity string.
|
||||||
|
|
||||||
|
The function seeds the random generator with the identity's hash,
|
||||||
|
ensuring consistent color output. The HSL format allows fine-tuned control
|
||||||
|
over saturation and lightness, empirically adjusted to produce visually
|
||||||
|
appealing and distinct colors. HSL is preferred over hex to constrain the color
|
||||||
|
range and ensure predictability.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# ruff: noqa:S324
|
||||||
|
identity_hash = hashlib.sha1(identity.encode("utf-8"))
|
||||||
|
# Keep only hash's last 16 bits, collisions are not a concern
|
||||||
|
seed = int(identity_hash.hexdigest(), 16) & 0xFFFF
|
||||||
|
random.seed(seed)
|
||||||
|
hue = random.randint(0, 360)
|
||||||
|
saturation = random.randint(50, 75)
|
||||||
|
lightness = random.randint(25, 60)
|
||||||
|
|
||||||
|
return f"hsl({hue}, {saturation}%, {lightness}%)"
|
||||||
|
|
||||||
|
|
||||||
def generate_token(room: str, user, username: Optional[str] = None) -> str:
|
def generate_token(room: str, user, username: Optional[str] = None) -> str:
|
||||||
"""Generate a Livekit access token for a user in a specific room.
|
"""Generate a LiveKit access token for a user in a specific room.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
room (str): The name of the room.
|
room (str): The name of the room.
|
||||||
@@ -21,10 +49,12 @@ def generate_token(room: str, user, username: Optional[str] = None) -> str:
|
|||||||
Returns:
|
Returns:
|
||||||
str: The LiveKit JWT access token.
|
str: The LiveKit JWT access token.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
video_grants = VideoGrants(
|
video_grants = VideoGrants(
|
||||||
room=room,
|
room=room,
|
||||||
room_join=True,
|
room_join=True,
|
||||||
|
room_admin=True,
|
||||||
|
room_record=True,
|
||||||
|
can_update_own_metadata=True,
|
||||||
can_publish_sources=[
|
can_publish_sources=[
|
||||||
"camera",
|
"camera",
|
||||||
"microphone",
|
"microphone",
|
||||||
@@ -33,18 +63,22 @@ def generate_token(room: str, user, username: Optional[str] = None) -> str:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
token = AccessToken(
|
|
||||||
api_key=settings.LIVEKIT_CONFIGURATION["api_key"],
|
|
||||||
api_secret=settings.LIVEKIT_CONFIGURATION["api_secret"],
|
|
||||||
).with_grants(video_grants)
|
|
||||||
|
|
||||||
if user.is_anonymous:
|
if user.is_anonymous:
|
||||||
token.with_identity(str(uuid4()))
|
identity = str(uuid4())
|
||||||
default_username = "Anonymous"
|
default_username = "Anonymous"
|
||||||
else:
|
else:
|
||||||
token.with_identity(user.sub)
|
identity = str(user.sub)
|
||||||
default_username = str(user)
|
default_username = str(user)
|
||||||
|
|
||||||
token.with_name(username or default_username)
|
token = (
|
||||||
|
AccessToken(
|
||||||
|
api_key=settings.LIVEKIT_CONFIGURATION["api_key"],
|
||||||
|
api_secret=settings.LIVEKIT_CONFIGURATION["api_secret"],
|
||||||
|
)
|
||||||
|
.with_grants(video_grants)
|
||||||
|
.with_identity(identity)
|
||||||
|
.with_name(username or default_username)
|
||||||
|
.with_metadata(json.dumps({"color": generate_color(identity)}))
|
||||||
|
)
|
||||||
|
|
||||||
return token.to_jwt()
|
return token.to_jwt()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""Management user to create a superuser."""
|
"""Management user to create a superuser."""
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"""
|
"""
|
||||||
meet's sandbox management script.
|
meet's sandbox management script.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"""Meet celery configuration file."""
|
"""Meet celery configuration file."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from celery import Celery
|
from celery import Celery
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ https://docs.djangoproject.com/en/3.1/topics/settings/
|
|||||||
For the full list of settings and their values, see
|
For the full list of settings and their values, see
|
||||||
https://docs.djangoproject.com/en/3.1/ref/settings/
|
https://docs.djangoproject.com/en/3.1/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
from socket import gethostbyname, gethostname
|
||||||
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
@@ -70,6 +72,7 @@ class Base(Configuration):
|
|||||||
# Security
|
# Security
|
||||||
ALLOWED_HOSTS = values.ListValue([])
|
ALLOWED_HOSTS = values.ListValue([])
|
||||||
SECRET_KEY = values.Value(None)
|
SECRET_KEY = values.Value(None)
|
||||||
|
SILENCED_SYSTEM_CHECKS = values.ListValue([])
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
ROOT_URLCONF = "meet.urls"
|
ROOT_URLCONF = "meet.urls"
|
||||||
@@ -272,6 +275,7 @@ class Base(Configuration):
|
|||||||
# Easy thumbnails
|
# Easy thumbnails
|
||||||
THUMBNAIL_EXTENSION = "webp"
|
THUMBNAIL_EXTENSION = "webp"
|
||||||
THUMBNAIL_TRANSPARENCY_EXTENSION = "webp"
|
THUMBNAIL_TRANSPARENCY_EXTENSION = "webp"
|
||||||
|
THUMBNAIL_DEFAULT_STORAGE_ALIAS = "default"
|
||||||
THUMBNAIL_ALIASES = {}
|
THUMBNAIL_ALIASES = {}
|
||||||
|
|
||||||
# Celery
|
# Celery
|
||||||
@@ -284,6 +288,8 @@ class Base(Configuration):
|
|||||||
SESSION_COOKIE_AGE = 60 * 60 * 12
|
SESSION_COOKIE_AGE = 60 * 60 * 12
|
||||||
|
|
||||||
# OIDC - Authorization Code Flow
|
# OIDC - Authorization Code Flow
|
||||||
|
OIDC_AUTHENTICATE_CLASS = "core.authentication.views.OIDCAuthenticationRequestView"
|
||||||
|
OIDC_CALLBACK_CLASS = "core.authentication.views.OIDCAuthenticationCallbackView"
|
||||||
OIDC_CREATE_USER = values.BooleanValue(
|
OIDC_CREATE_USER = values.BooleanValue(
|
||||||
default=True,
|
default=True,
|
||||||
environ_name="OIDC_CREATE_USER",
|
environ_name="OIDC_CREATE_USER",
|
||||||
@@ -344,6 +350,9 @@ class Base(Configuration):
|
|||||||
ALLOW_LOGOUT_GET_METHOD = values.BooleanValue(
|
ALLOW_LOGOUT_GET_METHOD = values.BooleanValue(
|
||||||
default=True, environ_name="ALLOW_LOGOUT_GET_METHOD", environ_prefix=None
|
default=True, environ_name="ALLOW_LOGOUT_GET_METHOD", environ_prefix=None
|
||||||
)
|
)
|
||||||
|
OIDC_REDIRECT_FIELD_NAME = values.Value(
|
||||||
|
"returnTo", environ_name="OIDC_REDIRECT_FIELD_NAME", environ_prefix=None
|
||||||
|
)
|
||||||
|
|
||||||
# Video conference configuration
|
# Video conference configuration
|
||||||
LIVEKIT_CONFIGURATION = {
|
LIVEKIT_CONFIGURATION = {
|
||||||
@@ -359,6 +368,9 @@ class Base(Configuration):
|
|||||||
ALLOW_UNREGISTERED_ROOMS = values.BooleanValue(
|
ALLOW_UNREGISTERED_ROOMS = values.BooleanValue(
|
||||||
True, environ_name="ALLOW_UNREGISTERED_ROOMS", environ_prefix=None
|
True, environ_name="ALLOW_UNREGISTERED_ROOMS", environ_prefix=None
|
||||||
)
|
)
|
||||||
|
ANALYTICS_KEY = values.Value(
|
||||||
|
None, environ_name="ANALYTICS_KEY", environ_prefix=None
|
||||||
|
)
|
||||||
|
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
@property
|
@property
|
||||||
@@ -479,6 +491,8 @@ class Test(Base):
|
|||||||
|
|
||||||
CELERY_TASK_ALWAYS_EAGER = values.BooleanValue(True)
|
CELERY_TASK_ALWAYS_EAGER = values.BooleanValue(True)
|
||||||
|
|
||||||
|
ANALYTICS_KEY = None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
self.INSTALLED_APPS += ["drf_spectacular_sidecar"]
|
self.INSTALLED_APPS += ["drf_spectacular_sidecar"]
|
||||||
@@ -502,7 +516,11 @@ class Production(Base):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Security
|
# Security
|
||||||
ALLOWED_HOSTS = values.ListValue(None)
|
ALLOWED_HOSTS = [
|
||||||
|
*values.ListValue([], environ_name="ALLOWED_HOSTS"),
|
||||||
|
gethostbyname(gethostname()),
|
||||||
|
]
|
||||||
|
|
||||||
CSRF_TRUSTED_ORIGINS = values.ListValue([])
|
CSRF_TRUSTED_ORIGINS = values.ListValue([])
|
||||||
SECURE_BROWSER_XSS_FILTER = True
|
SECURE_BROWSER_XSS_FILTER = True
|
||||||
SECURE_CONTENT_TYPE_NOSNIFF = True
|
SECURE_CONTENT_TYPE_NOSNIFF = True
|
||||||
|
|||||||
+42
-41
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "meet"
|
name = "meet"
|
||||||
version = "0.1.1"
|
version = "0.1.5"
|
||||||
authors = [{ "name" = "DINUM", "email" = "dev@mail.numerique.gouv.fr" }]
|
authors = [{ "name" = "DINUM", "email" = "dev@mail.numerique.gouv.fr" }]
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 5 - Production/Stable",
|
"Development Status :: 5 - Production/Stable",
|
||||||
@@ -19,44 +19,45 @@ classifiers = [
|
|||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
]
|
]
|
||||||
description = "An application to print markdown to pdf from a set of managed templates."
|
description = "A simple video and phone conferencing tool, powered by LiveKit"
|
||||||
keywords = ["Django", "Contacts", "Templates", "RBAC"]
|
keywords = ["Django", "Contacts", "Templates", "RBAC"]
|
||||||
license = { file = "LICENSE" }
|
license = { file = "LICENSE" }
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"boto3==1.33.6",
|
"boto3==1.35.10",
|
||||||
"Brotli==1.1.0",
|
"Brotli==1.1.0",
|
||||||
"celery[redis]==5.3.6",
|
"celery[redis]==5.4.0",
|
||||||
"django-configurations==2.5",
|
"django-configurations==2.5.1",
|
||||||
"django-cors-headers==4.3.1",
|
"django-cors-headers==4.4.0",
|
||||||
"django-countries==7.5.1",
|
"django-countries==7.6.1",
|
||||||
"django-parler==2.3",
|
"django-parler==2.3",
|
||||||
"redis==5.0.3",
|
"redis==5.0.8",
|
||||||
"django-redis==5.4.0",
|
"django-redis==5.4.0",
|
||||||
"django-storages[s3]==1.14.2",
|
"django-storages[s3]==1.14.4",
|
||||||
"django-timezone-field>=5.1",
|
"django-timezone-field>=5.1",
|
||||||
"django==5.0.3",
|
"django==5.1",
|
||||||
"djangorestframework==3.14.0",
|
"djangorestframework==3.15.2",
|
||||||
"drf_spectacular==0.26.5",
|
"drf_spectacular==0.27.2",
|
||||||
"dockerflow==2022.8.0",
|
"dockerflow==2024.4.2",
|
||||||
"easy_thumbnails==2.8.5",
|
"easy_thumbnails==2.9",
|
||||||
"factory_boy==3.3.0",
|
"factory_boy==3.3.1",
|
||||||
"freezegun==1.5.0",
|
"freezegun==1.5.1",
|
||||||
"gunicorn==22.0.0",
|
"gunicorn==23.0.0",
|
||||||
"jsonschema==4.20.0",
|
"jsonschema==4.23.0",
|
||||||
"markdown==3.5.1",
|
"june-analytics-python==2.3.0",
|
||||||
|
"markdown==3.7",
|
||||||
"nested-multipart-parser==1.5.0",
|
"nested-multipart-parser==1.5.0",
|
||||||
"psycopg[binary]==3.1.14",
|
"psycopg[binary]==3.2.1",
|
||||||
"PyJWT==2.8.0",
|
"PyJWT==2.9.0",
|
||||||
"python-frontmatter==1.0.1",
|
"python-frontmatter==1.1.0",
|
||||||
"requests==2.31.0",
|
"requests==2.32.3",
|
||||||
"sentry-sdk==1.38.0",
|
"sentry-sdk==2.13.0",
|
||||||
"url-normalize==1.4.3",
|
"url-normalize==1.4.3",
|
||||||
"WeasyPrint>=60.2",
|
"WeasyPrint>=60.2",
|
||||||
"whitenoise==6.6.0",
|
"whitenoise==6.7.0",
|
||||||
"mozilla-django-oidc==4.0.0",
|
"mozilla-django-oidc==4.0.1",
|
||||||
"livekit-api==0.5.1",
|
"livekit-api==0.7.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
@@ -68,20 +69,20 @@ dependencies = [
|
|||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
"django-extensions==3.2.3",
|
"django-extensions==3.2.3",
|
||||||
"drf-spectacular-sidecar==2023.12.1",
|
"drf-spectacular-sidecar==2024.7.1",
|
||||||
"ipdb==0.13.13",
|
"ipdb==0.13.13",
|
||||||
"ipython==8.18.1",
|
"ipython==8.27.0",
|
||||||
"pyfakefs==5.3.2",
|
"pyfakefs==5.6.0",
|
||||||
"pylint-django==2.5.5",
|
"pylint-django==2.5.5",
|
||||||
"pylint==3.0.3",
|
"pylint==3.2.7",
|
||||||
"pytest-cov==4.1.0",
|
"pytest-cov==5.0.0",
|
||||||
"pytest-django==4.7.0",
|
"pytest-django==4.8.0",
|
||||||
"pytest==7.4.3",
|
"pytest==8.3.2",
|
||||||
"pytest-icdiff==0.8",
|
"pytest-icdiff==0.9",
|
||||||
"pytest-xdist==3.5.0",
|
"pytest-xdist==3.6.1",
|
||||||
"responses==0.24.1",
|
"responses==0.25.3",
|
||||||
"ruff==0.1.6",
|
"ruff==0.6.3",
|
||||||
"types-requests==2.31.0.10",
|
"types-requests==2.32.0.20240712",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.setuptools]
|
[tool.setuptools]
|
||||||
@@ -100,7 +101,6 @@ exclude = [
|
|||||||
"__pycache__",
|
"__pycache__",
|
||||||
"*/migrations/*",
|
"*/migrations/*",
|
||||||
]
|
]
|
||||||
ignore= ["DJ001", "PLR2004"]
|
|
||||||
line-length = 88
|
line-length = 88
|
||||||
|
|
||||||
|
|
||||||
@@ -121,12 +121,13 @@ select = [
|
|||||||
"SLF", # flake8-self
|
"SLF", # flake8-self
|
||||||
"T20", # flake8-print
|
"T20", # flake8-print
|
||||||
]
|
]
|
||||||
|
ignore= ["DJ001", "PLR2004"]
|
||||||
|
|
||||||
[tool.ruff.lint.isort]
|
[tool.ruff.lint.isort]
|
||||||
section-order = ["future","standard-library","django","third-party","meet","first-party","local-folder"]
|
section-order = ["future","standard-library","django","third-party","meet","first-party","local-folder"]
|
||||||
sections = { meet=["core"], django=["django"] }
|
sections = { meet=["core"], django=["django"] }
|
||||||
|
|
||||||
[tool.ruff.per-file-ignores]
|
[tool.ruff.lint.per-file-ignores]
|
||||||
"**/tests/*" = ["S", "SLF"]
|
"**/tests/*" = ["S", "SLF"]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
"""Setup file for the meet module. All configuration stands in the setup.cfg file."""
|
|
||||||
# coding: utf-8
|
|
||||||
|
|
||||||
from setuptools import setup
|
|
||||||
|
|
||||||
setup()
|
|
||||||
@@ -7,6 +7,7 @@ module.exports = {
|
|||||||
'plugin:react-hooks/recommended',
|
'plugin:react-hooks/recommended',
|
||||||
'plugin:@tanstack/eslint-plugin-query/recommended',
|
'plugin:@tanstack/eslint-plugin-query/recommended',
|
||||||
'plugin:jsx-a11y/recommended',
|
'plugin:jsx-a11y/recommended',
|
||||||
|
'prettier'
|
||||||
],
|
],
|
||||||
ignorePatterns: ['dist', '.eslintrc.cjs', 'styled-system'],
|
ignorePatterns: ['dist', '.eslintrc.cjs', 'styled-system'],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
|
|||||||
Generated
+197
-50
@@ -1,16 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "meet",
|
"name": "meet",
|
||||||
"version": "0.1.1",
|
"version": "0.1.5",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "meet",
|
"name": "meet",
|
||||||
"version": "0.1.1",
|
"version": "0.1.5",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@livekit/components-react": "2.3.3",
|
"@livekit/components-react": "2.3.3",
|
||||||
"@livekit/components-styles": "1.0.12",
|
"@livekit/components-styles": "1.0.12",
|
||||||
"@pandacss/preset-panda": "0.41.0",
|
"@pandacss/preset-panda": "0.41.0",
|
||||||
|
"@react-aria/toast": "3.0.0-beta.15",
|
||||||
|
"@remixicon/react": "4.2.0",
|
||||||
"@tanstack/react-query": "5.49.2",
|
"@tanstack/react-query": "5.49.2",
|
||||||
"hoofd": "1.7.1",
|
"hoofd": "1.7.1",
|
||||||
"i18next": "23.12.1",
|
"i18next": "23.12.1",
|
||||||
@@ -22,6 +24,8 @@
|
|||||||
"react-aria-components": "1.2.1",
|
"react-aria-components": "1.2.1",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"react-i18next": "14.1.3",
|
"react-i18next": "14.1.3",
|
||||||
|
"use-sound": "^4.0.3",
|
||||||
|
"valtio": "1.13.2",
|
||||||
"wouter": "3.3.0"
|
"wouter": "3.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -35,10 +39,12 @@
|
|||||||
"@typescript-eslint/parser": "7.13.1",
|
"@typescript-eslint/parser": "7.13.1",
|
||||||
"@vitejs/plugin-react": "4.3.1",
|
"@vitejs/plugin-react": "4.3.1",
|
||||||
"eslint": "8.57.0",
|
"eslint": "8.57.0",
|
||||||
|
"eslint-config-prettier": "9.1.0",
|
||||||
"eslint-plugin-jsx-a11y": "6.9.0",
|
"eslint-plugin-jsx-a11y": "6.9.0",
|
||||||
"eslint-plugin-react-hooks": "4.6.2",
|
"eslint-plugin-react-hooks": "4.6.2",
|
||||||
"eslint-plugin-react-refresh": "0.4.7",
|
"eslint-plugin-react-refresh": "0.4.7",
|
||||||
"postcss": "8.4.39",
|
"postcss": "8.4.39",
|
||||||
|
"prettier": "3.3.3",
|
||||||
"typescript": "5.5.2",
|
"typescript": "5.5.2",
|
||||||
"vite": "5.3.1",
|
"vite": "5.3.1",
|
||||||
"vite-tsconfig-paths": "4.3.2"
|
"vite-tsconfig-paths": "4.3.2"
|
||||||
@@ -1103,9 +1109,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@internationalized/date": {
|
"node_modules/@internationalized/date": {
|
||||||
"version": "3.5.4",
|
"version": "3.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/@internationalized/date/-/date-3.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/@internationalized/date/-/date-3.5.5.tgz",
|
||||||
"integrity": "sha512-qoVJVro+O0rBaw+8HPjUB1iH8Ihf8oziEnqMnvhJUSuVIrHOuZ6eNLHNvzXJKUvAtaDiqMnRlg8Z2mgh09BlUw==",
|
"integrity": "sha512-H+CfYvOZ0LTJeeLOqm19E3uj/4YjrmOFtBufDHPfvtI80hFAMqtrp7oCACpe4Cil5l8S0Qu/9dYfZc/5lY8WQQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@swc/helpers": "^0.5.0"
|
"@swc/helpers": "^0.5.0"
|
||||||
}
|
}
|
||||||
@@ -1586,6 +1592,21 @@
|
|||||||
"node": "^10 || ^12 || >=14"
|
"node": "^10 || ^12 || >=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@pandacss/node/node_modules/prettier": {
|
||||||
|
"version": "3.2.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
|
||||||
|
"integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"prettier": "bin/prettier.cjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@pandacss/parser": {
|
"node_modules/@pandacss/parser": {
|
||||||
"version": "0.41.0",
|
"version": "0.41.0",
|
||||||
"resolved": "https://registry.npmjs.org/@pandacss/parser/-/parser-0.41.0.tgz",
|
"resolved": "https://registry.npmjs.org/@pandacss/parser/-/parser-0.41.0.tgz",
|
||||||
@@ -1952,35 +1973,35 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-aria/i18n": {
|
"node_modules/@react-aria/i18n": {
|
||||||
"version": "3.11.1",
|
"version": "3.12.2",
|
||||||
"resolved": "https://registry.npmjs.org/@react-aria/i18n/-/i18n-3.11.1.tgz",
|
"resolved": "https://registry.npmjs.org/@react-aria/i18n/-/i18n-3.12.2.tgz",
|
||||||
"integrity": "sha512-vuiBHw1kZruNMYeKkTGGnmPyMnM5T+gT8bz97H1FqIq1hQ6OPzmtBZ6W6l6OIMjeHI5oJo4utTwfZl495GALFQ==",
|
"integrity": "sha512-PvEyC6JWylTpe8dQEWqQwV6GiA+pbTxHQd//BxtMSapRW3JT9obObAnb/nFhj3HthkUvqHyj0oO1bfeN+mtD8A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@internationalized/date": "^3.5.4",
|
"@internationalized/date": "^3.5.5",
|
||||||
"@internationalized/message": "^3.1.4",
|
"@internationalized/message": "^3.1.4",
|
||||||
"@internationalized/number": "^3.5.3",
|
"@internationalized/number": "^3.5.3",
|
||||||
"@internationalized/string": "^3.2.3",
|
"@internationalized/string": "^3.2.3",
|
||||||
"@react-aria/ssr": "^3.9.4",
|
"@react-aria/ssr": "^3.9.5",
|
||||||
"@react-aria/utils": "^3.24.1",
|
"@react-aria/utils": "^3.25.2",
|
||||||
"@react-types/shared": "^3.23.1",
|
"@react-types/shared": "^3.24.1",
|
||||||
"@swc/helpers": "^0.5.0"
|
"@swc/helpers": "^0.5.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-aria/interactions": {
|
"node_modules/@react-aria/interactions": {
|
||||||
"version": "3.21.3",
|
"version": "3.22.2",
|
||||||
"resolved": "https://registry.npmjs.org/@react-aria/interactions/-/interactions-3.21.3.tgz",
|
"resolved": "https://registry.npmjs.org/@react-aria/interactions/-/interactions-3.22.2.tgz",
|
||||||
"integrity": "sha512-BWIuf4qCs5FreDJ9AguawLVS0lV9UU+sK4CCnbCNNmYqOWY+1+gRXCsnOM32K+oMESBxilAjdHW5n1hsMqYMpA==",
|
"integrity": "sha512-xE/77fRVSlqHp2sfkrMeNLrqf2amF/RyuAS6T5oDJemRSgYM3UoxTbWjucPhfnoW7r32pFPHHgz4lbdX8xqD/g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-aria/ssr": "^3.9.4",
|
"@react-aria/ssr": "^3.9.5",
|
||||||
"@react-aria/utils": "^3.24.1",
|
"@react-aria/utils": "^3.25.2",
|
||||||
"@react-types/shared": "^3.23.1",
|
"@react-types/shared": "^3.24.1",
|
||||||
"@swc/helpers": "^0.5.0"
|
"@swc/helpers": "^0.5.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-aria/label": {
|
"node_modules/@react-aria/label": {
|
||||||
@@ -1996,6 +2017,20 @@
|
|||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@react-aria/landmark": {
|
||||||
|
"version": "3.0.0-beta.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-aria/landmark/-/landmark-3.0.0-beta.15.tgz",
|
||||||
|
"integrity": "sha512-EEABy0IFzqoS7r11HoD2YwiGR5LFw4kWDFTFUFwJkRP5tHEzsrEgkKPSPJXScQr5m7tenV6j0/Zzl1+w1ki3lA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@react-aria/utils": "^3.25.2",
|
||||||
|
"@react-types/shared": "^3.24.1",
|
||||||
|
"@swc/helpers": "^0.5.0",
|
||||||
|
"use-sync-external-store": "^1.2.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@react-aria/link": {
|
"node_modules/@react-aria/link": {
|
||||||
"version": "3.7.1",
|
"version": "3.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/@react-aria/link/-/link-3.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/@react-aria/link/-/link-3.7.1.tgz",
|
||||||
@@ -2269,9 +2304,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-aria/ssr": {
|
"node_modules/@react-aria/ssr": {
|
||||||
"version": "3.9.4",
|
"version": "3.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.9.5.tgz",
|
||||||
"integrity": "sha512-4jmAigVq409qcJvQyuorsmBR4+9r3+JEC60wC+Y0MZV0HCtTmm8D9guYXlJMdx0SSkgj0hHAyFm/HvPNFofCoQ==",
|
"integrity": "sha512-xEwGKoysu+oXulibNUSkXf8itW0npHHTa6c4AyYeZIJyRoegeteYuFpZUBPtIDE8RfHdNsSmE1ssOkxRnwbkuQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@swc/helpers": "^0.5.0"
|
"@swc/helpers": "^0.5.0"
|
||||||
},
|
},
|
||||||
@@ -2279,7 +2314,7 @@
|
|||||||
"node": ">= 12"
|
"node": ">= 12"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-aria/switch": {
|
"node_modules/@react-aria/switch": {
|
||||||
@@ -2382,6 +2417,24 @@
|
|||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@react-aria/toast": {
|
||||||
|
"version": "3.0.0-beta.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-aria/toast/-/toast-3.0.0-beta.15.tgz",
|
||||||
|
"integrity": "sha512-bg6ZXq4B5JYVt3GXVlf075tQOakcfumbDLnUMaijez4BhacuxF01+IvBPzAVEsARVNXfELoXa7Frb2K54Wgvtw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@react-aria/i18n": "^3.12.2",
|
||||||
|
"@react-aria/interactions": "^3.22.2",
|
||||||
|
"@react-aria/landmark": "3.0.0-beta.15",
|
||||||
|
"@react-aria/utils": "^3.25.2",
|
||||||
|
"@react-stately/toast": "3.0.0-beta.5",
|
||||||
|
"@react-types/button": "^3.9.6",
|
||||||
|
"@react-types/shared": "^3.24.1",
|
||||||
|
"@swc/helpers": "^0.5.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@react-aria/toggle": {
|
"node_modules/@react-aria/toggle": {
|
||||||
"version": "3.10.4",
|
"version": "3.10.4",
|
||||||
"resolved": "https://registry.npmjs.org/@react-aria/toggle/-/toggle-3.10.4.tgz",
|
"resolved": "https://registry.npmjs.org/@react-aria/toggle/-/toggle-3.10.4.tgz",
|
||||||
@@ -2450,18 +2503,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-aria/utils": {
|
"node_modules/@react-aria/utils": {
|
||||||
"version": "3.24.1",
|
"version": "3.25.2",
|
||||||
"resolved": "https://registry.npmjs.org/@react-aria/utils/-/utils-3.24.1.tgz",
|
"resolved": "https://registry.npmjs.org/@react-aria/utils/-/utils-3.25.2.tgz",
|
||||||
"integrity": "sha512-O3s9qhPMd6n42x9sKeJ3lhu5V1Tlnzhu6Yk8QOvDuXf7UGuUjXf9mzfHJt1dYzID4l9Fwm8toczBzPM9t0jc8Q==",
|
"integrity": "sha512-GdIvG8GBJJZygB4L2QJP1Gabyn2mjFsha73I2wSe+o4DYeGWoJiMZRM06PyTIxLH4S7Sn7eVDtsSBfkc2VY/NA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-aria/ssr": "^3.9.4",
|
"@react-aria/ssr": "^3.9.5",
|
||||||
"@react-stately/utils": "^3.10.1",
|
"@react-stately/utils": "^3.10.3",
|
||||||
"@react-types/shared": "^3.23.1",
|
"@react-types/shared": "^3.24.1",
|
||||||
"@swc/helpers": "^0.5.0",
|
"@swc/helpers": "^0.5.0",
|
||||||
"clsx": "^2.0.0"
|
"clsx": "^2.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-aria/visually-hidden": {
|
"node_modules/@react-aria/visually-hidden": {
|
||||||
@@ -2807,6 +2860,18 @@
|
|||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@react-stately/toast": {
|
||||||
|
"version": "3.0.0-beta.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-stately/toast/-/toast-3.0.0-beta.5.tgz",
|
||||||
|
"integrity": "sha512-MEdQwcKsexlcJ4YQZ9cN5QSIqTlGGdgC5auzSKXXoq15DHuo4mtHfLzXPgcMDYOhOdmyphMto8Vt+21UL2FOrw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@swc/helpers": "^0.5.0",
|
||||||
|
"use-sync-external-store": "^1.2.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@react-stately/toggle": {
|
"node_modules/@react-stately/toggle": {
|
||||||
"version": "3.7.4",
|
"version": "3.7.4",
|
||||||
"resolved": "https://registry.npmjs.org/@react-stately/toggle/-/toggle-3.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/@react-stately/toggle/-/toggle-3.7.4.tgz",
|
||||||
@@ -2849,14 +2914,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-stately/utils": {
|
"node_modules/@react-stately/utils": {
|
||||||
"version": "3.10.1",
|
"version": "3.10.3",
|
||||||
"resolved": "https://registry.npmjs.org/@react-stately/utils/-/utils-3.10.1.tgz",
|
"resolved": "https://registry.npmjs.org/@react-stately/utils/-/utils-3.10.3.tgz",
|
||||||
"integrity": "sha512-VS/EHRyicef25zDZcM/ClpzYMC5i2YGN6uegOeQawmgfGjb02yaCX0F0zR69Pod9m2Hr3wunTbtpgVXvYbZItg==",
|
"integrity": "sha512-moClv7MlVSHpbYtQIkm0Cx+on8Pgt1XqtPx6fy9rQFb2DNc9u1G3AUVnqA17buOkH1vLxAtX4MedlxMWyRCYYA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@swc/helpers": "^0.5.0"
|
"@swc/helpers": "^0.5.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-stately/virtualizer": {
|
"node_modules/@react-stately/virtualizer": {
|
||||||
@@ -2885,14 +2950,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-types/button": {
|
"node_modules/@react-types/button": {
|
||||||
"version": "3.9.4",
|
"version": "3.9.6",
|
||||||
"resolved": "https://registry.npmjs.org/@react-types/button/-/button-3.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@react-types/button/-/button-3.9.6.tgz",
|
||||||
"integrity": "sha512-raeQBJUxBp0axNF74TXB8/H50GY8Q3eV6cEKMbZFP1+Dzr09Ngv0tJBeW0ewAxAguNH5DRoMUAUGIXtSXskVdA==",
|
"integrity": "sha512-8lA+D5JLbNyQikf8M/cPP2cji91aVTcqjrGpDqI7sQnaLFikM8eFR6l1ZWGtZS5MCcbfooko77ha35SYplSQvw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-types/shared": "^3.23.1"
|
"@react-types/shared": "^3.24.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-types/calendar": {
|
"node_modules/@react-types/calendar": {
|
||||||
@@ -3102,11 +3167,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-types/shared": {
|
"node_modules/@react-types/shared": {
|
||||||
"version": "3.23.1",
|
"version": "3.24.1",
|
||||||
"resolved": "https://registry.npmjs.org/@react-types/shared/-/shared-3.23.1.tgz",
|
"resolved": "https://registry.npmjs.org/@react-types/shared/-/shared-3.24.1.tgz",
|
||||||
"integrity": "sha512-5d+3HbFDxGZjhbMBeFHRQhexMFt4pUce3okyRtUVKbbedQFUrtXSBg9VszgF2RTeQDKDkMCIQDtz5ccP/Lk1gw==",
|
"integrity": "sha512-AUQeGYEm/zDTN6zLzdXolDxz3Jk5dDL7f506F07U8tBwxNNI3WRdhU84G0/AaFikOZzDXhOZDr3MhQMzyE7Ydw==",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-types/slider": {
|
"node_modules/@react-types/slider": {
|
||||||
@@ -3177,6 +3242,14 @@
|
|||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@remixicon/react": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@remixicon/react/-/react-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-eGhKpZ88OU0qkcY9pJu6khBmItDV82nU130E6C68yc+FbljueHlUYy/4CrJsmf860RIDMay2Rpzl27OSJ81miw==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=18.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@rollup/rollup-android-arm-eabi": {
|
"node_modules/@rollup/rollup-android-arm-eabi": {
|
||||||
"version": "4.18.0",
|
"version": "4.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz",
|
||||||
@@ -3634,13 +3707,13 @@
|
|||||||
"version": "15.7.12",
|
"version": "15.7.12",
|
||||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz",
|
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz",
|
||||||
"integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==",
|
"integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==",
|
||||||
"dev": true
|
"devOptional": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/react": {
|
"node_modules/@types/react": {
|
||||||
"version": "18.3.3",
|
"version": "18.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz",
|
||||||
"integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==",
|
"integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==",
|
||||||
"dev": true,
|
"devOptional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/prop-types": "*",
|
"@types/prop-types": "*",
|
||||||
"csstype": "^3.0.2"
|
"csstype": "^3.0.2"
|
||||||
@@ -5125,7 +5198,7 @@
|
|||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
||||||
"dev": true
|
"devOptional": true
|
||||||
},
|
},
|
||||||
"node_modules/damerau-levenshtein": {
|
"node_modules/damerau-levenshtein": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
@@ -5273,6 +5346,14 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/derive-valtio": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/derive-valtio/-/derive-valtio-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-OCg2UsLbXK7GmmpzMXhYkdO64vhJ1ROUUGaTFyHjVwEdMEcTTRj7W1TxLbSBxdY8QLBPCcp66MTyaSy0RpO17A==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"valtio": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/detect-libc": {
|
"node_modules/detect-libc": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
|
||||||
@@ -5682,6 +5763,18 @@
|
|||||||
"url": "https://opencollective.com/eslint"
|
"url": "https://opencollective.com/eslint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/eslint-config-prettier": {
|
||||||
|
"version": "9.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz",
|
||||||
|
"integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"eslint-config-prettier": "bin/cli.js"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"eslint": ">=7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/eslint-plugin-jsx-a11y": {
|
"node_modules/eslint-plugin-jsx-a11y": {
|
||||||
"version": "6.9.0",
|
"version": "6.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.9.0.tgz",
|
||||||
@@ -6603,6 +6696,11 @@
|
|||||||
"integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==",
|
"integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/howler": {
|
||||||
|
"version": "2.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/howler/-/howler-2.2.4.tgz",
|
||||||
|
"integrity": "sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w=="
|
||||||
|
},
|
||||||
"node_modules/html-parse-stringify": {
|
"node_modules/html-parse-stringify": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz",
|
||||||
@@ -8901,9 +8999,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/prettier": {
|
"node_modules/prettier": {
|
||||||
"version": "3.2.5",
|
"version": "3.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
|
||||||
"integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==",
|
"integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"prettier": "bin/prettier.cjs"
|
"prettier": "bin/prettier.cjs"
|
||||||
@@ -8928,6 +9026,11 @@
|
|||||||
"node": "10.* || >= 12.*"
|
"node": "10.* || >= 12.*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/proxy-compare": {
|
||||||
|
"version": "2.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-compare/-/proxy-compare-2.6.0.tgz",
|
||||||
|
"integrity": "sha512-8xuCeM3l8yqdmbPoYeLbrAXCBWu19XEYc5/F28f5qOaoAIMyfmBUkl5axiK+x9olUvRlcekvnm98AP9RDngOIw=="
|
||||||
|
},
|
||||||
"node_modules/punycode": {
|
"node_modules/punycode": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||||
@@ -10065,6 +10168,17 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/use-sound": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/use-sound/-/use-sound-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-L205pEUFIrLsGYsCUKHQVCt0ajs//YQOFbEQeNwaWaqQj3y3st4SuR+rvpMHLmv8hgTcfUFlvMQawZNI3OE18w==",
|
||||||
|
"dependencies": {
|
||||||
|
"howler": "^2.1.3"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=16.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/use-sync-external-store": {
|
"node_modules/use-sync-external-store": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz",
|
||||||
@@ -10092,6 +10206,39 @@
|
|||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/valtio": {
|
||||||
|
"version": "1.13.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/valtio/-/valtio-1.13.2.tgz",
|
||||||
|
"integrity": "sha512-Qik0o+DSy741TmkqmRfjq+0xpZBXi/Y6+fXZLn0xNF1z/waFMbE3rkivv5Zcf9RrMUp6zswf2J7sbh2KBlba5A==",
|
||||||
|
"dependencies": {
|
||||||
|
"derive-valtio": "0.1.0",
|
||||||
|
"proxy-compare": "2.6.0",
|
||||||
|
"use-sync-external-store": "1.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.20.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/react": ">=16.8",
|
||||||
|
"react": ">=16.8"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/valtio/node_modules/use-sync-external-store": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/value-or-function": {
|
"node_modules/value-or-function": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-4.0.0.tgz",
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
{
|
{
|
||||||
"name": "meet",
|
"name": "meet",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.1",
|
"version": "0.1.5",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "panda codegen && vite",
|
"dev": "panda codegen && vite",
|
||||||
"build": "panda codegen && tsc -b && vite build",
|
"build": "panda codegen && tsc -b && vite build",
|
||||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"i18n:extract": "npx i18next -c i18next-parser.config.json"
|
"i18n:extract": "npx i18next -c i18next-parser.config.json",
|
||||||
|
"format": "prettier --write ./src",
|
||||||
|
"check": "prettier --check ./src"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@livekit/components-react": "2.3.3",
|
"@livekit/components-react": "2.3.3",
|
||||||
"@livekit/components-styles": "1.0.12",
|
"@livekit/components-styles": "1.0.12",
|
||||||
"@pandacss/preset-panda": "0.41.0",
|
"@pandacss/preset-panda": "0.41.0",
|
||||||
|
"@react-aria/toast": "3.0.0-beta.15",
|
||||||
|
"@remixicon/react": "4.2.0",
|
||||||
"@tanstack/react-query": "5.49.2",
|
"@tanstack/react-query": "5.49.2",
|
||||||
"hoofd": "1.7.1",
|
"hoofd": "1.7.1",
|
||||||
"i18next": "23.12.1",
|
"i18next": "23.12.1",
|
||||||
@@ -25,6 +29,8 @@
|
|||||||
"react-aria-components": "1.2.1",
|
"react-aria-components": "1.2.1",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"react-i18next": "14.1.3",
|
"react-i18next": "14.1.3",
|
||||||
|
"use-sound": "4.0.3",
|
||||||
|
"valtio": "1.13.2",
|
||||||
"wouter": "3.3.0"
|
"wouter": "3.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -38,10 +44,12 @@
|
|||||||
"@typescript-eslint/parser": "7.13.1",
|
"@typescript-eslint/parser": "7.13.1",
|
||||||
"@vitejs/plugin-react": "4.3.1",
|
"@vitejs/plugin-react": "4.3.1",
|
||||||
"eslint": "8.57.0",
|
"eslint": "8.57.0",
|
||||||
|
"eslint-config-prettier": "9.1.0",
|
||||||
"eslint-plugin-jsx-a11y": "6.9.0",
|
"eslint-plugin-jsx-a11y": "6.9.0",
|
||||||
"eslint-plugin-react-hooks": "4.6.2",
|
"eslint-plugin-react-hooks": "4.6.2",
|
||||||
"eslint-plugin-react-refresh": "0.4.7",
|
"eslint-plugin-react-refresh": "0.4.7",
|
||||||
"postcss": "8.4.39",
|
"postcss": "8.4.39",
|
||||||
|
"prettier": "3.3.3",
|
||||||
"typescript": "5.5.2",
|
"typescript": "5.5.2",
|
||||||
"vite": "5.3.1",
|
"vite": "5.3.1",
|
||||||
"vite-tsconfig-paths": "4.3.2"
|
"vite-tsconfig-paths": "4.3.2"
|
||||||
|
|||||||
@@ -35,18 +35,6 @@ const config: Config = {
|
|||||||
exclude: [],
|
exclude: [],
|
||||||
jsxFramework: 'react',
|
jsxFramework: 'react',
|
||||||
outdir: 'src/styled-system',
|
outdir: 'src/styled-system',
|
||||||
conditions: {
|
|
||||||
extend: {
|
|
||||||
// React Aria builds upon data attributes instead of css pseudo-classes, in case we style a React Aria component
|
|
||||||
// we dont want to trigger pseudo class related styles
|
|
||||||
'ra-hover': '&:is([data-hovered])',
|
|
||||||
'ra-focus': '&:is([data-focused])',
|
|
||||||
'ra-focusVisible': '&:is([data-focus-visible])',
|
|
||||||
'ra-disabled': '&:is([data-disabled])',
|
|
||||||
pressed: '&:is([data-pressed])',
|
|
||||||
'ra-pressed': '&:is([data-pressed])',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
theme: {
|
theme: {
|
||||||
...pandaPreset.theme,
|
...pandaPreset.theme,
|
||||||
// media queries are defined in em so that zooming with text-only mode triggers breakpoints
|
// media queries are defined in em so that zooming with text-only mode triggers breakpoints
|
||||||
@@ -58,6 +46,47 @@ const config: Config = {
|
|||||||
xl: '80em', // 1280px
|
xl: '80em', // 1280px
|
||||||
'2xl': '96em', // 1536px
|
'2xl': '96em', // 1536px
|
||||||
},
|
},
|
||||||
|
keyframes: {
|
||||||
|
slide: {
|
||||||
|
from: {
|
||||||
|
transform: 'var(--origin)',
|
||||||
|
opacity: 0,
|
||||||
|
},
|
||||||
|
to: {
|
||||||
|
transform: 'translateY(0)',
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fade: { from: { opacity: 0 }, to: { opacity: 1 } },
|
||||||
|
pulse: {
|
||||||
|
'0%': { boxShadow: '0 0 0 0 rgba(255, 255, 255, 0.7)' },
|
||||||
|
'75%': { boxShadow: '0 0 0 30px rgba(255, 255, 255, 0)' },
|
||||||
|
'100%': { boxShadow: '0 0 0 0 rgba(255, 255, 255, 0)' },
|
||||||
|
},
|
||||||
|
active_speaker: {
|
||||||
|
'0%': { height: '4px' },
|
||||||
|
'25%': { height: '8px' },
|
||||||
|
'50%': { height: '6px' },
|
||||||
|
'100%': { height: '16px' },
|
||||||
|
},
|
||||||
|
active_speake_small: {
|
||||||
|
'0%': { height: '4px' },
|
||||||
|
'25%': { height: '6px' },
|
||||||
|
'50%': { height: '4px' },
|
||||||
|
'100%': { height: '8px' },
|
||||||
|
},
|
||||||
|
wave_hand: {
|
||||||
|
'0%': { transform: 'rotate(0deg)' },
|
||||||
|
'20%': { transform: 'rotate(-20deg)' },
|
||||||
|
'80%': { transform: 'rotate(20deg)' },
|
||||||
|
'100%': { transform: 'rotate(0)' },
|
||||||
|
},
|
||||||
|
pulse_mic: {
|
||||||
|
'0%': { color: 'primary', opacity: '1' },
|
||||||
|
'50%': { color: 'primary', opacity: '0.8' },
|
||||||
|
'100%': { color: 'primary', opacity: '1' },
|
||||||
|
},
|
||||||
|
},
|
||||||
tokens: defineTokens({
|
tokens: defineTokens({
|
||||||
/* we take a few things from the panda preset but for now we clear out some stuff.
|
/* we take a few things from the panda preset but for now we clear out some stuff.
|
||||||
* This way we'll only add the things we need step by step and prevent using lots of differents things.
|
* This way we'll only add the things we need step by step and prevent using lots of differents things.
|
||||||
@@ -165,7 +194,7 @@ const config: Config = {
|
|||||||
colors: {
|
colors: {
|
||||||
default: {
|
default: {
|
||||||
text: { value: '{colors.gray.900}' },
|
text: { value: '{colors.gray.900}' },
|
||||||
bg: { value: '{colors.slate.50}' },
|
bg: { value: 'white' },
|
||||||
subtle: { value: '{colors.gray.100}' },
|
subtle: { value: '{colors.gray.100}' },
|
||||||
'subtle-text': { value: '{colors.gray.600}' },
|
'subtle-text': { value: '{colors.gray.600}' },
|
||||||
},
|
},
|
||||||
@@ -179,7 +208,8 @@ const config: Config = {
|
|||||||
hover: { value: '{colors.gray.200}' },
|
hover: { value: '{colors.gray.200}' },
|
||||||
active: { value: '{colors.gray.300}' },
|
active: { value: '{colors.gray.300}' },
|
||||||
text: { value: '{colors.default.text}' },
|
text: { value: '{colors.default.text}' },
|
||||||
border: { value: '{colors.gray.300}' },
|
border: { value: '{colors.gray.500}' },
|
||||||
|
subtle: { value: '{colors.gray.400}' },
|
||||||
},
|
},
|
||||||
primary: {
|
primary: {
|
||||||
DEFAULT: { value: '{colors.blue.700}' },
|
DEFAULT: { value: '{colors.blue.700}' },
|
||||||
@@ -197,14 +227,16 @@ const config: Config = {
|
|||||||
text: { value: '{colors.white}' },
|
text: { value: '{colors.white}' },
|
||||||
subtle: { value: '{colors.red.100}' },
|
subtle: { value: '{colors.red.100}' },
|
||||||
'subtle-text': { value: '{colors.red.700}' },
|
'subtle-text': { value: '{colors.red.700}' },
|
||||||
|
...pandaPreset.theme.tokens.colors.red,
|
||||||
},
|
},
|
||||||
success: {
|
success: {
|
||||||
DEFAULT: { value: '{colors.emerald.700}' },
|
DEFAULT: { value: '{colors.green.700}' },
|
||||||
hover: { value: '{colors.emerald.800}' },
|
hover: { value: '{colors.green.800}' },
|
||||||
active: { value: '{colors.emerald.900}' },
|
active: { value: '{colors.green.900}' },
|
||||||
text: { value: '{colors.white}' },
|
text: { value: '{colors.white}' },
|
||||||
subtle: { value: '{colors.emerald.100}' },
|
subtle: { value: '{colors.green.100}' },
|
||||||
'subtle-text': { value: '{colors.emerald.700}' },
|
'subtle-text': { value: '{colors.green.800}' },
|
||||||
|
...pandaPreset.theme.tokens.colors.green,
|
||||||
},
|
},
|
||||||
warning: {
|
warning: {
|
||||||
DEFAULT: { value: '{colors.amber.700}' },
|
DEFAULT: { value: '{colors.amber.700}' },
|
||||||
@@ -214,6 +246,7 @@ const config: Config = {
|
|||||||
subtle: { value: '{colors.amber.100}' },
|
subtle: { value: '{colors.amber.100}' },
|
||||||
'subtle-text': { value: '{colors.amber.700}' },
|
'subtle-text': { value: '{colors.amber.700}' },
|
||||||
},
|
},
|
||||||
|
focusRing: { value: 'rgb(74, 121, 199)' },
|
||||||
},
|
},
|
||||||
shadows: {
|
shadows: {
|
||||||
box: { value: '{shadows.sm}' },
|
box: { value: '{shadows.sm}' },
|
||||||
@@ -229,12 +262,20 @@ const config: Config = {
|
|||||||
DEFAULT: { value: '{spacing.1}' },
|
DEFAULT: { value: '{spacing.1}' },
|
||||||
lg: { value: '{spacing.2}' },
|
lg: { value: '{spacing.2}' },
|
||||||
},
|
},
|
||||||
paragraph: { value: '{spacing.1}' },
|
paragraph: { value: '{spacing.0.5}' },
|
||||||
heading: { value: '{spacing.1}' },
|
heading: { value: '{spacing.1}' },
|
||||||
gutter: { value: '{spacing.1}' },
|
gutter: { value: '{spacing.1}' },
|
||||||
|
textfield: { value: '{spacing.1}' },
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
textStyles: defineTextStyles({
|
textStyles: defineTextStyles({
|
||||||
|
display: {
|
||||||
|
value: {
|
||||||
|
fontSize: '3rem',
|
||||||
|
lineHeight: '2rem',
|
||||||
|
fontWeight: 700,
|
||||||
|
},
|
||||||
|
},
|
||||||
h1: {
|
h1: {
|
||||||
value: {
|
value: {
|
||||||
fontSize: '1.5rem',
|
fontSize: '1.5rem',
|
||||||
@@ -253,7 +294,6 @@ const config: Config = {
|
|||||||
value: {
|
value: {
|
||||||
fontSize: '1.125rem',
|
fontSize: '1.125rem',
|
||||||
lineHeight: '1.75rem',
|
lineHeight: '1.75rem',
|
||||||
fontWeight: 700,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
body: {
|
body: {
|
||||||
@@ -262,7 +302,7 @@ const config: Config = {
|
|||||||
lineHeight: '1.5',
|
lineHeight: '1.5',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
small: {
|
sm: {
|
||||||
value: {
|
value: {
|
||||||
fontSize: '0.875rem',
|
fontSize: '0.875rem',
|
||||||
lineHeight: '1.25rem',
|
lineHeight: '1.25rem',
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+24
-15
@@ -2,30 +2,39 @@ import '@livekit/components-styles'
|
|||||||
import '@/styles/index.css'
|
import '@/styles/index.css'
|
||||||
import { Suspense } from 'react'
|
import { Suspense } from 'react'
|
||||||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
import { QueryClientProvider } from '@tanstack/react-query'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useLang } from 'hoofd'
|
import { useLang } from 'hoofd'
|
||||||
import { Route, Switch } from 'wouter'
|
import { Switch, Route } from 'wouter'
|
||||||
import { Screen } from './layout/Screen'
|
import { I18nProvider } from 'react-aria-components'
|
||||||
import { HomeRoute } from '@/features/home'
|
import { Layout } from './layout/Layout'
|
||||||
import { RoomRoute, roomIdRegex } from '@/features/rooms'
|
import { NotFoundScreen } from './components/NotFoundScreen'
|
||||||
import { NotFound } from './routes/NotFound'
|
import { routes } from './routes'
|
||||||
import './i18n/init'
|
import './i18n/init'
|
||||||
|
import { silenceLiveKitLogs } from '@/utils/livekit.ts'
|
||||||
const queryClient = new QueryClient()
|
import { queryClient } from '@/api/queryClient'
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const { i18n } = useTranslation()
|
const { i18n } = useTranslation()
|
||||||
useLang(i18n.language)
|
useLang(i18n.language)
|
||||||
|
|
||||||
|
const isProduction = import.meta.env.PROD
|
||||||
|
silenceLiveKitLogs(isProduction)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<Suspense fallback={<Screen />}>
|
<Suspense fallback={null}>
|
||||||
<Switch>
|
<I18nProvider locale={i18n.language}>
|
||||||
<Route path="/" component={HomeRoute} />
|
<Layout>
|
||||||
<Route path={roomIdRegex} component={RoomRoute} />
|
<Switch>
|
||||||
<Route component={NotFound} />
|
{Object.entries(routes).map(([, route], i) => (
|
||||||
</Switch>
|
<Route key={i} path={route.path} component={route.Component} />
|
||||||
<ReactQueryDevtools initialIsOpen={false} />
|
))}
|
||||||
|
<Route component={NotFoundScreen} />
|
||||||
|
</Switch>
|
||||||
|
</Layout>
|
||||||
|
<ReactQueryDevtools initialIsOpen={false} />
|
||||||
|
</I18nProvider>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { QueryClient } from '@tanstack/react-query'
|
||||||
|
|
||||||
|
export const queryClient = new QueryClient()
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { cva, RecipeVariantProps } from '@/styled-system/css'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
const avatar = cva({
|
||||||
|
base: {
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
color: 'white',
|
||||||
|
display: 'flex',
|
||||||
|
borderRadius: '50%',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
userSelect: 'none',
|
||||||
|
cursor: 'default',
|
||||||
|
flexGrow: 0,
|
||||||
|
flexShrink: 0,
|
||||||
|
},
|
||||||
|
variants: {
|
||||||
|
context: {
|
||||||
|
list: {
|
||||||
|
width: '32px',
|
||||||
|
height: '32px',
|
||||||
|
fontSize: '1.25rem',
|
||||||
|
},
|
||||||
|
placeholder: {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
context: 'list',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export type AvatarProps = React.HTMLAttributes<HTMLDivElement> & {
|
||||||
|
name?: string
|
||||||
|
bgColor?: string
|
||||||
|
} & RecipeVariantProps<typeof avatar>
|
||||||
|
|
||||||
|
export const Avatar = ({ name, bgColor, context, ...props }: AvatarProps) => {
|
||||||
|
const initial = name?.trim()?.charAt(0) || ''
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
backgroundColor: bgColor,
|
||||||
|
}}
|
||||||
|
className={avatar({ context })}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{initial}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { Link } from '@/primitives'
|
||||||
|
import { AProps } from '@/primitives/A'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
|
export const BackToHome = ({ size }: { size?: AProps['size'] }) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
return (
|
||||||
|
<p>
|
||||||
|
<Link to="/" size={size}>
|
||||||
|
{t('backToHome')}
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { useState, useEffect, type ReactNode } from 'react'
|
||||||
|
|
||||||
|
export const DelayedRender = ({
|
||||||
|
children,
|
||||||
|
delay = 500,
|
||||||
|
}: {
|
||||||
|
delay?: number
|
||||||
|
children: ReactNode
|
||||||
|
}) => {
|
||||||
|
const [show, setShow] = useState(false)
|
||||||
|
useEffect(() => {
|
||||||
|
if (delay === 0) {
|
||||||
|
setShow(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const timeout = setTimeout(() => setShow(true), delay)
|
||||||
|
return () => clearTimeout(timeout)
|
||||||
|
}, [delay])
|
||||||
|
if (delay !== 0 && !show) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return children
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { CenteredContent } from '@/layout/CenteredContent'
|
||||||
|
import { Screen } from '@/layout/Screen'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { Center } from '@/styled-system/jsx'
|
||||||
|
import { Text } from '@/primitives'
|
||||||
|
|
||||||
|
export const ErrorScreen = ({
|
||||||
|
title,
|
||||||
|
body,
|
||||||
|
}: {
|
||||||
|
title?: string
|
||||||
|
body?: string
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
return (
|
||||||
|
<Screen layout="centered">
|
||||||
|
<CenteredContent title={title || t('error.heading')} withBackButton>
|
||||||
|
{!!body && (
|
||||||
|
<Center>
|
||||||
|
<Text as="p" variant="h3" centered>
|
||||||
|
{body}
|
||||||
|
</Text>
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
</CenteredContent>
|
||||||
|
</Screen>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { Button } from '@/primitives'
|
||||||
|
import { css } from '@/styled-system/css'
|
||||||
|
import { RiExternalLinkLine } from '@remixicon/react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
|
export const Feedback = () => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
href="https://grist.incubateur.net/o/docs/forms/1YrfNP1QSSy8p2gCxMFnSf/4"
|
||||||
|
variant="success"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<span className={css({ marginRight: 0.5 })} aria-hidden="true">
|
||||||
|
💡
|
||||||
|
</span>
|
||||||
|
{t('feedbackAlert')}
|
||||||
|
<RiExternalLinkLine
|
||||||
|
size={16}
|
||||||
|
className={css({ marginLeft: 0.5 })}
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { Screen, type ScreenProps } from '@/layout/Screen'
|
||||||
|
import { DelayedRender } from './DelayedRender'
|
||||||
|
import { CenteredContent } from '@/layout/CenteredContent'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { Center } from '@/styled-system/jsx'
|
||||||
|
|
||||||
|
export const LoadingScreen = ({
|
||||||
|
delay = 500,
|
||||||
|
header = undefined,
|
||||||
|
layout = 'centered',
|
||||||
|
}: {
|
||||||
|
delay?: number
|
||||||
|
} & Omit<ScreenProps, 'children'>) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DelayedRender delay={delay}>
|
||||||
|
<Screen layout={layout} header={header}>
|
||||||
|
<CenteredContent>
|
||||||
|
<Center>
|
||||||
|
<p>{t('loading')}</p>
|
||||||
|
</Center>
|
||||||
|
</CenteredContent>
|
||||||
|
</Screen>
|
||||||
|
</DelayedRender>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { CenteredContent } from '@/layout/CenteredContent'
|
||||||
|
import { Screen } from '@/layout/Screen'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
|
export const NotFoundScreen = () => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
return (
|
||||||
|
<Screen layout="centered">
|
||||||
|
<CenteredContent title={t('notFound.heading')} withBackButton />
|
||||||
|
</Screen>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { ErrorScreen } from '@/components/ErrorScreen'
|
||||||
|
import { LoadingScreen } from '@/components/LoadingScreen'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render an error or loading Screen while a given `status` is not a success,
|
||||||
|
* otherwise directly render children.
|
||||||
|
*
|
||||||
|
* `status` matches react query statuses.
|
||||||
|
*
|
||||||
|
* Children usually contain a Screen at some point in the render tree.
|
||||||
|
*/
|
||||||
|
export const QueryAware = ({
|
||||||
|
status,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
status: 'error' | 'idle' | 'pending' | 'success'
|
||||||
|
children: React.ReactNode
|
||||||
|
}) => {
|
||||||
|
if (status === 'error') {
|
||||||
|
return <ErrorScreen />
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status === 'pending') {
|
||||||
|
return <LoadingScreen header={undefined} />
|
||||||
|
}
|
||||||
|
|
||||||
|
return children
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { Button } from '@/primitives'
|
||||||
|
import { useEffect, useRef, useState } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { useMediaDeviceSelect } from '@livekit/components-react'
|
||||||
|
|
||||||
|
export const SoundTester = () => {
|
||||||
|
const { t } = useTranslation('settings')
|
||||||
|
const [isPlaying, setIsPlaying] = useState(false)
|
||||||
|
const audioRef = useRef<HTMLAudioElement>(null)
|
||||||
|
|
||||||
|
const { activeDeviceId } = useMediaDeviceSelect({ kind: 'audiooutput' })
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const updateActiveId = async (deviceId: string) => {
|
||||||
|
try {
|
||||||
|
await audioRef?.current?.setSinkId(deviceId)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error setting sinkId: ${error}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateActiveId(activeDeviceId)
|
||||||
|
}, [activeDeviceId])
|
||||||
|
|
||||||
|
// prevent pausing the sound
|
||||||
|
navigator.mediaSession.setActionHandler('pause', function () {})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
invisible
|
||||||
|
onPress={() => {
|
||||||
|
audioRef?.current?.play()
|
||||||
|
setIsPlaying(true)
|
||||||
|
}}
|
||||||
|
size="sm"
|
||||||
|
isDisabled={isPlaying}
|
||||||
|
fullWidth
|
||||||
|
style={{
|
||||||
|
color: isPlaying ? 'var(--colors-primary)' : undefined,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isPlaying ? t('audio.speakers.ongoingTest') : t('audio.speakers.test')}
|
||||||
|
</Button>
|
||||||
|
{/* eslint-disable jsx-a11y/media-has-caption */}
|
||||||
|
<audio
|
||||||
|
ref={audioRef}
|
||||||
|
src="sounds/uprise.mp3"
|
||||||
|
onEnded={() => setIsPlaying(false)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { ApiError } from '@/api/ApiError'
|
import { ApiError } from '@/api/ApiError'
|
||||||
import { fetchApi } from '@/api/fetchApi'
|
import { fetchApi } from '@/api/fetchApi'
|
||||||
import { type ApiUser } from './ApiUser'
|
import { type ApiUser } from './ApiUser'
|
||||||
|
import { attemptSilentLogin, canAttemptSilentLogin } from '../utils/silentLogin'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fetch the logged-in user from the api.
|
* fetch the logged-in user from the api.
|
||||||
@@ -16,7 +17,13 @@ export const fetchUser = (): Promise<ApiUser | false> => {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// we assume that a 401 means the user is not logged in
|
// we assume that a 401 means the user is not logged in
|
||||||
if (error instanceof ApiError && error.statusCode === 401) {
|
if (error instanceof ApiError && error.statusCode === 401) {
|
||||||
resolve(false)
|
// make sure to not resolve the promise while trying to silent login
|
||||||
|
// so that consumers of fetchUser don't think the work already ended
|
||||||
|
if (canAttemptSilentLogin()) {
|
||||||
|
attemptSilentLogin(3600)
|
||||||
|
} else {
|
||||||
|
resolve(false)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
reject(error)
|
reject(error)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,27 @@
|
|||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
import { keys } from '@/api/queryKeys'
|
import { keys } from '@/api/queryKeys'
|
||||||
import { fetchUser } from './fetchUser'
|
import { fetchUser } from './fetchUser'
|
||||||
|
import { type ApiUser } from './ApiUser'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns info about currently logged in user
|
||||||
|
*
|
||||||
|
* `isLoggedIn` is undefined while query is loading and true/false when it's done
|
||||||
|
*/
|
||||||
export const useUser = () => {
|
export const useUser = () => {
|
||||||
const query = useQuery({
|
const query = useQuery({
|
||||||
queryKey: [keys.user],
|
queryKey: [keys.user],
|
||||||
queryFn: fetchUser,
|
queryFn: fetchUser,
|
||||||
|
staleTime: 1000 * 60 * 60, // 1 hour
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isLoggedIn =
|
||||||
|
query.status === 'success' ? query.data !== false : undefined
|
||||||
|
const isLoggedOut = isLoggedIn === false
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...query,
|
...query,
|
||||||
// if fetchUser returns false, it means the user is not logged in: expose that
|
user: isLoggedOut ? undefined : (query.data as ApiUser | undefined),
|
||||||
user: query.data === false ? undefined : query.data,
|
isLoggedIn,
|
||||||
isLoggedIn: query.data !== undefined && query.data !== false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { useUser } from '@/features/auth'
|
||||||
|
import { LoadingScreen } from '@/components/LoadingScreen'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders a loading Screen while user info has not been fetched yet,
|
||||||
|
* otherwise directly render children.
|
||||||
|
*
|
||||||
|
* Children usually contain a Screen at some point in the render tree.
|
||||||
|
*
|
||||||
|
* This is helpful to prevent flash of logged-out content for a few milliseconds when user is actually logged in
|
||||||
|
*/
|
||||||
|
export const UserAware = ({ children }: { children: React.ReactNode }) => {
|
||||||
|
const { isLoggedIn } = useUser()
|
||||||
|
|
||||||
|
return isLoggedIn !== undefined ? (
|
||||||
|
children
|
||||||
|
) : (
|
||||||
|
<LoadingScreen header={false} delay={1000} />
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
export { useUser } from './api/useUser'
|
export { useUser } from './api/useUser'
|
||||||
export { authUrl } from './utils/authUrl'
|
export { authUrl } from './utils/authUrl'
|
||||||
export { logoutUrl } from './utils/logoutUrl'
|
export { logoutUrl } from './utils/logoutUrl'
|
||||||
|
export { UserAware } from './components/UserAware'
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { apiUrl } from '@/api/apiUrl'
|
import { apiUrl } from '@/api/apiUrl'
|
||||||
|
|
||||||
export const authUrl = () => {
|
export const authUrl = ({
|
||||||
return apiUrl('/authenticate')
|
silent = false,
|
||||||
|
returnTo = window.location.href,
|
||||||
|
} = {}) => {
|
||||||
|
return apiUrl(
|
||||||
|
`/authenticate?silent=${encodeURIComponent(silent)}&returnTo=${encodeURIComponent(returnTo)}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { authUrl } from '@/features/auth'
|
||||||
|
|
||||||
|
const SILENT_LOGIN_RETRY_KEY = 'silent-login-retry'
|
||||||
|
|
||||||
|
const isRetryAllowed = () => {
|
||||||
|
const lastRetryDate = localStorage.getItem(SILENT_LOGIN_RETRY_KEY)
|
||||||
|
if (!lastRetryDate) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const now = new Date()
|
||||||
|
return now.getTime() > Number(lastRetryDate)
|
||||||
|
}
|
||||||
|
|
||||||
|
const setNextRetryTime = (retryIntervalInSeconds: number) => {
|
||||||
|
const now = new Date()
|
||||||
|
const nextRetryTime = now.getTime() + retryIntervalInSeconds * 1000
|
||||||
|
localStorage.setItem(SILENT_LOGIN_RETRY_KEY, String(nextRetryTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
const initiateSilentLogin = () => {
|
||||||
|
window.location.href = authUrl({ silent: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
export const canAttemptSilentLogin = () => {
|
||||||
|
return isRetryAllowed()
|
||||||
|
}
|
||||||
|
|
||||||
|
export const attemptSilentLogin = (retryIntervalInSeconds: number) => {
|
||||||
|
if (!isRetryAllowed()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setNextRetryTime(retryIntervalInSeconds)
|
||||||
|
initiateSilentLogin()
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { Field, Ul, H, P, Form, Dialog } from '@/primitives'
|
||||||
|
import { navigateTo } from '@/navigation/navigateTo'
|
||||||
|
import { isRoomValid } from '@/features/rooms'
|
||||||
|
|
||||||
|
export const JoinMeetingDialog = () => {
|
||||||
|
const { t } = useTranslation('home')
|
||||||
|
return (
|
||||||
|
<Dialog title={t('joinMeeting')}>
|
||||||
|
<Form
|
||||||
|
onSubmit={(data) => {
|
||||||
|
navigateTo(
|
||||||
|
'room',
|
||||||
|
(data.roomId as string)
|
||||||
|
.trim()
|
||||||
|
.replace(`${window.location.origin}/`, '')
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
submitLabel={t('joinInputSubmit')}
|
||||||
|
>
|
||||||
|
<Field
|
||||||
|
type="text"
|
||||||
|
name="roomId"
|
||||||
|
label={t('joinInputLabel')}
|
||||||
|
description={t('joinInputExample', {
|
||||||
|
example: 'https://meet.numerique.gouv.fr/azer-tyu-qsdf',
|
||||||
|
})}
|
||||||
|
validate={(value) => {
|
||||||
|
return !isRoomValid(value.trim()) ? (
|
||||||
|
<>
|
||||||
|
<p>{t('joinInputError')}</p>
|
||||||
|
<Ul>
|
||||||
|
<li>{window.location.origin}/uio-azer-jkl</li>
|
||||||
|
<li>uio-azer-jkl</li>
|
||||||
|
</Ul>
|
||||||
|
</>
|
||||||
|
) : null
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form>
|
||||||
|
<H lvl={2}>{t('joinMeetingTipHeading')}</H>
|
||||||
|
<P last>{t('joinMeetingTipContent')}</P>
|
||||||
|
</Dialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { getRouteUrl } from '@/navigation/getRouteUrl'
|
||||||
|
import { Button, Dialog, type DialogProps, P, Text } from '@/primitives'
|
||||||
|
import { HStack } from '@/styled-system/jsx'
|
||||||
|
import { RiCheckLine, RiFileCopyLine, RiSpam2Fill } from '@remixicon/react'
|
||||||
|
|
||||||
|
// fixme - duplication with the InviteDialog
|
||||||
|
export const LaterMeetingDialog = ({
|
||||||
|
roomId,
|
||||||
|
...dialogProps
|
||||||
|
}: { roomId: string } & Omit<DialogProps, 'title'>) => {
|
||||||
|
const { t } = useTranslation('home')
|
||||||
|
const roomUrl = getRouteUrl('room', roomId)
|
||||||
|
|
||||||
|
const [isCopied, setIsCopied] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isCopied) {
|
||||||
|
const timeout = setTimeout(() => setIsCopied(false), 3000)
|
||||||
|
return () => clearTimeout(timeout)
|
||||||
|
}
|
||||||
|
}, [isCopied])
|
||||||
|
|
||||||
|
const [isHovered, setIsHovered] = useState(false)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
isOpen={!!roomId}
|
||||||
|
{...dialogProps}
|
||||||
|
title={t('laterMeetingDialog.heading')}
|
||||||
|
>
|
||||||
|
<P>{t('laterMeetingDialog.description')}</P>
|
||||||
|
<Button
|
||||||
|
variant={isCopied ? 'success' : 'primary'}
|
||||||
|
size="sm"
|
||||||
|
fullWidth
|
||||||
|
aria-label={t('laterMeetingDialog.copy')}
|
||||||
|
style={{
|
||||||
|
justifyContent: 'start',
|
||||||
|
}}
|
||||||
|
onPress={() => {
|
||||||
|
navigator.clipboard.writeText(roomUrl)
|
||||||
|
setIsCopied(true)
|
||||||
|
}}
|
||||||
|
onHoverChange={setIsHovered}
|
||||||
|
>
|
||||||
|
{isCopied ? (
|
||||||
|
<>
|
||||||
|
<RiCheckLine size={18} style={{ marginRight: '8px' }} />
|
||||||
|
{t('laterMeetingDialog.copied')}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<RiFileCopyLine
|
||||||
|
size={18}
|
||||||
|
style={{ marginRight: '8px', minWidth: '18px' }}
|
||||||
|
/>
|
||||||
|
{isHovered ? (
|
||||||
|
t('laterMeetingDialog.copy')
|
||||||
|
) : (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
overflow: 'hidden',
|
||||||
|
userSelect: 'none',
|
||||||
|
textWrap: 'nowrap',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{roomUrl.replace(/^https?:\/\//, '')}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
<HStack>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#d9e5ff',
|
||||||
|
borderRadius: '50%',
|
||||||
|
padding: '4px',
|
||||||
|
marginTop: '1rem',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<RiSpam2Fill size={22} style={{ fill: '#4c84fc' }} />
|
||||||
|
</div>
|
||||||
|
<Text variant="sm" style={{ marginTop: '1rem' }}>
|
||||||
|
{t('laterMeetingDialog.permissions')}
|
||||||
|
</Text>
|
||||||
|
</HStack>
|
||||||
|
</Dialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,2 +1 @@
|
|||||||
export { navigateToHome } from './navigation/navigateToHome'
|
|
||||||
export { Home as HomeRoute } from './routes/Home'
|
export { Home as HomeRoute } from './routes/Home'
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import { navigate } from 'wouter/use-browser-location'
|
|
||||||
|
|
||||||
export const navigateToHome = () => {
|
|
||||||
navigate(`/`)
|
|
||||||
}
|
|
||||||
@@ -1,37 +1,98 @@
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { A, Button, Italic, P, Div, H, Box } from '@/primitives'
|
import { DialogTrigger } from 'react-aria-components'
|
||||||
import { authUrl, useUser } from '@/features/auth'
|
import { Button, Menu, Text } from '@/primitives'
|
||||||
import { navigateToNewRoom } from '@/features/rooms'
|
import { HStack } from '@/styled-system/jsx'
|
||||||
|
import { navigateTo } from '@/navigation/navigateTo'
|
||||||
import { Screen } from '@/layout/Screen'
|
import { Screen } from '@/layout/Screen'
|
||||||
|
import { Centered } from '@/layout/Centered'
|
||||||
|
import { generateRoomId } from '@/features/rooms'
|
||||||
|
import { authUrl, useUser, UserAware } from '@/features/auth'
|
||||||
|
import { JoinMeetingDialog } from '../components/JoinMeetingDialog'
|
||||||
|
import { useCreateRoom } from '@/features/rooms'
|
||||||
|
import { usePersistentUserChoices } from '@livekit/components-react'
|
||||||
|
import { menuItemRecipe } from '@/primitives/menuItemRecipe'
|
||||||
|
import { RiAddLine, RiLink } from '@remixicon/react'
|
||||||
|
import { MenuItem, Menu as RACMenu } from 'react-aria-components'
|
||||||
|
import { LaterMeetingDialog } from '@/features/home/components/LaterMeetingDialog'
|
||||||
|
import { useState } from 'react'
|
||||||
|
|
||||||
export const Home = () => {
|
export const Home = () => {
|
||||||
const { t } = useTranslation('home')
|
const { t } = useTranslation('home')
|
||||||
const { isLoggedIn } = useUser()
|
const { isLoggedIn } = useUser()
|
||||||
|
|
||||||
|
const {
|
||||||
|
userChoices: { username },
|
||||||
|
} = usePersistentUserChoices()
|
||||||
|
|
||||||
|
const { mutateAsync: createRoom } = useCreateRoom()
|
||||||
|
const [laterRoomId, setLaterRoomId] = useState<null | string>(null)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Screen>
|
<UserAware>
|
||||||
<Box type="screen">
|
<Screen>
|
||||||
<H lvl={1}>{t('heading')}</H>
|
<Centered width="fit-content">
|
||||||
<P>{t('intro')}</P>
|
<Text as="h1" variant="display">
|
||||||
<Div marginBottom="gutter">
|
{t('heading')}
|
||||||
<Box variant="subtle" size="sm">
|
</Text>
|
||||||
|
<Text as="p" variant="h3">
|
||||||
|
{t('intro')}
|
||||||
|
</Text>
|
||||||
|
{!isLoggedIn && (
|
||||||
|
<Text margin="sm" variant="note">
|
||||||
|
{t('loginToCreateMeeting')}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
<HStack gap="gutter">
|
||||||
{isLoggedIn ? (
|
{isLoggedIn ? (
|
||||||
<Button variant="primary" onPress={() => navigateToNewRoom()}>
|
<Menu>
|
||||||
{t('createMeeting')}
|
<Button variant="primary">{t('createMeeting')}</Button>
|
||||||
</Button>
|
<RACMenu>
|
||||||
|
<MenuItem
|
||||||
|
className={menuItemRecipe({ icon: true })}
|
||||||
|
onAction={async () => {
|
||||||
|
const slug = generateRoomId()
|
||||||
|
createRoom({ slug, username }).then((data) =>
|
||||||
|
navigateTo('room', data.slug, {
|
||||||
|
state: { create: true, initialRoomData: data },
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<RiAddLine size={18} />
|
||||||
|
{t('createMenu.instantOption')}
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
className={menuItemRecipe({ icon: true })}
|
||||||
|
onAction={() => {
|
||||||
|
const slug = generateRoomId()
|
||||||
|
createRoom({ slug, username }).then((data) =>
|
||||||
|
setLaterRoomId(data.slug)
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<RiLink size={18} />
|
||||||
|
{t('createMenu.laterOption')}
|
||||||
|
</MenuItem>
|
||||||
|
</RACMenu>
|
||||||
|
</Menu>
|
||||||
) : (
|
) : (
|
||||||
<p>
|
<Button variant="primary" href={authUrl()}>
|
||||||
<A href={authUrl()}>{t('login')}</A>
|
{t('login', { ns: 'global' })}
|
||||||
</p>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Box>
|
<DialogTrigger>
|
||||||
</Div>
|
<Button variant="primary" outline>
|
||||||
<P>
|
{t('joinMeeting')}
|
||||||
<Italic>{t('or')}</Italic>
|
</Button>
|
||||||
</P>
|
<JoinMeetingDialog />
|
||||||
<Box variant="subtle" size="sm">
|
</DialogTrigger>
|
||||||
<p>{t('copyMeetingUrl')}</p>
|
</HStack>
|
||||||
</Box>
|
</Centered>
|
||||||
</Box>
|
<LaterMeetingDialog
|
||||||
</Screen>
|
roomId={laterRoomId || ''}
|
||||||
|
onOpenChange={() => setLaterRoomId(null)}
|
||||||
|
/>
|
||||||
|
</Screen>
|
||||||
|
</UserAware>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
import { useEffect } from 'react'
|
||||||
|
import { useRoomContext } from '@livekit/components-react'
|
||||||
|
import { Participant, RemoteParticipant, RoomEvent } from 'livekit-client'
|
||||||
|
import { ToastProvider, toastQueue } from './components/ToastProvider'
|
||||||
|
import { NotificationType } from './NotificationType'
|
||||||
|
import { Div } from '@/primitives'
|
||||||
|
import { isMobileBrowser } from '@livekit/components-core'
|
||||||
|
import { useNotificationSound } from '@/features/notifications/hooks/useSoundNotification'
|
||||||
|
|
||||||
|
export const MainNotificationToast = () => {
|
||||||
|
const room = useRoomContext()
|
||||||
|
const { triggerNotificationSound } = useNotificationSound()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const showJoinNotification = (participant: Participant) => {
|
||||||
|
if (isMobileBrowser()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
triggerNotificationSound(NotificationType.Joined)
|
||||||
|
toastQueue.add(
|
||||||
|
{
|
||||||
|
participant,
|
||||||
|
type: NotificationType.Joined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
timeout: 5000,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
room.on(RoomEvent.ParticipantConnected, showJoinNotification)
|
||||||
|
return () => {
|
||||||
|
room.off(RoomEvent.ParticipantConnected, showJoinNotification)
|
||||||
|
}
|
||||||
|
}, [room, triggerNotificationSound])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const removeJoinNotification = (participant: Participant) => {
|
||||||
|
const existingToast = toastQueue.visibleToasts.find(
|
||||||
|
(toast) =>
|
||||||
|
toast.content.participant === participant &&
|
||||||
|
toast.content.type === NotificationType.Joined
|
||||||
|
)
|
||||||
|
if (existingToast) {
|
||||||
|
toastQueue.close(existingToast.key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
room.on(RoomEvent.ParticipantDisconnected, removeJoinNotification)
|
||||||
|
return () => {
|
||||||
|
room.off(RoomEvent.ParticipantConnected, removeJoinNotification)
|
||||||
|
}
|
||||||
|
}, [room])
|
||||||
|
|
||||||
|
// fixme - close all related toasters when hands are lowered remotely
|
||||||
|
useEffect(() => {
|
||||||
|
const decoder = new TextDecoder()
|
||||||
|
|
||||||
|
const handleNotificationReceived = (
|
||||||
|
payload: Uint8Array,
|
||||||
|
participant?: RemoteParticipant
|
||||||
|
) => {
|
||||||
|
if (!participant) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (isMobileBrowser()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const notification = decoder.decode(payload)
|
||||||
|
const existingToast = toastQueue.visibleToasts.find(
|
||||||
|
(toast) =>
|
||||||
|
toast.content.participant === participant &&
|
||||||
|
toast.content.type === NotificationType.Raised
|
||||||
|
)
|
||||||
|
if (existingToast && notification === NotificationType.Lowered) {
|
||||||
|
toastQueue.close(existingToast.key)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!existingToast && notification === NotificationType.Raised) {
|
||||||
|
triggerNotificationSound(NotificationType.Raised)
|
||||||
|
toastQueue.add(
|
||||||
|
{
|
||||||
|
participant,
|
||||||
|
type: NotificationType.Raised,
|
||||||
|
},
|
||||||
|
{ timeout: 5000 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
room.on(RoomEvent.DataReceived, handleNotificationReceived)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
room.off(RoomEvent.DataReceived, handleNotificationReceived)
|
||||||
|
}
|
||||||
|
}, [room, triggerNotificationSound])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Div position="absolute" bottom={20} right={5} zIndex={1000}>
|
||||||
|
<ToastProvider />
|
||||||
|
</Div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export enum NotificationType {
|
||||||
|
Joined = 'joined',
|
||||||
|
Default = 'default',
|
||||||
|
Raised = 'raised',
|
||||||
|
Lowered = 'lowered',
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import { useToast } from '@react-aria/toast'
|
||||||
|
import { Button } from '@/primitives'
|
||||||
|
import { RiCloseLine } from '@remixicon/react'
|
||||||
|
import { ToastState } from '@react-stately/toast'
|
||||||
|
import { styled } from '@/styled-system/jsx'
|
||||||
|
import { useRef } from 'react'
|
||||||
|
import { ToastData } from './ToastProvider'
|
||||||
|
import type { QueuedToast } from '@react-stately/toast'
|
||||||
|
|
||||||
|
export const StyledToastContainer = styled('div', {
|
||||||
|
base: {
|
||||||
|
margin: 0.5,
|
||||||
|
boxShadow:
|
||||||
|
'rgba(0, 0, 0, 0.5) 0px 4px 8px 0px, rgba(0, 0, 0, 0.3) 0px 6px 20px 4px',
|
||||||
|
backgroundColor: '#494c4f',
|
||||||
|
color: 'white',
|
||||||
|
borderRadius: '8px',
|
||||||
|
'&[data-entering]': { animation: 'fade 200ms' },
|
||||||
|
'&[data-exiting]': { animation: 'fade 150ms reverse ease-in' },
|
||||||
|
width: 'fit-content',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const StyledToast = styled('div', {
|
||||||
|
base: {
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '1rem',
|
||||||
|
padding: '10px',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export interface ToastProps {
|
||||||
|
key: string
|
||||||
|
toast: QueuedToast<ToastData>
|
||||||
|
state: ToastState<ToastData>
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Toast({ state, ...props }: ToastProps) {
|
||||||
|
const ref = useRef(null)
|
||||||
|
const { toastProps, contentProps, closeButtonProps } = useToast(
|
||||||
|
props,
|
||||||
|
state,
|
||||||
|
ref
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
<StyledToastContainer {...toastProps} ref={ref}>
|
||||||
|
<StyledToast>
|
||||||
|
<div {...contentProps}>{props.toast.content?.message} machine a</div>
|
||||||
|
<Button square size="sm" invisible {...closeButtonProps}>
|
||||||
|
<RiCloseLine color="white" />
|
||||||
|
</Button>
|
||||||
|
</StyledToast>
|
||||||
|
</StyledToastContainer>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import { useToast } from '@react-aria/toast'
|
||||||
|
import { useRef } from 'react'
|
||||||
|
import { Button as RACButton } from 'react-aria-components'
|
||||||
|
import { Track } from 'livekit-client'
|
||||||
|
import Source = Track.Source
|
||||||
|
|
||||||
|
import { useMaybeLayoutContext } from '@livekit/components-react'
|
||||||
|
import { ParticipantTile } from '@/features/rooms/livekit/components/ParticipantTile'
|
||||||
|
import { StyledToastContainer, ToastProps } from './Toast'
|
||||||
|
import { HStack, styled } from '@/styled-system/jsx'
|
||||||
|
import { Div } from '@/primitives'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
|
const ClickableToast = styled(RACButton, {
|
||||||
|
base: {
|
||||||
|
cursor: 'pointer',
|
||||||
|
display: 'flex',
|
||||||
|
borderRadius: 'inherit',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export function ToastJoined({ state, ...props }: ToastProps) {
|
||||||
|
const { t } = useTranslation('notifications')
|
||||||
|
const ref = useRef(null)
|
||||||
|
const { toastProps, contentProps, titleProps, closeButtonProps } = useToast(
|
||||||
|
props,
|
||||||
|
state,
|
||||||
|
ref
|
||||||
|
)
|
||||||
|
const layoutContext = useMaybeLayoutContext()
|
||||||
|
const participant = props.toast.content.participant
|
||||||
|
const trackReference = {
|
||||||
|
participant,
|
||||||
|
publication: participant.getTrackPublication(Source.Camera),
|
||||||
|
source: Source.Camera,
|
||||||
|
}
|
||||||
|
const pinParticipant = () => {
|
||||||
|
layoutContext?.pin.dispatch?.({
|
||||||
|
msg: 'set_pin',
|
||||||
|
trackReference,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<StyledToastContainer {...toastProps} ref={ref}>
|
||||||
|
<ClickableToast
|
||||||
|
ref={ref}
|
||||||
|
onPress={(e) => {
|
||||||
|
pinParticipant()
|
||||||
|
closeButtonProps.onPress?.(e)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<HStack justify="center" alignItems="center" {...contentProps}>
|
||||||
|
<Div display="flex" overflow="hidden" width="128" height="72">
|
||||||
|
<ParticipantTile
|
||||||
|
trackRef={trackReference}
|
||||||
|
disableSpeakingIndicator={true}
|
||||||
|
disableMetadata={true}
|
||||||
|
style={{
|
||||||
|
borderRadius: '7px 0 0 7px',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Div>
|
||||||
|
<Div padding={20} {...titleProps}>
|
||||||
|
{t('joined.description', {
|
||||||
|
name: participant.name || t('defaultName'),
|
||||||
|
})}
|
||||||
|
</Div>
|
||||||
|
</HStack>
|
||||||
|
</ClickableToast>
|
||||||
|
</StyledToastContainer>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/* eslint-disable react-refresh/only-export-components */
|
||||||
|
import { ToastQueue, useToastQueue } from '@react-stately/toast'
|
||||||
|
import { ToastRegion } from './ToastRegion'
|
||||||
|
import { Participant } from 'livekit-client'
|
||||||
|
import { NotificationType } from '../NotificationType'
|
||||||
|
|
||||||
|
export interface ToastData {
|
||||||
|
participant: Participant
|
||||||
|
type: NotificationType
|
||||||
|
message?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Using a global queue for toasts allows for centralized management and queuing of notifications
|
||||||
|
// from anywhere in the app, providing greater flexibility in complex scenarios.
|
||||||
|
export const toastQueue = new ToastQueue<ToastData>({
|
||||||
|
maxVisibleToasts: 5,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const ToastProvider = ({ ...props }) => {
|
||||||
|
const state = useToastQueue<ToastData>(toastQueue)
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{state.visibleToasts.length > 0 && (
|
||||||
|
<ToastRegion {...props} state={state} />
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import { useToast } from '@react-aria/toast'
|
||||||
|
import { useRef } from 'react'
|
||||||
|
|
||||||
|
import { StyledToastContainer, ToastProps } from './Toast'
|
||||||
|
import { HStack } from '@/styled-system/jsx'
|
||||||
|
import { Button, Div } from '@/primitives'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { RiCloseLine, RiHand } from '@remixicon/react'
|
||||||
|
import { useWidgetInteraction } from '@/features/rooms/livekit/hooks/useWidgetInteraction'
|
||||||
|
|
||||||
|
export function ToastRaised({ state, ...props }: ToastProps) {
|
||||||
|
const { t } = useTranslation('notifications')
|
||||||
|
const ref = useRef(null)
|
||||||
|
const { toastProps, contentProps, titleProps, closeButtonProps } = useToast(
|
||||||
|
props,
|
||||||
|
state,
|
||||||
|
ref
|
||||||
|
)
|
||||||
|
const participant = props.toast.content.participant
|
||||||
|
const { isParticipantsOpen, toggleParticipants } = useWidgetInteraction()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledToastContainer {...toastProps} ref={ref}>
|
||||||
|
<HStack
|
||||||
|
justify="center"
|
||||||
|
alignItems="center"
|
||||||
|
{...contentProps}
|
||||||
|
padding={14}
|
||||||
|
gap={0}
|
||||||
|
>
|
||||||
|
<RiHand
|
||||||
|
color="white"
|
||||||
|
style={{
|
||||||
|
marginRight: '1rem',
|
||||||
|
animationDuration: '300ms',
|
||||||
|
animationName: 'wave_hand',
|
||||||
|
animationIterationCount: '2',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Div {...titleProps} marginRight={0.5}>
|
||||||
|
{t('raised.description', {
|
||||||
|
name: participant.name || t('defaultName'),
|
||||||
|
})}
|
||||||
|
</Div>
|
||||||
|
{!isParticipantsOpen && (
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="text"
|
||||||
|
style={{
|
||||||
|
color: '#60a5fa',
|
||||||
|
}}
|
||||||
|
onPress={(e) => {
|
||||||
|
toggleParticipants()
|
||||||
|
closeButtonProps.onPress?.(e)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('raised.cta')}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<Button square size="sm" invisible {...closeButtonProps}>
|
||||||
|
<RiCloseLine size={18} color="white" />
|
||||||
|
</Button>
|
||||||
|
</HStack>
|
||||||
|
</StyledToastContainer>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { AriaToastRegionProps, useToastRegion } from '@react-aria/toast'
|
||||||
|
import type { ToastState } from '@react-stately/toast'
|
||||||
|
import { Toast } from './Toast'
|
||||||
|
import { useRef } from 'react'
|
||||||
|
import { NotificationType } from '../NotificationType'
|
||||||
|
import { ToastJoined } from './ToastJoined'
|
||||||
|
import { ToastData } from './ToastProvider'
|
||||||
|
import { ToastRaised } from '@/features/notifications/components/ToastRaised.tsx'
|
||||||
|
|
||||||
|
interface ToastRegionProps extends AriaToastRegionProps {
|
||||||
|
state: ToastState<ToastData>
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ToastRegion({ state, ...props }: ToastRegionProps) {
|
||||||
|
const ref = useRef(null)
|
||||||
|
const { regionProps } = useToastRegion(props, state, ref)
|
||||||
|
return (
|
||||||
|
<div {...regionProps} ref={ref} className="toast-region">
|
||||||
|
{state.visibleToasts.map((toast) => {
|
||||||
|
if (toast.content?.type === NotificationType.Joined) {
|
||||||
|
return <ToastJoined key={toast.key} toast={toast} state={state} />
|
||||||
|
}
|
||||||
|
if (toast.content?.type === NotificationType.Raised) {
|
||||||
|
return <ToastRaised key={toast.key} toast={toast} state={state} />
|
||||||
|
}
|
||||||
|
return <Toast key={toast.key} toast={toast} state={state} />
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import useSound from 'use-sound'
|
||||||
|
|
||||||
|
// fixme - handle dynamic audio output changes
|
||||||
|
export const useNotificationSound = () => {
|
||||||
|
const [play] = useSound('./sounds/notifications.mp3', {
|
||||||
|
sprite: {
|
||||||
|
joined: [0, 1150],
|
||||||
|
raised: [1400, 180],
|
||||||
|
message: [1580, 300],
|
||||||
|
waiting: [2039, 710],
|
||||||
|
success: [2740, 1304],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const triggerNotificationSound = (type: string) => {
|
||||||
|
play({ id: type })
|
||||||
|
}
|
||||||
|
return { triggerNotificationSound }
|
||||||
|
}
|
||||||
@@ -8,4 +8,7 @@ export type ApiRoom = {
|
|||||||
room: string
|
room: string
|
||||||
token: string
|
token: string
|
||||||
}
|
}
|
||||||
|
configuration?: {
|
||||||
|
[key: string]: string | number | boolean
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { useMutation, UseMutationOptions } from '@tanstack/react-query'
|
||||||
|
import { fetchApi } from '@/api/fetchApi'
|
||||||
|
import { ApiError } from '@/api/ApiError'
|
||||||
|
import { ApiRoom } from './ApiRoom'
|
||||||
|
|
||||||
|
export interface CreateRoomParams {
|
||||||
|
slug: string
|
||||||
|
username?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const createRoom = ({
|
||||||
|
slug,
|
||||||
|
username = '',
|
||||||
|
}: CreateRoomParams): Promise<ApiRoom> => {
|
||||||
|
return fetchApi(`rooms/?username=${encodeURIComponent(username)}`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({
|
||||||
|
name: slug,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useCreateRoom(
|
||||||
|
options?: UseMutationOptions<ApiRoom, ApiError, CreateRoomParams>
|
||||||
|
) {
|
||||||
|
return useMutation<ApiRoom, ApiError, CreateRoomParams>({
|
||||||
|
mutationFn: createRoom,
|
||||||
|
onSuccess: options?.onSuccess,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import { styled } from '@/styled-system/jsx'
|
||||||
|
|
||||||
|
const StyledContainer = styled('div', {
|
||||||
|
base: {
|
||||||
|
width: '24px',
|
||||||
|
height: '24px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
backgroundColor: 'primary',
|
||||||
|
borderRadius: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
gap: '2px',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const StyledChild = styled('div', {
|
||||||
|
base: {
|
||||||
|
backgroundColor: 'white',
|
||||||
|
width: '4px',
|
||||||
|
height: '4px',
|
||||||
|
borderRadius: '4px',
|
||||||
|
animationDuration: '400ms',
|
||||||
|
animationName: 'active_speaker',
|
||||||
|
animationIterationCount: 'infinite',
|
||||||
|
animationDirection: 'alternate',
|
||||||
|
},
|
||||||
|
variants: {
|
||||||
|
active: {
|
||||||
|
true: {
|
||||||
|
animationIterationCount: 'infinite',
|
||||||
|
},
|
||||||
|
false: {
|
||||||
|
animationIterationCount: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
small: {
|
||||||
|
animationName: 'active_speake_small',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export const ActiveSpeaker = ({ isSpeaking }: { isSpeaking: boolean }) => {
|
||||||
|
return (
|
||||||
|
<StyledContainer>
|
||||||
|
<StyledChild
|
||||||
|
active={isSpeaking}
|
||||||
|
size="small"
|
||||||
|
style={{
|
||||||
|
animationDelay: '300ms',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<StyledChild
|
||||||
|
active={isSpeaking}
|
||||||
|
style={{
|
||||||
|
animationDelay: '100ms',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<StyledChild
|
||||||
|
active={isSpeaking}
|
||||||
|
size="small"
|
||||||
|
style={{
|
||||||
|
animationDelay: '500ms',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</StyledContainer>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,48 +1,136 @@
|
|||||||
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
import {
|
import {
|
||||||
|
formatChatMessageLinks,
|
||||||
LiveKitRoom,
|
LiveKitRoom,
|
||||||
VideoConference,
|
|
||||||
type LocalUserChoices,
|
type LocalUserChoices,
|
||||||
} from '@livekit/components-react'
|
} from '@livekit/components-react'
|
||||||
|
import { Room, RoomOptions } from 'livekit-client'
|
||||||
import { keys } from '@/api/queryKeys'
|
import { keys } from '@/api/queryKeys'
|
||||||
import { QueryAware } from '@/layout/QueryAware'
|
import { queryClient } from '@/api/queryClient'
|
||||||
import { navigateToHome } from '@/features/home'
|
import { navigateTo } from '@/navigation/navigateTo'
|
||||||
|
import { Screen } from '@/layout/Screen'
|
||||||
|
import { QueryAware } from '@/components/QueryAware'
|
||||||
|
import { ErrorScreen } from '@/components/ErrorScreen'
|
||||||
import { fetchRoom } from '../api/fetchRoom'
|
import { fetchRoom } from '../api/fetchRoom'
|
||||||
|
import { ApiRoom } from '../api/ApiRoom'
|
||||||
|
import { useCreateRoom } from '../api/createRoom'
|
||||||
|
import { InviteDialog } from './InviteDialog'
|
||||||
|
|
||||||
|
import { VideoConference } from '../livekit/prefabs/VideoConference'
|
||||||
|
|
||||||
export const Conference = ({
|
export const Conference = ({
|
||||||
roomId,
|
roomId,
|
||||||
userConfig,
|
userConfig,
|
||||||
|
initialRoomData,
|
||||||
|
mode = 'join',
|
||||||
}: {
|
}: {
|
||||||
roomId: string
|
roomId: string
|
||||||
userConfig: LocalUserChoices
|
userConfig: LocalUserChoices
|
||||||
|
mode?: 'join' | 'create'
|
||||||
|
initialRoomData?: ApiRoom
|
||||||
}) => {
|
}) => {
|
||||||
const { status, data } = useQuery({
|
const fetchKey = [keys.room, roomId, userConfig.username]
|
||||||
queryKey: [keys.room, roomId, userConfig.username],
|
|
||||||
|
const {
|
||||||
|
mutateAsync: createRoom,
|
||||||
|
status: createStatus,
|
||||||
|
isError: isCreateError,
|
||||||
|
} = useCreateRoom({
|
||||||
|
onSuccess: (data) => {
|
||||||
|
queryClient.setQueryData(fetchKey, data)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const {
|
||||||
|
status: fetchStatus,
|
||||||
|
isError: isFetchError,
|
||||||
|
data,
|
||||||
|
} = useQuery({
|
||||||
|
queryKey: fetchKey,
|
||||||
|
staleTime: 6 * 60 * 60 * 1000, // By default, LiveKit access tokens expire 6 hours after generation
|
||||||
|
initialData: initialRoomData,
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
fetchRoom({
|
fetchRoom({
|
||||||
roomId: roomId as string,
|
roomId: roomId as string,
|
||||||
username: userConfig.username,
|
username: userConfig.username,
|
||||||
|
}).catch((error) => {
|
||||||
|
if (error.statusCode == '404') {
|
||||||
|
createRoom({ slug: roomId, username: userConfig.username })
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
|
retry: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const roomOptions = useMemo((): RoomOptions => {
|
||||||
|
return {
|
||||||
|
videoCaptureDefaults: {
|
||||||
|
deviceId: userConfig.videoDeviceId ?? undefined,
|
||||||
|
},
|
||||||
|
audioCaptureDefaults: {
|
||||||
|
deviceId: userConfig.audioDeviceId ?? undefined,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
// do not rely on the userConfig object directly as its reference may change on every render
|
||||||
|
}, [userConfig.videoDeviceId, userConfig.audioDeviceId])
|
||||||
|
|
||||||
|
const room = useMemo(() => new Room(roomOptions), [roomOptions])
|
||||||
|
|
||||||
|
const [showInviteDialog, setShowInviteDialog] = useState(mode === 'create')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checks for actual click on the leave button instead of
|
||||||
|
* relying on LiveKitRoom onDisconnected because onDisconnected
|
||||||
|
* triggers even on page reload, it's not a user "onLeave" event really.
|
||||||
|
* Here we want to react to the user actually deciding to leave.
|
||||||
|
*/
|
||||||
|
useEffect(() => {
|
||||||
|
const checkOnLeaveClick = (event: MouseEvent) => {
|
||||||
|
const target = event.target as HTMLElement
|
||||||
|
if (target.classList.contains('lk-disconnect-button')) {
|
||||||
|
navigateTo('feedback')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.body.addEventListener('click', checkOnLeaveClick)
|
||||||
|
return () => {
|
||||||
|
document.body.removeEventListener('click', checkOnLeaveClick)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const { t } = useTranslation('rooms')
|
||||||
|
if (isCreateError) {
|
||||||
|
// this error screen should be replaced by a proper waiting room for anonymous user.
|
||||||
|
return (
|
||||||
|
<ErrorScreen
|
||||||
|
title={t('error.createRoom.heading')}
|
||||||
|
body={t('error.createRoom.body')}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<QueryAware status={status}>
|
<QueryAware status={isFetchError ? createStatus : fetchStatus}>
|
||||||
<LiveKitRoom
|
<Screen header={false}>
|
||||||
serverUrl={data?.livekit?.url}
|
<LiveKitRoom
|
||||||
token={data?.livekit?.token}
|
room={room}
|
||||||
connect={true}
|
serverUrl={data?.livekit?.url}
|
||||||
audio={{
|
token={data?.livekit?.token}
|
||||||
deviceId: userConfig.audioDeviceId,
|
connect={true}
|
||||||
}}
|
audio={userConfig.audioEnabled}
|
||||||
video={{
|
video={userConfig.videoEnabled}
|
||||||
deviceId: userConfig.videoDeviceId,
|
>
|
||||||
}}
|
<VideoConference chatMessageFormatter={formatChatMessageLinks} />
|
||||||
onDisconnected={() => {
|
{showInviteDialog && (
|
||||||
navigateToHome()
|
<InviteDialog
|
||||||
}}
|
isOpen={showInviteDialog}
|
||||||
>
|
onOpenChange={setShowInviteDialog}
|
||||||
<VideoConference />
|
roomId={roomId}
|
||||||
</LiveKitRoom>
|
onClose={() => setShowInviteDialog(false)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</LiveKitRoom>
|
||||||
|
</Screen>
|
||||||
</QueryAware>
|
</QueryAware>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,141 @@
|
|||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { getRouteUrl } from '@/navigation/getRouteUrl'
|
||||||
|
import { Div, Button, type DialogProps, P } from '@/primitives'
|
||||||
|
import { HStack, styled, VStack } from '@/styled-system/jsx'
|
||||||
|
import { Heading, Dialog } from 'react-aria-components'
|
||||||
|
import { Text, text } from '@/primitives/Text'
|
||||||
|
import {
|
||||||
|
RiCheckLine,
|
||||||
|
RiCloseLine,
|
||||||
|
RiFileCopyLine,
|
||||||
|
RiSpam2Fill,
|
||||||
|
} from '@remixicon/react'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
|
// fixme - extract in a proper primitive this dialog without overlay
|
||||||
|
const StyledRACDialog = styled(Dialog, {
|
||||||
|
base: {
|
||||||
|
position: 'fixed',
|
||||||
|
left: '0.75rem',
|
||||||
|
bottom: 80,
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
zIndex: 1000,
|
||||||
|
width: '24.5rem',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '1.5rem',
|
||||||
|
boxShadow:
|
||||||
|
'0 1px 2px 0 rgba(60, 64, 67, .3), 0 2px 6px 2px rgba(60, 64, 67, .15)',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
'&[data-entering]': { animation: 'fade 200ms' },
|
||||||
|
'&[data-exiting]': { animation: 'fade 150ms reverse ease-in' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
export const InviteDialog = ({
|
||||||
|
roomId,
|
||||||
|
...dialogProps
|
||||||
|
}: { roomId: string } & Omit<DialogProps, 'title'>) => {
|
||||||
|
const { t } = useTranslation('rooms')
|
||||||
|
const roomUrl = getRouteUrl('room', roomId)
|
||||||
|
|
||||||
|
const [isCopied, setIsCopied] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isCopied) {
|
||||||
|
const timeout = setTimeout(() => setIsCopied(false), 3000)
|
||||||
|
return () => clearTimeout(timeout)
|
||||||
|
}
|
||||||
|
}, [isCopied])
|
||||||
|
|
||||||
|
const [isHovered, setIsHovered] = useState(false)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledRACDialog {...dialogProps}>
|
||||||
|
{({ close }) => (
|
||||||
|
<VStack
|
||||||
|
alignItems="left"
|
||||||
|
justify="start"
|
||||||
|
gap={0}
|
||||||
|
style={{ maxWidth: '100%', overflow: 'hidden' }}
|
||||||
|
>
|
||||||
|
<Heading slot="title" level={3} className={text({ variant: 'h2' })}>
|
||||||
|
{t('shareDialog.heading')}
|
||||||
|
</Heading>
|
||||||
|
<Div position="absolute" top="5" right="5">
|
||||||
|
<Button
|
||||||
|
invisible
|
||||||
|
size="xs"
|
||||||
|
onPress={() => {
|
||||||
|
dialogProps.onClose?.()
|
||||||
|
close()
|
||||||
|
}}
|
||||||
|
aria-label={t('closeDialog')}
|
||||||
|
>
|
||||||
|
<RiCloseLine />
|
||||||
|
</Button>
|
||||||
|
</Div>
|
||||||
|
<P>{t('shareDialog.description')}</P>
|
||||||
|
<Button
|
||||||
|
variant={isCopied ? 'success' : 'primary'}
|
||||||
|
size="sm"
|
||||||
|
fullWidth
|
||||||
|
aria-label={t('shareDialog.copy')}
|
||||||
|
style={{
|
||||||
|
justifyContent: 'start',
|
||||||
|
}}
|
||||||
|
onPress={() => {
|
||||||
|
navigator.clipboard.writeText(roomUrl)
|
||||||
|
setIsCopied(true)
|
||||||
|
}}
|
||||||
|
onHoverChange={setIsHovered}
|
||||||
|
>
|
||||||
|
{isCopied ? (
|
||||||
|
<>
|
||||||
|
<RiCheckLine size={18} style={{ marginRight: '8px' }} />
|
||||||
|
{t('shareDialog.copied')}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<RiFileCopyLine
|
||||||
|
size={18}
|
||||||
|
style={{ marginRight: '8px', minWidth: '18px' }}
|
||||||
|
/>
|
||||||
|
{isHovered ? (
|
||||||
|
t('shareDialog.copy')
|
||||||
|
) : (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
overflow: 'hidden',
|
||||||
|
userSelect: 'none',
|
||||||
|
textWrap: 'nowrap',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{roomUrl.replace(/^https?:\/\//, '')}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
<HStack>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#d9e5ff',
|
||||||
|
borderRadius: '50%',
|
||||||
|
padding: '4px',
|
||||||
|
marginTop: '1rem',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<RiSpam2Fill size={22} style={{ fill: '#4c84fc' }} />
|
||||||
|
</div>
|
||||||
|
<Text variant="sm" style={{ marginTop: '1rem' }}>
|
||||||
|
{t('shareDialog.permissions')}
|
||||||
|
</Text>
|
||||||
|
</HStack>
|
||||||
|
</VStack>
|
||||||
|
)}
|
||||||
|
</StyledRACDialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Box } from '@/layout/Box'
|
|
||||||
import { PreJoin, type LocalUserChoices } from '@livekit/components-react'
|
import { PreJoin, type LocalUserChoices } from '@livekit/components-react'
|
||||||
|
import { Screen } from '@/layout/Screen'
|
||||||
|
import { CenteredContent } from '@/layout/CenteredContent'
|
||||||
|
|
||||||
export const Join = ({
|
export const Join = ({
|
||||||
onSubmit,
|
onSubmit,
|
||||||
@@ -10,8 +11,17 @@ export const Join = ({
|
|||||||
const { t } = useTranslation('rooms')
|
const { t } = useTranslation('rooms')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box title={t('join.heading')} withBackButton>
|
<Screen layout="centered">
|
||||||
<PreJoin persistUserChoices onSubmit={onSubmit} />
|
<CenteredContent title={t('join.heading')}>
|
||||||
</Box>
|
<PreJoin
|
||||||
|
persistUserChoices
|
||||||
|
onSubmit={onSubmit}
|
||||||
|
micLabel={t('join.micLabel')}
|
||||||
|
camLabel={t('join.camlabel')}
|
||||||
|
joinLabel={t('join.joinLabel')}
|
||||||
|
userLabel={t('join.userLabel')}
|
||||||
|
/>
|
||||||
|
</CenteredContent>
|
||||||
|
</Screen>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
export { navigateToNewRoom } from './navigation/navigateToNewRoom'
|
|
||||||
export { Room as RoomRoute } from './routes/Room'
|
export { Room as RoomRoute } from './routes/Room'
|
||||||
export { roomIdRegex } from './utils/generateRoomId'
|
export { FeedbackRoute } from './routes/Feedback'
|
||||||
|
export { roomIdPattern, isRoomValid } from './utils/isRoomValid'
|
||||||
|
export { generateRoomId } from './utils/generateRoomId'
|
||||||
|
export { useCreateRoom } from './api/createRoom'
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user