Compare commits
39 changed files with 9818 additions and 4582 deletions
|
|
@ -12,7 +12,7 @@ jobs:
|
||||||
- name: Checkout Local Repository
|
- name: Checkout Local Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0 # 전체 커밋 히스토리를 가져와 비교 및 머지가 가능하도록 설정
|
||||||
|
|
||||||
- name: Configure Git
|
- name: Configure Git
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -24,22 +24,23 @@ jobs:
|
||||||
git remote add upstream https://github.com/cinnyapp/cinny.git
|
git remote add upstream https://github.com/cinnyapp/cinny.git
|
||||||
git fetch upstream dev
|
git fetch upstream dev
|
||||||
|
|
||||||
- name: Merge Upstream and Check Changes
|
- name: Check for Changes and Push Branch
|
||||||
id: check_changes
|
id: check_changes
|
||||||
run: |
|
run: |
|
||||||
BRANCH_NAME="upstream-sync-$(date +'%Y%m%d%H%M')"
|
if ! git diff --quiet HEAD upstream/dev; then
|
||||||
git checkout -b $BRANCH_NAME origin/dev
|
echo "New changes detected in upstream."
|
||||||
|
|
||||||
git merge upstream/dev --no-edit --allow-unrelated-histories
|
BRANCH_NAME="upstream-sync-$(date +'%Y%m%d%H%M')"
|
||||||
|
|
||||||
if ! git diff --quiet origin/dev HEAD; then
|
|
||||||
echo "New upstream changes merged successfully."
|
|
||||||
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
||||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
git checkout -b $BRANCH_NAME
|
||||||
|
# --allow-unrelated-histories 플래그를 추가하여 독립된 히스토리 간의 병합을 허용
|
||||||
|
git merge upstream/dev --no-edit --allow-unrelated-histories
|
||||||
|
|
||||||
git push origin $BRANCH_NAME
|
git push origin $BRANCH_NAME
|
||||||
else
|
else
|
||||||
echo "No new upstream changes to apply. Everything is up to date."
|
echo "No changes detected. Everything is up to date."
|
||||||
echo "has_changes=false" >> $GITHUB_OUTPUT
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -47,7 +48,7 @@ jobs:
|
||||||
if: ${{ steps.check_changes.outputs.has_changes == 'true' }}
|
if: ${{ steps.check_changes.outputs.has_changes == 'true' }}
|
||||||
run: |
|
run: |
|
||||||
PR_TITLE="chore(deps): sync upstream changes ($(date +'%Y-%m-%d'))"
|
PR_TITLE="chore(deps): sync upstream changes ($(date +'%Y-%m-%d'))"
|
||||||
PR_BODY="Upstream (cinnyapp/cinny)에 새로운 변경사항이 감지되어 내 커스텀 브랜치(dev)에 병합한 후 생성된 PR입니다."
|
PR_BODY="Upstream (cinnyapp/cinny)에 새로운 변경사항이 감지되어 자동으로 생성된 PR입니다."
|
||||||
HEAD_BRANCH="${{ steps.check_changes.outputs.branch_name }}"
|
HEAD_BRANCH="${{ steps.check_changes.outputs.branch_name }}"
|
||||||
BASE_BRANCH="dev"
|
BASE_BRANCH="dev"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ body:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Environment
|
label: Environement
|
||||||
description: |
|
description: |
|
||||||
Please provide information about your environment. Include the following:
|
Please provide information about your environment. Include the following:
|
||||||
- OS:
|
- OS:
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ jobs:
|
||||||
PR_NUMBER: ${{github.event.number}}
|
PR_NUMBER: ${{github.event.number}}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".node-version"
|
node-version-file: ".node-version"
|
||||||
package-manager-cache: false
|
package-manager-cache: false
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ jobs:
|
||||||
path: dist
|
path: dist
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
id: netlify
|
id: netlify
|
||||||
uses: nwtgck/actions-netlify@d22a32a27c918fe470bbc562e984f80ec48c2668 # v4.0.0
|
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0.0
|
||||||
with:
|
with:
|
||||||
publish-dir: dist
|
publish-dir: dist
|
||||||
deploy-message: "Deploy PR ${{ steps.pr.outputs.id }}"
|
deploy-message: "Deploy PR ${{ steps.pr.outputs.id }}"
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,17 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
|
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
||||||
|
|
||||||
- name: Login to Docker Hub #Do not update this action from a outside PR
|
- name: Login to Docker Hub #Do not update this action from a outside PR
|
||||||
if: github.event.pull_request.head.repo.fork == false
|
if: github.event.pull_request.head.repo.fork == false
|
||||||
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
@ -34,7 +34,7 @@ jobs:
|
||||||
|
|
||||||
- name: Login to the Github Container registry #Do not update this action from a outside PR
|
- name: Login to the Github Container registry #Do not update this action from a outside PR
|
||||||
if: github.event.pull_request.head.repo.fork == false
|
if: github.event.pull_request.head.repo.fork == false
|
||||||
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
|
|
@ -43,14 +43,14 @@ jobs:
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker, GHCR
|
- name: Extract metadata (tags, labels) for Docker, GHCR
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
|
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
ajbura/cinny
|
ajbura/cinny
|
||||||
ghcr.io/${{ github.repository }}
|
ghcr.io/${{ github.repository }}
|
||||||
|
|
||||||
- name: Build Docker image (no push)
|
- name: Build Docker image (no push)
|
||||||
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ jobs:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- name: NPM Lockfile Changes
|
- name: NPM Lockfile Changes
|
||||||
uses: codepunkt/npm-lockfile-changes@b40543471c36394409466fdb277a73a0856d7891 # v1.0.0
|
uses: codepunkt/npm-lockfile-changes@b40543471c36394409466fdb277a73a0856d7891 # v1.0.0
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".node-version"
|
node-version-file: ".node-version"
|
||||||
package-manager-cache: false
|
package-manager-cache: false
|
||||||
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
uses: nwtgck/actions-netlify@d22a32a27c918fe470bbc562e984f80ec48c2668 # v4.0.0
|
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0.0
|
||||||
with:
|
with:
|
||||||
publish-dir: dist
|
publish-dir: dist
|
||||||
deploy-message: 'Dev deploy ${{ github.sha }}'
|
deploy-message: 'Dev deploy ${{ github.sha }}'
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,48 @@
|
||||||
name: Production deploy
|
name: Production deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
workflow_dispatch:
|
||||||
types: [published]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy-and-tarball:
|
deploy-and-tarball:
|
||||||
name: Netlify deploy and tarball
|
name: Netlify deploy and tarball
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.vars.outputs.tag }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
fetch-depth: 0
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||||
|
with:
|
||||||
|
node-version-file: ".node-version"
|
||||||
package-manager-cache: false
|
package-manager-cache: false
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
- name: Run semantic release
|
||||||
|
run: npm run semantic-release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
|
||||||
|
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
|
||||||
|
GIT_COMMITTER_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
|
||||||
|
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
|
||||||
|
- name: Get version from tag
|
||||||
|
id: vars
|
||||||
|
run: |
|
||||||
|
TAG=$(git describe --tags --abbrev=0)
|
||||||
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
||||||
- name: Build app
|
- name: Build app
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: Deploy to Netlify
|
- name: Deploy to Netlify
|
||||||
uses: nwtgck/actions-netlify@d22a32a27c918fe470bbc562e984f80ec48c2668 # v4.0.0
|
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0.0
|
||||||
with:
|
with:
|
||||||
publish-dir: dist
|
publish-dir: dist
|
||||||
deploy-message: 'Prod deploy ${{ github.ref_name }}'
|
deploy-message: 'Prod deploy ${{ steps.vars.outputs.tag }}'
|
||||||
enable-commit-comment: false
|
enable-commit-comment: false
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
production-deploy: true
|
production-deploy: true
|
||||||
|
|
@ -36,9 +52,6 @@ jobs:
|
||||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_APP }}
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_APP }}
|
||||||
timeout-minutes: 1
|
timeout-minutes: 1
|
||||||
- name: Get version from tag
|
|
||||||
id: vars
|
|
||||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
|
||||||
- name: Create tar.gz
|
- name: Create tar.gz
|
||||||
run: tar -czvf cinny-${{ steps.vars.outputs.tag }}.tar.gz dist
|
run: tar -czvf cinny-${{ steps.vars.outputs.tag }}.tar.gz dist
|
||||||
- name: Sign tar.gz
|
- name: Sign tar.gz
|
||||||
|
|
@ -52,46 +65,54 @@ jobs:
|
||||||
gpg --export | xxd -p
|
gpg --export | xxd -p
|
||||||
echo '${{ secrets.GNUPG_PASSPHRASE }}' | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --armor --detach-sign cinny-${{ steps.vars.outputs.tag }}.tar.gz
|
echo '${{ secrets.GNUPG_PASSPHRASE }}' | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --armor --detach-sign cinny-${{ steps.vars.outputs.tag }}.tar.gz
|
||||||
- name: Upload tagged release
|
- name: Upload tagged release
|
||||||
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1
|
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref_name }}
|
tag_name: ${{ steps.vars.outputs.tag }}
|
||||||
files: |
|
files: |
|
||||||
cinny-${{ steps.vars.outputs.tag }}.tar.gz
|
cinny-${{ steps.vars.outputs.tag }}.tar.gz
|
||||||
cinny-${{ steps.vars.outputs.tag }}.tar.gz.asc
|
cinny-${{ steps.vars.outputs.tag }}.tar.gz.asc
|
||||||
|
|
||||||
publish-image:
|
publish-image:
|
||||||
name: Push Docker image to Docker Hub, GHCR
|
name: Push Docker image to Docker Hub, GHCR
|
||||||
|
needs: deploy-and-tarball
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.deploy-and-tarball.outputs.version }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
|
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
|
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
||||||
- name: Login to Docker Hub #Do not update this action from a outside PR
|
- name: Login to Docker Hub #Do not update this action from a outside PR
|
||||||
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
- name: Login to the Github Container registry #Do not update this action from a outside PR
|
- name: Login to the Github Container registry #Do not update this action from a outside PR
|
||||||
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Extract metadata (tags, labels) for Docker, GHCR
|
- name: Extract metadata (tags, labels) for Docker, GHCR
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
|
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
${{ secrets.DOCKER_USERNAME }}/cinny
|
${{ secrets.DOCKER_USERNAME }}/cinny
|
||||||
ghcr.io/${{ github.repository }}
|
ghcr.io/${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ env.VERSION }}
|
||||||
|
type=raw,value=latest
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
## App
|
## App
|
||||||
FROM nginx:1.31.4-alpine
|
FROM nginx:1.29.8-alpine
|
||||||
|
|
||||||
COPY --from=builder /src/dist /app
|
COPY --from=builder /src/dist /app
|
||||||
COPY --from=builder /src/docker-nginx.conf /etc/nginx/conf.d/default.conf
|
COPY --from=builder /src/docker-nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
|
||||||
5582
package-lock.json
generated
5582
package-lock.json
generated
File diff suppressed because it is too large
Load diff
44
package.json
44
package.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "cinny",
|
"name": "cinny",
|
||||||
"version": "4.12.6",
|
"version": "4.12.1",
|
||||||
"description": "Yet another matrix client",
|
"description": "Yet another matrix client",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"commit": "git-cz",
|
"commit": "git-cz",
|
||||||
"bump": "node scripts/update-version.js"
|
"semantic-release": "semantic-release"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{ts,tsx,js,jsx}": "eslint",
|
"*.{ts,tsx,js,jsx}": "eslint",
|
||||||
|
|
@ -29,6 +29,35 @@
|
||||||
"path": "./node_modules/cz-conventional-changelog"
|
"path": "./node_modules/cz-conventional-changelog"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"release": {
|
||||||
|
"branches": [
|
||||||
|
"dev"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"@semantic-release/commit-analyzer",
|
||||||
|
"@semantic-release/release-notes-generator",
|
||||||
|
[
|
||||||
|
"@semantic-release/exec",
|
||||||
|
{
|
||||||
|
"prepareCmd": "node scripts/update-version.js ${nextRelease.version}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@semantic-release/git",
|
||||||
|
{
|
||||||
|
"assets": [
|
||||||
|
"package.json",
|
||||||
|
"package-lock.json",
|
||||||
|
"src/app/features/settings/about/About.tsx",
|
||||||
|
"src/app/pages/auth/AuthFooter.tsx",
|
||||||
|
"src/app/pages/client/WelcomePage.tsx"
|
||||||
|
],
|
||||||
|
"message": "chore(release): ${nextRelease.version} [skip ci]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@semantic-release/github"
|
||||||
|
]
|
||||||
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "Ajay Bura",
|
"author": "Ajay Bura",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
|
|
@ -56,7 +85,7 @@
|
||||||
"emojibase-data": "15.3.2",
|
"emojibase-data": "15.3.2",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"focus-trap-react": "10.0.2",
|
"focus-trap-react": "10.0.2",
|
||||||
"folds": "2.7.1",
|
"folds": "2.6.2",
|
||||||
"html-dom-parser": "4.0.0",
|
"html-dom-parser": "4.0.0",
|
||||||
"html-react-parser": "4.2.0",
|
"html-react-parser": "4.2.0",
|
||||||
"i18next": "23.12.2",
|
"i18next": "23.12.2",
|
||||||
|
|
@ -67,7 +96,7 @@
|
||||||
"jotai": "2.6.0",
|
"jotai": "2.6.0",
|
||||||
"linkify-react": "4.3.2",
|
"linkify-react": "4.3.2",
|
||||||
"linkifyjs": "4.3.2",
|
"linkifyjs": "4.3.2",
|
||||||
"matrix-js-sdk": "41.7.0",
|
"matrix-js-sdk": "38.2.0",
|
||||||
"matrix-widget-api": "1.16.1",
|
"matrix-widget-api": "1.16.1",
|
||||||
"millify": "6.1.0",
|
"millify": "6.1.0",
|
||||||
"pdfjs-dist": "4.2.67",
|
"pdfjs-dist": "4.2.67",
|
||||||
|
|
@ -82,7 +111,7 @@
|
||||||
"react-i18next": "15.0.0",
|
"react-i18next": "15.0.0",
|
||||||
"react-range": "1.8.14",
|
"react-range": "1.8.14",
|
||||||
"react-router-dom": "6.30.3",
|
"react-router-dom": "6.30.3",
|
||||||
"sanitize-html": "2.17.6",
|
"sanitize-html": "2.17.4",
|
||||||
"slate": "0.123.0",
|
"slate": "0.123.0",
|
||||||
"slate-dom": "0.123.0",
|
"slate-dom": "0.123.0",
|
||||||
"slate-history": "0.113.1",
|
"slate-history": "0.113.1",
|
||||||
|
|
@ -90,10 +119,12 @@
|
||||||
"ua-parser-js": "1.0.35"
|
"ua-parser-js": "1.0.35"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@element-hq/element-call-embedded": "0.20.1",
|
"@element-hq/element-call-embedded": "0.19.1",
|
||||||
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
|
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
|
||||||
"@rollup/plugin-inject": "5.0.3",
|
"@rollup/plugin-inject": "5.0.3",
|
||||||
"@rollup/plugin-wasm": "6.1.1",
|
"@rollup/plugin-wasm": "6.1.1",
|
||||||
|
"@semantic-release/exec": "7.1.0",
|
||||||
|
"@semantic-release/git": "10.0.1",
|
||||||
"@types/chroma-js": "3.1.1",
|
"@types/chroma-js": "3.1.1",
|
||||||
"@types/file-saver": "2.0.5",
|
"@types/file-saver": "2.0.5",
|
||||||
"@types/is-hotkey": "0.1.10",
|
"@types/is-hotkey": "0.1.10",
|
||||||
|
|
@ -119,6 +150,7 @@
|
||||||
"husky": "9.1.7",
|
"husky": "9.1.7",
|
||||||
"lint-staged": "16.3.2",
|
"lint-staged": "16.3.2",
|
||||||
"prettier": "2.8.1",
|
"prettier": "2.8.1",
|
||||||
|
"semantic-release": "25.0.3",
|
||||||
"typescript": "4.9.4",
|
"typescript": "4.9.4",
|
||||||
"vite": "5.4.19",
|
"vite": "5.4.19",
|
||||||
"vite-plugin-pwa": "0.20.5",
|
"vite-plugin-pwa": "0.20.5",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
/* eslint-disable jsx-a11y/media-has-caption */
|
/* eslint-disable jsx-a11y/media-has-caption */
|
||||||
import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react';
|
import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
|
import { MatrixRTCSession } from 'matrix-js-sdk/lib/matrixrtc/MatrixRTCSession';
|
||||||
import FocusTrap from 'focus-trap-react';
|
import FocusTrap from 'focus-trap-react';
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
|
|
@ -92,14 +93,12 @@ function IncomingCall({ dm, info, onIgnore, onAnswer, onReject }: IncomingCallPr
|
||||||
const session = useCallSession(room);
|
const session = useCallSession(room);
|
||||||
useCallMembersChange(
|
useCallMembersChange(
|
||||||
session,
|
session,
|
||||||
useCallback(
|
useCallback(() => {
|
||||||
(members) => {
|
const members = MatrixRTCSession.sessionMembershipsForRoom(room, session.sessionDescription);
|
||||||
if (members.length === 0) {
|
if (members.length === 0) {
|
||||||
onIgnore();
|
onIgnore();
|
||||||
}
|
}
|
||||||
},
|
}, [room, session, onIgnore])
|
||||||
[onIgnore]
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const playSound = useCallback(() => {
|
const playSound = useCallback(() => {
|
||||||
|
|
@ -148,13 +147,11 @@ function IncomingCall({ dm, info, onIgnore, onAnswer, onReject }: IncomingCallPr
|
||||||
/>
|
/>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
</Box>
|
</Box>
|
||||||
<Box grow="Yes" direction="Column" gap="100" alignItems="Center">
|
<Box grow="Yes" direction="Column" gap="100">
|
||||||
<Text size="H3" align="Center" truncate>
|
<Text size="H3" align="Center" truncate>
|
||||||
{roomName}
|
{roomName}
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="T300" align="Center">
|
<Text size="T300">Incoming Call</Text>
|
||||||
Incoming Call
|
|
||||||
</Text>
|
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
{!livekitSupported && (
|
{!livekitSupported && (
|
||||||
|
|
@ -239,7 +236,6 @@ function IncomingCallListener({ callEmbed, joined }: IncomingCallListenerProps)
|
||||||
// only process rtc notification reference events.
|
// only process rtc notification reference events.
|
||||||
// we do not want to wait to decrypt all events.
|
// we do not want to wait to decrypt all events.
|
||||||
if (event.getRelation()?.rel_type !== RelationType.Reference) return;
|
if (event.getRelation()?.rel_type !== RelationType.Reference) return;
|
||||||
if (room?.isCallRoom()) return;
|
|
||||||
|
|
||||||
if (event.isEncrypted()) {
|
if (event.isEncrypted()) {
|
||||||
if (!event.isBeingDecrypted()) {
|
if (!event.isBeingDecrypted()) {
|
||||||
|
|
@ -268,8 +264,7 @@ function IncomingCallListener({ callEmbed, joined }: IncomingCallListenerProps)
|
||||||
const refEventId = relation?.event_id;
|
const refEventId = relation?.event_id;
|
||||||
|
|
||||||
const mention =
|
const mention =
|
||||||
content['m.mentions']?.room ||
|
content['m.mentions'].room || content['m.mentions'].user_ids?.includes(mx.getSafeUserId());
|
||||||
content['m.mentions']?.user_ids?.includes(mx.getSafeUserId());
|
|
||||||
if (!sender || !refEventId || !mention || Date.now() >= senderTs + lifetime) {
|
if (!sender || !refEventId || !mention || Date.now() >= senderTs + lifetime) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -241,15 +241,15 @@ export const getPointUntilChar = (
|
||||||
return targetPoint;
|
return targetPoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPrevWordRange = (editor: Editor): BaseRange | undefined => {
|
export const getPrevWorldRange = (editor: Editor): BaseRange | undefined => {
|
||||||
const { selection } = editor;
|
const { selection } = editor;
|
||||||
if (!selection || !Range.isCollapsed(selection)) return undefined;
|
if (!selection || !Range.isCollapsed(selection)) return undefined;
|
||||||
const [cursorPoint] = Range.edges(selection);
|
const [cursorPoint] = Range.edges(selection);
|
||||||
const wordStartPoint = getPointUntilChar(editor, cursorPoint, {
|
const worldStartPoint = getPointUntilChar(editor, cursorPoint, {
|
||||||
reverse: true,
|
reverse: true,
|
||||||
match: (char) => char === ' ' || char === '',
|
match: (char) => char === ' ',
|
||||||
});
|
});
|
||||||
return wordStartPoint && Editor.range(editor, wordStartPoint, cursorPoint);
|
return worldStartPoint && Editor.range(editor, worldStartPoint, cursorPoint);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isEmptyEditor = (editor: Editor): boolean => {
|
export const isEmptyEditor = (editor: Editor): boolean => {
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,6 @@ export const PageHeroSection = style([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
export const PageContentCenter = style([
|
export const PageContentCenter = style([
|
||||||
DefaultReset,
|
DefaultReset,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,6 @@ type MicrophoneButtonProps = {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
function MicrophoneButton({ enabled, onToggle, disabled }: MicrophoneButtonProps) {
|
function MicrophoneButton({ enabled, onToggle, disabled }: MicrophoneButtonProps) {
|
||||||
const [micState, toggleMic] = useAsyncCallback(onToggle);
|
|
||||||
const loading = micState.status === AsyncStatus.Loading;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider
|
<TooltipProvider
|
||||||
position="Top"
|
position="Top"
|
||||||
|
|
@ -31,9 +28,9 @@ function MicrophoneButton({ enabled, onToggle, disabled }: MicrophoneButtonProps
|
||||||
fill="Soft"
|
fill="Soft"
|
||||||
radii="300"
|
radii="300"
|
||||||
size="300"
|
size="300"
|
||||||
onClick={toggleMic}
|
onClick={() => onToggle()}
|
||||||
outlined
|
outlined
|
||||||
disabled={disabled || loading}
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
<Icon size="100" src={enabled ? Icons.Mic : Icons.MicMute} filled={!enabled} />
|
<Icon size="100" src={enabled ? Icons.Mic : Icons.MicMute} filled={!enabled} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
@ -85,9 +82,6 @@ type VideoButtonProps = {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
function VideoButton({ enabled, onToggle, disabled }: VideoButtonProps) {
|
function VideoButton({ enabled, onToggle, disabled }: VideoButtonProps) {
|
||||||
const [videoState, toggleVideo] = useAsyncCallback(onToggle);
|
|
||||||
const loading = videoState.status === AsyncStatus.Loading;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider
|
<TooltipProvider
|
||||||
position="Top"
|
position="Top"
|
||||||
|
|
@ -104,9 +98,9 @@ function VideoButton({ enabled, onToggle, disabled }: VideoButtonProps) {
|
||||||
fill="Soft"
|
fill="Soft"
|
||||||
radii="300"
|
radii="300"
|
||||||
size="300"
|
size="300"
|
||||||
onClick={toggleVideo}
|
onClick={() => onToggle()}
|
||||||
outlined
|
outlined
|
||||||
disabled={disabled || loading}
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
size="100"
|
size="100"
|
||||||
|
|
@ -164,9 +158,6 @@ export function CallControl({
|
||||||
const { microphone, video, sound, screenshare } = useCallControlState(callEmbed.control);
|
const { microphone, video, sound, screenshare } = useCallControlState(callEmbed.control);
|
||||||
const setCallEmbed = useSetAtom(callEmbedAtom);
|
const setCallEmbed = useSetAtom(callEmbedAtom);
|
||||||
|
|
||||||
const handleMicrophoneToggle = useCallback(() => callEmbed.control.toggleMicrophone(), [callEmbed]);
|
|
||||||
const handleVideoToggle = useCallback(() => callEmbed.control.toggleVideo(), [callEmbed]);
|
|
||||||
|
|
||||||
const [hangupState, hangup] = useAsyncCallback(
|
const [hangupState, hangup] = useAsyncCallback(
|
||||||
useCallback(() => callEmbed.hangup(), [callEmbed])
|
useCallback(() => callEmbed.hangup(), [callEmbed])
|
||||||
);
|
);
|
||||||
|
|
@ -186,7 +177,7 @@ export function CallControl({
|
||||||
<Box alignItems="Inherit" gap="200">
|
<Box alignItems="Inherit" gap="200">
|
||||||
<MicrophoneButton
|
<MicrophoneButton
|
||||||
enabled={microphone}
|
enabled={microphone}
|
||||||
onToggle={handleMicrophoneToggle}
|
onToggle={() => callEmbed.control.toggleMicrophone()}
|
||||||
disabled={!callJoined}
|
disabled={!callJoined}
|
||||||
/>
|
/>
|
||||||
<SoundButton
|
<SoundButton
|
||||||
|
|
@ -197,7 +188,7 @@ export function CallControl({
|
||||||
{!compact && <StatusDivider />}
|
{!compact && <StatusDivider />}
|
||||||
<VideoButton
|
<VideoButton
|
||||||
enabled={video}
|
enabled={video}
|
||||||
onToggle={handleVideoToggle}
|
onToggle={() => callEmbed.control.toggleVideo()}
|
||||||
disabled={!callJoined}
|
disabled={!callJoined}
|
||||||
/>
|
/>
|
||||||
{!compact && (
|
{!compact && (
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export function CallStatus({ callEmbed }: CallStatusProps) {
|
||||||
const { room } = callEmbed;
|
const { room } = callEmbed;
|
||||||
|
|
||||||
const callSession = useCallSession(room);
|
const callSession = useCallSession(room);
|
||||||
const callMembers = useCallMembers(callSession);
|
const callMembers = useCallMembers(room, callSession);
|
||||||
const screenSize = useScreenSize();
|
const screenSize = useScreenSize();
|
||||||
const callJoined = useCallJoined(callEmbed);
|
const callJoined = useCallJoined(callEmbed);
|
||||||
const speakers = useCallSpeakers(callEmbed);
|
const speakers = useCallSpeakers(callEmbed);
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ export function LiveChip({ count, room, members }: LiveChipProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={callMember.memberId}
|
key={callMember.membershipID}
|
||||||
size="400"
|
size="400"
|
||||||
variant="Surface"
|
variant="Surface"
|
||||||
radii="300"
|
radii="300"
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ export function MemberGlance({ room, members, speakers, max = 6 }: MemberGlanceP
|
||||||
return (
|
return (
|
||||||
<Box alignItems="Center">
|
<Box alignItems="Center">
|
||||||
{visibleMembers.map((callMember) => {
|
{visibleMembers.map((callMember) => {
|
||||||
const { userId } = callMember;
|
const userId = callMember.sender;
|
||||||
if (!userId) return null;
|
if (!userId) return null;
|
||||||
const name = getMemberDisplayName(room, userId) ?? getMxIdLocalPart(userId) ?? userId;
|
const name = getMemberDisplayName(room, userId) ?? getMxIdLocalPart(userId) ?? userId;
|
||||||
const avatarMxc = getMemberAvatarMxc(room, userId);
|
const avatarMxc = getMemberAvatarMxc(room, userId);
|
||||||
|
|
@ -39,7 +39,7 @@ export function MemberGlance({ room, members, speakers, max = 6 }: MemberGlanceP
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StackedAvatar
|
<StackedAvatar
|
||||||
key={callMember.memberId}
|
key={callMember.membershipID}
|
||||||
className={speakers.has(callMember.sender) ? css.SpeakerAvatarOutline : undefined}
|
className={speakers.has(callMember.sender) ? css.SpeakerAvatarOutline : undefined}
|
||||||
title={name}
|
title={name}
|
||||||
as="button"
|
as="button"
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,6 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||||
setCords(undefined);
|
setCords(undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMicrophoneToggle = useCallback(() => callEmbed.control.toggleMicrophone(), [callEmbed]);
|
|
||||||
const handleVideoToggle = useCallback(() => callEmbed.control.toggleVideo(), [callEmbed]);
|
|
||||||
|
|
||||||
const [hangupState, hangup] = useAsyncCallback(
|
const [hangupState, hangup] = useAsyncCallback(
|
||||||
useCallback(() => callEmbed.hangup(), [callEmbed])
|
useCallback(() => callEmbed.hangup(), [callEmbed])
|
||||||
);
|
);
|
||||||
|
|
@ -99,13 +96,13 @@ export function CallControls({ callEmbed }: CallControlsProps) {
|
||||||
<Box shrink="No" alignItems="Inherit" justifyContent="Inherit" gap="200">
|
<Box shrink="No" alignItems="Inherit" justifyContent="Inherit" gap="200">
|
||||||
<MicrophoneButton
|
<MicrophoneButton
|
||||||
enabled={microphone}
|
enabled={microphone}
|
||||||
onToggle={handleMicrophoneToggle}
|
onToggle={() => callEmbed.control.toggleMicrophone()}
|
||||||
/>
|
/>
|
||||||
<SoundButton enabled={sound} onToggle={() => callEmbed.control.toggleSound()} />
|
<SoundButton enabled={sound} onToggle={() => callEmbed.control.toggleSound()} />
|
||||||
</Box>
|
</Box>
|
||||||
{!compact && <ControlDivider />}
|
{!compact && <ControlDivider />}
|
||||||
<Box shrink="No" alignItems="Inherit" justifyContent="Inherit" gap="200">
|
<Box shrink="No" alignItems="Inherit" justifyContent="Inherit" gap="200">
|
||||||
<VideoButton enabled={video} onToggle={handleVideoToggle} />
|
<VideoButton enabled={video} onToggle={() => callEmbed.control.toggleVideo()} />
|
||||||
<ScreenShareButton
|
<ScreenShareButton
|
||||||
enabled={screenshare}
|
enabled={screenshare}
|
||||||
onToggle={() => callEmbed.control.toggleScreenshare()}
|
onToggle={() => callEmbed.control.toggleScreenshare()}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { CallMembership } from 'matrix-js-sdk/lib/matrixrtc/CallMembership';
|
import { CallMembership, SessionMembershipData } from 'matrix-js-sdk/lib/matrixrtc/CallMembership';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Avatar, Box, Icon, Icons, Text } from 'folds';
|
import { Avatar, Box, Icon, Icons, Text } from 'folds';
|
||||||
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
import { useMatrixClient } from '../../hooks/useMatrixClient';
|
||||||
|
|
@ -12,6 +12,12 @@ import { UserAvatar } from '../../components/user-avatar';
|
||||||
import { getMouseEventCords } from '../../utils/dom';
|
import { getMouseEventCords } from '../../utils/dom';
|
||||||
import * as css from './styles.css';
|
import * as css from './styles.css';
|
||||||
|
|
||||||
|
interface MemberWithMembershipData {
|
||||||
|
membershipData?: SessionMembershipData & {
|
||||||
|
'm.call.intent': 'video' | 'audio';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
type CallMemberCardProps = {
|
type CallMemberCardProps = {
|
||||||
member: CallMembership;
|
member: CallMembership;
|
||||||
};
|
};
|
||||||
|
|
@ -22,7 +28,7 @@ export function CallMemberCard({ member }: CallMemberCardProps) {
|
||||||
|
|
||||||
const openUserProfile = useOpenUserRoomProfile();
|
const openUserProfile = useOpenUserRoomProfile();
|
||||||
|
|
||||||
const { userId } = member;
|
const userId = member.sender;
|
||||||
if (!userId) return null;
|
if (!userId) return null;
|
||||||
|
|
||||||
const name = getMemberDisplayName(room, userId) ?? getMxIdLocalPart(userId) ?? userId;
|
const name = getMemberDisplayName(room, userId) ?? getMxIdLocalPart(userId) ?? userId;
|
||||||
|
|
@ -31,12 +37,13 @@ export function CallMemberCard({ member }: CallMemberCardProps) {
|
||||||
? mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96) ?? undefined
|
? mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96) ?? undefined
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const audioOnly = member.callIntent === 'audio';
|
const audioOnly =
|
||||||
|
(member as unknown as MemberWithMembershipData).membershipData?.['m.call.intent'] === 'audio';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SequenceCard
|
<SequenceCard
|
||||||
as="button"
|
as="button"
|
||||||
key={member.memberId}
|
key={member.membershipID}
|
||||||
className={css.CallMemberCard}
|
className={css.CallMemberCard}
|
||||||
variant="SurfaceVariant"
|
variant="SurfaceVariant"
|
||||||
radii="500"
|
radii="500"
|
||||||
|
|
@ -85,7 +92,7 @@ export function CallMemberRenderer({
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{truncatedMembers.map((member) => (
|
{truncatedMembers.map((member) => (
|
||||||
<CallMemberCard key={member.memberId} member={member} />
|
<CallMemberCard key={member.membershipID} member={member} />
|
||||||
))}
|
))}
|
||||||
{members.length > max && (
|
{members.length > max && (
|
||||||
<SequenceCard
|
<SequenceCard
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ function CallPrescreen() {
|
||||||
);
|
);
|
||||||
|
|
||||||
const callSession = useCallSession(room);
|
const callSession = useCallSession(room);
|
||||||
const callMembers = useCallMembers(callSession);
|
const callMembers = useCallMembers(room, callSession);
|
||||||
const hasParticipant = callMembers.length > 0;
|
const hasParticipant = callMembers.length > 0;
|
||||||
|
|
||||||
const callEmbed = useCallEmbed();
|
const callEmbed = useCallEmbed();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import { Icon, IconButton, Icons, Line, Text, Tooltip, TooltipProvider } from 'f
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import * as css from './styles.css';
|
import * as css from './styles.css';
|
||||||
import { callChatAtom } from '../../state/callEmbed';
|
import { callChatAtom } from '../../state/callEmbed';
|
||||||
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
|
|
||||||
|
|
||||||
export function ControlDivider() {
|
export function ControlDivider() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -13,12 +12,9 @@ export function ControlDivider() {
|
||||||
|
|
||||||
type MicrophoneButtonProps = {
|
type MicrophoneButtonProps = {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
onToggle: () => Promise<unknown>;
|
onToggle: () => void;
|
||||||
};
|
};
|
||||||
export function MicrophoneButton({ enabled, onToggle }: MicrophoneButtonProps) {
|
export function MicrophoneButton({ enabled, onToggle }: MicrophoneButtonProps) {
|
||||||
const [micState, toggleMic] = useAsyncCallback(onToggle);
|
|
||||||
const loading = micState.status === AsyncStatus.Loading;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider
|
<TooltipProvider
|
||||||
position="Top"
|
position="Top"
|
||||||
|
|
@ -36,9 +32,8 @@ export function MicrophoneButton({ enabled, onToggle }: MicrophoneButtonProps) {
|
||||||
fill="Soft"
|
fill="Soft"
|
||||||
radii="400"
|
radii="400"
|
||||||
size="400"
|
size="400"
|
||||||
onClick={toggleMic}
|
onClick={() => onToggle()}
|
||||||
outlined
|
outlined
|
||||||
disabled={loading}
|
|
||||||
>
|
>
|
||||||
<Icon size="400" src={enabled ? Icons.Mic : Icons.MicMute} filled={!enabled} />
|
<Icon size="400" src={enabled ? Icons.Mic : Icons.MicMute} filled={!enabled} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
@ -85,12 +80,9 @@ export function SoundButton({ enabled, onToggle }: SoundButtonProps) {
|
||||||
|
|
||||||
type VideoButtonProps = {
|
type VideoButtonProps = {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
onToggle: () => Promise<unknown>;
|
onToggle: () => void;
|
||||||
};
|
};
|
||||||
export function VideoButton({ enabled, onToggle }: VideoButtonProps) {
|
export function VideoButton({ enabled, onToggle }: VideoButtonProps) {
|
||||||
const [videoState, toggleVideo] = useAsyncCallback(onToggle);
|
|
||||||
const loading = videoState.status === AsyncStatus.Loading;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider
|
<TooltipProvider
|
||||||
position="Top"
|
position="Top"
|
||||||
|
|
@ -108,9 +100,8 @@ export function VideoButton({ enabled, onToggle }: VideoButtonProps) {
|
||||||
fill="Soft"
|
fill="Soft"
|
||||||
radii="400"
|
radii="400"
|
||||||
size="400"
|
size="400"
|
||||||
onClick={toggleVideo}
|
onClick={() => onToggle()}
|
||||||
outlined
|
outlined
|
||||||
disabled={loading}
|
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
size="400"
|
size="400"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useCallback } from 'react';
|
import React from 'react';
|
||||||
import { Box, Button, Icon, Icons, Spinner, Text } from 'folds';
|
import { Box, Button, Icon, Icons, Spinner, Text } from 'folds';
|
||||||
import { SequenceCard } from '../../components/sequence-card';
|
import { SequenceCard } from '../../components/sequence-card';
|
||||||
import * as css from './styles.css';
|
import * as css from './styles.css';
|
||||||
|
|
@ -26,10 +26,6 @@ export function PrescreenControls({ canJoin }: PrescreenControlsProps) {
|
||||||
const { microphone, video, sound, toggleMicrophone, toggleVideo, toggleSound } =
|
const { microphone, video, sound, toggleMicrophone, toggleVideo, toggleSound } =
|
||||||
useCallPreferences();
|
useCallPreferences();
|
||||||
|
|
||||||
|
|
||||||
const handleMicrophoneToggle = useCallback(async () => toggleMicrophone(), [toggleMicrophone]);
|
|
||||||
const handleVideoToggle = useCallback(async () => toggleVideo(), [toggleVideo]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SequenceCard
|
<SequenceCard
|
||||||
className={css.ControlCard}
|
className={css.ControlCard}
|
||||||
|
|
@ -41,12 +37,12 @@ export function PrescreenControls({ canJoin }: PrescreenControlsProps) {
|
||||||
wrap="Wrap"
|
wrap="Wrap"
|
||||||
>
|
>
|
||||||
<Box shrink="No" alignItems="Inherit" justifyContent="SpaceBetween" gap="200">
|
<Box shrink="No" alignItems="Inherit" justifyContent="SpaceBetween" gap="200">
|
||||||
<MicrophoneButton enabled={microphone} onToggle={handleMicrophoneToggle} />
|
<MicrophoneButton enabled={microphone} onToggle={toggleMicrophone} />
|
||||||
<SoundButton enabled={sound} onToggle={toggleSound} />
|
<SoundButton enabled={sound} onToggle={toggleSound} />
|
||||||
</Box>
|
</Box>
|
||||||
<ControlDivider />
|
<ControlDivider />
|
||||||
<Box shrink="No" alignItems="Inherit" justifyContent="SpaceBetween" gap="200">
|
<Box shrink="No" alignItems="Inherit" justifyContent="SpaceBetween" gap="200">
|
||||||
<VideoButton enabled={video} onToggle={handleVideoToggle} />
|
<VideoButton enabled={video} onToggle={toggleVideo} />
|
||||||
<ChatButton />
|
<ChatButton />
|
||||||
</Box>
|
</Box>
|
||||||
<Box grow="Yes" direction="Column">
|
<Box grow="Yes" direction="Column">
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ export const LobbyHeroTopic = style({
|
||||||
WebkitLineClamp: 3,
|
WebkitLineClamp: 3,
|
||||||
WebkitBoxOrient: 'vertical',
|
WebkitBoxOrient: 'vertical',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
wordBreak: 'break-word',
|
|
||||||
|
|
||||||
':hover': {
|
':hover': {
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ export function RoomNavItem({
|
||||||
|
|
||||||
const optionsVisible = hover || !!menuAnchor;
|
const optionsVisible = hover || !!menuAnchor;
|
||||||
const callSession = useCallSession(room);
|
const callSession = useCallSession(room);
|
||||||
const callMembers = useCallMembers(callSession);
|
const callMembers = useCallMembers(room, callSession);
|
||||||
const startCall = useCallStart(direct);
|
const startCall = useCallStart(direct);
|
||||||
const callEmbed = useCallEmbed();
|
const callEmbed = useCallEmbed();
|
||||||
const callPref = useAtomValue(useCallPreferencesAtom());
|
const callPref = useAtomValue(useCallPreferencesAtom());
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export function Room() {
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
|
|
||||||
const callSession = useCallSession(room);
|
const callSession = useCallSession(room);
|
||||||
const callMembers = useCallMembers(callSession);
|
const callMembers = useCallMembers(room, callSession);
|
||||||
const callEmbed = useCallEmbed();
|
const callEmbed = useCallEmbed();
|
||||||
|
|
||||||
const [isDrawer] = useSetting(settingsAtom, 'isPeopleDrawer');
|
const [isDrawer] = useSetting(settingsAtom, 'isPeopleDrawer');
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import {
|
||||||
AutocompletePrefix,
|
AutocompletePrefix,
|
||||||
AutocompleteQuery,
|
AutocompleteQuery,
|
||||||
getAutocompleteQuery,
|
getAutocompleteQuery,
|
||||||
getPrevWordRange,
|
getPrevWorldRange,
|
||||||
resetEditor,
|
resetEditor,
|
||||||
RoomMentionAutocomplete,
|
RoomMentionAutocomplete,
|
||||||
UserMentionAutocomplete,
|
UserMentionAutocomplete,
|
||||||
|
|
@ -411,7 +411,7 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
|
||||||
sendTypingStatus(!isEmptyEditor(editor));
|
sendTypingStatus(!isEmptyEditor(editor));
|
||||||
}
|
}
|
||||||
|
|
||||||
const prevWordRange = getPrevWordRange(editor);
|
const prevWordRange = getPrevWorldRange(editor);
|
||||||
const query = prevWordRange
|
const query = prevWordRange
|
||||||
? getAutocompleteQuery<AutocompletePrefix>(editor, prevWordRange, AUTOCOMPLETE_PREFIXES)
|
? getAutocompleteQuery<AutocompletePrefix>(editor, prevWordRange, AUTOCOMPLETE_PREFIXES)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import { HTMLReactParserOptions } from 'html-react-parser';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { ReactEditor } from 'slate-react';
|
import { ReactEditor } from 'slate-react';
|
||||||
import { Editor } from 'slate';
|
import { Editor } from 'slate';
|
||||||
|
import { SessionMembershipData } from 'matrix-js-sdk/lib/matrixrtc/CallMembership';
|
||||||
import to from 'await-to-js';
|
import to from 'await-to-js';
|
||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
import {
|
import {
|
||||||
|
|
@ -1474,7 +1475,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||||
const senderId = mEvent.getSender() ?? '';
|
const senderId = mEvent.getSender() ?? '';
|
||||||
const senderName = getMemberDisplayName(room, senderId) || getMxIdLocalPart(senderId);
|
const senderName = getMemberDisplayName(room, senderId) || getMxIdLocalPart(senderId);
|
||||||
|
|
||||||
const content = mEvent.getContent();
|
const content = mEvent.getContent<SessionMembershipData>();
|
||||||
const prevContent = mEvent.getPrevContent();
|
const prevContent = mEvent.getPrevContent();
|
||||||
|
|
||||||
const callJoined = content.application;
|
const callJoined = content.application;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import {
|
||||||
createEmoticonElement,
|
createEmoticonElement,
|
||||||
customHtmlEqualsPlainText,
|
customHtmlEqualsPlainText,
|
||||||
getAutocompleteQuery,
|
getAutocompleteQuery,
|
||||||
getPrevWordRange,
|
getPrevWorldRange,
|
||||||
htmlToEditorInput,
|
htmlToEditorInput,
|
||||||
moveCursor,
|
moveCursor,
|
||||||
plainToEditorInput,
|
plainToEditorInput,
|
||||||
|
|
@ -187,7 +187,7 @@ export const MessageEditor = as<'div', MessageEditorProps>(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const prevWordRange = getPrevWordRange(editor);
|
const prevWordRange = getPrevWorldRange(editor);
|
||||||
const query = prevWordRange
|
const query = prevWordRange
|
||||||
? getAutocompleteQuery<AutocompletePrefix>(editor, prevWordRange, AUTOCOMPLETE_PREFIXES)
|
? getAutocompleteQuery<AutocompletePrefix>(editor, prevWordRange, AUTOCOMPLETE_PREFIXES)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ export function About({ requestClose }: AboutProps) {
|
||||||
<Box direction="Column" gap="100">
|
<Box direction="Column" gap="100">
|
||||||
<Box gap="100" alignItems="End">
|
<Box gap="100" alignItems="End">
|
||||||
<Text size="H3">Cinny</Text>
|
<Text size="H3">Cinny</Text>
|
||||||
<Text size="T200">v4.12.6</Text>
|
<Text size="T200">v4.12.1</Text>
|
||||||
</Box>
|
</Box>
|
||||||
<Text>Yet another matrix client.</Text>
|
<Text>Yet another matrix client.</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ export const useAccountManagementActions = () => {
|
||||||
const actions = useMemo(
|
const actions = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
profile: 'org.matrix.profile',
|
profile: 'org.matrix.profile',
|
||||||
sessionsList: 'org.matrix.devices_list',
|
sessionsList: 'org.matrix.sessions_list',
|
||||||
sessionView: 'org.matrix.device_view',
|
sessionView: 'org.matrix.session_view',
|
||||||
sessionEnd: 'org.matrix.device_delete',
|
sessionEnd: 'org.matrix.session_end',
|
||||||
accountDeactivate: 'org.matrix.account_deactivate',
|
accountDeactivate: 'org.matrix.account_deactivate',
|
||||||
crossSigningReset: 'org.matrix.cross_signing_reset',
|
crossSigningReset: 'org.matrix.cross_signing_reset',
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import { Room } from 'matrix-js-sdk';
|
||||||
import {
|
import {
|
||||||
MatrixRTCSession,
|
MatrixRTCSession,
|
||||||
MatrixRTCSessionEvent,
|
MatrixRTCSessionEvent,
|
||||||
MatrixRTCSessionEventHandlerMap,
|
|
||||||
} from 'matrix-js-sdk/lib/matrixrtc/MatrixRTCSession';
|
} from 'matrix-js-sdk/lib/matrixrtc/MatrixRTCSession';
|
||||||
import { CallMembership } from 'matrix-js-sdk/lib/matrixrtc/CallMembership';
|
import { CallMembership } from 'matrix-js-sdk/lib/matrixrtc/CallMembership';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
@ -34,27 +33,32 @@ export const useCallSession = (room: Room): MatrixRTCSession => {
|
||||||
return session;
|
return session;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useCallMembersChange = (
|
export const useCallMembers = (room: Room, session: MatrixRTCSession): CallMembership[] => {
|
||||||
session: MatrixRTCSession,
|
const [memberships, setMemberships] = useState<CallMembership[]>(
|
||||||
callback: (members: CallMembership[]) => void
|
MatrixRTCSession.sessionMembershipsForRoom(room, session.sessionDescription)
|
||||||
): void => {
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleMembershipsChange: MatrixRTCSessionEventHandlerMap[MatrixRTCSessionEvent.MembershipsChanged] =
|
const updateMemberships = () => {
|
||||||
(oldestMembership, newMemberships) => {
|
setMemberships(MatrixRTCSession.sessionMembershipsForRoom(room, session.sessionDescription));
|
||||||
callback(newMemberships);
|
|
||||||
};
|
|
||||||
|
|
||||||
session.on(MatrixRTCSessionEvent.MembershipsChanged, handleMembershipsChange);
|
|
||||||
return () => {
|
|
||||||
session.removeListener(MatrixRTCSessionEvent.MembershipsChanged, handleMembershipsChange);
|
|
||||||
};
|
};
|
||||||
}, [session, callback]);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const useCallMembers = (session: MatrixRTCSession): CallMembership[] => {
|
updateMemberships();
|
||||||
const [memberships, setMemberships] = useState<CallMembership[]>(session.memberships);
|
|
||||||
|
|
||||||
useCallMembersChange(session, setMemberships);
|
session.on(MatrixRTCSessionEvent.MembershipsChanged, updateMemberships);
|
||||||
|
return () => {
|
||||||
|
session.removeListener(MatrixRTCSessionEvent.MembershipsChanged, updateMemberships);
|
||||||
|
};
|
||||||
|
}, [session, room]);
|
||||||
|
|
||||||
return memberships;
|
return memberships;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useCallMembersChange = (session: MatrixRTCSession, callback: () => void): void => {
|
||||||
|
useEffect(() => {
|
||||||
|
session.on(MatrixRTCSessionEvent.MembershipsChanged, callback);
|
||||||
|
return () => {
|
||||||
|
session.removeListener(MatrixRTCSessionEvent.MembershipsChanged, callback);
|
||||||
|
};
|
||||||
|
}, [session, callback]);
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { createContext, RefObject, useCallback, useContext, useEffect, useState } from 'react';
|
import { createContext, RefObject, useCallback, useContext, useEffect, useState } from 'react';
|
||||||
|
import { MatrixRTCSession } from 'matrix-js-sdk/lib/matrixrtc/MatrixRTCSession';
|
||||||
import { MatrixClient, Room } from 'matrix-js-sdk';
|
import { MatrixClient, Room } from 'matrix-js-sdk';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import {
|
import {
|
||||||
|
|
@ -44,7 +45,8 @@ export const createCallEmbed = (
|
||||||
pref?: CallPreferences
|
pref?: CallPreferences
|
||||||
): CallEmbed => {
|
): CallEmbed => {
|
||||||
const rtcSession = mx.matrixRTC.getRoomSession(room);
|
const rtcSession = mx.matrixRTC.getRoomSession(room);
|
||||||
const ongoing = rtcSession.memberships.length > 0;
|
const ongoing =
|
||||||
|
MatrixRTCSession.sessionMembershipsForRoom(room, rtcSession.sessionDescription).length > 0;
|
||||||
|
|
||||||
const intent = CallEmbed.getIntent(dm, ongoing, pref?.video);
|
const intent = CallEmbed.getIntent(dm, ongoing, pref?.video);
|
||||||
const widget = CallEmbed.getWidget(mx, room, intent, themeKind);
|
const widget = CallEmbed.getWidget(mx, room, intent, themeKind);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { useCallJoined } from './useCallEmbed';
|
||||||
export const useCallSpeakers = (callEmbed: CallEmbed): Set<string> => {
|
export const useCallSpeakers = (callEmbed: CallEmbed): Set<string> => {
|
||||||
const [speakers, setSpeakers] = useState(new Set<string>());
|
const [speakers, setSpeakers] = useState(new Set<string>());
|
||||||
const callSession = useCallSession(callEmbed.room);
|
const callSession = useCallSession(callEmbed.room);
|
||||||
const callMembers = useCallMembers(callSession);
|
const callMembers = useCallMembers(callEmbed.room, callSession);
|
||||||
const joined = useCallJoined(callEmbed);
|
const joined = useCallJoined(callEmbed);
|
||||||
|
|
||||||
const videoContainers = useMemo(() => {
|
const videoContainers = useMemo(() => {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ export function AuthFooter() {
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
v4.12.6
|
v4.12.1
|
||||||
</Text>
|
</Text>
|
||||||
<Text as="a" size="T300" href="https://twitter.com/cinnyapp" target="_blank" rel="noreferrer">
|
<Text as="a" size="T300" href="https://twitter.com/cinnyapp" target="_blank" rel="noreferrer">
|
||||||
Twitter
|
Twitter
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export function WelcomePage() {
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer noopener"
|
rel="noreferrer noopener"
|
||||||
>
|
>
|
||||||
v4.12.6
|
v4.12.1
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,8 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||||
|
|
||||||
private iframe: HTMLIFrameElement;
|
private iframe: HTMLIFrameElement;
|
||||||
|
|
||||||
private bodyMutationObserver: MutationObserver;
|
|
||||||
|
|
||||||
private controlMutationObserver: MutationObserver;
|
private controlMutationObserver: MutationObserver;
|
||||||
|
|
||||||
private mediaStatePromiseResolver: undefined | (() => void);
|
|
||||||
|
|
||||||
private get document(): Document | undefined {
|
private get document(): Document | undefined {
|
||||||
return this.iframe.contentDocument ?? this.iframe.contentWindow?.document;
|
return this.iframe.contentDocument ?? this.iframe.contentWindow?.document;
|
||||||
}
|
}
|
||||||
|
|
@ -32,25 +28,16 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||||
return screenshareBtn ?? undefined;
|
return screenshareBtn ?? undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private get leaveButton(): Element | undefined {
|
private get settingsButton(): HTMLElement | undefined {
|
||||||
const leaveBtn = this.document?.querySelector('[data-testid="incall_leave"]');
|
const leaveBtn = this.document?.querySelector('[data-testid="incall_leave"]');
|
||||||
|
|
||||||
return leaveBtn ?? undefined;
|
const settingsButton = leaveBtn?.previousElementSibling as HTMLElement | null;
|
||||||
}
|
|
||||||
|
|
||||||
private get settingsButton(): HTMLElement | undefined {
|
return settingsButton ?? undefined;
|
||||||
const settingsButtonLeft = this.document?.querySelector(
|
|
||||||
'[data-testid="settings-bottom-left"]'
|
|
||||||
) as HTMLButtonElement | undefined;
|
|
||||||
const settingsButtonCenter = this.document?.querySelector(
|
|
||||||
'[data-testid="settings-bottom-center"]'
|
|
||||||
) as HTMLButtonElement | undefined;
|
|
||||||
|
|
||||||
return settingsButtonLeft ?? settingsButtonCenter ?? undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private get reactionsButton(): HTMLElement | undefined {
|
private get reactionsButton(): HTMLElement | undefined {
|
||||||
const reactionsButton = this.leaveButton?.previousElementSibling as HTMLElement | null;
|
const reactionsButton = this.settingsButton?.previousElementSibling as HTMLElement | null;
|
||||||
|
|
||||||
return reactionsButton ?? undefined;
|
return reactionsButton ?? undefined;
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +65,6 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||||
this.call = call;
|
this.call = call;
|
||||||
this.iframe = iframe;
|
this.iframe = iframe;
|
||||||
|
|
||||||
this.bodyMutationObserver = new MutationObserver(this.onBodyMutation.bind(this));
|
|
||||||
this.controlMutationObserver = new MutationObserver(this.onControlMutation.bind(this));
|
this.controlMutationObserver = new MutationObserver(this.onControlMutation.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,30 +102,6 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||||
}
|
}
|
||||||
|
|
||||||
public startObserving() {
|
public startObserving() {
|
||||||
if (!this.document) return;
|
|
||||||
|
|
||||||
this.bodyMutationObserver.observe(this.document.body, {
|
|
||||||
childList: true,
|
|
||||||
subtree: false, // only direct children of body
|
|
||||||
});
|
|
||||||
this.onBodyMutation();
|
|
||||||
}
|
|
||||||
|
|
||||||
private onBodyMutation() {
|
|
||||||
if (!this.document) return;
|
|
||||||
|
|
||||||
this.document.body.style.setProperty('background', 'none', 'important');
|
|
||||||
|
|
||||||
const controls = this.leaveButton?.parentElement?.parentElement;
|
|
||||||
if (controls) {
|
|
||||||
controls.style.setProperty('position', 'absolute');
|
|
||||||
controls.style.setProperty('visibility', 'hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.observeControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
private observeControls() {
|
|
||||||
this.controlMutationObserver.disconnect();
|
this.controlMutationObserver.disconnect();
|
||||||
|
|
||||||
const screenshareBtn = this.screenshareButton;
|
const screenshareBtn = this.screenshareButton;
|
||||||
|
|
@ -163,14 +125,8 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||||
this.setSound(this.sound);
|
this.setSound(this.sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async setMediaState(state: ElementMediaStatePayload) {
|
private setMediaState(state: ElementMediaStatePayload) {
|
||||||
const data = await this.call.transport.send(ElementWidgetActions.DeviceMute, state);
|
return this.call.transport.send(ElementWidgetActions.DeviceMute, state);
|
||||||
return new Promise<typeof data>(resolve => {
|
|
||||||
if (this.mediaStatePromiseResolver) {
|
|
||||||
this.mediaStatePromiseResolver();
|
|
||||||
}
|
|
||||||
this.mediaStatePromiseResolver = () => resolve(data);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private setSound(sound: boolean): void {
|
private setSound(sound: boolean): void {
|
||||||
|
|
@ -201,14 +157,9 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||||
if (this.microphone && !this.sound) {
|
if (this.microphone && !this.sound) {
|
||||||
this.toggleSound();
|
this.toggleSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mediaStatePromiseResolver) {
|
|
||||||
this.mediaStatePromiseResolver();
|
|
||||||
this.mediaStatePromiseResolver = undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private onControlMutation() {
|
public onControlMutation() {
|
||||||
const screenshare: boolean = this.screenshareButton?.getAttribute('data-kind') === 'primary';
|
const screenshare: boolean = this.screenshareButton?.getAttribute('data-kind') === 'primary';
|
||||||
const spotlight: boolean = this.spotlightButton?.checked ?? false;
|
const spotlight: boolean = this.spotlightButton?.checked ?? false;
|
||||||
|
|
||||||
|
|
@ -279,7 +230,6 @@ export class CallControl extends EventEmitter implements CallControlState {
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose() {
|
public dispose() {
|
||||||
this.bodyMutationObserver.disconnect();
|
|
||||||
this.controlMutationObserver.disconnect();
|
this.controlMutationObserver.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,10 +172,6 @@ export class CallEmbed {
|
||||||
|
|
||||||
const controlState = initialControlState ?? new CallControlState(true, false, true);
|
const controlState = initialControlState ?? new CallControlState(true, false, true);
|
||||||
this.control = new CallControl(controlState, call, iframe);
|
this.control = new CallControl(controlState, call, iframe);
|
||||||
this.control.startObserving();
|
|
||||||
iframe.onload = () => {
|
|
||||||
this.control.startObserving();
|
|
||||||
};
|
|
||||||
|
|
||||||
let initialMediaEvent = true;
|
let initialMediaEvent = true;
|
||||||
this.disposables.push(
|
this.disposables.push(
|
||||||
|
|
@ -276,6 +272,21 @@ export class CallEmbed {
|
||||||
|
|
||||||
private onCallJoined(): void {
|
private onCallJoined(): void {
|
||||||
this.joined = true;
|
this.joined = true;
|
||||||
|
this.applyStyles();
|
||||||
|
this.control.startObserving();
|
||||||
|
}
|
||||||
|
|
||||||
|
private applyStyles(): void {
|
||||||
|
const doc = this.document;
|
||||||
|
if (!doc) return;
|
||||||
|
|
||||||
|
doc.body.style.setProperty('background', 'none', 'important');
|
||||||
|
const controls = doc.body.querySelector('[data-testid="incall_leave"]')?.parentElement
|
||||||
|
?.parentElement;
|
||||||
|
if (controls) {
|
||||||
|
controls.style.setProperty('position', 'absolute');
|
||||||
|
controls.style.setProperty('visibility', 'hidden');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onEvent(ev: MatrixEvent): void {
|
private onEvent(ev: MatrixEvent): void {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import {
|
||||||
type IWidgetApiErrorResponseDataDetails,
|
type IWidgetApiErrorResponseDataDetails,
|
||||||
type ISearchUserDirectoryResult,
|
type ISearchUserDirectoryResult,
|
||||||
type IGetMediaConfigResult,
|
type IGetMediaConfigResult,
|
||||||
|
type UpdateDelayedEventAction,
|
||||||
OpenIDRequestState,
|
OpenIDRequestState,
|
||||||
SimpleObservable,
|
SimpleObservable,
|
||||||
IOpenIDUpdate,
|
IOpenIDUpdate,
|
||||||
|
|
@ -52,11 +53,14 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
stateKey: string | null = null,
|
stateKey: string | null = null,
|
||||||
targetRoomId: string | null = null
|
targetRoomId: string | null = null
|
||||||
): Promise<ISendEventDetails> {
|
): Promise<ISendEventDetails> {
|
||||||
|
const client = this.mx;
|
||||||
const roomId = targetRoomId || this.inRoomId;
|
const roomId = targetRoomId || this.inRoomId;
|
||||||
|
|
||||||
|
if (!client || !roomId) throw new Error('Not in a room or not attached to a client');
|
||||||
|
|
||||||
let r: { event_id: string } | null;
|
let r: { event_id: string } | null;
|
||||||
if (typeof stateKey === 'string') {
|
if (typeof stateKey === 'string') {
|
||||||
r = await this.mx.sendStateEvent(
|
r = await client.sendStateEvent(
|
||||||
roomId,
|
roomId,
|
||||||
eventType as keyof StateEvents,
|
eventType as keyof StateEvents,
|
||||||
content as StateEvents[keyof StateEvents],
|
content as StateEvents[keyof StateEvents],
|
||||||
|
|
@ -64,9 +68,9 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
);
|
);
|
||||||
} else if (eventType === EventType.RoomRedaction) {
|
} else if (eventType === EventType.RoomRedaction) {
|
||||||
// special case: extract the `redacts` property and call redact
|
// special case: extract the `redacts` property and call redact
|
||||||
r = await this.mx.redactEvent(roomId, content.redacts);
|
r = await client.redactEvent(roomId, content.redacts);
|
||||||
} else {
|
} else {
|
||||||
r = await this.mx.sendEvent(
|
r = await client.sendEvent(
|
||||||
roomId,
|
roomId,
|
||||||
eventType as keyof TimelineEvents,
|
eventType as keyof TimelineEvents,
|
||||||
content as TimelineEvents[keyof TimelineEvents]
|
content as TimelineEvents[keyof TimelineEvents]
|
||||||
|
|
@ -84,8 +88,11 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
stateKey: string | null = null,
|
stateKey: string | null = null,
|
||||||
targetRoomId: string | null = null
|
targetRoomId: string | null = null
|
||||||
): Promise<ISendDelayedEventDetails> {
|
): Promise<ISendDelayedEventDetails> {
|
||||||
|
const client = this.mx;
|
||||||
const roomId = targetRoomId || this.inRoomId;
|
const roomId = targetRoomId || this.inRoomId;
|
||||||
|
|
||||||
|
if (!client || !roomId) throw new Error('Not in a room or not attached to a client');
|
||||||
|
|
||||||
let delayOpts;
|
let delayOpts;
|
||||||
if (delay !== null) {
|
if (delay !== null) {
|
||||||
delayOpts = {
|
delayOpts = {
|
||||||
|
|
@ -103,7 +110,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
let r: SendDelayedEventResponse | null;
|
let r: SendDelayedEventResponse | null;
|
||||||
if (stateKey !== null) {
|
if (stateKey !== null) {
|
||||||
// state event
|
// state event
|
||||||
r = await this.mx._unstable_sendDelayedStateEvent(
|
r = await client._unstable_sendDelayedStateEvent(
|
||||||
roomId,
|
roomId,
|
||||||
delayOpts,
|
delayOpts,
|
||||||
eventType as keyof StateEvents,
|
eventType as keyof StateEvents,
|
||||||
|
|
@ -112,7 +119,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// message event
|
// message event
|
||||||
r = await this.mx._unstable_sendDelayedEvent(
|
r = await client._unstable_sendDelayedEvent(
|
||||||
roomId,
|
roomId,
|
||||||
delayOpts,
|
delayOpts,
|
||||||
null,
|
null,
|
||||||
|
|
@ -127,16 +134,15 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async cancelScheduledDelayedEvent(delayId: string): Promise<void> {
|
public async updateDelayedEvent(
|
||||||
await this.mx._unstable_cancelScheduledDelayedEvent(delayId);
|
delayId: string,
|
||||||
}
|
action: UpdateDelayedEventAction
|
||||||
|
): Promise<void> {
|
||||||
|
const client = this.mx;
|
||||||
|
|
||||||
public async restartScheduledDelayedEvent(delayId: string): Promise<void> {
|
if (!client) throw new Error('Not in a room or not attached to a client');
|
||||||
await this.mx._unstable_restartScheduledDelayedEvent(delayId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async sendScheduledDelayedEvent(delayId: string): Promise<void> {
|
await client._unstable_updateDelayedEvent(delayId, action);
|
||||||
await this.mx._unstable_sendScheduledDelayedEvent(delayId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendToDevice(
|
public async sendToDevice(
|
||||||
|
|
@ -144,8 +150,10 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
encrypted: boolean,
|
encrypted: boolean,
|
||||||
contentMap: { [userId: string]: { [deviceId: string]: object } }
|
contentMap: { [userId: string]: { [deviceId: string]: object } }
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
const client = this.mx;
|
||||||
|
|
||||||
if (encrypted) {
|
if (encrypted) {
|
||||||
const crypto = this.mx.getCrypto();
|
const crypto = client.getCrypto();
|
||||||
if (!crypto) throw new Error('E2EE not enabled');
|
if (!crypto) throw new Error('E2EE not enabled');
|
||||||
|
|
||||||
// attempt to re-batch these up into a single request
|
// attempt to re-batch these up into a single request
|
||||||
|
|
@ -171,11 +179,11 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
JSON.parse(stringifiedContent)
|
JSON.parse(stringifiedContent)
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.mx.queueToDevice(batch);
|
await client.queueToDevice(batch);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await this.mx.queueToDevice({
|
await client.queueToDevice({
|
||||||
eventType,
|
eventType,
|
||||||
batch: Object.entries(contentMap).flatMap(([userId, userContentMap]) =>
|
batch: Object.entries(contentMap).flatMap(([userId, userContentMap]) =>
|
||||||
Object.entries(userContentMap).map(([deviceId, content]) => ({
|
Object.entries(userContentMap).map(([deviceId, content]) => ({
|
||||||
|
|
@ -255,6 +263,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
limit?: number,
|
limit?: number,
|
||||||
direction?: 'f' | 'b'
|
direction?: 'f' | 'b'
|
||||||
): Promise<IReadEventRelationsResult> {
|
): Promise<IReadEventRelationsResult> {
|
||||||
|
const client = this.mx;
|
||||||
const dir = direction as Direction;
|
const dir = direction as Direction;
|
||||||
const targetRoomId = roomId ?? this.inRoomId ?? undefined;
|
const targetRoomId = roomId ?? this.inRoomId ?? undefined;
|
||||||
|
|
||||||
|
|
@ -262,7 +271,7 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
throw new Error('Error while reading the current room');
|
throw new Error('Error while reading the current room');
|
||||||
}
|
}
|
||||||
|
|
||||||
const { events, nextBatch, prevBatch } = await this.mx.relations(
|
const { events, nextBatch, prevBatch } = await client.relations(
|
||||||
targetRoomId,
|
targetRoomId,
|
||||||
eventId,
|
eventId,
|
||||||
relationType ?? null,
|
relationType ?? null,
|
||||||
|
|
@ -281,7 +290,9 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
searchTerm: string,
|
searchTerm: string,
|
||||||
limit?: number
|
limit?: number
|
||||||
): Promise<ISearchUserDirectoryResult> {
|
): Promise<ISearchUserDirectoryResult> {
|
||||||
const { limited, results } = await this.mx.searchUserDirectory({ term: searchTerm, limit });
|
const client = this.mx;
|
||||||
|
|
||||||
|
const { limited, results } = await client.searchUserDirectory({ term: searchTerm, limit });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
limited,
|
limited,
|
||||||
|
|
@ -294,11 +305,15 @@ export class CallWidgetDriver extends WidgetDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getMediaConfig(): Promise<IGetMediaConfigResult> {
|
public async getMediaConfig(): Promise<IGetMediaConfigResult> {
|
||||||
return this.mx.getMediaConfig();
|
const client = this.mx;
|
||||||
|
|
||||||
|
return client.getMediaConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async uploadFile(file: XMLHttpRequestBodyInit): Promise<{ contentUri: string }> {
|
public async uploadFile(file: XMLHttpRequestBodyInit): Promise<{ contentUri: string }> {
|
||||||
const uploadResult = await this.mx.uploadContent(file);
|
const client = this.mx;
|
||||||
|
|
||||||
|
const uploadResult = await client.uploadContent(file);
|
||||||
|
|
||||||
return { contentUri: uploadResult.content_uri };
|
return { contentUri: uploadResult.content_uri };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue