diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3683b106..750dc652 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,30 +1,30 @@ # Docs: -version: 2 -updates: - - package-ecosystem: npm - directory: / - schedule: - interval: weekly - day: "tuesday" - time: "01:00" - timezone: "Asia/Kolkata" - open-pull-requests-limit: 15 +# version: 2 +# updates: +# - package-ecosystem: npm +# directory: / +# schedule: +# interval: weekly +# day: "tuesday" +# time: "01:00" +# timezone: "Asia/Kolkata" +# open-pull-requests-limit: 15 - - package-ecosystem: github-actions - directory: / - schedule: - interval: weekly - day: "tuesday" - time: "01:00" - timezone: "Asia/Kolkata" - open-pull-requests-limit: 5 +# - package-ecosystem: github-actions +# directory: / +# schedule: +# interval: weekly +# day: "tuesday" +# time: "01:00" +# timezone: "Asia/Kolkata" +# open-pull-requests-limit: 5 - - package-ecosystem: docker - directory: / - schedule: - interval: weekly - day: "tuesday" - time: "01:00" - timezone: "Asia/Kolkata" - open-pull-requests-limit: 5 +# - package-ecosystem: docker +# directory: / +# schedule: +# interval: weekly +# day: "tuesday" +# time: "01:00" +# timezone: "Asia/Kolkata" +# open-pull-requests-limit: 5 diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml index ae1097be..0a3676e7 100644 --- a/.github/workflows/build-pull-request.yml +++ b/.github/workflows/build-pull-request.yml @@ -12,9 +12,9 @@ jobs: PR_NUMBER: ${{github.event.number}} steps: - name: Checkout repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Setup node - uses: actions/setup-node@v4.0.3 + uses: actions/setup-node@v4.0.4 with: node-version: 20.12.2 cache: 'npm' @@ -25,7 +25,7 @@ jobs: NODE_OPTIONS: '--max_old_space_size=4096' run: npm run build - name: Upload artifact - uses: actions/upload-artifact@v4.3.6 + uses: actions/upload-artifact@v4.5.0 with: name: preview path: dist @@ -33,7 +33,7 @@ jobs: - name: Save pr number run: echo ${PR_NUMBER} > ./pr.txt - name: Upload pr number - uses: actions/upload-artifact@v4.3.6 + uses: actions/upload-artifact@v4.5.0 with: name: pr path: ./pr.txt diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 65513427..29fe7eb2 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -12,7 +12,7 @@ jobs: - name: 'CLA Assistant' if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' # Beta Release - uses: cla-assistant/github-action@v2.5.1 + uses: cla-assistant/github-action@v2.6.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # the below token should have repo scope and must be manually added by you in the repository's secret diff --git a/.github/workflows/deploy-pull-request.yml b/.github/workflows/deploy-pull-request.yml index 72ffed87..d7b84ed9 100644 --- a/.github/workflows/deploy-pull-request.yml +++ b/.github/workflows/deploy-pull-request.yml @@ -15,7 +15,7 @@ jobs: if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Download pr number - uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 + uses: dawidd6/action-download-artifact@80620a5d27ce0ae443b965134db88467fc607b43 with: workflow: ${{ github.event.workflow.id }} run_id: ${{ github.event.workflow_run.id }} @@ -24,7 +24,7 @@ jobs: id: pr run: echo "id=$(> $GITHUB_OUTPUT - name: Download artifact - uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 + uses: dawidd6/action-download-artifact@80620a5d27ce0ae443b965134db88467fc607b43 with: workflow: ${{ github.event.workflow.id }} run_id: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml index 7c67c27a..075ae6f1 100644 --- a/.github/workflows/docker-pr.yml +++ b/.github/workflows/docker-pr.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Build Docker image - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.10.0 with: context: . push: false diff --git a/.github/workflows/lockfile.yml b/.github/workflows/lockfile.yml index 410d2f59..be52eb50 100644 --- a/.github/workflows/lockfile.yml +++ b/.github/workflows/lockfile.yml @@ -14,7 +14,7 @@ jobs: pull-requests: write steps: - name: Checkout - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: NPM Lockfile Changes uses: codepunkt/npm-lockfile-changes@b40543471c36394409466fdb277a73a0856d7891 with: diff --git a/.github/workflows/netlify-dev.yml b/.github/workflows/netlify-dev.yml index 71d34294..08a66128 100644 --- a/.github/workflows/netlify-dev.yml +++ b/.github/workflows/netlify-dev.yml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Setup node - uses: actions/setup-node@v4.0.3 + uses: actions/setup-node@v4.0.4 with: node-version: 20.12.2 cache: 'npm' diff --git a/.github/workflows/prod-deploy.yml b/.github/workflows/prod-deploy.yml index f8f13a7e..9aab29e1 100644 --- a/.github/workflows/prod-deploy.yml +++ b/.github/workflows/prod-deploy.yml @@ -10,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Setup node - uses: actions/setup-node@v4.0.3 + uses: actions/setup-node@v4.0.4 with: node-version: 20.12.2 cache: 'npm' @@ -66,7 +66,7 @@ jobs: packages: write steps: - name: Checkout repository - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.0 - name: Set up QEMU uses: docker/setup-qemu-action@v3.2.0 - name: Set up Docker Buildx @@ -84,13 +84,13 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v5.5.1 + uses: docker/metadata-action@v5.6.1 with: images: | ${{ secrets.DOCKER_USERNAME }}/cinny ghcr.io/${{ github.repository }} - name: Build and push Docker image - uses: docker/build-push-action@v6.7.0 + uses: docker/build-push-action@v6.10.0 with: context: . platforms: linux/amd64,linux/arm64 diff --git a/package-lock.json b/package-lock.json index 7435f9ce..1eb7798c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cinny", - "version": "4.2.1", + "version": "4.2.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cinny", - "version": "4.2.1", + "version": "4.2.3", "license": "AGPL-3.0-only", "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "1.1.6", @@ -45,7 +45,7 @@ "jotai": "2.6.0", "linkify-react": "4.1.3", "linkifyjs": "4.1.3", - "matrix-js-sdk": "34.5.0", + "matrix-js-sdk": "34.11.1", "millify": "6.1.0", "pdfjs-dist": "4.2.67", "prismjs": "1.29.0", @@ -2280,9 +2280,9 @@ "integrity": "sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==" }, "node_modules/@matrix-org/matrix-sdk-crypto-wasm": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@matrix-org/matrix-sdk-crypto-wasm/-/matrix-sdk-crypto-wasm-7.0.0.tgz", - "integrity": "sha512-MOencXiW/gI5MuTtCNsuojjwT5DXCrjMqv9xOslJC9h2tPdLFFFMGr58dY5Lis4DRd9MRWcgrGowUIHOqieWTA==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@matrix-org/matrix-sdk-crypto-wasm/-/matrix-sdk-crypto-wasm-9.1.0.tgz", + "integrity": "sha512-CtPoNcoRW6ehwxpRQAksG3tR+NJ7k4DV02nMFYTDwQtie1V4R8OTY77BjEIs97NOblhtS26jU8m1lWsOBEz0Og==", "license": "Apache-2.0", "engines": { "node": ">= 10" @@ -8270,12 +8270,13 @@ "integrity": "sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA==" }, "node_modules/matrix-js-sdk": { - "version": "34.5.0", - "resolved": "https://registry.npmjs.org/matrix-js-sdk/-/matrix-js-sdk-34.5.0.tgz", - "integrity": "sha512-pbp+IxAkSwGmefrlUGCrtrs3UWyqN2iWh4lKnJW+jFIlsksXq7A8vL4cS1z8LXmpcHQAg3mKNuj8n8uhm51t1A==", + "version": "34.11.1", + "resolved": "https://registry.npmjs.org/matrix-js-sdk/-/matrix-js-sdk-34.11.1.tgz", + "integrity": "sha512-rDbIUIqEsN/pbHb6haBQmjxxgeb9G3Df2IhPPOotUbX6R1KseA8yJ6TAY0YySM2zVaBV3yZ6dnKWexF/uWvZfA==", + "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.12.5", - "@matrix-org/matrix-sdk-crypto-wasm": "^7.0.0", + "@matrix-org/matrix-sdk-crypto-wasm": "^9.0.0", "@matrix-org/olm": "3.2.15", "another-json": "^0.2.0", "bs58": "^6.0.0", diff --git a/package.json b/package.json index 118f9640..1ecbc190 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cinny", - "version": "4.2.1", + "version": "4.2.3", "description": "Yet another matrix client", "main": "index.js", "type": "module", @@ -56,7 +56,7 @@ "jotai": "2.6.0", "linkify-react": "4.1.3", "linkifyjs": "4.1.3", - "matrix-js-sdk": "34.5.0", + "matrix-js-sdk": "34.11.1", "millify": "6.1.0", "pdfjs-dist": "4.2.67", "prismjs": "1.29.0", diff --git a/src/app/components/RenderMessageContent.tsx b/src/app/components/RenderMessageContent.tsx index 1ce37e5c..55b0ffc2 100644 --- a/src/app/components/RenderMessageContent.tsx +++ b/src/app/components/RenderMessageContent.tsx @@ -29,6 +29,7 @@ import { ImageViewer } from './image-viewer'; import { PdfViewer } from './Pdf-viewer'; import { TextViewer } from './text-viewer'; import { testMatrixTo } from '../plugins/matrix-to'; +import {IImageContent} from "../../types/matrix/common"; type RenderMessageContentProps = { displayName: string; @@ -67,38 +68,63 @@ export function RenderMessageContent({ ); }; + const renderCaption = () => { + const content: IImageContent = getContent(); + if(content.filename && content.filename !== content.body) { + return ( + ( + + )} + renderUrlsPreview={urlPreview ? renderUrlsPreview : undefined} + /> + ) + } + return null; + } const renderFile = () => ( - ( - ( - + ( + } - /> - )} - renderAsTextFile={() => ( - } - /> - )} - > - - - )} - outlined={outlineAttachment} - /> + renderAsPdfFile={() => ( + } + /> + )} + renderAsTextFile={() => ( + } + /> + )} + > + + + + )} + outlined={outlineAttachment} + /> + {renderCaption()} + ); if (msgType === MsgType.Text) { @@ -158,36 +184,40 @@ export function RenderMessageContent({ if (msgType === MsgType.Image) { return ( - ( - } - renderViewer={(p) => } - /> - )} - outlined={outlineAttachment} - /> + <> + ( + } + renderViewer={(p) => } + /> + )} + outlined={outlineAttachment} + /> + {renderCaption()} + ); } if (msgType === MsgType.Video) { return ( - ( - ( + <> + ( + ( ( @@ -195,26 +225,33 @@ export function RenderMessageContent({ )} /> ) - : undefined - } - renderVideo={(p) =>