153 Commits

Author SHA1 Message Date
8e0a08da05 icons
All checks were successful
Deploy / publish-web (push) Successful in 44s
2026-02-03 22:02:45 +06:00
0a3b2c3dc8 resize
All checks were successful
Deploy / publish-web (push) Successful in 44s
2026-02-03 17:05:43 +06:00
e5f1e6bbb3 показывать себя в превью
All checks were successful
Deploy / publish-web (push) Successful in 41s
2026-02-03 16:54:51 +06:00
1354ca3f7e показывать себя в превью
All checks were successful
Deploy / publish-web (push) Successful in 42s
2026-02-03 16:47:33 +06:00
269b19a5be вебкамера там, туда-сюда
All checks were successful
Deploy / publish-web (push) Successful in 1m16s
2026-02-02 14:39:16 +06:00
0922fc4f41 новый-старый clientrow
All checks were successful
Deploy / publish-web (push) Successful in 41s
2026-01-29 23:19:31 +06:00
9fc8f954e3 новый-старый clientrow 2026-01-29 23:18:47 +06:00
a645885cf2 client volumes
All checks were successful
Deploy / publish-web (push) Successful in 1m31s
2026-01-29 22:05:05 +06:00
4c8a0e791c client volumes 2026-01-29 22:04:40 +06:00
fbdceb2e55 client volumes 2026-01-29 21:59:41 +06:00
aeaea47609 client volumes and dominant client
All checks were successful
Deploy / deploy (push) Successful in 33s
2026-01-29 21:40:56 +06:00
f4fd752448 client volumes and dominant client
All checks were successful
Deploy / deploy (push) Successful in 34s
2026-01-29 21:34:46 +06:00
595354b7f0 Merge pull request 'shareFps' (#9) from shareFps into master
All checks were successful
Deploy / publish-web (push) Successful in 1m32s
Reviewed-on: #9
2026-01-12 07:23:51 +00:00
Nadar
d08b011596 shareFps 2026-01-12 10:22:56 +03:00
12ce381abd minor update
All checks were successful
Deploy / publish-web (push) Successful in 46s
2025-12-27 02:52:17 +06:00
2d30ac2863 minor update
All checks were successful
Deploy / publish-web (push) Successful in 44s
2025-12-27 02:49:39 +06:00
0f218c1519 button colors 2025-12-27 01:58:01 +06:00
4b1a563850 screen sharing
All checks were successful
Deploy / publish-web (push) Successful in 1m25s
2025-12-27 01:49:25 +06:00
169d43f0db screen sharing 2025-12-27 01:48:49 +06:00
47a464f08f screen sharing
All checks were successful
Deploy / publish-web (push) Successful in 48s
2025-12-26 18:22:22 +06:00
4d5db12e1b screen sharing
Some checks failed
Deploy / deploy (push) Successful in 35s
Deploy / publish-web (push) Failing after 22s
2025-12-26 17:36:30 +06:00
4f59cbcf65 screen sharing
All checks were successful
Deploy / deploy (push) Successful in 35s
2025-12-26 17:21:59 +06:00
3b3f6b6e40 update 2025-12-26 01:44:16 +06:00
461cbc6f83 profile rest
All checks were successful
Deploy / publish-web (push) Successful in 46s
2025-12-26 01:25:14 +06:00
a5cda8828f refactor
All checks were successful
Deploy / deploy (push) Successful in 34s
2025-12-26 01:22:34 +06:00
778f0a5687 refactor
All checks were successful
Deploy / deploy (push) Successful in 35s
2025-12-26 01:18:54 +06:00
2aca9bca08 refactor
All checks were successful
Deploy / deploy (push) Successful in 40s
2025-12-26 01:13:21 +06:00
7ed23df3e9 refactor
All checks were successful
Deploy / deploy (push) Successful in 39s
2025-12-26 01:08:44 +06:00
2ac88f1010 user preferences
All checks were successful
Deploy / publish-web (push) Successful in 2m14s
2025-12-25 22:53:12 +06:00
c2cffd18de user preferences 2025-12-25 22:51:02 +06:00
bf38267c37 user preferences
All checks were successful
Deploy / deploy (push) Successful in 36s
2025-12-25 22:50:56 +06:00
22c5fafb11 user preferences
All checks were successful
Deploy / deploy (push) Successful in 36s
2025-12-25 21:30:30 +06:00
37683c42a9 user preferences
All checks were successful
Deploy / deploy (push) Successful in 35s
2025-12-25 21:27:54 +06:00
2cbc75d7e3 user preferences
All checks were successful
Deploy / deploy (push) Successful in 37s
2025-12-25 21:24:41 +06:00
6721f63d22 user preferences
All checks were successful
Deploy / deploy (push) Successful in 36s
2025-12-25 21:22:43 +06:00
b47643552f user preferences
All checks were successful
Deploy / deploy (push) Successful in 36s
2025-12-25 21:08:14 +06:00
0ab3e15784 cors origins
All checks were successful
Deploy / deploy (push) Successful in 37s
2025-12-25 07:38:07 +06:00
28c64edaf8 update 2025-12-25 07:33:18 +06:00
67a8dc7782 update 2025-12-25 07:30:57 +06:00
43a8b98a6a update 2025-12-25 07:21:45 +06:00
0f9a7e39ce update 2025-12-25 07:21:30 +06:00
8265e2d719 update 2025-12-25 03:51:29 +06:00
4f91309f7f update 2025-12-24 06:29:44 +06:00
bcd457e2d6 update 2025-12-24 06:20:11 +06:00
8eef4fc477 update 2025-12-24 04:39:46 +06:00
614867bd12 update 2025-12-24 04:35:41 +06:00
cdf2bf5952 update 2025-12-24 04:35:13 +06:00
a4bd6705b6 Merge branch 'master' of git.koptilnya.xyz:opti1337/chad
Some checks failed
Deploy / publish-windows (push) Has been cancelled
2025-12-24 04:03:07 +06:00
723048c72a update 2025-12-24 04:02:53 +06:00
06ea0cd488 Обновить .gitea/workflows/deploy-client.yml
Some checks failed
Deploy / publish-windows (push) Failing after 6m3s
2025-12-23 19:52:47 +00:00
007d3ddda7 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Has been cancelled
2025-12-24 00:42:07 +06:00
33cdaebada Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 3m0s
2025-12-24 00:25:30 +06:00
9650ea63fc update
Some checks failed
Deploy / publish-windows (push) Failing after 18s
2025-12-24 00:23:29 +06:00
db59b85bd2 udpate
All checks were successful
Deploy / publish-windows (push) Successful in 3m22s
2025-12-24 00:11:03 +06:00
3f6f3b739e Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 9m54s
2025-12-23 23:43:14 +06:00
b33a896117 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 4m17s
2025-12-23 23:14:44 +06:00
01ae1b5011 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 24s
2025-12-23 22:53:46 +06:00
0ac69610f2 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 26s
2025-12-23 22:52:38 +06:00
c4489b58c9 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 23s
2025-12-23 22:50:37 +06:00
c19bef73e0 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Has been cancelled
2025-12-23 22:44:24 +06:00
c573d2277a update
Some checks failed
Deploy / publish-windows (push) Failing after 23s
2025-12-23 22:42:04 +06:00
3006a82a0f update
Some checks failed
Deploy / publish-windows (push) Failing after 19m11s
2025-12-23 22:03:09 +06:00
a68aa78ae1 update
Some checks failed
Deploy / publish-windows (push) Failing after 16m16s
2025-12-23 21:45:21 +06:00
ba9f51bd5e Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 18m59s
2025-12-23 21:21:44 +06:00
89a3eac2b9 Update deploy-client.yml
Some checks failed
Deploy / publish-windows (push) Failing after 18s
2025-12-23 20:55:14 +06:00
01de23a036 Merge pull request 'release test' (#7) from release into master
Reviewed-on: #7
2025-12-23 14:51:49 +00:00
aef93ef821 update 2025-12-23 20:50:13 +06:00
72f46df4d1 update
All checks were successful
Deploy / publish-windows (push) Successful in 19s
2025-12-23 00:59:01 +06:00
50c56e87ff Update Dockerfile.windows
All checks were successful
Deploy / publish-windows (push) Successful in 6m11s
2025-12-23 00:37:41 +06:00
a7d65f0e3c Update deploy-client.yml
Some checks failed
Deploy / publish-windows (push) Failing after 5m37s
2025-12-23 00:27:43 +06:00
649b49a732 update
Some checks failed
Deploy / publish-windows (push) Failing after 9s
2025-12-23 00:27:01 +06:00
b887b69997 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 2m45s
2025-12-23 00:07:40 +06:00
687a2958c0 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 1m52s
2025-12-22 23:35:59 +06:00
a7fe94abec Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 3m13s
2025-12-22 22:40:13 +06:00
adb539350f Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 27s
2025-12-22 22:37:41 +06:00
d870b7c1f1 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 9m31s
2025-12-22 22:27:02 +06:00
edd5a69cd4 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 35s
2025-12-22 22:24:34 +06:00
6343f1de4d Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 2m21s
2025-12-22 22:19:14 +06:00
3f581ea8e9 Update deploy-client.yml
Some checks failed
Deploy / publish-windows (push) Failing after 2m34s
2025-12-22 22:15:37 +06:00
10bfcf0727 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 21s
2025-12-22 22:14:24 +06:00
6b5383ba24 Update Dockerfile.windows
Some checks failed
Deploy / publish-windows (push) Failing after 19s
2025-12-22 22:01:30 +06:00
6b5d669f64 update
Some checks failed
Deploy / publish-windows (push) Failing after 27s
2025-12-22 21:55:12 +06:00
40d66d356b update
Some checks failed
Deploy / publish-tauri (push) Failing after 15s
Deploy / publish-web (push) Successful in 40s
2025-12-22 21:50:33 +06:00
c665c19cf3 update
Some checks failed
Deploy / publish-web (push) Failing after 33s
Deploy / publish-tauri (push) Failing after 50s
2025-12-22 21:47:24 +06:00
b05a7324d6 update
Some checks failed
Deploy / publish-web (push) Successful in 41s
Deploy / publish-tauri (push) Failing after 52s
2025-12-22 21:45:17 +06:00
e8cbf6e146 update
Some checks failed
Deploy / publish-tauri (push) Has been cancelled
Deploy / publish-web (push) Has been cancelled
2025-12-22 21:44:36 +06:00
472fa8d907 update
Some checks failed
Deploy / publish-web (push) Failing after 20s
Deploy / publish-tauri (push) Failing after 18s
2025-12-22 21:40:38 +06:00
ddc43e4b42 update
Some checks failed
Deploy / publish-web (push) Failing after 41s
Deploy / publish-tauri (push) Failing after 25s
2025-12-22 21:36:12 +06:00
8d02eb380d update
Some checks failed
Deploy / publish-web (push) Failing after 13s
Deploy / publish-tauri (push) Failing after 12s
2025-12-22 21:17:29 +06:00
4c70dce568 build
Some checks failed
Deploy / publish-web (push) Failing after 25s
Deploy / publish-tauri (push) Failing after 10s
2025-12-22 21:07:20 +06:00
76f0ec74b5 test publish
Some checks failed
Deploy / deploy (push) Has been cancelled
Deploy / publish-web (push) Successful in 1m43s
Deploy / publish-tauri (push) Has been cancelled
2025-12-22 19:23:06 +06:00
Никита Круглицкий
e3d0106d8f куча говна
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-20 06:44:21 +06:00
Никита Круглицкий
e2068dd89a куча говна
All checks were successful
Deploy / deploy (push) Successful in 45s
2025-10-20 06:14:18 +06:00
Никита Круглицкий
a2f845f228 куча говна
All checks were successful
Deploy / deploy (push) Successful in 45s
2025-10-20 06:01:29 +06:00
Никита Круглицкий
1a497d402d куча говна
All checks were successful
Deploy / deploy (push) Successful in 46s
2025-10-20 05:59:06 +06:00
Никита Круглицкий
924bbd4285 куча говна
All checks were successful
Deploy / deploy (push) Successful in 43s
2025-10-20 05:57:08 +06:00
Никита Круглицкий
58d37ee02b куча говна
All checks were successful
Deploy / deploy (push) Successful in 45s
2025-10-20 05:50:27 +06:00
Никита Круглицкий
ba12d413dc куча говна
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-20 03:53:29 +06:00
Никита Круглицкий
f525d1afe5 куча говна
All checks were successful
Deploy / deploy (push) Successful in 45s
2025-10-20 03:36:30 +06:00
Никита Круглицкий
75fe5b0b8c куча говна
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-20 03:33:07 +06:00
Никита Круглицкий
39e877bbe9 куча говна
All checks were successful
Deploy / deploy (push) Successful in 47s
2025-10-20 03:23:34 +06:00
Никита Круглицкий
fe205531e0 куча говна
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-20 03:17:54 +06:00
Никита Круглицкий
1ef0df7afb куча говна
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-20 00:20:09 +06:00
Никита Круглицкий
a0bd6f92e9 куча говна
Some checks failed
Deploy / deploy (push) Failing after 25s
2025-10-20 00:19:25 +06:00
Никита Круглицкий
511cb76888 куча говна
Some checks failed
Deploy / deploy (push) Failing after 1m27s
2025-10-20 00:16:59 +06:00
Никита Круглицкий
a433e1982b куча говна
Some checks failed
Deploy / deploy (push) Failing after 9s
2025-10-20 00:11:03 +06:00
Никита Круглицкий
ec67be8aa6 куча говна
All checks were successful
Deploy / deploy (push) Successful in 4m32s
2025-10-20 00:10:13 +06:00
Никита Круглицкий
31460598ba server
All checks were successful
Deploy / deploy (push) Successful in 24s
2025-10-16 22:23:30 +06:00
Никита Круглицкий
4c368458a9 server
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-09 23:56:49 +06:00
Никита Круглицкий
aa31e7ad0c server
Some checks failed
Deploy / deploy (push) Failing after 8s
2025-10-09 23:52:08 +06:00
Никита Круглицкий
7b4be60099 server
Some checks failed
Deploy / deploy (push) Failing after 9s
2025-10-09 23:51:17 +06:00
Никита Круглицкий
d5915a9d40 fix migrations
All checks were successful
Deploy / deploy (push) Successful in 45s
2025-10-09 23:19:26 +06:00
Никита Круглицкий
7d4fdfb2e6 add migrations
All checks were successful
Deploy / deploy (push) Successful in 40s
2025-10-09 22:58:48 +06:00
Никита Круглицкий
ad71b15f81 update
All checks were successful
Deploy / deploy (push) Successful in 20s
2025-10-09 22:54:34 +06:00
Никита Круглицкий
a49fe5fc53 update
Some checks failed
Deploy / deploy (push) Failing after 41s
2025-10-09 22:53:20 +06:00
Никита Круглицкий
8f2b9861c2 update
All checks were successful
Deploy / deploy (push) Successful in 49s
2025-10-09 22:47:51 +06:00
Никита Круглицкий
adcc5b65a6 update
All checks were successful
Deploy / deploy (push) Successful in 19s
2025-10-09 22:40:28 +06:00
Никита Круглицкий
b8a21a1451 update
Some checks failed
Deploy / deploy (push) Failing after 13s
2025-10-09 22:37:02 +06:00
Никита Круглицкий
c0969c4494 update
Some checks failed
Deploy / deploy (push) Failing after 15s
2025-10-09 22:35:05 +06:00
Никита Круглицкий
bb48e52a99 update
Some checks failed
Deploy / deploy (push) Failing after 4m2s
2025-10-09 22:29:42 +06:00
Никита Круглицкий
6ada2c3fbd update
All checks were successful
Deploy / deploy (push) Successful in 43s
2025-10-09 06:23:13 +06:00
Никита Круглицкий
e2064dba6c front update
All checks were successful
Deploy / deploy (push) Successful in 38s
2025-10-09 06:14:35 +06:00
Никита Круглицкий
fc43c8df96 server update
Some checks failed
Deploy / deploy (push) Failing after 15s
2025-10-09 06:14:24 +06:00
Никита Круглицкий
6b6a66eef4 server update
All checks were successful
Deploy / deploy (push) Successful in 43s
2025-10-09 06:09:28 +06:00
Никита Круглицкий
5ca3a47d40 front update
All checks were successful
Deploy / deploy (push) Successful in 39s
2025-10-09 04:48:02 +06:00
Никита Круглицкий
484e61f337 front update
All checks were successful
Deploy / deploy (push) Successful in 40s
2025-10-09 04:45:09 +06:00
Никита Круглицкий
196aa36970 front update
All checks were successful
Deploy / deploy (push) Successful in 43s
2025-10-09 04:42:34 +06:00
Никита Круглицкий
7cd4ff72d4 #4
All checks were successful
Deploy / deploy (push) Successful in 45s
2025-10-07 06:13:54 +06:00
Никита Круглицкий
1339a48da0 #4 2025-10-07 06:13:42 +06:00
Никита Круглицкий
ea55b99116 #4
Some checks failed
Deploy / deploy (push) Failing after 7s
2025-10-07 05:39:40 +06:00
Никита Круглицкий
fbbb2b9b8e #4
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-06 23:14:32 +06:00
Никита Круглицкий
87b4c1489e #4
All checks were successful
Deploy / deploy (push) Successful in 43s
2025-10-06 23:03:06 +06:00
Никита Круглицкий
d224ccc52e #4
All checks were successful
Deploy / deploy (push) Successful in 45s
2025-10-06 22:52:47 +06:00
Никита Круглицкий
fb5b42e9db front update
All checks were successful
Deploy / deploy (push) Successful in 1m38s
2025-10-05 21:43:28 +06:00
Никита Круглицкий
1ea3b2d376 #4
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-05 21:36:28 +06:00
Никита Круглицкий
c370a455bd #4
All checks were successful
Deploy / deploy (push) Successful in 42s
2025-10-05 07:29:41 +06:00
Никита Круглицкий
189404e22c #4
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-04 23:59:48 +06:00
Никита Круглицкий
80c53a079b #4
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-04 22:44:55 +06:00
Никита Круглицкий
e6a274cc9d #6
All checks were successful
Deploy / deploy (push) Successful in 1m6s
2025-10-04 02:53:42 +06:00
Никита Круглицкий
c365f3e885 #4
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-03 02:36:38 +06:00
Никита Круглицкий
7cecf0641f #4
All checks were successful
Deploy / deploy (push) Successful in 29s
2025-10-03 02:05:50 +06:00
Никита Круглицкий
423fa3b62a #4
All checks were successful
Deploy / deploy (push) Successful in 33s
2025-10-03 02:01:12 +06:00
Никита Круглицкий
0a8015528d #4
All checks were successful
Deploy / deploy (push) Successful in 30s
2025-10-03 01:53:36 +06:00
Никита Круглицкий
c9feff7224 №4
All checks were successful
Deploy / deploy (push) Successful in 30s
2025-10-02 23:57:54 +06:00
Никита Круглицкий
7294e56778 №4
All checks were successful
Deploy / deploy (push) Successful in 22s
2025-10-02 23:55:04 +06:00
Никита Круглицкий
8e19f55dc0 №4
All checks were successful
Deploy / deploy (push) Successful in 3m59s
2025-10-02 23:39:59 +06:00
Никита Круглицкий
a01f8857ab #2 update
All checks were successful
Deploy / deploy (push) Successful in 49s
2025-10-02 04:38:33 +06:00
Никита Круглицкий
e66493b733 #2 update
All checks were successful
Deploy / deploy (push) Successful in 45s
2025-10-02 04:33:29 +06:00
Никита Круглицкий
496e2ec4ef #2 update
All checks were successful
Deploy / deploy (push) Successful in 44s
2025-10-02 04:29:43 +06:00
Никита Круглицкий
c442e1aa47 #2 #3 update
All checks were successful
Deploy / deploy (push) Successful in 48s
2025-10-02 04:22:10 +06:00
Никита Круглицкий
6d4076969e #2 update
All checks were successful
Deploy / deploy (push) Successful in 23s
2025-10-02 03:54:35 +06:00
Никита Круглицкий
b24a30314f #2 update
All checks were successful
Deploy / deploy (push) Successful in 13s
2025-10-02 03:47:50 +06:00
Никита Круглицкий
aa257565fb #2 update 2025-10-02 03:47:30 +06:00
145 changed files with 13232 additions and 2026 deletions

View File

@@ -1,43 +1,83 @@
name: Deploy
on:
workflow_dispatch:
push:
branches:
- master
paths:
- '.gitea/workflows/deploy-client.yml'
- 'client/**'
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
# paths:
# - ".gitea/workflows/deploy-client.yml"
# - "client/**"
jobs:
deploy:
runs-on: ubuntu-latest
# publish-windows:
# runs-on: ubuntu-latest
#
# steps:
# - name: Keyscan
# run: |
# ssh-keyscan git.koptilnya.xyz >> ~/.ssh/known_hosts
#
# - name: Checkout
# uses: actions/checkout@v4
# with:
# ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
# ssh-strict: false
# persist-credentials: false
#
# - name: Build
# run: |
# docker build \
# -t chad-client-windows-builder \
# -f ./client/Dockerfile.windows \
# ./client \
# --build-arg COMMIT_SHA=${{ gitea.sha }} \
# --build-arg API_BASE_URL=${{ vars.API_BASE_URL }} \
# --build-arg TAURI_SIGNING_PRIVATE_KEY=${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
#
# docker create --name chad-client-windows-container chad-client-windows-builder
# mkdir -p artifacts
# docker cp chad-client-windows-container:/artifacts artifacts/
# docker rm chad-client-windows-container
# ls -la artifacts
#
# - name: Publish
# uses: akkuman/gitea-release-action@v1
# with:
# files: |
# artifacts/**
# draft: true
steps:
- name: Keyscan
run: |
ssh-keyscan git.koptilnya.xyz >> ~/.ssh/known_hosts
publish-web:
runs-on: ubuntu-latest
- name: Checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-strict: false
persist-credentials: false
steps:
- name: Keyscan
run: |
ssh-keyscan git.koptilnya.xyz >> ~/.ssh/known_hosts
- name: Build
run: docker build -t chad-client ./client --build-arg COMMIT_SHA=${{ gitea.sha }}
- name: Checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-strict: false
persist-credentials: false
- name: Stop old container
run: docker rm -f chad-client || true
- name: Build
run: docker build -t chad-client -f ./client/Dockerfile.web ./client --build-arg COMMIT_SHA=${{ gitea.sha }} --build-arg API_BASE_URL=${{ vars.API_BASE_URL }}
- name: Run
run: |
docker run -d \
--name chad-client \
--network traefik \
--label "traefik.enable=true" \
--label "traefik.http.routers.chad-client.rule=Host(\`chad.koptilnya.xyz\`)" \
--label "traefik.http.routers.chad-client.entrypoints=websecure" \
--label "traefik.http.routers.chad-client.tls.certresolver=myresolver" \
--label "traefik.http.services.chad-client.loadbalancer.server.port=80" \
chad-client:latest
- name: Stop old container
run: docker rm -f chad-client || true
- name: Run
run: |
docker run -d \
--name chad-client \
--network traefik \
--label "traefik.enable=true" \
--label "traefik.http.routers.chad-client.rule=Host(\`chad.koptilnya.xyz\`)" \
--label "traefik.http.routers.chad-client.entrypoints=websecure" \
--label "traefik.http.routers.chad-client.tls.certresolver=myresolver" \
--label "traefik.http.services.chad-client.loadbalancer.server.port=80" \
chad-client:latest

View File

@@ -24,6 +24,9 @@ jobs:
ssh-strict: false
persist-credentials: false
# - name: Backup DB
# run: cp /home/koptilnya/services/chad/data/database.db /home/koptilnya/services/chad/database-$(date+"%d-%m-%Y").db
- name: Build
run: docker build -t chad-server ./server
@@ -35,7 +38,8 @@ jobs:
docker run -d \
--name chad-server \
--network traefik \
-p 20000-40000:20000-40000/udp \
--volume /home/koptilnya/services/chad/data:/app/data \
-p 40000-40100:40000-40100/udp \
--label "traefik.enable=true" \
--label "traefik.http.routers.chad-server.rule=Host(\`api.koptilnya.xyz\`) && PathPrefix(\`/chad\`)" \
--label "traefik.http.routers.chad-server.entrypoints=websecure" \

2
client/.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
/.yarn/releases/** binary
/.yarn/plugins/** binary

8
client/.gitignore vendored
View File

@@ -23,9 +23,15 @@ logs
.env.*
!.env.example
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
!.yarn/versions
scripts/release.ps1
.tauri
updater.json

Binary file not shown.

942
client/.yarn/releases/yarn-4.12.0.cjs vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1 +1,3 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.12.0.cjs

View File

@@ -2,16 +2,17 @@ FROM node:lts-alpine AS builder
WORKDIR /app
RUN corepack enable
RUN yarn set version stable
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn ./.yarn
RUN yarn install
RUN yarn install --immutable
COPY . .
ARG COMMIT_SHA=unknown
ENV COMMIT_SHA=$COMMIT_SHA
ARG API_BASE_URL
ENV COMMIT_SHA=$COMMIT_SHA \
API_BASE_URL=$API_BASE_URL
RUN yarn generate

46
client/Dockerfile.windows Normal file
View File

@@ -0,0 +1,46 @@
# === Build ===
FROM node:lts AS builder
WORKDIR /app
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn ./.yarn
RUN yarn install --immutable
COPY . .
ARG COMMIT_SHA=unknown
ARG API_BASE_URL
ARG TAURI_SIGNING_PRIVATE_KEY
ENV COMMIT_SHA=$COMMIT_SHA \
API_BASE_URL=$API_BASE_URL \
TAURI_SIGNING_PRIVATE_KEY=$TAURI_SIGNING_PRIVATE_KEY \
TAURI_SIGNING_PRIVATE_KEY_PASSWORD=
RUN apt update && apt install -y --no-install-recommends \
nsis \
clang \
lld \
llvm \
&& rm -rf /var/lib/apt/lists/*
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH=/root/.cargo/bin:$PATH
RUN rustup target add x86_64-pc-windows-msvc
RUN cargo install --locked cargo-xwin
RUN yarn tauri build --runner cargo-xwin --target x86_64-pc-windows-msvc
RUN node scripts/generate-updater.mjs
# === Artifacts ===
FROM scratch AS artifacts
COPY --from=builder /app/updater.json ./artifacts
COPY --from=builder /app/src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/ ./artifacts
CMD ["true"]

View File

@@ -1,13 +1,11 @@
<template>
<h1>yo</h1>
<pre>{{ connected }}</pre>
<audio v-for="(s, i) in streams" :key="i" :ref="(el) => onAudioRef(el, s)" autoplay controls />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<PrimeToast position="bottom-center" />
</template>
<script lang="ts" setup>
const { connected, streams } = useMediasoup()
function onAudioRef(ref: Element, stream: MediaStream) {
(ref as HTMLAudioElement).srcObject = stream
}
<script setup lang="ts">
const route = useRoute()
</script>

View File

@@ -0,0 +1,47 @@
html,
body {
font-family: 'Inter', sans-serif;
font-size: 16px;
height: 100%;
overflow: hidden;
background-image: radial-gradient(var(--p-surface-700), var(--p-surface-800));
background-size: 200% 200%;
background-position: left -100% top -100%;
}
#__nuxt {
--p-scrollpanel-bar-size: 5px;
--p-scrollpanel-bar-background: var(--p-surface-950);
--p-divider-horizontal-margin: 2rem 0 1rem;
height: 100%;
}
.p-divider {
&:first-child {
--p-divider-horizontal-margin: 1rem 0 1rem;
}
}
.p-scrollpanel-bar-y {
translate: -0.25rem;
}
.p-select-overlay {
/* Force dropdown width to match computed min-width from PrimeVue internals. */
width: 0 !important;
}
.p-select-label {
width: 0 !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
}
.p-select-option-label {
min-width: 0 !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
}

View File

@@ -0,0 +1 @@
@import 'primeicons/primeicons.css';

View File

@@ -0,0 +1,2 @@
@import "tailwindcss";
@import "tailwindcss-primeui";

34
client/app/components.d.ts vendored Normal file
View File

@@ -0,0 +1,34 @@
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
// biome-ignore lint: disable
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
PrimeAvatar: typeof import('primevue/avatar')['default']
PrimeBadge: typeof import('primevue/badge')['default']
PrimeButton: typeof import('primevue/button')['default']
PrimeButtonGroup: typeof import('primevue/buttongroup')['default']
PrimeCard: typeof import('primevue/card')['default']
PrimeDivider: typeof import('primevue/divider')['default']
PrimeFloatLabel: typeof import('primevue/floatlabel')['default']
PrimeInputText: typeof import('primevue/inputtext')['default']
PrimePassword: typeof import('primevue/password')['default']
PrimeProgressBar: typeof import('primevue/progressbar')['default']
PrimeScrollPanel: typeof import('primevue/scrollpanel')['default']
PrimeSelect: typeof import('primevue/select')['default']
PrimeSelectButton: typeof import('primevue/selectbutton')['default']
PrimeSlider: typeof import('primevue/slider')['default']
PrimeTag: typeof import('primevue/tag')['default']
PrimeToast: typeof import('primevue/toast')['default']
PrimeToggleSwitch: typeof import('primevue/toggleswitch')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
export interface ComponentCustomProperties {
Tooltip: typeof import('primevue/tooltip')['default']
}
}

View File

@@ -0,0 +1,142 @@
<template>
<div
class="overflow-hidden rounded-xl transition-[background-color]"
:class="{
'hover:bg-surface-800 cursor-pointer': !isMe,
'bg-surface-800': expanded,
}"
>
<div class="p-3" @click="toggleExpand">
<div class="flex items-center gap-3">
<PrimeAvatar
size="small"
class="shrink-0"
:class="{
'outline-1 outline-primary outline-offset-2': speaking,
}"
>
<template #icon>
<User :size="20" />
</template>
</PrimeAvatar>
<p class="flex-1 text-sm leading-5 font-medium text-color truncate w-0">
{{ client.displayName || client.username }}
</p>
<Component :is="expanded ? ChevronUp : ChevronDown" v-if="!isMe" :size="20" class="text-muted-color" />
</div>
<div v-if="hasBadges" class="flex justify-end align-center gap-1 mt-2">
<PrimeBadge v-if="streaming" v-tooltip.top="'Watch'" severity="success" value="Streaming" size="small" @click.stop="watchStream" />
<PrimeBadge v-if="premuted" severity="danger" value="Muted" size="small" />
<PrimeBadge v-else-if="client.outputMuted" severity="info" value="No sound" size="small" />
<PrimeBadge v-else-if="inputMuted" severity="info" value="Muted" size="small" />
<PrimeBadge v-if="isMe" severity="secondary" value="You" size="small" class="shrink-0" />
</div>
</div>
<CollapseTransition v-if="!isMe">
<div v-if="expanded">
<div class="px-3 pb-3">
<div class="flex justify-between text-sm mb-3">
<span>Volume</span>
<span>{{ volume }}</span>
</div>
<PrimeSlider v-model="volume" :min="0" :max="1000" :step="volume < 200 ? 5 : 25" />
<div class="mt-3 flex gap-1 justify-end">
<PrimeButton size="small" variant="text" @click="premuted = !premuted">
{{ premuted ? 'Unmute' : 'Mute' }}
</PrimeButton>
</div>
</div>
</div>
</CollapseTransition>
</div>
</template>
<script setup lang="ts">
import type { ChadClient } from '#shared/types'
import { ChevronDown, ChevronUp, User } from 'lucide-vue-next'
import CollapseTransition from '~/components/CollapseTransition.vue'
const props = defineProps<{
client: ChadClient
}>()
const { outputMuted } = useApp()
const { consumers: allConsumers, micProducer } = useMediasoup()
const { me } = useClients()
const { show } = useFullscreenVideo()
const expanded = ref(false)
const {
volume,
premuted,
speaking,
audioConsumers,
videoConsumers,
shareConsumers,
streaming,
} = useClient(toRef(() => props.client.socketId))
const isMe = computed(() => {
return me.value && props.client.userId === me.value.userId
})
const audioConsumer = computed(() => {
return audioConsumers.value[0]
})
const audioTrack = computed(() => {
return audioConsumer.value?.raw.track
})
const audioConsumerPaused = computed(() => {
if (Object.keys(allConsumers.value).length === 0)
return false
return audioConsumer.value?.paused ?? false
})
const inputMuted = computed(() => {
if (isMe.value)
return micProducer.value?.paused ?? false
return premuted.value || audioConsumerPaused.value
})
const hasBadges = computed(() => {
return streaming.value
|| premuted.value
|| inputMuted.value
|| props.client.outputMuted
|| isMe.value
})
const { setGain } = useAudioContext(audioTrack)
watchEffect(() => {
setGain((outputMuted.value || premuted.value) ? 0 : (volume.value * 0.01))
})
function toggleExpand() {
if (isMe.value)
return
expanded.value = !expanded.value
}
function watchStream() {
if (!streaming.value)
return
const consumer = [...videoConsumers.value, ...shareConsumers.value][0]!
show(new MediaStream([consumer.raw.track]))
}
</script>

View File

@@ -0,0 +1,118 @@
<template>
<Transition name="collapse-transition" v-on="bindings">
<slot />
</Transition>
</template>
<script lang="ts" setup>
import type { RendererElement } from 'vue'
defineOptions({
name: 'CollapseTransition',
})
const emit = defineEmits<{
expanded: []
collapsed: []
}>()
const bindings = {
beforeEnter(el: RendererElement) {
if (!el.dataset)
el.dataset = {}
el.dataset.oldPaddingTop = el.style.paddingTop
el.dataset.oldPaddingBottom = el.style.paddingBottom
el.dataset.elExistsHeight = el.style.height ?? undefined
el.style.maxHeight = 0
el.style.paddingTop = 0
el.style.paddingBottom = 0
},
enter(el: RendererElement) {
requestAnimationFrame(() => {
el.dataset.oldOverflow = el.style.overflow
if (el.dataset.elExistsHeight) {
el.style.maxHeight = el.dataset.elExistsHeight
}
else if (el.scrollHeight !== 0) {
el.style.maxHeight = `${el.scrollHeight}px`
}
else {
el.style.maxHeight = 0
}
el.style.paddingTop = el.dataset.oldPaddingTop
el.style.paddingBottom = el.dataset.oldPaddingBottom
el.style.overflow = 'hidden'
})
},
afterEnter(el: RendererElement) {
el.style.maxHeight = ''
el.style.overflow = el.dataset.oldOverflow
emit('expanded')
},
enterCancelled(el: RendererElement) {
reset(el)
},
beforeLeave(el: RendererElement) {
if (!el.dataset)
el.dataset = {}
el.dataset.oldPaddingTop = el.style.paddingTop
el.dataset.oldPaddingBottom = el.style.paddingBottom
el.dataset.oldOverflow = el.style.overflow
el.style.maxHeight = `${el.scrollHeight}px`
el.style.overflow = 'hidden'
},
leave(el: RendererElement) {
if (el.scrollHeight !== 0) {
el.style.maxHeight = 0
el.style.paddingTop = 0
el.style.paddingBottom = 0
}
},
afterLeave(el: RendererElement) {
reset(el)
emit('collapsed')
},
leaveCancelled(el: RendererElement) {
reset(el)
},
}
function reset(el: RendererElement) {
el.style.maxHeight = ''
el.style.overflow = el.dataset.oldOverflow
el.style.paddingTop = el.dataset.oldPaddingTop
el.style.paddingBottom = el.dataset.oldPaddingBottom
}
</script>
<style lang="scss">
.collapse-transition {
transition-property: height, padding-top, padding-bottom;
transition-timing-function: var(--default-transition-timing-function, cubic-bezier(0.4, 0, 0.2, 1));
transition-duration: var(--default-transition-duration, 150ms);
}
.collapse-transition-leave-active,
.collapse-transition-enter-active {
transition-property: opacity, max-height, padding-top, padding-bottom;
transition-timing-function: var(--default-transition-timing-function, cubic-bezier(0.4, 0, 0.2, 1));
transition-duration: var(--default-transition-duration, 150ms);
}
.collapse-transition-leave-to,
.collapse-transition-enter-from {
opacity: 0;
}
</style>

View File

@@ -0,0 +1,25 @@
<template>
<div class="text-sm overflow-x-auto">
<p class="text-muted-color">
{{ consumer.id }}
</p>
<p>paused: {{ consumer.paused }}</p>
<p v-for="[key, value] in appData" :key="key">
{{ key }}: {{ value }}
</p>
</div>
</template>
<script setup lang="ts">
import type { Consumer } from 'mediasoup-client/types'
const props = defineProps<{
consumer: Consumer
}>()
const appData = computed(() => {
return Object.entries(props.consumer.appData)
})
</script>

View File

@@ -0,0 +1,20 @@
<template>
<Teleport to="body">
<div ref="root" class="fullscreen-gallery">
{{ videoConsumers.length + shareConsumers.length }}
</div>
</Teleport>
</template>
<script setup lang="ts">
import { useFullscreen } from '@vueuse/core'
const rootRef = useTemplateRef('root')
const { enter } = useFullscreen(rootRef)
const { videoConsumers, shareConsumers } = useMediasoup()
onMounted(() => {
// enter()
})
</script>

View File

@@ -0,0 +1,13 @@
<template>
<div class="fullscreen-gallery-card">
sasd
</div>
</template>
<script setup lang="ts">
</script>
<style>
</style>

View File

@@ -0,0 +1,40 @@
<template>
<div
class="group cursor-pointer hover:outline outline-primary relative rounded overflow-hidden flex items-center justify-center"
@click="watch"
>
<video :srcObject="stream" muted autoplay />
<PrimeTag
severity="secondary"
class="absolute bottom-2 text-sm opacity-70 group-hover:opacity-100"
rounded
>
{{ isMe ? 'You' : client.displayName }}
</PrimeTag>
</div>
</template>
<script setup lang="ts">
import type { ChadClient } from '#shared/types'
const props = defineProps<{
client: ChadClient
stream: MediaStream
}>()
const { me } = useClients()
const fullscreenVideo = useFullscreenVideo()
const isMe = computed(() => {
return props.client.socketId === me.value?.socketId
})
function watch() {
fullscreenVideo.show(props.stream)
}
</script>
<style>
</style>

View File

@@ -0,0 +1,153 @@
import { getVersion } from '@tauri-apps/api/app'
import { computedAsync, createGlobalState } from '@vueuse/core'
import { useClients } from '~/composables/use-clients'
export const useApp = createGlobalState(() => {
const { clients } = useClients()
const mediasoup = useMediasoup()
const signaling = useSignaling()
const toast = useToast()
const ready = ref(false)
const isTauri = computed(() => '__TAURI_INTERNALS__' in window)
const commitSha = __COMMIT_SHA__
const version = computedAsync(() => {
if (import.meta.dev) {
return 'dev'
}
else if (isTauri.value) {
return getVersion()
}
else {
return 'web'
}
}, '-')
const inputMuted = computed(() => {
return !!mediasoup.micProducer.value?.paused
})
const previousInputMuted = ref(inputMuted.value)
const outputMuted = ref(false)
const videoEnabled = computed(() => {
return !!mediasoup.videoProducer.value
})
const sharingEnabled = computed(() => {
return !!mediasoup.shareProducer.value
})
const somebodyStreamingVideo = computed(() => {
return !!mediasoup.videoProducer.value
|| !!mediasoup.shareProducer.value
|| mediasoup.videoConsumers.value.length > 0
|| mediasoup.shareConsumers.value.length > 0
})
async function muteInput() {
if (inputMuted.value || !mediasoup.micProducer.value)
return
await mediasoup.pauseProducer(mediasoup.micProducer.value)
toast.add({ severity: 'info', summary: 'Microphone muted', closable: false, life: 1000 })
}
async function unmuteInput() {
if (!inputMuted.value || !mediasoup.micProducer.value)
return
if (outputMuted.value) {
await unmuteOutput()
}
await mediasoup.resumeProducer(mediasoup.micProducer.value)
toast.add({ severity: 'info', summary: 'Microphone activated', closable: false, life: 1000 })
}
async function toggleInput() {
if (inputMuted.value)
await unmuteInput()
else
await muteInput()
}
async function muteOutput() {
if (outputMuted.value)
return
outputMuted.value = true
previousInputMuted.value = inputMuted.value
await muteInput()
await signaling.socket.value?.emitWithAck('updateClient', {
outputMuted: true,
})
toast.add({ severity: 'info', summary: 'Sound muted', closable: false, life: 1000 })
}
async function unmuteOutput() {
outputMuted.value = false
if (!previousInputMuted.value)
await unmuteInput()
await signaling.socket.value?.emitWithAck('updateClient', {
outputMuted: false,
})
toast.add({ severity: 'info', summary: 'Sound resumed', closable: false, life: 1000 })
}
async function toggleOutput() {
if (outputMuted.value)
await unmuteOutput()
else
await muteOutput()
}
async function toggleVideo() {
if (!mediasoup.videoProducer.value) {
await mediasoup.enableVideo()
}
else {
await mediasoup.disableProducer(mediasoup.videoProducer.value)
}
}
async function toggleShare() {
if (!mediasoup.shareProducer.value) {
await mediasoup.enableShare()
}
else {
await mediasoup.disableProducer(mediasoup.shareProducer.value)
}
}
return {
ready,
clients,
inputMuted,
muteInput,
unmuteInput,
toggleInput,
outputMuted,
muteOutput,
unmuteOutput,
toggleOutput,
toggleVideo,
version,
isTauri,
commitSha,
toggleShare,
videoEnabled,
sharingEnabled,
somebodyStreamingVideo,
}
})

View File

@@ -0,0 +1,62 @@
import { useEventListener } from '@vueuse/core'
export default function useAudioContext(audioTrack: Ref<MediaStreamTrack | undefined>) {
const ctx = new (window.AudioContext || window.webkitAudioContext)()
const stream = new MediaStream()
const audioEl = new Audio()
const sourceNode = shallowRef<MediaStreamAudioSourceNode>()
const gainNode = ctx.createGain()
watch(audioTrack, async (track, prevTrack) => {
if (prevTrack)
stream.removeTrack(prevTrack)
if (!track)
return
stream.addTrack(track)
if (!audioEl.srcObject) {
audioEl.srcObject = stream
audioEl.muted = true
}
sourceNode.value = ctx.createMediaStreamSource(stream)
await connect()
}, { immediate: true })
useEventListener(document, 'click', async () => {
if (ctx.state === 'suspended') {
await ctx.resume()
}
await connect()
}, { once: true })
onScopeDispose(() => {
audioEl.pause()
audioEl.srcObject = null
ctx.close()
})
async function connect() {
if (!sourceNode.value || ctx.state === 'suspended')
return
sourceNode.value.connect(gainNode)
gainNode.connect(ctx.destination)
ctx.resume()
}
function setGain(value: number) {
gainNode.gain.value = value
}
return {
setGain,
}
}

View File

@@ -0,0 +1,69 @@
import chadApi from '#shared/chad-api'
import { createGlobalState } from '@vueuse/core'
interface Me {
id: string
username: string
displayName: string
}
export const useAuth = createGlobalState(() => {
const me = shallowRef<Me>()
function setMe(value: Me | undefined): void {
me.value = value
}
async function login(username: string, password: string): Promise<void> {
try {
const result = await chadApi<Me>('/login', {
method: 'POST',
body: {
username,
password,
},
})
setMe(result)
await navigateTo('/')
}
catch {}
}
async function register(username: string, password: string): Promise<void> {
try {
const result = await chadApi<Me>('/register', {
method: 'POST',
body: {
username,
password,
},
})
setMe(result)
await navigateTo('/')
}
catch {}
}
async function logout(): Promise<void> {
try {
await chadApi('/logout', { method: 'POST' })
setMe(undefined)
await navigateTo({ name: 'Login' })
}
catch {}
}
return {
me: readonly(me),
setMe,
login,
register,
logout,
}
})

View File

@@ -0,0 +1,52 @@
import type { ChadClient } from '#shared/types'
import { useLocalStorage } from '@vueuse/core'
export function useClient(socketId: MaybeRef<ChadClient['socketId']>) {
const mediasoup = useMediasoup()
const { getClient } = useClients()
const client = computed(() => getClient(unref(socketId))!)
const volume = useLocalStorage<number>(computed(() => `CLIENT_VOLUME_${client.value.userId}`), 100, { writeDefaults: false })
const premuted = useLocalStorage<boolean>(computed(() => `CLIENT_PREMUTED_${client.value.userId}`), false, { writeDefaults: false })
const consumers = computed(() => {
return Object.values(mediasoup.consumers.value).filter(consumer => consumer.appData.socketId === client.value.socketId)
})
const audioConsumers = computed(() => {
return mediasoup.audioConsumers.value.filter(consumer => consumer.appData.socketId === client.value.socketId)
})
const videoConsumers = computed(() => {
return mediasoup.videoConsumers.value.filter(consumer => consumer.appData.socketId === client.value.socketId)
})
const shareConsumers = computed(() => {
return mediasoup.shareConsumers.value.filter(consumer => consumer.appData.socketId === client.value.socketId)
})
const producers = computed(() => {
return Object.values(mediasoup.producers.value).filter(producer => producer.appData.socketId === client.value.socketId)
})
const streaming = computed(() => {
return videoConsumers.value.length > 0 || shareConsumers.value.length > 0
})
const speaking = computed(() => {
return mediasoup.speakingClients.value.some(speaker => speaker.clientId === client.value.socketId)
})
return {
volume,
premuted,
consumers,
producers,
audioConsumers,
videoConsumers,
shareConsumers,
streaming,
speaking,
}
}

View File

@@ -0,0 +1,66 @@
import type { ChadClient, UpdatedClient } from '#shared/types'
import { createGlobalState } from '@vueuse/core'
export const useClients = createGlobalState(() => {
const auth = useAuth()
const signaling = useSignaling()
const toast = useToast()
const clients = shallowRef<ChadClient[]>([])
const me = computed(() => clients.value.find(client => client.userId === auth.me.value?.id))
watch(signaling.socket, (socket) => {
if (!socket)
return
socket.on('clientChanged', (clientId: ChadClient['socketId'], updatedClient: UpdatedClient) => {
const client = getClient(clientId)
updateClient(clientId, updatedClient)
if (client && client.displayName !== updatedClient.displayName)
toast.add({ severity: 'info', summary: `${client.displayName} is now ${updatedClient.displayName}`, closable: false, life: 1000 })
})
socket.on('disconnect', () => {
clients.value = []
})
})
function getClient(clientId: ChadClient['socketId']) {
return clients.value.find(client => client.socketId === clientId)
}
function addClient(...client: ChadClient[]) {
clients.value.push(...client)
triggerRef(clients)
}
function removeClient(clientId: ChadClient['socketId']) {
clients.value = clients.value.filter(client => client.socketId !== clientId)
}
function updateClient(clientId: ChadClient['socketId'], updatedClient: UpdatedClient) {
const clientIdx = clients.value.findIndex(client => client.socketId === clientId)
if (clientIdx === -1)
return
clients.value[clientIdx] = {
...clients.value[clientIdx],
...updatedClient,
} as ChadClient
triggerRef(clients)
}
return {
me,
clients,
getClient,
addClient,
removeClient,
updateClient,
}
})

View File

@@ -0,0 +1,37 @@
import { createGlobalState, useDevicesList } from '@vueuse/core'
export const useDevices = createGlobalState(() => {
const {
ensurePermissions,
permissionGranted,
videoInputs,
audioInputs,
audioOutputs,
} = useDevicesList()
async function getShareStream(fps = 30) {
return navigator.mediaDevices.getDisplayMedia({
audio: false,
video: {
displaySurface: 'monitor',
frameRate: { max: fps },
},
})
}
;(async () => {
if (permissionGranted.value)
return
await ensurePermissions()
})()
return {
ensurePermissions,
permissionGranted,
videoInputs: computed<MediaDeviceInfo[]>(() => JSON.parse(JSON.stringify(videoInputs.value))),
audioInputs: computed<MediaDeviceInfo[]>(() => JSON.parse(JSON.stringify(audioInputs.value))),
audioOutputs: computed<MediaDeviceInfo[]>(() => JSON.parse(JSON.stringify(audioOutputs.value))),
getShareStream,
}
})

View File

@@ -0,0 +1,5 @@
import { createSharedComposable } from '@vueuse/core'
export const useFullscreenGallery = createSharedComposable(() => {
return {}
})

View File

@@ -0,0 +1,65 @@
import { createGlobalState, useEventListener } from '@vueuse/core'
export const useFullscreenVideo = createGlobalState(() => {
const videoEl = shallowRef<HTMLVideoElement>()
const visible = computed(() => !!videoEl.value)
async function show(stream: MediaStream) {
if (videoEl.value) {
videoEl.value.srcObject = stream
}
else {
const el = document.createElement('video')
el.srcObject = stream
el.autoplay = true
el.playsInline = true
el.controls = false
el.muted = true
// el.style.position = 'fixed'
// el.style.top = '0'
// el.style.left = '0'
// el.style.width = '1px'
// el.style.height = '1px'
// el.style.opacity = '0'
// el.style.pointerEvents = 'none'
document.body.appendChild(el)
videoEl.value = el
}
stream.getTracks().forEach(t =>
t.addEventListener('ended', hide),
)
videoEl.value.addEventListener('ended', hide)
await videoEl.value.requestFullscreen()
}
function hide() {
if (!videoEl.value)
return
(videoEl.value.srcObject as MediaStream).getTracks().forEach(t =>
t.removeEventListener('ended', hide),
)
videoEl.value.removeEventListener('ended', hide)
videoEl.value?.remove()
videoEl.value = undefined
}
useEventListener(document, 'fullscreenchange', () => {
if (!document.fullscreenElement && videoEl.value) {
videoEl.value?.remove()
videoEl.value = undefined
}
})
return {
visible,
show,
hide,
}
})

View File

@@ -1,161 +1,512 @@
import type { Socket } from 'socket.io-client'
import { createGlobalState } from '@vueuse/core'
import type { ChadClient, Consumer, Producer } from '#shared/types'
import type { MediaKind, ProducerOptions } from 'mediasoup-client/types'
import { createSharedComposable } from '@vueuse/core'
import * as mediasoupClient from 'mediasoup-client'
import { io } from 'socket.io-client'
import { shallowRef } from 'vue'
import { useDevices } from '~/composables/use-devices'
import { usePreferences } from '~/composables/use-preferences'
import { useSignaling } from '~/composables/use-signaling'
type ProducerType = 'microphone' | 'video' | 'share'
interface SpeakingClient {
clientId: ChadClient['socketId']
volume: number
}
const ICE_SERVERS: RTCIceServer[] = [
// {
// urls: 'stun:stun.relay.metered.ca:80',
// },
// {
// urls: 'turn:global.relay.metered.ca:80',
// username: '4cad09c0111f423f5283814c',
// credential: 'B1dO8AGehex4o3pt',
// },
// {
// urls: 'turn:global.relay.metered.ca:80?transport=tcp',
// username: '4cad09c0111f423f5283814c',
// credential: 'B1dO8AGehex4o3pt',
// },
// {
// urls: 'turn:global.relay.metered.ca:443',
// username: '4cad09c0111f423f5283814c',
// credential: 'B1dO8AGehex4o3pt',
// },
{
urls: 'turns:global.relay.metered.ca:443?transport=tcp',
username: '4cad09c0111f423f5283814c',
credential: 'B1dO8AGehex4o3pt',
},
{ urls: 'stun:stun.l.google.com:19302' },
{ urls: 'stun:stun.l.google.com:5349' },
{ urls: 'stun:stun1.l.google.com:3478' },
{ urls: 'stun:stun1.l.google.com:5349' },
{ urls: 'stun:stun2.l.google.com:19302' },
{ urls: 'stun:stun2.l.google.com:5349' },
{ urls: 'stun:stun3.l.google.com:3478' },
{ urls: 'stun:stun3.l.google.com:5349' },
{ urls: 'stun:stun4.l.google.com:19302' },
{ urls: 'stun:stun4.l.google.com:5349' },
]
export const useMediasoup = createGlobalState(() => {
const socket: Socket = io('https://api.koptilnya.xyz', {
path: '/chad/ws/',
transports: ['websocket'],
export const useMediasoup = createSharedComposable(() => {
const toast = useToast()
const signaling = useSignaling()
const { addClient, removeClient } = useClients()
const preferences = usePreferences()
const { getShareStream } = useDevices()
const device = shallowRef<mediasoupClient.Device>()
const rtpCapabilities = shallowRef<mediasoupClient.types.RtpCapabilities>()
const sendTransport = shallowRef<mediasoupClient.types.Transport>()
const recvTransport = shallowRef<mediasoupClient.types.Transport>()
const consumers = ref<Record<Consumer['id'], Consumer>>({})
const producers = ref<Record<Producer['id'], Producer>>({})
const consumersArray = computed(() => {
return Object.values(consumers.value)
})
const initializing = ref(false)
const connected = ref(false)
const streams = shallowRef<MediaStream[]>([])
let device: mediasoupClient.Device
let sendTransport: mediasoupClient.types.Transport
let recvTransport: mediasoupClient.types.Transport
const audioConsumers = computed(() => {
return consumersArray.value.filter(consumer => consumer.raw.kind === 'audio')
})
socket.on('newProducer', async ({ producerId }) => {
const params = await socket.emitWithAck('consume', {
producerId,
transportId: recvTransport.id,
rtpCapabilities: device.rtpCapabilities,
})
const videoConsumers = computed(() => {
return consumersArray.value.filter(consumer => consumer.raw.kind === 'video' && consumer.appData.source !== 'share')
})
if (params?.error) {
console.error('consume error:', params.error)
const shareConsumers = computed(() => {
return consumersArray.value.filter(consumer => consumer.raw.kind === 'video' && consumer.appData.source === 'share')
})
const producersArray = computed(() => {
return Object.values(producers.value)
})
const micProducer = computed(() => {
return producersArray.value.find(producer => producer.raw.kind === 'audio' && producer.raw.appData.source === 'mic-video')
})
const videoProducer = computed(() => {
return producersArray.value.find(producer => producer.raw.kind === 'video' && producer.raw.appData.source !== 'share')
})
const shareProducer = computed(() => {
return producersArray.value.find(producer => producer.raw.kind === 'video' && producer.raw.appData.source === 'share')
})
const speakingClients = shallowRef<SpeakingClient[]>([])
watch(signaling.socket, (socket) => {
if (!socket)
return
}
const consumer = await recvTransport.consume(params)
const stream = new MediaStream([consumer.track])
socket.on('authenticated', async () => {
if (!signaling.socket.value)
return
streams.value.push(stream)
triggerRef(streams)
})
device.value = new mediasoupClient.Device()
rtpCapabilities.value = await signaling.socket.value.emitWithAck('getRtpCapabilities')
async function loadDevice() {
device = new mediasoupClient.Device()
const rtpCapabilities = await socket.emitWithAck('getRtpCapabilities')
await device.load({ routerRtpCapabilities: rtpCapabilities })
}
await device.value.load({ routerRtpCapabilities: rtpCapabilities.value! })
async function createSendTransport() {
const params = await socket.emitWithAck('createTransport')
sendTransport = device.createSendTransport({
...params,
iceServers: [
...ICE_SERVERS,
...(params.iceServers ?? []),
],
})
sendTransport.on('connect', async ({ dtlsParameters }, callback, errback) => {
try {
await socket.emitWithAck('connectTransport', {
transportId: sendTransport.id,
dtlsParameters,
// Send transport
{
const transportInfo = await signaling.socket.value.emitWithAck('createTransport', { producing: true, consuming: false })
sendTransport.value = device.value.createSendTransport({
...transportInfo,
iceServers: [
...ICE_SERVERS,
...(transportInfo.iceServers ?? []),
],
})
callback()
sendTransport.value.on('connect', async ({ dtlsParameters }, callback, errback) => {
try {
await signaling.socket.value!.emitWithAck('connectTransport', {
transportId: sendTransport.value!.id,
dtlsParameters,
})
callback()
}
catch (error) {
if (error instanceof Error) {
errback(error)
}
}
})
sendTransport.value.on('produce', async ({ kind, rtpParameters, appData }, callback, errback) => {
try {
const { id } = await signaling.socket.value!.emitWithAck('produce', {
transportId: sendTransport.value!.id,
kind,
rtpParameters,
appData,
})
callback({ id })
}
catch (error) {
if (error instanceof Error) {
errback(error)
}
}
})
}
catch (err) {
errback(err)
// Recv Transport
{
const transportInfo = await signaling.socket.value.emitWithAck('createTransport', { producing: false, consuming: true })
recvTransport.value = device.value.createRecvTransport({
...transportInfo,
iceServers: [
...ICE_SERVERS,
...(transportInfo.iceServers ?? []),
],
})
recvTransport.value.on('connect', async ({ dtlsParameters }, callback, errback) => {
try {
await signaling.socket.value!.emitWithAck('connectTransport', {
transportId: recvTransport.value!.id,
dtlsParameters,
})
callback()
}
catch (error) {
if (error instanceof Error) {
errback(error)
}
}
})
}
const joinedClients = (await signaling.socket.value.emitWithAck('join', {
rtpCapabilities: rtpCapabilities.value,
}))
addClient(...joinedClients)
toast.add({ severity: 'success', summary: 'Joined', closable: false, life: 1000 })
await enableMic()
})
sendTransport.on('produce', async ({ kind, rtpParameters }, callback, errback) => {
try {
const { id } = await socket.emitWithAck('produce', {
transportId: sendTransport.id,
socket.on('newPeer', (client) => {
addClient(client)
})
socket.on('peerClosed', (id) => {
removeClient(id)
})
socket.on(
'newConsumer',
async (
{ id, producerId, kind, rtpParameters, socketId, appData, producerPaused },
cb,
) => {
if (!recvTransport.value)
return
const consumer = await recvTransport.value.consume({
id,
producerId,
kind,
rtpParameters,
})
callback({ id })
}
catch (err) {
errback(err)
}
})
}
async function publishMic() {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
const track = stream.getAudioTracks()[0]
await sendTransport.produce({ track })
}
async function createRecvTransport() {
const params = await socket.emitWithAck('createTransport')
recvTransport = device.createRecvTransport({
...params,
iceServers: [
...ICE_SERVERS,
...(params.iceServers ?? []),
],
})
recvTransport.on('connect', async ({ dtlsParameters }, callback, errback) => {
try {
await socket.emitWithAck('connectTransport', {
transportId: recvTransport.id,
dtlsParameters,
streamId: `${socketId}-${appData.source || 'stream'}`,
appData: { ...appData, socketId },
})
callback()
}
catch (err) {
errback(err)
}
})
}
if (producerPaused)
consumer.pause()
(async () => {
if (initializing.value || connected.value)
consumers.value[consumer.id] = {
id: consumer.id,
paused: consumer.paused,
appData: consumer.appData,
raw: markRaw(consumer),
}
consumer.observer.on('resume', () => {
consumers.value[consumer.id]!.paused = false
})
consumer.observer.on('pause', () => {
consumers.value[consumer.id]!.paused = true
})
consumer.observer.on('close', () => {
delete consumers.value[consumer.id]
})
consumer.on('trackended', () => {
consumer.close()
})
cb()
},
)
socket.on(
'consumerClosed',
async (
{ consumerId },
) => {
const consumer = consumers.value[consumerId]
if (!consumer)
return
consumer.raw.close()
},
)
socket.on('consumerPaused', ({ consumerId }) => {
const consumer = consumers.value[consumerId]
if (!consumer)
return
consumer.raw.pause()
})
socket.on('consumerResumed', ({ consumerId }) => {
const consumer = consumers.value[consumerId]
if (!consumer)
return
consumer.raw.resume()
})
socket.on('speakingPeers', (value: SpeakingClient[]) => {
speakingClients.value = value
})
socket.on('disconnect', () => {
device.value = undefined
rtpCapabilities.value = undefined
sendTransport.value?.close()
sendTransport.value = undefined
recvTransport.value?.close()
recvTransport.value = undefined
consumers.value = {}
producers.value = {}
})
}, { immediate: true, flush: 'sync' })
async function createProducer(options: ProducerOptions) {
if (!device.value || !sendTransport.value)
return
initializing.value = true
connected.value = false
if (!options.track)
return
await loadDevice()
await createSendTransport()
await createRecvTransport()
await publishMic()
if (!device.value.canProduce(options.track.kind as MediaKind))
return
initializing.value = false
connected.value = true
})()
const producer = await sendTransport.value.produce({ disableTrackOnPause: true, ...options })
producers.value[producer.id] = {
id: producer.id,
paused: producer.paused,
appData: producer.appData,
raw: markRaw(producer),
}
producer.observer.on('pause', () => {
producers.value[producer.id]!.paused = true
})
producer.observer.on('resume', () => {
producers.value[producer.id]!.paused = false
})
producer.observer.on('close', () => {
delete producers.value[producer.id]
})
producer.on('trackended', () => {
disableProducer(producers.value[producer.id]!)
})
}
async function disableProducer(producer: Producer) {
if (!signaling.socket.value)
return
try {
producer.raw.close()
await signaling.socket.value.emitWithAck('closeProducer', {
producerId: producer.id,
})
}
catch {
}
finally {
delete producers.value[producer.id]
}
}
async function enableMic() {
if (micProducer.value)
return
const stream = await navigator.mediaDevices.getUserMedia({
audio: {
deviceId: { exact: preferences.inputDeviceId.value },
autoGainControl: { exact: preferences.autoGainControl.value },
echoCancellation: { exact: preferences.echoCancellation.value },
noiseSuppression: { exact: preferences.noiseSuppression.value },
},
})
const track = stream.getAudioTracks()[0]
if (!track)
return
await createProducer({
track,
streamId: 'mic-video',
codecOptions: {
opusStereo: true,
opusDtx: true, // Меньше пакетов летит когда тишина
opusFec: false, // Фиксит пакет лос
},
appData: {
source: 'mic-video',
},
})
}
async function disableMic() {
if (!micProducer.value)
return
await disableProducer(micProducer.value)
}
async function enableVideo() {
if (videoProducer.value)
return
if (!device.value)
return
const stream = await navigator.mediaDevices.getUserMedia({
video: {
deviceId: { exact: preferences.videoDeviceId.value },
width: { ideal: 1920 },
height: { ideal: 1080 },
frameRate: { ideal: 60 },
},
})
const track = stream.getVideoTracks()[0]
if (!track)
return
await createProducer({
track,
streamId: 'mic-video',
// codec: device.value.rtpCapabilities.codecs?.find(
// c => c.mimeType.toLowerCase() === 'video/AV1',
// ),
// codecOptions: {
// videoGoogleStartBitrate: 1000,
// },
appData: {
source: 'mic-video',
},
})
}
async function enableShare() {
if (shareProducer.value)
return
if (!device.value)
return
const stream = await getShareStream(preferences.shareFps.value)
const track = stream.getVideoTracks()[0]
if (!track)
return
await createProducer({
track,
streamId: 'share',
codec: device.value.rtpCapabilities.codecs?.find(
c => c.mimeType.toLowerCase() === 'video/AV1',
),
codecOptions: {
videoGoogleStartBitrate: 1000,
},
zeroRtpOnPause: true,
appData: {
source: 'share',
},
})
}
async function pauseProducer(producer: Producer) {
if (!signaling.socket.value)
return
if (producer.paused)
return
try {
producer.raw.pause()
await signaling.socket.value.emitWithAck('pauseProducer', {
producerId: producer.id,
})
}
catch {
producer.raw.resume()
}
}
async function resumeProducer(producer: Producer) {
if (!signaling.socket.value)
return
try {
producer.raw.resume()
await signaling.socket.value.emitWithAck('resumeProducer', {
producerId: producer.id,
})
}
catch {
producer.raw.pause()
}
}
watch([
preferences.inputDeviceId,
preferences.echoCancellation,
preferences.autoGainControl,
preferences.noiseSuppression,
], async ([inputDeviceId]) => {
await disableMic()
if (!inputDeviceId)
return
await enableMic()
})
return {
connected,
streams,
consumers,
audioConsumers,
videoConsumers,
shareConsumers,
producers,
speakingClients,
sendTransport,
recvTransport,
rtpCapabilities,
device,
micProducer,
videoProducer,
shareProducer,
pauseProducer,
resumeProducer,
enableVideo,
enableShare,
disableProducer,
}
})

View File

@@ -0,0 +1,75 @@
import chadApi from '#shared/chad-api'
import { createGlobalState, useLocalStorage, watchDebounced } from '@vueuse/core'
export interface SyncedPreferences {
toggleInputHotkey: string
toggleOutputHotkey: string
volumes: Record<Client['id'], number>
}
export const usePreferences = createGlobalState(() => {
const { videoInputs, audioInputs, audioOutputs } = useDevices()
const synced = ref(false)
const inputDeviceId = useLocalStorage<MediaDeviceInfo['deviceId']>('INPUT_DEVICE_ID', 'default')
const outputDeviceId = useLocalStorage<MediaDeviceInfo['deviceId']>('OUTPUT_DEVICE_ID', 'default')
const videoDeviceId = useLocalStorage<MediaDeviceInfo['deviceId']>('VIDEO_DEVICE_ID', 'default')
const autoGainControl = useLocalStorage('AUTO_GAIN_CONTROL', false)
const noiseSuppression = useLocalStorage('NOISE_SUPPRESSION', true)
const echoCancellation = useLocalStorage('ECHO_CANCELLATION', true)
const shareFps = useLocalStorage('SHARE_FPS', 30)
const toggleInputHotkey = ref<SyncedPreferences['toggleInputHotkey']>('')
const toggleOutputHotkey = ref<SyncedPreferences['toggleOutputHotkey']>('')
const inputDeviceExist = computed(() => {
return audioInputs.value.some(device => device.deviceId === inputDeviceId.value)
})
const outputDeviceExist = computed(() => {
return audioOutputs.value.some(device => device.deviceId === outputDeviceId.value)
})
const videoDeviceExist = computed(() => {
return videoInputs.value.some(device => device.deviceId === videoDeviceId.value)
})
watchDebounced(
[toggleInputHotkey, toggleOutputHotkey],
async ([toggleInputHotkey, toggleOutputHotkey]) => {
try {
await chadApi(
'/preferences',
{
method: 'PATCH',
body: {
toggleInputHotkey,
toggleOutputHotkey,
},
},
)
}
catch {}
},
{ debounce: 1000 },
)
return {
synced,
inputDeviceId,
outputDeviceId,
videoDeviceId,
autoGainControl,
noiseSuppression,
echoCancellation,
shareFps,
toggleInputHotkey,
toggleOutputHotkey,
inputDeviceExist,
outputDeviceExist,
videoDeviceExist,
}
})

View File

@@ -0,0 +1,84 @@
import type { Socket } from 'socket.io-client'
import { createSharedComposable } from '@vueuse/core'
import { io } from 'socket.io-client'
import { parseURL } from 'ufo'
export const useSignaling = createSharedComposable(() => {
const toast = useToast()
const { me } = useAuth()
const socket = shallowRef<Socket>()
const connected = ref(false)
watch(socket, (socket, prevSocket) => {
if (prevSocket) {
prevSocket.close()
}
if (!socket) {
return
}
if (import.meta.dev) {
socket.onAny((event, ...args) => {
console.info('[onAny]', event, args)
})
socket.onAnyOutgoing((event, ...args) => {
console.info('[onAnyOutgoing]', event, args)
})
}
socket.on('connect', async () => {
connected.value = true
})
socket.on('disconnect', async () => {
connected.value = false
})
}, { immediate: true, flush: 'sync' })
watch(connected, (connected) => {
if (connected)
toast.add({ severity: 'success', summary: 'Connected', closable: false, life: 1000 })
else
toast.add({ severity: 'error', summary: 'Disconnected', closable: false, life: 1000 })
}, { immediate: true })
watch(me, (me) => {
if (!me) {
socket.value?.close()
socket.value = undefined
}
})
onScopeDispose(() => {
socket.value?.close()
socket.value = undefined
})
function connect() {
if (socket.value || !me.value)
return
const { protocol, host, pathname } = parseURL(__API_BASE_URL__)
const uri = host ? `${protocol}//${host}` : ``
socket.value = io(`${uri}/webrtc`, {
path: `${pathname}/ws`,
transports: ['websocket'],
withCredentials: true,
auth: {
userId: me.value.id,
},
})
}
return {
socket,
connected,
connect,
}
})

View File

@@ -0,0 +1,28 @@
import type { Update } from '@tauri-apps/plugin-updater'
import { check } from '@tauri-apps/plugin-updater'
import { createGlobalState } from '@vueuse/core'
export const useUpdater = createGlobalState(() => {
const lastUpdate = shallowRef<Update>()
const checking = ref(false)
async function checkForUpdates() {
try {
checking.value = true
lastUpdate.value = (await check()) ?? undefined
}
finally {
checking.value = false
}
return lastUpdate.value
}
return {
lastUpdate,
checking,
checkForUpdates,
}
})

7
client/app/index.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
declare module '#app' {
interface PageMeta {
auth?: boolean | 'guest'
}
}
export {}

View File

@@ -0,0 +1,42 @@
<template>
<div class="w-full h-full flex p-3">
<img src="/chad-bg.webp" alt="Background" draggable="false" class="pointer-events-none absolute opacity-3 -z-1 block inset-0 object-contain w-full h-full">
<div v-auto-animate class="w-1/2 m-auto">
<div class="text-center">
<PrimeSelectButton v-model="tab" class="mb-6" :options="options" option-label="label" :allow-empty="false" />
</div>
<slot />
</div>
</div>
<PrimeBadge class="fixed top-3 right-3 opacity-50" severity="secondary" :value="version" size="small" />
</template>
<script setup lang="ts">
const route = useRoute()
const { version } = useApp()
const options = computed(() => {
return [
{
label: 'Login',
routeName: 'Login',
},
{
label: 'Register',
routeName: 'Register',
},
]
})
const tab = shallowRef(options.value.find(option => route.name === option.routeName))
watch(tab, (tab) => {
if (!tab)
return
navigateTo({ name: tab.routeName })
})
</script>

View File

@@ -0,0 +1,3 @@
<template>
<slot />
</template>

View File

@@ -0,0 +1,155 @@
<template>
<div class="grid grid-cols-[360px_1fr] gap-2 p-2 h-screen grid-rows-[auto_1fr] max-w-full">
<div
class="flex items-center justify-between gap-2 rounded-xl p-3 bg-surface-950"
>
<div class="inline-flex items-center gap-3">
<PrimeBadge class="opacity-50" severity="secondary" :value="version" size="small" />
<PrimeBadge :severity="connected ? 'success' : 'danger' " />
</div>
<PrimeButtonGroup class="ml-auto">
<PrimeButton :severity="inputMuted ? 'info' : undefined" outlined @click="toggleInput">
<template #icon>
<Component :is="inputMuted ? MicOff : Mic" />
</template>
</PrimeButton>
<PrimeButton :severity="outputMuted ? 'info' : undefined" outlined @click="toggleOutput">
<template #icon>
<Component :is="outputMuted ? VolumeOff : Volume2" />
</template>
</PrimeButton>
</PrimeButtonGroup>
<PrimeButton :severity="videoEnabled ? 'success' : undefined" outlined @click="toggleVideo">
<template #icon>
<Component :is="videoEnabled ? CameraOff : Camera" />
</template>
</PrimeButton>
<PrimeButton :severity="sharingEnabled ? 'success' : undefined" outlined @click="toggleShare">
<template #icon>
<Component :is="sharingEnabled ? ScreenShareOff : ScreenShare" />
</template>
</PrimeButton>
</div>
<div
class="flex items-center justify-center rounded-xl p-3 bg-surface-950"
>
<PrimeSelectButton
v-model="activeTab"
:options="tabs"
option-label="id"
:allow-empty="false"
style="--p-togglebutton-content-padding: 0.25rem 0.5rem"
>
<template #option="{ option }">
<Component :is="option.icon" size="24" />
</template>
</PrimeSelectButton>
</div>
<PrimeScrollPanel class="bg-surface-900 rounded-xl overflow-hidden" style="min-height: 0">
<div v-auto-animate class="p-3 space-y-1">
<ClientRow v-for="client of clients" :key="client.userId" :client="client" />
</div>
</PrimeScrollPanel>
<PrimeScrollPanel class="bg-surface-900 rounded-xl overflow-hidden" style="min-height: 0">
<div class="p-3">
<slot />
</div>
</PrimeScrollPanel>
</div>
<FullscreenGallery />
</template>
<script setup lang="ts">
import {
Camera,
CameraOff,
MessageCircle,
Mic,
MicOff,
ScreenShare,
ScreenShareOff,
Settings,
TvMinimalPlay,
UserPen,
Volume2,
VolumeOff,
} from 'lucide-vue-next'
const {
version,
clients,
inputMuted,
outputMuted,
videoEnabled,
sharingEnabled,
somebodyStreamingVideo,
toggleInput,
toggleOutput,
toggleVideo,
toggleShare,
} = useApp()
const { connect, connected } = useSignaling()
interface Tab {
id: string
icon: Component
onClick: () => void | Promise<void>
}
const route = useRoute()
const tabs = computed<Tab[]>(() => {
const result = []
if (somebodyStreamingVideo.value) {
result.push({
id: 'Gallery',
icon: TvMinimalPlay,
onClick: () => {
navigateTo({ name: 'Gallery' })
},
})
}
result.push(
{
id: 'Index',
icon: MessageCircle,
onClick: () => {
navigateTo({ name: 'Index' })
},
},
{
id: 'Profile',
icon: UserPen,
onClick: () => {
navigateTo({ name: 'Profile' })
},
},
{
id: 'Preferences',
icon: Settings,
onClick: () => {
navigateTo({ name: 'Preferences' })
},
},
)
return result
})
const activeTab = ref<Tab>(tabs.value.find(tab => tab.id === route.name) ?? tabs.value.find(tab => tab.id === 'Index')!)
watch(activeTab, (activeTab) => {
activeTab.onClick()
})
connect()
</script>

View File

@@ -0,0 +1,20 @@
export default defineNuxtRouteMiddleware(async (to, from) => {
if (import.meta.dev || import.meta.server)
return
const { isTauri } = useApp()
if (!isTauri.value)
return
if (from?.name || !!to.redirectedFrom)
return
const { checkForUpdates } = useUpdater()
const update = await checkForUpdates()
if (update) {
return navigateTo({ name: 'Updater' })
}
})

View File

@@ -0,0 +1,23 @@
import chadApi from '#shared/chad-api'
export default defineNuxtRouteMiddleware(async (to, from) => {
const { me, setMe } = useAuth()
if (!me.value) {
try {
setMe(await chadApi('/me', { method: 'GET' }))
if (to.meta.auth !== false)
return navigateTo({ name: 'Index' })
}
catch {
if (to.meta.auth !== 'guest') {
return navigateTo({ name: 'Login' })
}
}
}
if (me.value && to.meta.auth === 'guest') {
return navigateTo({ name: 'Index' })
}
})

View File

@@ -0,0 +1,26 @@
import type { SyncedPreferences } from '~/composables/use-preferences'
import chadApi from '#shared/chad-api'
export default defineNuxtRouteMiddleware(async () => {
const { me } = useAuth()
if (!me.value)
return
const { synced, toggleInputHotkey, toggleOutputHotkey } = usePreferences()
if (synced.value)
return
try {
const preferences = await chadApi<SyncedPreferences>('/preferences', { method: 'GET' })
if (!preferences)
return
toggleInputHotkey.value = preferences.toggleInputHotkey ?? toggleInputHotkey.value
toggleOutputHotkey.value = preferences.toggleOutputHotkey ?? toggleOutputHotkey.value
synced.value = true
}
catch {}
})

View File

@@ -1,5 +0,0 @@
export default defineNuxtRouteMiddleware((to, from) => {
console.group('Build Info')
console.log(`COMMIT_SHA: ${__COMMIT_SHA__}`)
console.groupEnd()
})

View File

@@ -0,0 +1,64 @@
<template>
<div class="grid grid-cols-[1fr_1fr] gap-2">
<GalleryCard
v-for="item in gallery"
:key="item.client.socketId"
:client="item.client"
:stream="item.stream"
/>
</div>
</template>
<script setup lang="ts">
import type { ChadClient } from '#shared/types'
interface GalleryItem {
client: ChadClient
stream: MediaStream
}
definePageMeta({
name: 'Gallery',
})
const { videoProducer, shareProducer } = useMediasoup()
const { clients, me } = useClients()
const gallery = computed(() => {
return clients.value.reduce<GalleryItem[]>(
(acc, client) => {
const { streaming, videoConsumers, shareConsumers } = useClient(client.socketId)
if (!streaming.value)
return acc
for (const consumer of [...videoConsumers.value, ...shareConsumers.value]) {
acc.push({
client,
stream: new MediaStream([consumer.raw.track]),
})
}
return acc
},
[videoProducer.value, shareProducer.value].reduce<GalleryItem[]>((acc, producer) => {
if (!me.value || !producer || !producer.raw.track)
return acc
acc.push({
client: me.value,
stream: new MediaStream([producer.raw.track]),
})
return acc
}, []),
)
})
watch(gallery, (gallery) => {
if (gallery.length > 0)
return
navigateTo({ name: 'Index' })
})
</script>

View File

@@ -0,0 +1,17 @@
<template>
<div>
<div class="flex items-center justify-center">
<PrimeCard>
<template #content>
The chat is under development.
</template>
</PrimeCard>
</div>
</div>
</template>
<script setup lang="ts">
definePageMeta({
name: 'Index',
})
</script>

View File

@@ -0,0 +1,67 @@
<template>
<PrimeCard>
<template #content>
<form @submit.prevent="submit">
<div class="flex flex-col gap-3">
<PrimeFloatLabel variant="on">
<PrimeInputText id="username" v-model="username" size="large" autocomplete="off" fluid autofocus />
<label for="username">Username</label>
</PrimeFloatLabel>
<PrimeFloatLabel variant="on">
<PrimePassword id="password" v-model="password" size="large" autocomplete="off" toggle-mask fluid :feedback="false" />
<label for="password">Password</label>
</PrimeFloatLabel>
</div>
<PrimeButton
class="mt-6"
size="large"
icon="pi pi-arrow-right"
icon-pos="right"
label="Let's go"
:loading="submitting"
:disabled="!valid"
type="submit"
fluid
/>
</form>
</template>
</PrimeCard>
</template>
<script lang="ts" setup>
definePageMeta({
name: 'Login',
layout: 'auth',
auth: 'guest',
})
const { login } = useAuth()
const submitting = ref(false)
const username = ref<string>()
const password = ref<string>()
const valid = computed(() => {
if (!username.value)
return false
if (!password.value)
return false
return true
})
async function submit() {
if (!valid.value)
return
submitting.value = true
await login(username.value!, password.value!)
submitting.value = false
}
</script>

View File

@@ -0,0 +1,208 @@
<template>
<div>
<PrimeDivider align="left">
Audio
</PrimeDivider>
<PrimeFloatLabel variant="on">
<PrimeSelect
v-model="inputDeviceId"
:options="audioInputs"
option-label="label"
option-value="deviceId"
input-id="inputDevice"
placeholder="No input device"
fluid
:invalid="!inputDeviceExist"
/>
<label for="inputDevice">Input device</label>
</PrimeFloatLabel>
<div class="flex items-center gap-2 mt-3">
<PrimeToggleSwitch v-model="autoGainControl" input-id="autoGainControl" />
<label for="autoGainControl">Auto Gain Control</label>
</div>
<div class="flex items-center gap-2 mt-3">
<PrimeToggleSwitch v-model="echoCancellation" input-id="echoCancellation" />
<label for="echoCancellation">Echo Cancellation</label>
</div>
<div class="flex items-center gap-2 mt-3">
<PrimeToggleSwitch v-model="noiseSuppression" input-id="noiseSuppression" />
<label for="noiseSuppression">Noise Suppression</label>
</div>
<!-- <PrimeFloatLabel variant="on"> -->
<!-- <PrimeSelect -->
<!-- v-model="outputDeviceId" -->
<!-- :options="audioOutputs" -->
<!-- option-label="label" -->
<!-- option-value="deviceId" -->
<!-- fluid -->
<!-- class="mt-6" -->
<!-- input-id="outputDevice" -->
<!-- :invalid="!outputDeviceExist" -->
<!-- -->
<!-- /> -->
<!-- <label for="outputDevice">Output device</label> -->
<!-- </PrimeFloatLabel> -->
<PrimeDivider align="left">
Video
</PrimeDivider>
<PrimeFloatLabel variant="on">
<PrimeSelect
v-model="videoDeviceId"
:options="videoInputs"
option-label="label"
option-value="deviceId"
input-id="videoDevice"
placeholder="No video device"
fluid
:invalid="!videoDeviceExist"
/>
<label for="inputDevice">Input device</label>
</PrimeFloatLabel>
<PrimeDivider align="left">
Screen sharing
</PrimeDivider>
<div>
<p class="text-sm mb-2 text-center">
FPS
</p>
<PrimeSelectButton
v-model="shareFps"
:options="shareFpsOptions"
fluid
size="small"
option-label="label"
option-value="value"
/>
</div>
<template v-if="isTauri">
<PrimeDivider align="left">
Hotkeys
</PrimeDivider>
<PrimeFloatLabel variant="on">
<PrimeInputText id="microphoneToggle" :model-value="toggleInputHotkey" fluid @keydown="setupToggleInputHotkey" />
<label for="microphoneToggle">Toggle microphone</label>
</PrimeFloatLabel>
<PrimeFloatLabel variant="on" class="mt-3">
<PrimeInputText id="soundToggle" :model-value="toggleOutputHotkey" fluid @keydown="setupToggleOutputHotkey" />
<label for="soundToggle">Toggle sound</label>
</PrimeFloatLabel>
</template>
<PrimeDivider align="left">
About
</PrimeDivider>
<p v-if="version" class="text-muted-color text-sm">
VERSION: {{ version }}
</p>
<p class="text-muted-color text-sm mt-2">
COMMIT_SHA: {{ commitSha }}
</p>
<template v-if="isTauri">
<PrimeButton
v-if="lastUpdate"
class="mt-3"
size="small"
label="Install new version"
fluid
severity="success"
@click="navigateTo({ name: 'Updater' })"
/>
<PrimeButton
v-else
class="mt-3"
size="small"
label="Check for Updates"
fluid
severity="info"
:loading="checking"
@click="checkForUpdates"
/>
</template>
</div>
</template>
<script setup lang="ts">
import type { RemovableRef } from '@vueuse/core'
definePageMeta({
name: 'Preferences',
})
const { isTauri, version, commitSha } = useApp()
const { checking, checkForUpdates, lastUpdate } = useUpdater()
const { audioInputs, audioOutputs, videoInputs } = useDevices()
const {
inputDeviceId,
outputDeviceId,
videoDeviceId,
autoGainControl,
noiseSuppression,
echoCancellation,
toggleInputHotkey,
toggleOutputHotkey,
inputDeviceExist,
outputDeviceExist,
videoDeviceExist,
shareFps,
} = usePreferences()
const shareFpsOptions = [5, 30, 60].map((value) => {
return {
label: value.toString(),
value,
}
})
const setupToggleInputHotkey = (event: KeyboardEvent) => setupHotkey(event, toggleInputHotkey)
const setupToggleOutputHotkey = (event: KeyboardEvent) => setupHotkey(event, toggleOutputHotkey)
function setupHotkey(event: KeyboardEvent, model: RemovableRef<string>) {
if (event.key === 'Tab' || event.key === 'Enter') {
return
}
event.preventDefault()
const hotkey = []
if (event.ctrlKey || event.metaKey)
hotkey.push('CommandOrControl')
if (event.altKey)
hotkey.push('Alt')
if (event.shiftKey)
hotkey.push('Shift')
const modifierApplied = hotkey.length > 0
if (!modifierApplied && ['Escape', 'Backspace', 'Delete'].includes(event.key)) {
model.value = ''
return
}
if (!['Control', 'Shift', 'Alt'].includes(event.key)) {
hotkey.push(event.key.toUpperCase())
}
if (modifierApplied && hotkey.length === 1) {
model.value = ''
return
}
model.value = hotkey.join('+')
}
</script>

View File

@@ -0,0 +1,68 @@
<template>
<form @submit.prevent="save()">
<PrimeDivider align="left">
General
</PrimeDivider>
<PrimeFloatLabel variant="on">
<PrimeInputText id="displayName" v-model="displayName" fluid autocomplete="off" />
<label for="displayName">Display name</label>
</PrimeFloatLabel>
<div class="flex items-center gap-3 mt-6">
<PrimeButton label="Save" :disabled="!valid" :loading="saving" fluid type="submit" />
<PrimeButton severity="danger" class="shrink-0" @click="logout()">
<template #icon>
<LogOut />
</template>
</PrimeButton>
</div>
</form>
</template>
<script setup lang="ts">
import chadApi from '#shared/chad-api'
import { LogOut } from 'lucide-vue-next'
definePageMeta({
name: 'Profile',
})
const { me, setMe, logout } = useAuth()
const signaling = useSignaling()
const toast = useToast()
const displayName = ref(me.value?.displayName || '')
const saving = ref(false)
const valid = computed(() => {
if (!me.value)
return false
if (displayName.value === me.value.displayName)
return false
return true
})
async function save() {
if (!valid.value)
return
saving.value = true
const updatedMe = await chadApi('/profile', {
method: 'PATCH',
body: {
displayName: displayName.value,
},
})
setMe({ ...me.value!, displayName: (updatedMe.displayName as string) })
toast.add({ severity: 'success', summary: 'Saved', life: 1000, closable: false })
saving.value = false
}
</script>

View File

@@ -0,0 +1,74 @@
<template>
<PrimeCard>
<template #content>
<form @submit.prevent="submit">
<div class="flex flex-col gap-3">
<PrimeFloatLabel variant="on">
<PrimeInputText id="username" v-model="username" size="large" autocomplete="off" fluid autofocus />
<label for="username">Username</label>
</PrimeFloatLabel>
<PrimeFloatLabel variant="on">
<PrimePassword id="password" v-model="password" size="large" autocomplete="off" toggle-mask fluid :feedback="false" />
<label for="password">Password</label>
</PrimeFloatLabel>
<PrimeFloatLabel variant="on">
<PrimePassword id="repeatPassword" v-model="repeatPassword" size="large" autocomplete="off" toggle-mask fluid :feedback="false" />
<label for="repeatPassword">Repeat password</label>
</PrimeFloatLabel>
</div>
<PrimeButton
class="mt-6"
size="large"
label="Register"
:loading="submitting"
:disabled="!valid"
type="submit"
fluid
/>
</form>
</template>
</PrimeCard>
</template>
<script lang="ts" setup>
definePageMeta({
name: 'Register',
layout: 'auth',
auth: 'guest',
})
const { register } = useAuth()
const submitting = ref(false)
const username = ref<string>()
const password = ref<string>()
const repeatPassword = ref<string>()
const valid = computed(() => {
if (!username.value)
return false
if (!password.value)
return false
if (repeatPassword.value !== password.value)
return false
return true
})
async function submit() {
if (!valid.value)
return
submitting.value = true
await register(username.value!, password.value!)
submitting.value = false
}
</script>

View File

@@ -0,0 +1,41 @@
<template>
<div class="flex h-full">
<div class="w-80 m-auto">
<p class="text-center text-muted-color mb-4">
Updating...
</p>
<PrimeProgressBar mode="indeterminate" style="height: 8px;" />
<div class="flex items-center justify-center gap-2 mt-8">
<PrimeBadge :value="lastUpdate.currentVersion" size="small" severity="secondary" />
<i class="pi pi-arrow-right" style="font-size: 0.75rem;" />
<PrimeBadge :value="lastUpdate.version" size="small" severity="contrast" />
</div>
</div>
</div>
</template>
<script lang="ts" setup>
definePageMeta({
name: 'Updater',
layout: 'blank',
auth: false,
middleware: () => {
const { lastUpdate } = useUpdater()
if (!lastUpdate.value)
return navigateTo('/')
},
})
const lastUpdate = useUpdater().lastUpdate.value!
;(async () => {
try {
await lastUpdate.downloadAndInstall()
}
catch {
await navigateTo('/')
}
})()
</script>

View File

@@ -0,0 +1,7 @@
export default defineNuxtPlugin({
setup() {
console.group('Build Info')
console.log(`COMMIT_SHA: ${__COMMIT_SHA__}`)
console.groupEnd()
},
})

View File

@@ -0,0 +1,45 @@
import { isRegistered, register, unregister, unregisterAll } from '@tauri-apps/plugin-global-shortcut'
export default defineNuxtPlugin({
async setup() {
const { isTauri, toggleInput, toggleOutput } = useApp()
const preferences = usePreferences()
if (!isTauri.value)
return
await unregisterAll()
watch(preferences.toggleInputHotkey, async (shortcut, prevShortcut) => {
await registerHotkey(shortcut, prevShortcut, toggleInput)
}, {
immediate: true,
})
watch(preferences.toggleOutputHotkey, async (shortcut, prevShortcut) => {
await registerHotkey(shortcut, prevShortcut, toggleOutput)
}, {
immediate: true,
})
async function registerHotkey(shortcut: string, prevShortcut: string | undefined, cb: () => void) {
if (!!prevShortcut && await isRegistered(prevShortcut)) {
await unregister(prevShortcut)
}
if (!shortcut)
return
if (await isRegistered(shortcut)) {
await unregister(shortcut)
}
await register(shortcut, ({ state }) => {
if (state !== 'Released')
return
cb()
})
}
},
})

View File

@@ -5,6 +5,9 @@ export default antfu({
css: true,
},
overrides: {
typescript: {
'no-console': 'off',
},
vue: {
'vue/block-order': ['error', {
order: ['template', 'script', 'style'],

1
client/globals.d.ts vendored
View File

@@ -1 +1,2 @@
declare const __API_BASE_URL__: string
declare const __COMMIT_SHA__: string

View File

@@ -1,18 +1,104 @@
import { definePreset } from '@primeuix/themes'
import Aura from '@primeuix/themes/aura'
import tailwindcss from '@tailwindcss/vite'
export default defineNuxtConfig({
compatibilityDate: '2025-09-29',
devtools: { enabled: true },
devtools: { enabled: true, vueDevTools: true },
ssr: false,
devServer: {
// host: '0',
modules: [
'@nuxt/fonts',
'@primevue/nuxt-module',
'@formkit/auto-animate/nuxt',
],
fonts: {
provider: 'google',
},
primevue: {
options: {
theme: {
preset: definePreset(Aura, {
semantic: {
transitionDuration: '150ms',
primary: {
50: '{zinc.50}',
100: '{zinc.100}',
200: '{zinc.200}',
300: '{zinc.300}',
400: '{zinc.400}',
500: '{zinc.500}',
600: '{zinc.600}',
700: '{zinc.700}',
800: '{zinc.800}',
900: '{zinc.900}',
950: '{zinc.950}',
},
},
colorScheme: {
light: {
primary: {
color: '{zinc.950}',
inverseColor: '#ffffff',
hoverColor: '{zinc.900}',
activeColor: '{zinc.800}',
},
highlight: {
background: '{zinc.950}',
focusBackground: '{zinc.700}',
color: '#ffffff',
focusColor: '#ffffff',
},
},
dark: {
primary: {
color: '{zinc.50}',
inverseColor: '{zinc.950}',
hoverColor: '{zinc.100}',
activeColor: '{zinc.200}',
},
highlight: {
background: 'rgba(250, 250, 250, .16)',
focusBackground: 'rgba(250, 250, 250, .24)',
color: 'rgba(255,255,255,.87)',
focusColor: 'rgba(255,255,255,.87)',
},
},
},
}),
},
},
components: {
prefix: 'Prime',
},
},
css: [
'@/assets/styles/tailwind.css',
'@/assets/styles/primeicons.css',
'@/assets/styles/main.scss',
],
vite: {
plugins: [
tailwindcss(),
],
clearScreen: false,
envPrefix: ['VITE_', 'TAURI_'],
server: {
strictPort: true,
proxy: {
'/api': {
// target: 'http://localhost:4000/chad',
target: 'https://api.koptilnya.xyz/chad',
ws: true,
changeOrigin: true,
rewrite: (path) => {
return path.replace(/^\/api/, '')
},
},
},
},
define: {
__COMMIT_SHA__: JSON.stringify(process.env.COMMIT_SHA || 'local'),
__API_BASE_URL__: JSON.stringify(import.meta.env.API_BASE_URL || 'http://localhost:4000/chad'),
__COMMIT_SHA__: JSON.stringify(import.meta.env.COMMIT_SHA || 'local'),
},
},
ignore: ['**/src-tauri/**'],

View File

@@ -4,25 +4,42 @@
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"dev": "nuxt dev --host",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@formkit/auto-animate": "^0.9.0",
"@nuxt/fonts": "^0.11.4",
"@primeuix/themes": "^1.2.5",
"@tailwindcss/vite": "^4.1.14",
"@tauri-apps/plugin-global-shortcut": "~2",
"@tauri-apps/plugin-process": "~2",
"@tauri-apps/plugin-updater": "~2",
"@vueuse/core": "^13.9.0",
"mediasoup-client": "^3.16.7",
"nuxt": "^4.1.2",
"hotkeys-js": "^4.0.0",
"lucide-vue-next": "^0.562.0",
"mediasoup-client": "^3.18.6",
"nuxt": "^4.2.2",
"postcss": "^8.5.6",
"primeicons": "^7.0.0",
"primevue": "^4.4.0",
"socket.io-client": "^4.8.1",
"typescript": "^5.9.3",
"tailwindcss": "^4.1.14",
"tailwindcss-primeui": "^0.6.1",
"ufo": "^1.6.1",
"vue": "^3.5.22",
"vue-router": "^4.5.1"
},
"packageManager": "yarn@4.10.3",
"packageManager": "yarn@4.12.0",
"devDependencies": {
"@antfu/eslint-config": "^5.4.1",
"@primevue/nuxt-module": "^4.4.0",
"@tauri-apps/cli": "^2.8.4",
"eslint": "^9.36.0",
"eslint-plugin-format": "^1.0.2"
"eslint-plugin-format": "^1.0.2",
"sass-embedded": "^1.93.2",
"typescript": "^5.9.3"
}
}

BIN
client/public/chad-bg.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@@ -0,0 +1,41 @@
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const TAURI_CONF = path.resolve(__dirname, '../src-tauri/tauri.conf.json')
const OUTPUT = path.resolve(__dirname, '../updater.json')
const PLATFORM = 'windows-x86_64'
const BASE_URL = 'https://git.koptilnya.xyz/opti1337/chad/releases/download/latest'
const tauriConfRaw = fs.readFileSync(TAURI_CONF, 'utf8')
const tauriConf = JSON.parse(tauriConfRaw)
const version = tauriConf.version
const SIG_FILE = path.resolve(
__dirname,
`../src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/chad_${version}_x64-setup.exe.sig`,
)
const signature = fs.readFileSync(SIG_FILE, 'utf8').trim()
const installerName = `chad_${version}_x64-setup.exe`
const updater = {
pub_date: new Date().toISOString(),
version,
platforms: {
[PLATFORM]: {
url: `${BASE_URL}/${installerName}`,
signature,
},
},
notes: '',
}
fs.writeFileSync(OUTPUT, JSON.stringify(updater, null, 2), 'utf8')
console.log('updater.json generated')

View File

@@ -0,0 +1,4 @@
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('render:html', (html, { event }) => {
})
})

64
client/shared/chad-api.ts Normal file
View File

@@ -0,0 +1,64 @@
import { ToastEventBus } from 'primevue'
const instance = $fetch.create({
baseURL: __API_BASE_URL__,
credentials: 'include',
retry: false,
onResponseError({ request, response }) {
if (!import.meta.client)
return
if (typeof request === 'string' && request.endsWith('/me'))
return
const message = response._data.error || 'Something went wrong'
ToastEventBus.emit('add', { severity: 'error', summary: 'Error', detail: message, closable: false, life: 3000 })
},
})
// function instance(url: string, request: Request) {
// console.log(url)
// return fetch({
// url: `https://api.koptilnya.xyz${url}`,
// credentials: 'include',
// method: 'GET',
// headers: {
// 'Accept': 'application/json',
// 'Content-Type': 'application/json',
// ...request.headers,
// },
// ...request,
// body: request.body ? JSON.stringify(request.body) : undefined,
// })
// }
// async function instance(url: string, options: Partial<Request> = {}) {
// const response = await fetch(`https://api.koptilnya.xyz/chad${url}`, {
// method: options.method || 'GET',
// headers: {
// 'Content-Type': 'application/json',
// ...(options.headers || {}),
// },
// body: JSON.stringify(options.body ?? {}),
// responseType: 2,
// credentials: 'include',
// })
//
// const data = await response.json()
//
// if (response.status >= 400) {
// if (!import.meta.client)
// return
//
// const message = data?.error || 'Something went wrong'
//
// ToastEventBus.emit('add', { severity: 'error', summary: 'Error', detail: message, closable: false, life: 3000 })
//
// throw new Error(`HTTP ${response.status}: ${data?.message || 'Ошибка'}`)
// }
//
// return data
// }
export default instance

36
client/shared/types.ts Normal file
View File

@@ -0,0 +1,36 @@
import type { Consumer as MediasoupConsumer, Producer as MediasoupProducer } from 'mediasoup-client/types'
export interface ChadClient {
socketId: string
userId: string
username: string
displayName: string
inputMuted?: boolean
outputMuted?: boolean
consumers: unknown[]
producers: unknown[]
volume: number
isDominant: boolean
}
export interface AppData {
socketId?: ChadClient['socketId']
source?: 'share' | 'mic-video'
}
export interface Consumer {
id: MediasoupConsumer['id']
paused: MediasoupConsumer['paused']
appData: AppData
raw: MediasoupConsumer
}
export interface Producer {
id: MediasoupProducer['id']
paused: MediasoupProducer['paused']
appData: AppData
raw: MediasoupProducer
}
export type UpdatedClient = Omit<ChadClient, 'socketId' | 'userId' | 'isMe'>

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
description = "WW додепчик"
authors = ["KPTL"]
license = ""
repository = ""
edition = "2021"
@@ -23,3 +23,9 @@ serde = { version = "1.0", features = ["derive"] }
log = "0.4"
tauri = { version = "2.8.5", features = [] }
tauri-plugin-log = "2"
tauri-plugin-process = "2"
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-global-shortcut = "2"
tauri-plugin-single-instance = "2"
tauri-plugin-updater = "2"

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCameraUsageDescription</key>
<string>Request camera access for WebRTC</string>
<key>NSMicrophoneUsageDescription</key>
<string>Request microphone access for WebRTC</string>
</dict>
</plist>

View File

@@ -1,3 +1,3 @@
fn main() {
tauri_build::build()
tauri_build::build()
}

View File

@@ -0,0 +1,18 @@
{
"identifier": "desktop-capability",
"platforms": [
"macOS",
"windows",
"linux"
],
"windows": [
"main"
],
"permissions": [
"updater:default",
"global-shortcut:allow-is-registered",
"global-shortcut:allow-register",
"global-shortcut:allow-unregister",
"global-shortcut:allow-unregister-all"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

Some files were not shown because too many files have changed in this diff Show More