mirror of
https://github.com/element-hq/element-desktop.git
synced 2026-01-03 13:07:55 -05:00
Compare commits
1 Commits
v1.11.91
...
dbkr/lruca
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3266be0772 |
22
.eslintrc-hak.js
Normal file
22
.eslintrc-hak.js
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
plugins: ["matrix-org"],
|
||||
extends: [".eslintrc.js"],
|
||||
parserOptions: {
|
||||
project: ["hak/tsconfig.json"],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ["hak/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
22
.eslintrc-scripts.js
Normal file
22
.eslintrc-scripts.js
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
plugins: ["matrix-org"],
|
||||
extends: [".eslintrc.js"],
|
||||
parserOptions: {
|
||||
project: ["scripts/tsconfig.json"],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ["scripts/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
22
.eslintrc-test.js
Normal file
22
.eslintrc-test.js
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
plugins: ["matrix-org"],
|
||||
extends: [".eslintrc.js"],
|
||||
parserOptions: {
|
||||
project: ["playwright/tsconfig.json"],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ["playwright/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,88 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: ["matrix-org", "n"],
|
||||
extends: ["plugin:matrix-org/javascript"],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2021,
|
||||
project: ["tsconfig.json"],
|
||||
},
|
||||
env: {
|
||||
es6: true,
|
||||
node: true,
|
||||
// we also have some browser code (ie. the preload script)
|
||||
browser: true,
|
||||
},
|
||||
// NOTE: These rules are frozen and new rules should not be added here.
|
||||
// New changes belong in https://github.com/matrix-org/eslint-plugin-matrix-org/
|
||||
rules: {
|
||||
"quotes": "off",
|
||||
"indent": "off",
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"no-async-promise-executor": "off",
|
||||
|
||||
"n/file-extension-in-import": ["error", "always"],
|
||||
"unicorn/prefer-node-protocol": ["error"],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ["src/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["hak/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
parserOptions: {
|
||||
project: ["hak/tsconfig.json"],
|
||||
},
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["scripts/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
parserOptions: {
|
||||
project: ["scripts/tsconfig.json"],
|
||||
},
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["playwright/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
parserOptions: {
|
||||
project: ["playwright/tsconfig.json"],
|
||||
},
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
37
.eslintrc.js
Normal file
37
.eslintrc.js
Normal file
@@ -0,0 +1,37 @@
|
||||
module.exports = {
|
||||
plugins: ["matrix-org"],
|
||||
extends: ["plugin:matrix-org/javascript"],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2021,
|
||||
project: ["tsconfig.json"],
|
||||
},
|
||||
env: {
|
||||
es6: true,
|
||||
node: true,
|
||||
// we also have some browser code (ie. the preload script)
|
||||
browser: true,
|
||||
},
|
||||
// NOTE: These rules are frozen and new rules should not be added here.
|
||||
// New changes belong in https://github.com/matrix-org/eslint-plugin-matrix-org/
|
||||
rules: {
|
||||
"quotes": "off",
|
||||
"indent": "off",
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"no-async-promise-executor": "off",
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ["src/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +1 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Bug report for the Element flatpak app
|
||||
url: https://github.com/flathub/im.riot.Riot/issues
|
||||
about: Please file bugs with the Flatpak application on the respective repository.
|
||||
|
||||
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] Ensure your code works with manual testing.
|
||||
- [ ] New or updated `public`/`exported` symbols have accurate [TSDoc](https://tsdoc.org/) documentation.
|
||||
- [ ] Linter and other CI checks pass.
|
||||
- [ ] I have licensed the changes to Element by completing the [Contributor License Agreement (CLA)](https://cla-assistant.io/element-hq/element-desktop)
|
||||
- [ ] Ensure your code works with manual testing.
|
||||
- [ ] New or updated `public`/`exported` symbols have accurate [TSDoc](https://tsdoc.org/) documentation.
|
||||
- [ ] Linter and other CI checks pass.
|
||||
- [ ] I have licensed the changes to Element by completing the [Contributor License Agreement (CLA)](https://cla-assistant.io/element-hq/element-desktop)
|
||||
|
||||
4
.github/workflows/backport.yml
vendored
4
.github/workflows/backport.yml
vendored
@@ -7,12 +7,10 @@ on:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
permissions: {} # We use ELEMENT_BOT_TOKEN instead
|
||||
|
||||
jobs:
|
||||
backport:
|
||||
name: Backport
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
# Only react to merged PRs for security reasons.
|
||||
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
|
||||
if: >
|
||||
|
||||
7
.github/workflows/build_and_deploy.yaml
vendored
7
.github/workflows/build_and_deploy.yaml
vendored
@@ -41,12 +41,9 @@ run-name: Element ${{ inputs.mode != 'release' && github.event_name != 'release'
|
||||
concurrency: ${{ github.workflow }}
|
||||
env:
|
||||
R2_BUCKET: ${{ vars.R2_BUCKET }}
|
||||
permissions: {} # Uses ELEMENT_BOT_TOKEN
|
||||
jobs:
|
||||
prepare:
|
||||
uses: ./.github/workflows/build_prepare.yaml
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
config: element.io/${{ inputs.mode || (github.event_name == 'release' && 'release') || 'nightly' }}
|
||||
version: ${{ (inputs.mode != 'release' && github.event_name != 'release') && 'develop' || '' }}
|
||||
@@ -102,7 +99,7 @@ jobs:
|
||||
- macos
|
||||
- linux
|
||||
- windows
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
name: ${{ needs.prepare.outputs.deploy == 'true' && 'Deploy' || 'Deploy (dry-run)' }}
|
||||
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
|
||||
environment: ${{ needs.prepare.outputs.deploy == 'true' && 'packages.element.io' || '' }}
|
||||
@@ -255,7 +252,7 @@ jobs:
|
||||
|
||||
deploy-ess:
|
||||
needs: deploy
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploy builds to ESS
|
||||
if: needs.prepare.outputs.deploy == 'true' && github.event_name == 'release'
|
||||
env:
|
||||
|
||||
15
.github/workflows/build_and_test.yaml
vendored
15
.github/workflows/build_and_test.yaml
vendored
@@ -6,12 +6,9 @@ on:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
permissions: {} # No permissions required
|
||||
jobs:
|
||||
fetch:
|
||||
uses: ./.github/workflows/build_prepare.yaml
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
|
||||
version: ${{ github.event.pull_request.base.ref == 'develop' && 'develop' || '' }}
|
||||
@@ -53,7 +50,7 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- name: macOS Universal
|
||||
os: macos-14
|
||||
os: macos-latest
|
||||
artifact: macos
|
||||
executable: "/Users/runner/Applications/Element.app/Contents/MacOS/Element"
|
||||
# We need to mount the DMG and copy the app to the Applications folder as a mounted DMG is
|
||||
@@ -63,12 +60,12 @@ jobs:
|
||||
rsync -a /Volumes/Element/Element.app ~/Applications/ &&
|
||||
hdiutil detach /Volumes/Element
|
||||
- name: "Linux (amd64) (sqlcipher: system)"
|
||||
os: ubuntu-22.04
|
||||
os: ubuntu-latest
|
||||
artifact: linux-amd64-sqlcipher-system
|
||||
executable: "/opt/Element/element-desktop"
|
||||
prepare_cmd: "sudo apt-get -qq update && sudo apt install ./dist/*.deb"
|
||||
- name: "Linux (amd64) (sqlcipher: static)"
|
||||
os: ubuntu-22.04
|
||||
os: ubuntu-latest
|
||||
artifact: linux-amd64-sqlcipher-static
|
||||
executable: "/opt/Element/element-desktop"
|
||||
prepare_cmd: "sudo apt-get -qq update && sudo apt install ./dist/*.deb"
|
||||
@@ -83,11 +80,11 @@ jobs:
|
||||
executable: "/opt/Element/element-desktop"
|
||||
prepare_cmd: "sudo apt-get -qq update && sudo apt install -y ./dist/*.deb"
|
||||
- name: Windows (x86)
|
||||
os: windows-2022
|
||||
os: windows-latest
|
||||
artifact: win-ia32
|
||||
executable: "./dist/win-ia32-unpacked/Element.exe"
|
||||
- name: Windows (x64)
|
||||
os: windows-2022
|
||||
os: windows-latest
|
||||
artifact: win-x64
|
||||
executable: "./dist/win-unpacked/Element.exe"
|
||||
name: Test ${{ matrix.name }}
|
||||
@@ -135,7 +132,7 @@ jobs:
|
||||
RUN_AS: ${{ runner.os == 'Linux' && 'sudo' || '' }}
|
||||
|
||||
- name: Workaround macOS GHA permission issues
|
||||
if: runner.os == 'macOS'
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);"
|
||||
sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/opt/off/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);"
|
||||
|
||||
11
.github/workflows/build_linux.yaml
vendored
11
.github/workflows/build_linux.yaml
vendored
@@ -22,12 +22,11 @@ on:
|
||||
description: "How to link sqlcipher, one of 'system' | 'static'"
|
||||
env:
|
||||
SQLCIPHER_BUNDLED: ${{ inputs.sqlcipher == 'static' && '1' || '' }}
|
||||
permissions: {} # No permissions required
|
||||
jobs:
|
||||
# We build the hak files on native infrastructure as matrix-seshat fails to cross-compile properly
|
||||
# https://github.com/matrix-org/seshat/issues/135
|
||||
hak:
|
||||
runs-on: ${{ inputs.arch == 'arm64' && 'dind-l-arm64' || 'ubuntu-22.04' }}
|
||||
runs-on: ${{ inputs.arch == 'arm64' && 'dind-l-arm64' || 'ubuntu-latest' }}
|
||||
env:
|
||||
HAK_DOCKER_IMAGE: ghcr.io/element-hq/element-desktop-dockerbuild
|
||||
outputs:
|
||||
@@ -113,14 +112,14 @@ jobs:
|
||||
- name: "Get modified files"
|
||||
id: changed_files
|
||||
if: steps.cache.outputs.cache-hit != 'true' && github.event_name == 'pull_request'
|
||||
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45
|
||||
uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c # v45
|
||||
with:
|
||||
files: |
|
||||
dockerbuild/**
|
||||
|
||||
# This allows contributors to test changes to the dockerbuild image within a pull request
|
||||
- name: Build docker image
|
||||
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
|
||||
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
|
||||
if: steps.changed_files.outputs.any_modified == 'true'
|
||||
with:
|
||||
context: dockerbuild
|
||||
@@ -145,11 +144,11 @@ jobs:
|
||||
./scripts/glibc-check.sh $filename
|
||||
done
|
||||
env:
|
||||
MAX_VER: 2.31 # bullseye-era glibc
|
||||
MAX_VER: 2.28 # buster-era glibc
|
||||
|
||||
build:
|
||||
needs: hak
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
3
.github/workflows/build_macos.yaml
vendored
3
.github/workflows/build_macos.yaml
vendored
@@ -27,7 +27,6 @@ on:
|
||||
type: string
|
||||
required: false
|
||||
description: "The URL to which the output will be deployed."
|
||||
permissions: {} # No permissions required
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-14 # M1
|
||||
@@ -87,7 +86,7 @@ jobs:
|
||||
run: |
|
||||
yarn build:universal --publish never
|
||||
env:
|
||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
ED_NOTARYTOOL_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CSC_KEY_PASSWORD }}
|
||||
|
||||
12
.github/workflows/build_prepare.yaml
vendored
12
.github/workflows/build_prepare.yaml
vendored
@@ -41,14 +41,11 @@ on:
|
||||
deploy:
|
||||
description: "The relative path to the config file for this run"
|
||||
value: ${{ inputs.deploy }}
|
||||
permissions: {}
|
||||
jobs:
|
||||
prepare:
|
||||
name: Prepare
|
||||
environment: ${{ inputs.nightly && 'packages.element.io' || '' }}
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: read
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
nightly-version: ${{ steps.versions.outputs.nightly }}
|
||||
steps:
|
||||
@@ -68,8 +65,7 @@ jobs:
|
||||
# We split this out to save the build_* scripts having to do it to make use of `hashFiles` in the cache action
|
||||
- name: Generate cache hash files
|
||||
run: |
|
||||
# Add --no-sandbox as otherwise it fails because the helper isn't setuid root. It's only getting the version.
|
||||
yarn run --silent electron --no-sandbox --version > electronVersion
|
||||
yarn run --silent electron --version > electronVersion
|
||||
cat package.json | jq -c .hakDependencies | sha1sum > hakHash
|
||||
find hak -type f -print0 | xargs -0 sha1sum >> hakHash
|
||||
find scripts/hak -type f -print0 | xargs -0 sha1sum >> hakHash
|
||||
@@ -130,7 +126,8 @@ jobs:
|
||||
BUNDLE_HASH=$(npx asar l webapp.asar | grep /bundles/ | head -n 1 | sed 's|.*/||')
|
||||
WEBAPP_VERSION=$(./scripts/get-version.ts)
|
||||
WEB_VERSION=${WEBAPP_VERSION:0:12}
|
||||
JS_VERSION=${WEBAPP_VERSION:16:12}
|
||||
REACT_VERSION=${WEBAPP_VERSION:19:12}
|
||||
JS_VERSION=${WEBAPP_VERSION:35:12}
|
||||
|
||||
echo "### Nightly build ${{ steps.versions.outputs.nightly }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
@@ -138,6 +135,7 @@ jobs:
|
||||
echo "| ----------- | ------- |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Bundle Hash | $BUNDLE_HASH |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Element Web | [$WEB_VERSION](https://github.com/element-hq/element-web/commit/$WEB_VERSION) |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| React SDK | [$REACT_VERSION](https://github.com/matrix-org/matrix-react-sdk/commit/$REACT_VERSION) |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| JS SDK | [$JS_VERSION](https://github.com/matrix-org/matrix-js-sdk/commit/$JS_VERSION) |" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
|
||||
5
.github/workflows/build_windows.yaml
vendored
5
.github/workflows/build_windows.yaml
vendored
@@ -2,7 +2,7 @@
|
||||
# Due to this extra care must be taken to only ever run all build_* scripts against the same branch to ensure
|
||||
# the correct cache scoping, and additional care must be taken to not run untrusted actions on the develop branch.
|
||||
|
||||
# Windows GHA runner by default uses the pwsh shell which breaks codeSigningCert in the workflow
|
||||
# window-latest by default uses the pwsh shell which breaks codeSigningCert in the workflow
|
||||
defaults:
|
||||
run:
|
||||
shell: powershell
|
||||
@@ -28,10 +28,9 @@ on:
|
||||
type: string
|
||||
required: false
|
||||
description: "Whether to sign & notarise the build, requires 'packages.element.io' environment"
|
||||
permissions: {} # No permissions required
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2022
|
||||
runs-on: windows-latest
|
||||
environment: ${{ inputs.sign && 'packages.element.io' || '' }}
|
||||
env:
|
||||
SIGNTOOL_PATH: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22000.0/x86/signtool.exe"
|
||||
|
||||
11
.github/workflows/dockerbuild.yaml
vendored
11
.github/workflows/dockerbuild.yaml
vendored
@@ -9,11 +9,10 @@ concurrency: ${{ github.workflow }}-${{ github.ref_name }}
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}-dockerbuild
|
||||
permissions: {}
|
||||
jobs:
|
||||
build:
|
||||
name: Docker Build
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
@@ -24,12 +23,12 @@ jobs:
|
||||
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
|
||||
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
|
||||
uses: docker/login-action@3b8fed7e4b60203b2aa0ecc6c6d6d91d12c06760
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
@@ -37,14 +36,14 @@ jobs:
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5
|
||||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6
|
||||
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
|
||||
with:
|
||||
context: dockerbuild
|
||||
push: true
|
||||
|
||||
2
.github/workflows/localazy_download.yaml
vendored
2
.github/workflows/localazy_download.yaml
vendored
@@ -3,8 +3,6 @@ on:
|
||||
workflow_dispatch: {}
|
||||
schedule:
|
||||
- cron: "0 6 * * 1,3,5" # Every Monday, Wednesday and Friday at 6am UTC
|
||||
permissions:
|
||||
pull-requests: write # needed to auto-approve PRs
|
||||
jobs:
|
||||
download:
|
||||
uses: matrix-org/matrix-web-i18n/.github/workflows/localazy_download.yaml@main
|
||||
|
||||
1
.github/workflows/localazy_upload.yaml
vendored
1
.github/workflows/localazy_upload.yaml
vendored
@@ -4,7 +4,6 @@ on:
|
||||
branches: [develop]
|
||||
paths:
|
||||
- "src/i18n/strings/en_EN.json"
|
||||
permissions: {} # No permissions needed
|
||||
jobs:
|
||||
upload:
|
||||
uses: matrix-org/matrix-web-i18n/.github/workflows/localazy_upload.yaml@main
|
||||
|
||||
3
.github/workflows/pull_request.yaml
vendored
3
.github/workflows/pull_request.yaml
vendored
@@ -2,11 +2,8 @@ name: Pull Request
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited, labeled, unlabeled, synchronize]
|
||||
permissions: {}
|
||||
jobs:
|
||||
action:
|
||||
uses: matrix-org/matrix-js-sdk/.github/workflows/pull_request.yaml@develop
|
||||
permissions:
|
||||
pull-requests: write
|
||||
secrets:
|
||||
ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||
|
||||
3
.github/workflows/release-drafter.yml
vendored
3
.github/workflows/release-drafter.yml
vendored
@@ -4,11 +4,8 @@ on:
|
||||
branches: [staging]
|
||||
workflow_dispatch: {}
|
||||
concurrency: ${{ github.workflow }}
|
||||
permissions: {}
|
||||
jobs:
|
||||
draft:
|
||||
uses: matrix-org/matrix-js-sdk/.github/workflows/release-drafter-workflow.yml@develop
|
||||
permissions:
|
||||
contents: write
|
||||
with:
|
||||
include-changes: element-hq/element-web~$VERSION
|
||||
|
||||
1
.github/workflows/release-gitflow.yml
vendored
1
.github/workflows/release-gitflow.yml
vendored
@@ -4,7 +4,6 @@ on:
|
||||
push:
|
||||
branches: [master]
|
||||
concurrency: ${{ github.repository }}-${{ github.workflow }}
|
||||
permissions: {} # Uses ELEMENT_BOT_TOKEN
|
||||
jobs:
|
||||
merge:
|
||||
uses: matrix-org/matrix-js-sdk/.github/workflows/release-gitflow.yml@develop
|
||||
|
||||
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@@ -11,14 +11,9 @@ on:
|
||||
- rc
|
||||
- final
|
||||
concurrency: ${{ github.workflow }}
|
||||
permissions: {}
|
||||
jobs:
|
||||
release:
|
||||
uses: matrix-org/matrix-js-sdk/.github/workflows/release-make.yml@develop
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: read
|
||||
secrets:
|
||||
ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
@@ -31,9 +26,7 @@ jobs:
|
||||
check:
|
||||
name: Post release checks
|
||||
needs: release
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
checks: read
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Wait for desktop packaging
|
||||
uses: t3chguy/wait-on-check-action@18541021811b56544d90e0f073401c2b99e249d6 # fork
|
||||
@@ -41,5 +34,5 @@ jobs:
|
||||
ref: master
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
wait-interval: 10
|
||||
check-regexp: Prepare|Linux|macOS|Windows|Deploy|deploy
|
||||
check-name: Deploy
|
||||
allowed-conclusions: success
|
||||
|
||||
11
.github/workflows/static_analysis.yaml
vendored
11
.github/workflows/static_analysis.yaml
vendored
@@ -3,11 +3,10 @@ on:
|
||||
pull_request: {}
|
||||
push:
|
||||
branches: [develop, master]
|
||||
permissions: {} # No permissions needed
|
||||
jobs:
|
||||
ts_lint:
|
||||
name: "Typescript Syntax Check"
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -26,14 +25,12 @@ jobs:
|
||||
i18n_lint:
|
||||
name: "i18n Check"
|
||||
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@main
|
||||
permissions:
|
||||
pull-requests: read
|
||||
with:
|
||||
hardcoded-words: "Element"
|
||||
|
||||
js_lint:
|
||||
name: "ESLint"
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -51,7 +48,7 @@ jobs:
|
||||
|
||||
workflow_lint:
|
||||
name: "Workflow Lint"
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -69,7 +66,7 @@ jobs:
|
||||
|
||||
analyse_dead_code:
|
||||
name: "Analyse Dead Code"
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
1
.github/workflows/sync-labels.yml
vendored
1
.github/workflows/sync-labels.yml
vendored
@@ -8,7 +8,6 @@ on:
|
||||
- develop
|
||||
paths:
|
||||
- .github/labels.yml
|
||||
permissions: {} # Uses ELEMENT_BOT_TOKEN
|
||||
jobs:
|
||||
sync-labels:
|
||||
uses: element-hq/element-meta/.github/workflows/sync-labels.yml@develop
|
||||
|
||||
4
.github/workflows/triage-incoming.yml
vendored
4
.github/workflows/triage-incoming.yml
vendored
@@ -4,11 +4,9 @@ on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
permissions: {} # Uses ELEMENT_BOT_TOKEN
|
||||
|
||||
jobs:
|
||||
automate-project-columns-next:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/add-to-project@main
|
||||
with:
|
||||
|
||||
2
.github/workflows/triage-labelled.yml
vendored
2
.github/workflows/triage-labelled.yml
vendored
@@ -4,8 +4,6 @@ on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
|
||||
permissions: {} # Uses ELEMENT_BOT_TOKEN
|
||||
|
||||
jobs:
|
||||
call-triage-labelled:
|
||||
uses: element-hq/element-web/.github/workflows/triage-labelled.yml@develop
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -17,4 +17,3 @@ node_modules/
|
||||
yarn-error.log
|
||||
/hak/**/*.js
|
||||
/scripts/hak/**/*.js
|
||||
.DS_Store
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx lint-staged --concurrent false
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"*": "prettier --write",
|
||||
"*.(ts|tsx)": ["eslint --fix"]
|
||||
}
|
||||
241
CHANGELOG.md
241
CHANGELOG.md
@@ -1,244 +1,3 @@
|
||||
Changes in [1.11.91](https://github.com/element-hq/element-desktop/releases/tag/v1.11.91) (2025-01-28)
|
||||
======================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
* Implement changes to memberlist from feedback ([#29029](https://github.com/element-hq/element-web/pull/29029)). Contributed by @MidhunSureshR.
|
||||
* Add toast for recovery keys being out of sync ([#28946](https://github.com/element-hq/element-web/pull/28946)). Contributed by @dbkr.
|
||||
* Refactor LegacyCallHandler event emitter to use TypedEventEmitter ([#29008](https://github.com/element-hq/element-web/pull/29008)). Contributed by @t3chguy.
|
||||
* Add `Recovery` section in the new user settings `Encryption` tab ([#28673](https://github.com/element-hq/element-web/pull/28673)). Contributed by @florianduros.
|
||||
* Retry loading chunks to make the app more resilient ([#29001](https://github.com/element-hq/element-web/pull/29001)). Contributed by @t3chguy.
|
||||
* Clear account idb table on logout ([#28996](https://github.com/element-hq/element-web/pull/28996)). Contributed by @t3chguy.
|
||||
* Implement new memberlist design with MVVM architecture ([#28874](https://github.com/element-hq/element-web/pull/28874)). Contributed by @MidhunSureshR.
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* [Backport staging] Switch to secure random strings ([#29035](https://github.com/element-hq/element-web/pull/29035)). Contributed by @RiotRobot.
|
||||
* React to MatrixEvent sender/target being updated for rendering state events ([#28947](https://github.com/element-hq/element-web/pull/28947)). Contributed by @t3chguy.
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.90](https://github.com/element-hq/element-desktop/releases/tag/v1.11.90) (2025-01-14)
|
||||
======================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
* Docker: run as non-root ([#28849](https://github.com/element-hq/element-web/pull/28849)). Contributed by @richvdh.
|
||||
* Docker: allow configuration of HTTP listen port via env var ([#28840](https://github.com/element-hq/element-web/pull/28840)). Contributed by @richvdh.
|
||||
* Update matrix-wysiwyg to consume WASM asset ([#28838](https://github.com/element-hq/element-web/pull/28838)). Contributed by @t3chguy.
|
||||
* OIDC settings tweaks ([#28787](https://github.com/element-hq/element-web/pull/28787)). Contributed by @t3chguy.
|
||||
* Delabs native OIDC support ([#28615](https://github.com/element-hq/element-web/pull/28615)). Contributed by @t3chguy.
|
||||
* Move room header info button to right-most position ([#28754](https://github.com/element-hq/element-web/pull/28754)). Contributed by @t3chguy.
|
||||
* Enable key backup by default ([#28691](https://github.com/element-hq/element-web/pull/28691)). Contributed by @dbkr.
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* Fix building the automations mermaid diagram ([#28881](https://github.com/element-hq/element-web/pull/28881)). Contributed by @dbkr.
|
||||
* Playwright: wait for the network listener on the postgres db ([#28808](https://github.com/element-hq/element-web/pull/28808)). Contributed by @dbkr.
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.89](https://github.com/element-hq/element-desktop/releases/tag/v1.11.89) (2024-12-18)
|
||||
======================================================================================================
|
||||
* No changes
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* Upgrade matrix-sdk-crypto-wasm to 1.11.0 (https://github.com/matrix-org/matrix-js-sdk/pull/4593)
|
||||
* Fix url preview display ([#28766](https://github.com/element-hq/element-web/pull/28766)).
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.88](https://github.com/element-hq/element-desktop/releases/tag/v1.11.88) (2024-12-17)
|
||||
======================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
* Allow trusted Element Call widget to send and receive media encryption key to-device messages ([#28316](https://github.com/element-hq/element-web/pull/28316)). Contributed by @hughns.
|
||||
* increase ringing timeout from 10 seconds to 90 seconds ([#28630](https://github.com/element-hq/element-web/pull/28630)). Contributed by @fkwp.
|
||||
* Add `Close` tooltip to dialog ([#28617](https://github.com/element-hq/element-web/pull/28617)). Contributed by @florianduros.
|
||||
* New UX for Share dialog ([#28598](https://github.com/element-hq/element-web/pull/28598)). Contributed by @florianduros.
|
||||
* Improve performance of RoomContext in RoomHeader ([#28574](https://github.com/element-hq/element-web/pull/28574)). Contributed by @t3chguy.
|
||||
* Remove `Features.RustCrypto` flag ([#28582](https://github.com/element-hq/element-web/pull/28582)). Contributed by @florianduros.
|
||||
* Add Modernizr warning when running in non-secure context ([#28581](https://github.com/element-hq/element-web/pull/28581)). Contributed by @t3chguy.
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* Fix secret storage not being used due to bad import ([#2029](https://github.com/element-hq/element-desktop/pull/2029)). Contributed by @t3chguy.
|
||||
* Fix inability to click on non-logged-in modals on macOS ([#2025](https://github.com/element-hq/element-desktop/pull/2025)). Contributed by @t3chguy.
|
||||
* Fix jumpy timeline when the pinned message banner is displayed ([#28654](https://github.com/element-hq/element-web/pull/28654)). Contributed by @florianduros.
|
||||
* Fix font \& spaces in settings subsection ([#28631](https://github.com/element-hq/element-web/pull/28631)). Contributed by @florianduros.
|
||||
* Remove manual device verification which is not supported by the new cryptography stack ([#28588](https://github.com/element-hq/element-web/pull/28588)). Contributed by @florianduros.
|
||||
* Fix code block highlighting not working reliably with many code blocks ([#28613](https://github.com/element-hq/element-web/pull/28613)). Contributed by @t3chguy.
|
||||
* Remove remaining reply fallbacks code ([#28610](https://github.com/element-hq/element-web/pull/28610)). Contributed by @t3chguy.
|
||||
* Provide a way to activate GIFs via the keyboard for a11y ([#28611](https://github.com/element-hq/element-web/pull/28611)). Contributed by @t3chguy.
|
||||
* Fix format bar position ([#28591](https://github.com/element-hq/element-web/pull/28591)). Contributed by @florianduros.
|
||||
* Fix room taking long time to load ([#28579](https://github.com/element-hq/element-web/pull/28579)). Contributed by @florianduros.
|
||||
* Show the correct shield status in tooltip for more conditions ([#28476](https://github.com/element-hq/element-web/pull/28476)). Contributed by @uhoreg.
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.87](https://github.com/element-hq/element-desktop/releases/tag/v1.11.87) (2024-12-03)
|
||||
======================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
* Send and respect MSC4230 is\_animated flag ([#28513](https://github.com/element-hq/element-web/pull/28513)). Contributed by @t3chguy.
|
||||
* Display a warning when an unverified user's identity changes ([#28211](https://github.com/element-hq/element-web/pull/28211)). Contributed by @uhoreg.
|
||||
* Swap out Twitter link for Mastodon on auth footer ([#28508](https://github.com/element-hq/element-web/pull/28508)). Contributed by @t3chguy.
|
||||
* Consider `org.matrix.msc3417.call` as video room in create room dialog ([#28497](https://github.com/element-hq/element-web/pull/28497)). Contributed by @t3chguy.
|
||||
* Standardise icons using Compound Design Tokens ([#28217](https://github.com/element-hq/element-web/pull/28217)). Contributed by @t3chguy.
|
||||
* Start sending stable `m.marked_unread` events ([#28478](https://github.com/element-hq/element-web/pull/28478)). Contributed by @tulir.
|
||||
* Upgrade to compound-design-tokens v2 ([#28471](https://github.com/element-hq/element-web/pull/28471)). Contributed by @t3chguy.
|
||||
* Standardise icons using Compound Design Tokens ([#28286](https://github.com/element-hq/element-web/pull/28286)). Contributed by @t3chguy.
|
||||
* Remove reply fallbacks as per merged MSC2781 ([#28406](https://github.com/element-hq/element-web/pull/28406)). Contributed by @t3chguy.
|
||||
* Use React Suspense when rendering async modals ([#28386](https://github.com/element-hq/element-web/pull/28386)). Contributed by @t3chguy.
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* Add spinner when room encryption is loading in room settings ([#28535](https://github.com/element-hq/element-web/pull/28535)). Contributed by @florianduros.
|
||||
* Fix getOidcCallbackUrl for Element Desktop ([#28521](https://github.com/element-hq/element-web/pull/28521)). Contributed by @t3chguy.
|
||||
* Filter out redacted poll votes to avoid crashing the Poll widget ([#28498](https://github.com/element-hq/element-web/pull/28498)). Contributed by @t3chguy.
|
||||
* Fix force tab complete not working since switching to React 18 createRoot API ([#28505](https://github.com/element-hq/element-web/pull/28505)). Contributed by @t3chguy.
|
||||
* Fix media captions in bubble layout ([#28480](https://github.com/element-hq/element-web/pull/28480)). Contributed by @tulir.
|
||||
* Reset cross-signing before backup when resetting both ([#28402](https://github.com/element-hq/element-web/pull/28402)). Contributed by @uhoreg.
|
||||
* Listen to events so that encryption icon updates when status changes ([#28407](https://github.com/element-hq/element-web/pull/28407)). Contributed by @uhoreg.
|
||||
* Check that the file the user chose has a MIME type of `image/*` ([#28467](https://github.com/element-hq/element-web/pull/28467)). Contributed by @t3chguy.
|
||||
* Fix download button size in message action bar ([#28472](https://github.com/element-hq/element-web/pull/28472)). Contributed by @t3chguy.
|
||||
* Allow tab completing users in brackets ([#28460](https://github.com/element-hq/element-web/pull/28460)). Contributed by @t3chguy.
|
||||
* Fix React 18 strict mode breaking spotlight dialog ([#28452](https://github.com/element-hq/element-web/pull/28452)). Contributed by @MidhunSureshR.
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.86](https://github.com/element-hq/element-desktop/releases/tag/v1.11.86) (2024-11-19)
|
||||
======================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
* Deduplicate icons using Compound Design Tokens ([#28419](https://github.com/element-hq/element-web/pull/28419)). Contributed by @t3chguy.
|
||||
* Let widget driver send error details ([#28357](https://github.com/element-hq/element-web/pull/28357)). Contributed by @AndrewFerr.
|
||||
* Deduplicate icons using Compound Design Tokens ([#28381](https://github.com/element-hq/element-web/pull/28381)). Contributed by @t3chguy.
|
||||
* Auto approvoce `io.element.call.reaction` capability for element call widgets ([#28401](https://github.com/element-hq/element-web/pull/28401)). Contributed by @toger5.
|
||||
* Show message type prefix in thread root \& reply previews ([#28361](https://github.com/element-hq/element-web/pull/28361)). Contributed by @t3chguy.
|
||||
* Support sending encrypted to device messages from widgets ([#28315](https://github.com/element-hq/element-web/pull/28315)). Contributed by @hughns.
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* Feed events to widgets as they are decrypted (even if out of order) ([#28376](https://github.com/element-hq/element-web/pull/28376)). Contributed by @robintown.
|
||||
* Handle authenticated media when downloading from ImageView ([#28379](https://github.com/element-hq/element-web/pull/28379)). Contributed by @t3chguy.
|
||||
* Ignore `m.3pid_changes` for Identity service 3PID changes ([#28375](https://github.com/element-hq/element-web/pull/28375)). Contributed by @t3chguy.
|
||||
* Fix markdown escaping wrongly passing html through ([#28363](https://github.com/element-hq/element-web/pull/28363)). Contributed by @t3chguy.
|
||||
* Remove "Upgrade your encryption" flow in `CreateSecretStorageDialog` ([#28290](https://github.com/element-hq/element-web/pull/28290)). Contributed by @florianduros.
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.85](https://github.com/element-hq/element-desktop/releases/tag/v1.11.85) (2024-11-12)
|
||||
======================================================================================================
|
||||
# Security
|
||||
- Fixes for [CVE-2024-51750](https://www.cve.org/CVERecord?id=CVE-2024-51750) / [GHSA-w36j-v56h-q9pc](https://github.com/element-hq/element-web/security/advisories/GHSA-w36j-v56h-q9pc)
|
||||
- Fixes for [CVE-2024-51749](https://www.cve.org/CVERecord?id=CVE-2024-51749) / [GHSA-5486-384g-mcx2](https://github.com/element-hq/element-web/security/advisories/GHSA-5486-384g-mcx2)
|
||||
- Update JS SDK with the fixes for [CVE-2024-50336](https://www.cve.org/CVERecord?id=CVE-2024-50336) / [GHSA-xvg8-m4x3-w6xr](https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-xvg8-m4x3-w6xr)
|
||||
|
||||
|
||||
Changes in [1.11.84](https://github.com/element-hq/element-desktop/releases/tag/v1.11.84) (2024-11-05)
|
||||
======================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
* Support specifying the config location manually (outside of the user's profile) ([#1921](https://github.com/element-hq/element-desktop/pull/1921)). Contributed by @Half-Shot.
|
||||
* Remove abandoned MSC3886, MSC3903, MSC3906 implementations ([#28274](https://github.com/element-hq/element-web/pull/28274)). Contributed by @t3chguy.
|
||||
* Update to React 18 ([#24763](https://github.com/element-hq/element-web/pull/24763)). Contributed by @t3chguy.
|
||||
* Deduplicate icons using Compound ([#28239](https://github.com/element-hq/element-web/pull/28239)). Contributed by @t3chguy.
|
||||
* Replace legacy Tooltips with Compound tooltips ([#28231](https://github.com/element-hq/element-web/pull/28231)). Contributed by @t3chguy.
|
||||
* Deduplicate icons using Compound Design Tokens ([#28219](https://github.com/element-hq/element-web/pull/28219)). Contributed by @t3chguy.
|
||||
* Add reactions to html export ([#28210](https://github.com/element-hq/element-web/pull/28210)). Contributed by @langleyd.
|
||||
* Remove feature\_dehydration ([#28173](https://github.com/element-hq/element-web/pull/28173)). Contributed by @florianduros.
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* Improve seshat deleteContents ([#1916](https://github.com/element-hq/element-desktop/pull/1916)). Contributed by @langleyd.
|
||||
* Remove upgrade encryption in `DeviceListener` and `SetupEncryptionToast` ([#28299](https://github.com/element-hq/element-web/pull/28299)). Contributed by @florianduros.
|
||||
* Fix 'remove alias' button in room settings ([#28269](https://github.com/element-hq/element-web/pull/28269)). Contributed by @Dev-Gurjar.
|
||||
* Add back unencrypted path in `StopGapWidgetDriver.sendToDevice` ([#28295](https://github.com/element-hq/element-web/pull/28295)). Contributed by @florianduros.
|
||||
* Fix other devices not being decorated as such ([#28279](https://github.com/element-hq/element-web/pull/28279)). Contributed by @t3chguy.
|
||||
* Fix pill contrast in invitation dialog ([#28250](https://github.com/element-hq/element-web/pull/28250)). Contributed by @florianduros.
|
||||
* Close right panel chat when minimising maximised voip widget ([#28241](https://github.com/element-hq/element-web/pull/28241)). Contributed by @t3chguy.
|
||||
* Fix develop changelog parsing ([#28232](https://github.com/element-hq/element-web/pull/28232)). Contributed by @t3chguy.
|
||||
* Fix Ctrl+F shortcut not working with minimised room summary card ([#28223](https://github.com/element-hq/element-web/pull/28223)). Contributed by @t3chguy.
|
||||
* Fix network dropdown missing checkbox \& aria-checked ([#28220](https://github.com/element-hq/element-web/pull/28220)). Contributed by @t3chguy.
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.83](https://github.com/element-hq/element-desktop/releases/tag/v1.11.83) (2024-10-29)
|
||||
======================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
* [Backport staging] Enable Element Call by default on release instances ([#1954](https://github.com/element-hq/element-desktop/pull/1954)). Contributed by @RiotRobot.
|
||||
* Enable Element Call by default on release instances ([#28314](https://github.com/element-hq/element-web/pull/28314)). Contributed by @t3chguy.
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.82](https://github.com/element-hq/element-desktop/releases/tag/v1.11.82) (2024-10-22)
|
||||
======================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
* Add monochrome tray icon ([#1804](https://github.com/element-hq/element-desktop/pull/1804)). Contributed by @SakiiCode.
|
||||
* Deduplicate more icons using Compound Design Tokens ([#132](https://github.com/element-hq/matrix-react-sdk/pull/132)). Contributed by @t3chguy.
|
||||
* Always show link new device flow even if unsupported ([#147](https://github.com/element-hq/matrix-react-sdk/pull/147)). Contributed by @t3chguy.
|
||||
* Update design of files list in right panel ([#144](https://github.com/element-hq/matrix-react-sdk/pull/144)). Contributed by @t3chguy.
|
||||
* Remove feature\_dehydration ([#138](https://github.com/element-hq/matrix-react-sdk/pull/138)). Contributed by @florianduros.
|
||||
* Upgrade emojibase-bindings and remove local handling of emoticon variations ([#127](https://github.com/element-hq/matrix-react-sdk/pull/127)). Contributed by @langleyd.
|
||||
* Add support for rendering media captions ([#43](https://github.com/element-hq/matrix-react-sdk/pull/43)). Contributed by @tulir.
|
||||
* Replace composer icons with Compound variants ([#123](https://github.com/element-hq/matrix-react-sdk/pull/123)). Contributed by @t3chguy.
|
||||
* Tweak default right panel size to be 320px except for maximised widgets at 420px ([#110](https://github.com/element-hq/matrix-react-sdk/pull/110)). Contributed by @t3chguy.
|
||||
* Add a pinned message badge under a pinned message ([#118](https://github.com/element-hq/matrix-react-sdk/pull/118)). Contributed by @florianduros.
|
||||
* Ditch right panel tabs and re-add close button ([#99](https://github.com/element-hq/matrix-react-sdk/pull/99)). Contributed by @t3chguy.
|
||||
* Force verification even for refreshed clients ([#44](https://github.com/element-hq/matrix-react-sdk/pull/44)). Contributed by @dbkr.
|
||||
* Update emoji text, border and background colour in timeline ([#119](https://github.com/element-hq/matrix-react-sdk/pull/119)). Contributed by @florianduros.
|
||||
* Disable ICE fallback based on well-known configuration ([#111](https://github.com/element-hq/matrix-react-sdk/pull/111)). Contributed by @t3chguy.
|
||||
* Remove legacy room header and promote beta room header ([#105](https://github.com/element-hq/matrix-react-sdk/pull/105)). Contributed by @t3chguy.
|
||||
* Respect `io.element.jitsi` `useFor1To1Calls` in well-known ([#112](https://github.com/element-hq/matrix-react-sdk/pull/112)). Contributed by @t3chguy.
|
||||
* Use Compound close icon in favour of mishmash of x/close icons ([#108](https://github.com/element-hq/matrix-react-sdk/pull/108)). Contributed by @t3chguy.
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* Correct typo in option documentation ([#28148](https://github.com/element-hq/element-web/pull/28148)). Contributed by @AndrewKvalheim.
|
||||
* Revert #124 and #135 ([#139](https://github.com/element-hq/matrix-react-sdk/pull/139)). Contributed by @dbkr.
|
||||
* Add aria-label to e2e icon ([#136](https://github.com/element-hq/matrix-react-sdk/pull/136)). Contributed by @florianduros.
|
||||
* Fix bell icons on room list hover being black squares ([#135](https://github.com/element-hq/matrix-react-sdk/pull/135)). Contributed by @dbkr.
|
||||
* Fix vertical overflow on the mobile register screen ([#137](https://github.com/element-hq/matrix-react-sdk/pull/137)). Contributed by @langleyd.
|
||||
* Allow to unpin redacted event ([#98](https://github.com/element-hq/matrix-react-sdk/pull/98)). Contributed by @florianduros.
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.81](https://github.com/element-hq/element-desktop/releases/tag/v1.11.81) (2024-10-15)
|
||||
======================================================================================================
|
||||
This release fixes High severity vulnerability CVE-2024-47771 / GHSA-963w-49j9-gxj6.
|
||||
|
||||
Changes in [1.11.80](https://github.com/element-hq/element-desktop/releases/tag/v1.11.80) (2024-10-08)
|
||||
======================================================================================================
|
||||
## ✨ Features
|
||||
|
||||
* enable Element Call on desktop nightly ([#1873](https://github.com/element-hq/element-desktop/pull/1873)). Contributed by @fkwp.
|
||||
* Add doc for 'force\_verification config option ([#28035](https://github.com/element-hq/element-web/pull/28035)). Contributed by @dbkr.
|
||||
* Roll back change to device isolation mode ([#104](https://github.com/element-hq/matrix-react-sdk/pull/104)). Contributed by @richvdh.
|
||||
* Remove right panel toggling behaviour on room header buttons ([#100](https://github.com/element-hq/matrix-react-sdk/pull/100)). Contributed by @t3chguy.
|
||||
* Improve error display for messages sent from insecure devices ([#93](https://github.com/element-hq/matrix-react-sdk/pull/93)). Contributed by @richvdh.
|
||||
* Add labs option to exclude unverified devices ([#92](https://github.com/element-hq/matrix-react-sdk/pull/92)). Contributed by @richvdh.
|
||||
* Improve contrast for timestamps, date separators \& spotlight trigger ([#91](https://github.com/element-hq/matrix-react-sdk/pull/91)). Contributed by @t3chguy.
|
||||
* Open room settings on room header avatar click ([#88](https://github.com/element-hq/matrix-react-sdk/pull/88)). Contributed by @t3chguy.
|
||||
* Use `strong` over `b` for improved a11y semantics ([#41](https://github.com/element-hq/matrix-react-sdk/pull/41)). Contributed by @t3chguy.
|
||||
* Grant Element Call widget capabilities for "raise hand" feature ([#82](https://github.com/element-hq/matrix-react-sdk/pull/82)). Contributed by @AndrewFerr.
|
||||
* Mobile registration optimizations and tests ([#62](https://github.com/element-hq/matrix-react-sdk/pull/62)). Contributed by @langleyd.
|
||||
* Ignore chat effect when older than 48h ([#48](https://github.com/element-hq/matrix-react-sdk/pull/48)). Contributed by @florianduros.
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
* Update native OIDC callback url to be RFC8252 compliant ([#28096](https://github.com/element-hq/element-web/pull/28096)). Contributed by @t3chguy.
|
||||
* Update icons to include transparency ([#28040](https://github.com/element-hq/element-web/pull/28040)). Contributed by @t3chguy.
|
||||
* Fix default\_widget\_container\_height in sample config ([#28034](https://github.com/element-hq/element-web/pull/28034)). Contributed by @dbkr.
|
||||
* Fix untranslated keys being rendered in `/help` dialog ([#90](https://github.com/element-hq/matrix-react-sdk/pull/90)). Contributed by @t3chguy.
|
||||
* Ensure timeline search results are visible even in video rooms ([#96](https://github.com/element-hq/matrix-react-sdk/pull/96)). Contributed by @t3chguy.
|
||||
* Pop right panel timeline when unmaximising widget to avoid double timeline ([#94](https://github.com/element-hq/matrix-react-sdk/pull/94)). Contributed by @t3chguy.
|
||||
* Fix accessible label on left panel spotlight trigger ([#87](https://github.com/element-hq/matrix-react-sdk/pull/87)). Contributed by @t3chguy.
|
||||
* Crypto: fix display of device key ([#86](https://github.com/element-hq/matrix-react-sdk/pull/86)). Contributed by @richvdh.
|
||||
|
||||
|
||||
|
||||
Changes in [1.11.79](https://github.com/element-hq/element-desktop/releases/tag/v1.11.79) (2024-10-01)
|
||||
======================================================================================================
|
||||
* No changes
|
||||
|
||||
21
README.md
21
README.md
@@ -75,10 +75,10 @@ yarn run build
|
||||
|
||||
This will do a couple of things:
|
||||
|
||||
- Run the `setversion` script to set the local package version to match whatever
|
||||
version of Element you installed above.
|
||||
- Run electron-builder to build a package. The package built will match the operating system
|
||||
you're running the build process on.
|
||||
- Run the `setversion` script to set the local package version to match whatever
|
||||
version of Element you installed above.
|
||||
- Run electron-builder to build a package. The package built will match the operating system
|
||||
you're running the build process on.
|
||||
|
||||
## Docker
|
||||
|
||||
@@ -101,6 +101,9 @@ After running, the packages should be in `dist/`.
|
||||
If you'd just like to run the electron app locally for development:
|
||||
|
||||
```
|
||||
# Install electron - we don't normally need electron itself as it's provided
|
||||
# by electron-builder when building packages
|
||||
yarn add electron
|
||||
yarn start
|
||||
```
|
||||
|
||||
@@ -131,19 +134,15 @@ Alternatively, a custom location for the profile data can be specified using the
|
||||
|
||||
# User-specified config.json
|
||||
|
||||
- `%APPDATA%\$NAME\config.json` on Windows
|
||||
- `$XDG_CONFIG_HOME/$NAME/config.json` or `~/.config/$NAME/config.json` on Linux
|
||||
- `~/Library/Application Support/$NAME/config.json` on macOS
|
||||
- `%APPDATA%\$NAME\config.json` on Windows
|
||||
- `$XDG_CONFIG_HOME/$NAME/config.json` or `~/.config/$NAME/config.json` on Linux
|
||||
- `~/Library/Application Support/$NAME/config.json` on macOS
|
||||
|
||||
In the paths above, `$NAME` is typically `Element`, unless you use `--profile
|
||||
$PROFILE` in which case it becomes `Element-$PROFILE`, or it is using one of
|
||||
the above created by a pre-1.7 install, in which case it will be `Riot` or
|
||||
`Riot-$PROFILE`.
|
||||
|
||||
You may also specify a different path entirely for the `config.json` file by
|
||||
providing the `--config $YOUR_CONFIG_JSON_FILE` to the process, or via the
|
||||
`ELEMENT_DESKTOP_CONFIG_JSON` environment variable.
|
||||
|
||||
# Translations
|
||||
|
||||
To add a new translation, head to the [translating doc](https://github.com/vector-im/element-web/blob/develop/docs/translating.md).
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# Docker image to facilitate building Element Desktop's native bits using a glibc version (2.31)
|
||||
# with broader compatibility, down to Debian bullseye & Ubuntu focal.
|
||||
FROM rust:bullseye
|
||||
# Docker image to facilitate building Element Desktop's native bits using a glibc version with broader compatibility
|
||||
FROM rust:buster
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# Summary
|
||||
|
||||
- [Introduction](../README.md)
|
||||
- [Introduction](../README.md)
|
||||
|
||||
# Build
|
||||
|
||||
- [Native Node modules](native-node-modules.md)
|
||||
- [Windows requirements](windows-requirements.md)
|
||||
- [Native Node modules](native-node-modules.md)
|
||||
- [Windows requirements](windows-requirements.md)
|
||||
|
||||
# Distribution
|
||||
|
||||
- [Updates](updates.md)
|
||||
- [Packaging](packaging.md)
|
||||
- [Updates](updates.md)
|
||||
- [Packaging](packaging.md)
|
||||
|
||||
# Setup
|
||||
|
||||
- [Config](config.md)
|
||||
- [Config](config.md)
|
||||
|
||||
@@ -17,9 +17,9 @@ when releasing.
|
||||
|
||||
Install the pre-requisites for your system:
|
||||
|
||||
- [Windows pre-requisites](https://github.com/vector-im/element-desktop/blob/develop/docs/windows-requirements.md)
|
||||
- Linux: TODO
|
||||
- OS X: TODO
|
||||
- [Windows pre-requisites](https://github.com/vector-im/element-desktop/blob/develop/docs/windows-requirements.md)
|
||||
- Linux: TODO
|
||||
- OS X: TODO
|
||||
|
||||
Then optionally, [add seshat and dependencies to support search in E2E rooms](#adding-seshat-for-search-in-e2e-encrypted-rooms).
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ Simply go to https://github.com/vector-im/element-desktop/actions/workflows/buil
|
||||
|
||||
For releasing Element Desktop, we assume the following prerequisites:
|
||||
|
||||
- a tag of `element-desktop` repo with the Element Desktop version to be released set in `package.json`.
|
||||
- an Element Web tarball published to GitHub with a matching version number.
|
||||
- a tag of `element-desktop` repo with the Element Desktop version to be released set in `package.json`.
|
||||
- an Element Web tarball published to GitHub with a matching version number.
|
||||
|
||||
**Both of these are done automatically when you run the release automation.**
|
||||
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
|
||||
## Requirements to build native modules
|
||||
|
||||
We rely on Github Actions `windows-2022` plus a few extra utilities as per [the workflow](https://github.com/vector-im/element-desktop/blob/develop/.github/workflows/build_windows.yaml).
|
||||
We rely on Github Actions `windows-latest` plus a few extra utilities as per [the workflow](https://github.com/vector-im/element-desktop/blob/develop/.github/workflows/build_windows.yaml).
|
||||
|
||||
If you want to build native modules, make sure that the following tools are installed on your system.
|
||||
|
||||
- [Git for Windows](https://git-scm.com/download/win)
|
||||
- [Node 16](https://nodejs.org)
|
||||
- [Python 3](https://www.python.org/downloads/) (if you type 'python' into command prompt it will offer to install it from the windows store)
|
||||
- [Strawberry Perl](https://strawberryperl.com/)
|
||||
- [Rustup](https://rustup.rs/)
|
||||
- [NASM](https://www.nasm.us/)
|
||||
- [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) with the following configuration:
|
||||
- On the Workloads tab:
|
||||
- Desktop & Mobile -> C++ build tools
|
||||
- On the Individual components tab:
|
||||
- MSVC VS 2019 C++ build tools
|
||||
- Windows 10 SDK (latest version available)
|
||||
- C++ CMake tools for Windows
|
||||
- [Git for Windows](https://git-scm.com/download/win)
|
||||
- [Node 16](https://nodejs.org)
|
||||
- [Python 3](https://www.python.org/downloads/) (if you type 'python' into command prompt it will offer to install it from the windows store)
|
||||
- [Strawberry Perl](https://strawberryperl.com/)
|
||||
- [Rustup](https://rustup.rs/)
|
||||
- [NASM](https://www.nasm.us/)
|
||||
- [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) with the following configuration:
|
||||
- On the Workloads tab:
|
||||
- Desktop & Mobile -> C++ build tools
|
||||
- On the Individual components tab:
|
||||
- MSVC VS 2019 C++ build tools
|
||||
- Windows 10 SDK (latest version available)
|
||||
- C++ CMake tools for Windows
|
||||
|
||||
Once installed make sure all those utilities are accessible in your `PATH`.
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ import { flipFuses, FuseVersion, FuseV1Options } from "@electron/fuses";
|
||||
* Passes $ED_SIGNTOOL_THUMBPRINT and $ED_SIGNTOOL_SUBJECT_NAME to
|
||||
* build.win.signingHashAlgorithms and build.win.certificateSubjectName respectively if specified.
|
||||
*
|
||||
* On macOS:
|
||||
* Passes $ED_NOTARYTOOL_TEAM_ID to build.mac.notarize.notarize if specified
|
||||
*
|
||||
* On Linux:
|
||||
* Replaces spaces in the product name with dashes as spaces in paths can cause issues
|
||||
* Removes libsqlcipher0 recommended dependency if env SQLCIPHER_BUNDLED is asserted.
|
||||
@@ -135,8 +138,6 @@ const config: Writable<Configuration> = {
|
||||
"Replaces: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0)",
|
||||
"--deb-field",
|
||||
"Breaks: riot-desktop (<< 1.7.0), riot-web (<< 1.7.0)",
|
||||
"--deb-pre-depends",
|
||||
"libc6 (>= 2.31)",
|
||||
],
|
||||
},
|
||||
mac: {
|
||||
@@ -176,6 +177,16 @@ if (process.env.ED_SIGNTOOL_SUBJECT_NAME && process.env.ED_SIGNTOOL_THUMBPRINT)
|
||||
config.win.certificateSha1 = process.env.ED_SIGNTOOL_THUMBPRINT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow specifying macOS notary team id via env var
|
||||
* @param {string} process.env.ED_NOTARYTOOL_TEAM_ID
|
||||
*/
|
||||
if (process.env.ED_NOTARYTOOL_TEAM_ID) {
|
||||
config.mac.notarize = {
|
||||
teamId: process.env.ED_NOTARYTOOL_TEAM_ID,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow specifying nightly version via env var
|
||||
* @param {string} process.env.ED_NIGHTLY
|
||||
|
||||
@@ -47,13 +47,5 @@
|
||||
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx",
|
||||
"setting_defaults": {
|
||||
"RustCrypto.staged_rollout_percent": 60
|
||||
},
|
||||
"features": {
|
||||
"feature_video_rooms": true,
|
||||
"feature_group_calls": true,
|
||||
"feature_element_call_video_rooms": true
|
||||
},
|
||||
"element_call": {
|
||||
"url": "https://call.element.io"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,21 +6,31 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import path from "node:path";
|
||||
import path from "path";
|
||||
import childProcess from "child_process";
|
||||
|
||||
import type HakEnv from "../../scripts/hak/hakEnv.js";
|
||||
import type { DependencyInfo } from "../../scripts/hak/dep.js";
|
||||
import HakEnv from "../../scripts/hak/hakEnv";
|
||||
import { DependencyInfo } from "../../scripts/hak/dep";
|
||||
|
||||
export default async function buildKeytar(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
const env = hakEnv.makeGypEnv();
|
||||
|
||||
console.log("Running yarn with env", env);
|
||||
await hakEnv.spawn(
|
||||
path.join(moduleInfo.nodeModuleBinDir, "node-gyp"),
|
||||
["rebuild", "--arch", hakEnv.getTargetArch()],
|
||||
{
|
||||
cwd: moduleInfo.moduleBuildDir,
|
||||
env,
|
||||
},
|
||||
);
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const proc = childProcess.spawn(
|
||||
path.join(moduleInfo.nodeModuleBinDir, "node-gyp" + (hakEnv.isWin() ? ".cmd" : "")),
|
||||
["rebuild", "--arch", hakEnv.getTargetArch()],
|
||||
{
|
||||
cwd: moduleInfo.moduleBuildDir,
|
||||
env,
|
||||
stdio: "inherit",
|
||||
// We need shell mode on Windows to be able to launch `.cmd` executables
|
||||
// See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
|
||||
shell: hakEnv.isWin(),
|
||||
},
|
||||
);
|
||||
proc.on("exit", (code) => {
|
||||
code ? reject(code) : resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,10 +6,26 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type HakEnv from "../../scripts/hak/hakEnv.js";
|
||||
import type { DependencyInfo } from "../../scripts/hak/dep.js";
|
||||
import childProcess from "child_process";
|
||||
|
||||
import HakEnv from "../../scripts/hak/hakEnv";
|
||||
import { DependencyInfo } from "../../scripts/hak/dep";
|
||||
|
||||
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
// node-gyp uses python for reasons beyond comprehension
|
||||
await hakEnv.checkTools([["python", "--version"]]);
|
||||
const tools = [["python", "--version"]]; // node-gyp uses python for reasons beyond comprehension
|
||||
|
||||
for (const tool of tools) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const proc = childProcess.spawn(tool[0], tool.slice(1), {
|
||||
stdio: ["ignore"],
|
||||
});
|
||||
proc.on("exit", (code) => {
|
||||
if (code !== 0) {
|
||||
reject("Can't find " + tool);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type HakEnv from "../../scripts/hak/hakEnv.js";
|
||||
import type { DependencyInfo } from "../../scripts/hak/dep.js";
|
||||
import childProcess from "child_process";
|
||||
|
||||
import HakEnv from "../../scripts/hak/hakEnv";
|
||||
import { DependencyInfo } from "../../scripts/hak/dep";
|
||||
|
||||
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
const env = hakEnv.makeGypEnv();
|
||||
@@ -17,18 +19,30 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
|
||||
}
|
||||
|
||||
console.log("Running yarn install");
|
||||
await hakEnv.spawn("yarn", ["install"], {
|
||||
cwd: moduleInfo.moduleBuildDir,
|
||||
env,
|
||||
shell: true,
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const proc = childProcess.spawn("yarn" + (hakEnv.isWin() ? ".cmd" : ""), ["install"], {
|
||||
cwd: moduleInfo.moduleBuildDir,
|
||||
env,
|
||||
shell: true,
|
||||
stdio: "inherit",
|
||||
});
|
||||
proc.on("exit", (code) => {
|
||||
code ? reject(code) : resolve();
|
||||
});
|
||||
});
|
||||
|
||||
const buildTarget = hakEnv.wantsStaticSqlCipher() ? "build-bundled" : "build";
|
||||
|
||||
console.log("Running yarn build");
|
||||
await hakEnv.spawn("yarn", ["run", buildTarget], {
|
||||
cwd: moduleInfo.moduleBuildDir,
|
||||
env,
|
||||
shell: true,
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const proc = childProcess.spawn("yarn" + (hakEnv.isWin() ? ".cmd" : ""), ["run", buildTarget], {
|
||||
cwd: moduleInfo.moduleBuildDir,
|
||||
env,
|
||||
shell: true,
|
||||
stdio: "inherit",
|
||||
});
|
||||
proc.on("exit", (code) => {
|
||||
code ? reject(code) : resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,15 +6,14 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import childProcess from "node:child_process";
|
||||
import fsProm from "node:fs/promises";
|
||||
import childProcess from "child_process";
|
||||
import fsProm from "fs/promises";
|
||||
|
||||
import type HakEnv from "../../scripts/hak/hakEnv.js";
|
||||
import type { Tool } from "../../scripts/hak/hakEnv.js";
|
||||
import type { DependencyInfo } from "../../scripts/hak/dep.js";
|
||||
import HakEnv from "../../scripts/hak/hakEnv";
|
||||
import { DependencyInfo } from "../../scripts/hak/dep";
|
||||
|
||||
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
const tools: Tool[] = [
|
||||
const tools = [
|
||||
["rustc", "--version"],
|
||||
["python", "--version"], // node-gyp uses python for reasons beyond comprehension
|
||||
];
|
||||
@@ -26,7 +25,21 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
|
||||
} else {
|
||||
tools.push(["make", "--version"]);
|
||||
}
|
||||
await hakEnv.checkTools(tools);
|
||||
|
||||
for (const tool of tools) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const proc = childProcess.spawn(tool[0], tool.slice(1), {
|
||||
stdio: ["ignore"],
|
||||
});
|
||||
proc.on("exit", (code) => {
|
||||
if (code !== 0) {
|
||||
reject("Can't find " + tool);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Ensure Rust target exists (nb. we avoid depending on rustup)
|
||||
await new Promise((resolve, reject) => {
|
||||
|
||||
@@ -7,5 +7,8 @@
|
||||
"strict": true,
|
||||
"lib": ["es2022"]
|
||||
},
|
||||
"include": ["../scripts/@types/*.d.ts", "./**/*.ts"]
|
||||
"include": ["../scripts/@types/*.d.ts", "./**/*.ts"],
|
||||
"ts-node": {
|
||||
"transpileOnly": true
|
||||
}
|
||||
}
|
||||
|
||||
2
knip.ts
2
knip.ts
@@ -12,8 +12,6 @@ export default {
|
||||
"@types/yargs",
|
||||
// Required for `action-validator`
|
||||
"@action-validator/*",
|
||||
// Used for git pre-commit hooks
|
||||
"husky",
|
||||
],
|
||||
ignoreBinaries: ["jq", "scripts/in-docker.sh"],
|
||||
} satisfies KnipConfig;
|
||||
|
||||
70
package.json
70
package.json
@@ -2,8 +2,7 @@
|
||||
"name": "element-desktop",
|
||||
"productName": "Element",
|
||||
"main": "lib/electron-main.js",
|
||||
"exports": "./lib/electron-main.js",
|
||||
"version": "1.11.91",
|
||||
"version": "1.11.79",
|
||||
"description": "A feature-rich client for Matrix.org",
|
||||
"author": "Element",
|
||||
"homepage": "https://element.io",
|
||||
@@ -12,7 +11,6 @@
|
||||
"url": "https://github.com/vector-im/element-desktop"
|
||||
},
|
||||
"license": "AGPL-3.0-only OR GPL-3.0-only",
|
||||
"type": "module",
|
||||
"files": [],
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
@@ -23,12 +21,20 @@
|
||||
"i18n:lint": "prettier --log-level=silent --write src/i18n/strings/ --ignore-path /dev/null",
|
||||
"i18n:diff": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
|
||||
"mkdirs": "mkdirp packages deploys",
|
||||
"fetch": "yarn run mkdirs && tsx scripts/fetch-package.ts",
|
||||
"fetch": "yarn run mkdirs && ts-node scripts/fetch-package.ts",
|
||||
"asar-webapp": "asar p webapp webapp.asar",
|
||||
"start": "yarn run build:ts && yarn run build:res && electron .",
|
||||
"lint": "yarn lint:types && yarn lint:js && yarn lint:workflows",
|
||||
"lint:js": "eslint --max-warnings 0 src hak playwright scripts && prettier --check .",
|
||||
"lint:js-fix": "eslint --fix --max-warnings 0 src hak playwright scripts && prettier --log-level=warn --write .",
|
||||
"lint:js": "yarn lint:js:src && yarn lint:js:test && yarn lint:js:scripts && yarn lint:js:hak && prettier --check .",
|
||||
"lint:js:src": "eslint --max-warnings 0 src",
|
||||
"lint:js:test": "eslint --max-warnings 0 --config .eslintrc-test.js playwright",
|
||||
"lint:js:scripts": "eslint --max-warnings 0 --config .eslintrc-scripts.js scripts",
|
||||
"lint:js:hak": "eslint --max-warnings 0 --config .eslintrc-hak.js hak",
|
||||
"lint:js-fix": "yarn lint:js-fix:src &&yarn lint:js-fix:test && yarn lint:js-fix:scripts && yarn lint:js-fix:hak && prettier --log-level=warn --write .",
|
||||
"lint:js-fix:src": "eslint --fix --max-warnings 0 src",
|
||||
"lint:js-fix:test": "eslint --fix --max-warnings 0 --config .eslintrc-test.js playwright",
|
||||
"lint:js-fix:scripts": "eslint --fix --max-warnings 0 --config .eslintrc-scripts.js scripts",
|
||||
"lint:js-fix:hak": "eslint --fix --max-warnings 0 --config .eslintrc-hak.js hak",
|
||||
"lint:types": "yarn lint:types:src && yarn lint:types:test && yarn lint:types:scripts && yarn lint:types:hak",
|
||||
"lint:types:src": "tsc --noEmit",
|
||||
"lint:types:test": "tsc --noEmit -p playwright/tsconfig.json",
|
||||
@@ -43,13 +49,13 @@
|
||||
"build:universal": "yarn run build:ts && yarn run build:res && electron-builder --universal",
|
||||
"build": "yarn run build:ts && yarn run build:res && electron-builder",
|
||||
"build:ts": "tsc",
|
||||
"build:res": "tsx scripts/copy-res.ts",
|
||||
"build:res": "ts-node scripts/copy-res.ts",
|
||||
"docker:setup": "docker build --platform linux/amd64 -t element-desktop-dockerbuild dockerbuild",
|
||||
"docker:build:native": "scripts/in-docker.sh yarn run hak",
|
||||
"docker:build": "scripts/in-docker.sh yarn run build",
|
||||
"docker:install": "scripts/in-docker.sh yarn install",
|
||||
"clean": "rimraf webapp.asar dist packages deploys lib",
|
||||
"hak": "tsx scripts/hak/index.ts",
|
||||
"hak": "ts-node scripts/hak/index.ts",
|
||||
"test": "playwright test",
|
||||
"test:open": "yarn test --ui",
|
||||
"test:screenshots:build": "docker build playwright -t element-desktop-playwright --platform linux/amd64",
|
||||
@@ -60,11 +66,12 @@
|
||||
"auto-launch": "^5.0.5",
|
||||
"counterpart": "^0.18.6",
|
||||
"electron-clear-data": "^1.0.5",
|
||||
"electron-store": "^10.0.0",
|
||||
"electron-store": "^8.0.2",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"minimist": "^1.2.6",
|
||||
"node-fetch": "^2",
|
||||
"png-to-ico": "^2.1.1",
|
||||
"uuid": "^11.0.0"
|
||||
"uuid": "^10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@action-validator/cli": "^0.6.0",
|
||||
@@ -72,52 +79,51 @@
|
||||
"@babel/core": "^7.18.10",
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@electron/asar": "3.2.18",
|
||||
"@electron/asar": "^3.2.3",
|
||||
"@electron/fuses": "^1.7.0",
|
||||
"@mapbox/node-pre-gyp": "^1.0.11",
|
||||
"@playwright/test": "1.49.1",
|
||||
"@stylistic/eslint-plugin": "^2.9.0",
|
||||
"@playwright/test": "1.47.1",
|
||||
"@types/auto-launch": "^5.0.1",
|
||||
"@types/counterpart": "^0.18.1",
|
||||
"@types/minimist": "^1.2.1",
|
||||
"@types/node": "18.19.70",
|
||||
"@types/node": "18.19.54",
|
||||
"@types/pacote": "^11.1.1",
|
||||
"@types/tar": "^6.1.3",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@types/yargs": "^17.0.32",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"app-builder-lib": "25.1.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0",
|
||||
"app-builder-lib": "24.13.3",
|
||||
"chokidar": "^4.0.0",
|
||||
"detect-libc": "^2.0.0",
|
||||
"electron": "32.0.0",
|
||||
"electron-builder": "25.1.8",
|
||||
"electron-builder-squirrel-windows": "25.1.8",
|
||||
"electron-devtools-installer": "^4.0.0",
|
||||
"electron": "^32.0.0",
|
||||
"electron-builder": "24.13.3",
|
||||
"electron-builder-squirrel-windows": "24.13.3",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"eslint": "^8.26.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-import": "^2.25.4",
|
||||
"eslint-plugin-matrix-org": "^2.0.1",
|
||||
"eslint-plugin-n": "^17.12.0",
|
||||
"eslint-plugin-unicorn": "^56.0.0",
|
||||
"eslint-plugin-matrix-org": "^1.0.0",
|
||||
"eslint-plugin-unicorn": "^55.0.0",
|
||||
"glob": "^11.0.0",
|
||||
"husky": "^9.1.6",
|
||||
"knip": "^5.0.0",
|
||||
"lint-staged": "^15.2.10",
|
||||
"matrix-web-i18n": "^3.2.1",
|
||||
"mkdirp": "^3.0.0",
|
||||
"pacote": "^21.0.0",
|
||||
"pacote": "^19.0.0",
|
||||
"prettier": "^3.0.0",
|
||||
"rimraf": "^6.0.0",
|
||||
"tar": "^7.0.0",
|
||||
"tsx": "^4.19.2",
|
||||
"typescript": "5.7.3"
|
||||
"tar": "^6.2.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "5.5.4"
|
||||
},
|
||||
"hakDependencies": {
|
||||
"matrix-seshat": "^4.0.0",
|
||||
"keytar": "^7.9.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/node": "18.19.70",
|
||||
"config-file-ts": "0.2.8-rc1"
|
||||
"@types/node": "18.19.54",
|
||||
"config-file-ts": "0.2.8-rc1",
|
||||
"lru-cache": "11.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM mcr.microsoft.com/playwright:v1.49.1-jammy
|
||||
FROM mcr.microsoft.com/playwright:v1.46.1-jammy
|
||||
|
||||
WORKDIR /work/element-desktop
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { test, expect } from "../../element-desktop-test.js";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
test.describe("App config options", () => {
|
||||
test.describe("Should load custom config via env", () => {
|
||||
test.slow();
|
||||
test.use({
|
||||
extraEnv: {
|
||||
ELEMENT_DESKTOP_CONFIG_JSON: resolve(__dirname, "../..", "fixtures/custom-config.json"),
|
||||
},
|
||||
});
|
||||
test("should launch and use configured homeserver", async ({ page }) => {
|
||||
await page.locator("#matrixchat").waitFor();
|
||||
await page.locator(".mx_Welcome").waitFor();
|
||||
await expect(page).toHaveURL("vector://vector/webapp/#/welcome");
|
||||
await page.getByText("Sign in").click();
|
||||
await page.getByText("matrix.example.org", { exact: true }).waitFor();
|
||||
});
|
||||
});
|
||||
test.describe("Should load custom config via argument", () => {
|
||||
test.slow();
|
||||
test.use({
|
||||
extraArgs: ["--config", resolve(__dirname, "../..", "fixtures/custom-config.json")],
|
||||
});
|
||||
test("should launch and use configured homeserver", async ({ page }) => {
|
||||
await page.locator("#matrixchat").waitFor();
|
||||
await page.locator(".mx_Welcome").waitFor();
|
||||
await expect(page).toHaveURL("vector://vector/webapp/#/welcome");
|
||||
await page.getByText("Sign in").click();
|
||||
await page.getByText("matrix.example.org", { exact: true }).waitFor();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -6,9 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { platform } from "node:os";
|
||||
|
||||
import { test, expect } from "../../element-desktop-test.js";
|
||||
import { test, expect } from "../../element-desktop-test";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -19,7 +17,6 @@ declare global {
|
||||
supportsEventIndexing(): Promise<boolean>;
|
||||
}
|
||||
| undefined;
|
||||
createPickleKey(userId: string, deviceId: string): Promise<string | null>;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -27,32 +24,17 @@ declare global {
|
||||
|
||||
test.describe("App launch", () => {
|
||||
test.slow();
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
test("should launch and render the welcome view successfully and support seshat", async ({ page }) => {
|
||||
await page.locator("#matrixchat").waitFor();
|
||||
await page.locator(".mx_Welcome").waitFor();
|
||||
});
|
||||
|
||||
test("should launch and render the welcome view successfully", async ({ page }) => {
|
||||
await expect(page).toHaveURL("vector://vector/webapp/#/welcome");
|
||||
await expect(page).toHaveScreenshot();
|
||||
});
|
||||
|
||||
test("should launch and render the welcome view successfully and support seshat", async ({ page }) => {
|
||||
await expect(
|
||||
page.evaluate<boolean>(async () => {
|
||||
return window.mxPlatformPeg.get().getEventIndexingManager()?.supportsEventIndexing();
|
||||
}),
|
||||
).resolves.toBeTruthy();
|
||||
});
|
||||
const supported = await page.evaluate<boolean>(async () => {
|
||||
const indexManager = window.mxPlatformPeg.get()?.getEventIndexingManager();
|
||||
return await indexManager?.supportsEventIndexing();
|
||||
});
|
||||
|
||||
test("should launch and render the welcome view successfully and support keytar", async ({ page }) => {
|
||||
test.skip(platform() === "linux", "This test does not yet support Linux");
|
||||
|
||||
await expect(
|
||||
page.evaluate<string | null>(async () => {
|
||||
return await window.mxPlatformPeg.get().createPickleKey("@user:server", "ABCDEF");
|
||||
}),
|
||||
).resolves.not.toBeNull();
|
||||
expect(supported).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,22 +8,10 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
import { _electron as electron, test as base, expect as baseExpect, type ElectronApplication } from "@playwright/test";
|
||||
import fs from "node:fs/promises";
|
||||
import path, { dirname } from "node:path";
|
||||
import path from "node:path";
|
||||
import os from "node:os";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
interface Fixtures {
|
||||
app: ElectronApplication;
|
||||
tmpDir: string;
|
||||
extraEnv: Record<string, string>;
|
||||
extraArgs: string[];
|
||||
}
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
export const test = base.extend<Fixtures>({
|
||||
extraEnv: {},
|
||||
extraArgs: [],
|
||||
export const test = base.extend<{ app: ElectronApplication; tmpDir: string }>({
|
||||
// eslint-disable-next-line no-empty-pattern
|
||||
tmpDir: async ({}, use) => {
|
||||
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "element-desktop-tests-"));
|
||||
@@ -31,7 +19,7 @@ export const test = base.extend<Fixtures>({
|
||||
await use(tmpDir);
|
||||
await fs.rm(tmpDir, { recursive: true });
|
||||
},
|
||||
app: async ({ tmpDir, extraEnv, extraArgs }, use) => {
|
||||
app: async ({ tmpDir }, use) => {
|
||||
const args = ["--profile-dir", tmpDir];
|
||||
|
||||
const executablePath = process.env["ELEMENT_DESKTOP_EXECUTABLE"];
|
||||
@@ -41,12 +29,9 @@ export const test = base.extend<Fixtures>({
|
||||
}
|
||||
|
||||
const app = await electron.launch({
|
||||
env: {
|
||||
...process.env,
|
||||
...extraEnv,
|
||||
},
|
||||
env: process.env,
|
||||
executablePath,
|
||||
args: [...args, ...extraArgs],
|
||||
args,
|
||||
});
|
||||
|
||||
app.process().stdout.pipe(process.stdout);
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"default_server_config": {
|
||||
"m.homeserver": {
|
||||
"base_url": "https://matrix.example.org"
|
||||
},
|
||||
"m.identity_server": {
|
||||
"base_url": "https://identity.example.org"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
7
release_config.yaml
Normal file
7
release_config.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
signing_id: releases@riot.im
|
||||
subprojects:
|
||||
element-web:
|
||||
includeByDefault: true
|
||||
# Because element-web is not in our dependencies, but the versions
|
||||
# follow those of this project (well, vice-versa really)
|
||||
mirrorVersion: true
|
||||
@@ -1,20 +1,20 @@
|
||||
#!/usr/bin/env -S npx tsx
|
||||
#!/usr/bin/env -S npx ts-node
|
||||
|
||||
// copies resources into the lib directory.
|
||||
|
||||
import parseArgs from "minimist";
|
||||
import * as chokidar from "chokidar";
|
||||
import * as path from "node:path";
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "path";
|
||||
import * as fs from "fs";
|
||||
|
||||
const argv = parseArgs(process.argv.slice(2), {});
|
||||
|
||||
const watch = argv.w;
|
||||
const verbose = argv.v;
|
||||
|
||||
function errCheck(err: unknown): void {
|
||||
function errCheck(err?: Error): void {
|
||||
if (err) {
|
||||
console.error(err instanceof Error ? err.message : err);
|
||||
console.error(err.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#!/usr/bin/env -S npx tsx --resolveJsonModule
|
||||
#!/usr/bin/env -S npx ts-node --resolveJsonModule
|
||||
|
||||
import * as path from "node:path";
|
||||
import { createWriteStream, promises as fs } from "node:fs";
|
||||
import * as childProcess from "node:child_process";
|
||||
import * as tar from "tar";
|
||||
import * as path from "path";
|
||||
import { createWriteStream, promises as fs } from "fs";
|
||||
import * as childProcess from "child_process";
|
||||
import tar from "tar";
|
||||
import * as asar from "@electron/asar";
|
||||
import { promises as stream } from "node:stream";
|
||||
import fetch from "node-fetch";
|
||||
import { promises as stream } from "stream";
|
||||
|
||||
import riotDesktopPackageJson from "../package.json";
|
||||
import { setPackageVersion } from "./set-version.js";
|
||||
import { setPackageVersion } from "./set-version";
|
||||
|
||||
const PUB_KEY_URL = "https://packages.riot.im/element-release-key.asc";
|
||||
const PACKAGE_URL_PREFIX = "https://github.com/element-hq/element-web/releases/download/";
|
||||
@@ -27,7 +28,7 @@ async function downloadToFile(url: string, filename: string): Promise<void> {
|
||||
console.error(e);
|
||||
try {
|
||||
await fs.unlink(filename);
|
||||
} catch {}
|
||||
} catch (_) {}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@@ -124,8 +125,6 @@ async function main(): Promise<number | undefined> {
|
||||
});
|
||||
fetch(PUB_KEY_URL)
|
||||
.then((resp) => {
|
||||
if (!resp.ok) throw new Error(`unexpected response ${resp.statusText}`);
|
||||
if (!resp.body) throw new Error(`unexpected response has no body ${resp.statusText}`);
|
||||
stream.pipeline(resp.body, gpgProc.stdin!).catch(reject);
|
||||
})
|
||||
.catch(reject);
|
||||
@@ -151,14 +150,14 @@ async function main(): Promise<number | undefined> {
|
||||
await fs.opendir(expectedDeployDir);
|
||||
console.log(expectedDeployDir + "already exists");
|
||||
haveDeploy = true;
|
||||
} catch {}
|
||||
} catch (e) {}
|
||||
|
||||
if (!haveDeploy) {
|
||||
const outPath = path.join(pkgDir, filename);
|
||||
try {
|
||||
await fs.stat(outPath);
|
||||
console.log("Already have " + filename + ": not redownloading");
|
||||
} catch {
|
||||
} catch (e) {
|
||||
try {
|
||||
await downloadToFile(url, outPath);
|
||||
} catch (e) {
|
||||
@@ -171,7 +170,7 @@ async function main(): Promise<number | undefined> {
|
||||
try {
|
||||
await fs.stat(outPath + ".asc");
|
||||
console.log("Already have " + filename + ".asc: not redownloading");
|
||||
} catch {
|
||||
} catch (e) {
|
||||
try {
|
||||
await downloadToFile(url + ".asc", outPath + ".asc");
|
||||
} catch (e) {
|
||||
@@ -207,7 +206,7 @@ async function main(): Promise<number | undefined> {
|
||||
await fs.stat(ASAR_PATH);
|
||||
console.log(ASAR_PATH + " already present: removing");
|
||||
await fs.unlink(ASAR_PATH);
|
||||
} catch {}
|
||||
} catch (e) {}
|
||||
|
||||
if (cfgDir.length) {
|
||||
const configJsonSource = path.join(cfgDir, "config.json");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env -S npx tsx
|
||||
#!/usr/bin/env -S npx ts-node
|
||||
|
||||
/**
|
||||
* Script to generate incremental Nightly build versions, based on the latest Nightly build version of that kind.
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#!/usr/bin/env -S npx tsx
|
||||
#!/usr/bin/env -S npx ts-node
|
||||
|
||||
/*
|
||||
* Checks for the presence of a webapp, inspects its version and prints it
|
||||
*/
|
||||
|
||||
import url from "node:url";
|
||||
|
||||
import { versionFromAsar } from "./set-version.js";
|
||||
import { versionFromAsar } from "./set-version";
|
||||
|
||||
async function main(): Promise<number> {
|
||||
const version = await versionFromAsar();
|
||||
@@ -15,16 +13,13 @@ async function main(): Promise<number> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (import.meta.url.startsWith("file:")) {
|
||||
const modulePath = url.fileURLToPath(import.meta.url);
|
||||
if (process.argv[1] === modulePath) {
|
||||
main()
|
||||
.then((ret) => {
|
||||
process.exit(ret);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
if (require.main === module) {
|
||||
main()
|
||||
.then((ret) => {
|
||||
process.exit(ret);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@ documentation for it.
|
||||
|
||||
Goals:
|
||||
|
||||
- Must build compiled native node modules in a shippable state
|
||||
(ie. only dynamically linked against libraries that will be on the
|
||||
target system, all unnecessary files removed).
|
||||
- Must be able to build any native module, no matter what build system
|
||||
it uses (electron-rebuild is supposed to do this job but only works
|
||||
for modules that use gyp).
|
||||
- Must build compiled native node modules in a shippable state
|
||||
(ie. only dynamically linked against libraries that will be on the
|
||||
target system, all unnecessary files removed).
|
||||
- Must be able to build any native module, no matter what build system
|
||||
it uses (electron-rebuild is supposed to do this job but only works
|
||||
for modules that use gyp).
|
||||
|
||||
It's also loosely designed to be a general tool and agnostic to what it's
|
||||
actually building. It's used here to build modules for the electron app
|
||||
@@ -25,13 +25,13 @@ If no dependencies are given, hak runs the command on all dependencies.
|
||||
|
||||
There are a lot of files involved:
|
||||
|
||||
- scripts/hak/... - The tool itself
|
||||
- hak/[dependency] - Files provided by the app that tell hak how to build each of its native dependencies.
|
||||
Contains a hak.json file and also some script files, each of which must be referenced in hak.json.
|
||||
- .hak/ - Files generated by hak in the course of doing its job. Includes the dependency module itself and
|
||||
any of the native dependency's native dependencies.
|
||||
- .hak/[dependency]/build - An extracted copy of the dependency's node module used to build it.
|
||||
- .hak/[dependency]/out - Another extracted copy of the dependency, this one contains only what will be shipped.
|
||||
- scripts/hak/... - The tool itself
|
||||
- hak/[dependency] - Files provided by the app that tell hak how to build each of its native dependencies.
|
||||
Contains a hak.json file and also some script files, each of which must be referenced in hak.json.
|
||||
- .hak/ - Files generated by hak in the course of doing its job. Includes the dependency module itself and
|
||||
any of the native dependency's native dependencies.
|
||||
- .hak/[dependency]/build - An extracted copy of the dependency's node module used to build it.
|
||||
- .hak/[dependency]/out - Another extracted copy of the dependency, this one contains only what will be shipped.
|
||||
|
||||
# Workings
|
||||
|
||||
@@ -60,10 +60,10 @@ own in the .hak directory (unless one already exists, in which case this is your
|
||||
|
||||
Hak is divided into lifecycle stages, in order:
|
||||
|
||||
- fetch - Download and extract the source of the dependency
|
||||
- link - Link the copy of the dependency into your node_modules directory
|
||||
- build - The Good Stuff. Configure and build any native dependencies, then the module itself.
|
||||
- copy - Copy the built artifact from the module build directory to the module output directory.
|
||||
- fetch - Download and extract the source of the dependency
|
||||
- link - Link the copy of the dependency into your node_modules directory
|
||||
- build - The Good Stuff. Configure and build any native dependencies, then the module itself.
|
||||
- copy - Copy the built artifact from the module build directory to the module output directory.
|
||||
|
||||
# hak.json
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type { DependencyInfo } from "./dep.js";
|
||||
import type HakEnv from "./hakEnv.js";
|
||||
import { DependencyInfo } from "./dep";
|
||||
import HakEnv from "./hakEnv";
|
||||
|
||||
export default async function build(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
await moduleInfo.scripts.build(hakEnv, moduleInfo);
|
||||
|
||||
@@ -6,8 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type { DependencyInfo } from "./dep.js";
|
||||
import type HakEnv from "./hakEnv.js";
|
||||
import { DependencyInfo } from "./dep";
|
||||
import HakEnv from "./hakEnv";
|
||||
|
||||
export default async function check(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
if (moduleInfo.scripts.check) {
|
||||
|
||||
@@ -6,11 +6,11 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import path from "node:path";
|
||||
import path from "path";
|
||||
import { rimraf } from "rimraf";
|
||||
|
||||
import type { DependencyInfo } from "./dep.js";
|
||||
import type HakEnv from "./hakEnv.js";
|
||||
import { DependencyInfo } from "./dep";
|
||||
import HakEnv from "./hakEnv";
|
||||
|
||||
export default async function clean(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
await rimraf(moduleInfo.moduleDotHakDir);
|
||||
|
||||
@@ -6,15 +6,15 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import path from "node:path";
|
||||
import fsProm from "node:fs/promises";
|
||||
import childProcess from "node:child_process";
|
||||
import path from "path";
|
||||
import fsProm from "fs/promises";
|
||||
import childProcess from "child_process";
|
||||
import { rimraf } from "rimraf";
|
||||
import { glob } from "glob";
|
||||
import { mkdirp } from "mkdirp";
|
||||
|
||||
import type HakEnv from "./hakEnv.js";
|
||||
import type { DependencyInfo } from "./dep.js";
|
||||
import HakEnv from "./hakEnv";
|
||||
import { DependencyInfo } from "./dep";
|
||||
|
||||
export default async function copy(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
if (moduleInfo.cfg.prune) {
|
||||
|
||||
@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type HakEnv from "./hakEnv.js";
|
||||
import HakEnv from "./hakEnv";
|
||||
|
||||
export interface DependencyInfo {
|
||||
name: string;
|
||||
|
||||
@@ -6,18 +6,19 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import fsProm from "node:fs/promises";
|
||||
import fsProm from "fs/promises";
|
||||
import childProcess from "child_process";
|
||||
import pacote from "pacote";
|
||||
|
||||
import type HakEnv from "./hakEnv.js";
|
||||
import type { DependencyInfo } from "./dep.js";
|
||||
import HakEnv from "./hakEnv";
|
||||
import { DependencyInfo } from "./dep";
|
||||
|
||||
export default async function fetch(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
let haveModuleBuildDir;
|
||||
try {
|
||||
const stats = await fsProm.stat(moduleInfo.moduleBuildDir);
|
||||
haveModuleBuildDir = stats.isDirectory();
|
||||
} catch {
|
||||
} catch (e) {
|
||||
haveModuleBuildDir = false;
|
||||
}
|
||||
|
||||
@@ -31,8 +32,17 @@ export default async function fetch(hakEnv: HakEnv, moduleInfo: DependencyInfo):
|
||||
});
|
||||
|
||||
console.log("Running yarn install in " + moduleInfo.moduleBuildDir);
|
||||
await hakEnv.spawn("yarn", ["install", "--ignore-scripts"], {
|
||||
cwd: moduleInfo.moduleBuildDir,
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const proc = childProcess.spawn(hakEnv.isWin() ? "yarn.cmd" : "yarn", ["install", "--ignore-scripts"], {
|
||||
stdio: "inherit",
|
||||
cwd: moduleInfo.moduleBuildDir,
|
||||
// We need shell mode on Windows to be able to launch `.cmd` executables
|
||||
// See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
|
||||
shell: hakEnv.isWin(),
|
||||
});
|
||||
proc.on("exit", (code) => {
|
||||
code ? reject(code) : resolve();
|
||||
});
|
||||
});
|
||||
|
||||
// also extract another copy to the output directory at this point
|
||||
|
||||
@@ -8,8 +8,8 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
import { mkdirp } from "mkdirp";
|
||||
|
||||
import type { DependencyInfo } from "./dep.js";
|
||||
import type HakEnv from "./hakEnv.js";
|
||||
import { DependencyInfo } from "./dep";
|
||||
import HakEnv from "./hakEnv";
|
||||
|
||||
export default async function fetchDeps(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
await mkdirp(moduleInfo.moduleDotHakDir);
|
||||
|
||||
@@ -6,13 +6,12 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import path from "node:path";
|
||||
import os from "node:os";
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
import nodePreGypVersioning from "@mapbox/node-pre-gyp/lib/util/versioning";
|
||||
import { getElectronVersionFromInstalled } from "app-builder-lib/out/electron/electronVersion.js";
|
||||
import childProcess, { SpawnOptions } from "node:child_process";
|
||||
import { getElectronVersionFromInstalled } from "app-builder-lib/out/electron/electronVersion";
|
||||
|
||||
import { Arch, Target, TARGETS, getHost, isHostId, TargetId } from "./target.js";
|
||||
import { Arch, Target, TARGETS, getHost, isHostId, TargetId } from "./target";
|
||||
|
||||
async function getRuntime(projectRoot: string): Promise<string> {
|
||||
const electronVersion = await getElectronVersionFromInstalled(projectRoot);
|
||||
@@ -28,8 +27,6 @@ async function getRuntimeVersion(projectRoot: string): Promise<string> {
|
||||
}
|
||||
}
|
||||
|
||||
export type Tool = [cmd: string, ...args: string[]];
|
||||
|
||||
export default class HakEnv {
|
||||
public readonly target: Target;
|
||||
public runtime?: string;
|
||||
@@ -107,41 +104,4 @@ export default class HakEnv {
|
||||
public wantsStaticSqlCipher(): boolean {
|
||||
return !(this.isLinux() || this.isFreeBSD()) || process.env.SQLCIPHER_BUNDLED == "1";
|
||||
}
|
||||
|
||||
public spawn(
|
||||
cmd: string,
|
||||
args: string[],
|
||||
{ ignoreWinCmdlet, ...options }: SpawnOptions & { ignoreWinCmdlet?: boolean } = {},
|
||||
): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const proc = childProcess.spawn(cmd + (!ignoreWinCmdlet && this.isWin() ? ".cmd" : ""), args, {
|
||||
stdio: "inherit",
|
||||
// We need shell mode on Windows to be able to launch `.cmd` executables
|
||||
// See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
|
||||
shell: this.isWin(),
|
||||
...options,
|
||||
});
|
||||
proc.on("exit", (code) => {
|
||||
if (code) {
|
||||
reject(code);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public async checkTools(tools: Tool[]): Promise<void> {
|
||||
for (const [tool, ...args] of tools) {
|
||||
try {
|
||||
await this.spawn(tool, args, {
|
||||
ignoreWinCmdlet: true,
|
||||
stdio: ["ignore"],
|
||||
shell: false,
|
||||
});
|
||||
} catch {
|
||||
throw new Error(`Can't find ${tool}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,11 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import path, { dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import path from "path";
|
||||
|
||||
import HakEnv from "./hakEnv.js";
|
||||
import type { TargetId } from "./target.js";
|
||||
import type { DependencyInfo } from "./dep.js";
|
||||
import { loadJsonFile } from "../../src/utils.js";
|
||||
import packageJson from "../../package.json";
|
||||
import HakEnv from "./hakEnv";
|
||||
import { TargetId } from "./target";
|
||||
import { DependencyInfo } from "./dep";
|
||||
|
||||
const GENERALCOMMANDS = ["target"];
|
||||
|
||||
@@ -30,15 +27,20 @@ const METACOMMANDS: Record<string, string[]> = {
|
||||
// Scripts valid in a hak.json 'scripts' section
|
||||
const HAKSCRIPTS = ["check", "fetch", "build"];
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const prefix = path.join(__dirname, "..", "..");
|
||||
let packageJson;
|
||||
try {
|
||||
packageJson = require(path.join(prefix, "package.json"));
|
||||
} catch (e) {
|
||||
console.error("Can't find a package.json!");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const targetIds: TargetId[] = [];
|
||||
// Apply `--target <target>` option if specified
|
||||
// Can be specified multiple times for the copy command to bundle
|
||||
// multiple arches into a single universal output module)
|
||||
// multiple archs into a single universal output module)
|
||||
for (;;) {
|
||||
// eslint-disable-line no-constant-condition
|
||||
const targetIndex = process.argv.indexOf("--target");
|
||||
@@ -63,19 +65,19 @@ async function main(): Promise<void> {
|
||||
|
||||
const hakDepsCfg = packageJson.hakDependencies || {};
|
||||
|
||||
for (const dep in hakDepsCfg) {
|
||||
for (const dep of Object.keys(hakDepsCfg)) {
|
||||
const hakJsonPath = path.join(prefix, "hak", dep, "hak.json");
|
||||
let hakJson: Record<string, any>;
|
||||
try {
|
||||
hakJson = loadJsonFile(hakJsonPath);
|
||||
} catch {
|
||||
hakJson = await require(hakJsonPath);
|
||||
} catch (e) {
|
||||
console.error("No hak.json found for " + dep + ".");
|
||||
console.log("Expecting " + hakJsonPath);
|
||||
process.exit(1);
|
||||
}
|
||||
deps[dep] = {
|
||||
name: dep,
|
||||
version: hakDepsCfg[dep as keyof typeof hakDepsCfg],
|
||||
version: hakDepsCfg[dep],
|
||||
cfg: hakJson,
|
||||
moduleHakDir: path.join(prefix, "hak", dep),
|
||||
moduleDotHakDir: path.join(hakEnv.dotHakDir, dep),
|
||||
@@ -89,9 +91,9 @@ async function main(): Promise<void> {
|
||||
};
|
||||
|
||||
for (const s of HAKSCRIPTS) {
|
||||
if (hakJson.scripts?.[s]) {
|
||||
const scriptModule = await import(path.join("file://", prefix, "hak", dep, hakJson.scripts[s]));
|
||||
if (scriptModule.default) {
|
||||
if (hakJson.scripts && hakJson.scripts[s]) {
|
||||
const scriptModule = await import(path.join(prefix, "hak", dep, hakJson.scripts[s]));
|
||||
if (scriptModule.__esModule) {
|
||||
deps[dep].scripts[s] = scriptModule.default;
|
||||
} else {
|
||||
deps[dep].scripts[s] = scriptModule;
|
||||
|
||||
@@ -6,12 +6,13 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import path from "node:path";
|
||||
import os from "node:os";
|
||||
import fsProm from "node:fs/promises";
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
import fsProm from "fs/promises";
|
||||
import childProcess from "child_process";
|
||||
|
||||
import HakEnv from "./hakEnv.js";
|
||||
import { DependencyInfo } from "./dep.js";
|
||||
import HakEnv from "./hakEnv";
|
||||
import { DependencyInfo } from "./dep";
|
||||
|
||||
export default async function link(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
const yarnrc = path.join(hakEnv.projectRoot, ".yarnrc");
|
||||
@@ -23,7 +24,7 @@ export default async function link(hakEnv: HakEnv, moduleInfo: DependencyInfo):
|
||||
// Also we do this for each module which is unnecessary, but meh.
|
||||
try {
|
||||
await fsProm.stat(yarnrc);
|
||||
} catch {
|
||||
} catch (e) {
|
||||
await fsProm.writeFile(
|
||||
yarnrc,
|
||||
// XXX: 1. This must be absolute, as yarn will resolve link directories
|
||||
@@ -38,10 +39,31 @@ export default async function link(hakEnv: HakEnv, moduleInfo: DependencyInfo):
|
||||
);
|
||||
}
|
||||
|
||||
await hakEnv.spawn("yarn", ["link"], {
|
||||
cwd: moduleInfo.moduleOutDir,
|
||||
const yarnCmd = "yarn" + (hakEnv.isWin() ? ".cmd" : "");
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const proc = childProcess.spawn(yarnCmd, ["link"], {
|
||||
cwd: moduleInfo.moduleOutDir,
|
||||
stdio: "inherit",
|
||||
// We need shell mode on Windows to be able to launch `.cmd` executables
|
||||
// See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
|
||||
shell: hakEnv.isWin(),
|
||||
});
|
||||
proc.on("exit", (code) => {
|
||||
code ? reject(code) : resolve();
|
||||
});
|
||||
});
|
||||
await hakEnv.spawn("yarn", ["link", moduleInfo.name], {
|
||||
cwd: hakEnv.projectRoot,
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const proc = childProcess.spawn(yarnCmd, ["link", moduleInfo.name], {
|
||||
cwd: hakEnv.projectRoot,
|
||||
stdio: "inherit",
|
||||
// We need shell mode on Windows to be able to launch `.cmd` executables
|
||||
// See https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
|
||||
shell: hakEnv.isWin(),
|
||||
});
|
||||
proc.on("exit", (code) => {
|
||||
code ? reject(code) : resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
#!/usr/bin/env -S npx tsx
|
||||
#!/usr/bin/env -S npx ts-node
|
||||
|
||||
/*
|
||||
* Checks for the presence of a webapp, inspects its version and sets the
|
||||
* version metadata of the package to match.
|
||||
*/
|
||||
|
||||
import { promises as fs } from "node:fs";
|
||||
import { promises as fs } from "fs";
|
||||
import * as asar from "@electron/asar";
|
||||
import * as childProcess from "node:child_process";
|
||||
import * as url from "node:url";
|
||||
import * as childProcess from "child_process";
|
||||
|
||||
export async function versionFromAsar(): Promise<string> {
|
||||
try {
|
||||
await fs.stat("webapp.asar");
|
||||
} catch {
|
||||
} catch (e) {
|
||||
throw new Error("No 'webapp.asar' found. Run 'yarn run fetch'");
|
||||
}
|
||||
|
||||
@@ -58,16 +57,13 @@ async function main(args: string[]): Promise<number> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (import.meta.url.startsWith("file:")) {
|
||||
const modulePath = url.fileURLToPath(import.meta.url);
|
||||
if (process.argv[1] === modulePath) {
|
||||
main(process.argv.slice(2))
|
||||
.then((ret) => {
|
||||
process.exit(ret);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
if (require.main === module) {
|
||||
main(process.argv.slice(2))
|
||||
.then((ret) => {
|
||||
process.exit(ret);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node16",
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"target": "es2022",
|
||||
"module": "node16",
|
||||
"target": "es2017",
|
||||
"module": "commonjs",
|
||||
"sourceMap": false,
|
||||
"strict": true,
|
||||
"lib": ["es2020"]
|
||||
"lib": ["es2020", "dom"]
|
||||
},
|
||||
"include": ["../src/@types", "./**/*.ts"]
|
||||
"include": ["../src/@types", "./**/*.ts"],
|
||||
"ts-node": {
|
||||
"transpileOnly": true
|
||||
}
|
||||
}
|
||||
|
||||
2
src/@types/global.d.ts
vendored
2
src/@types/global.d.ts
vendored
@@ -9,7 +9,7 @@ import { BrowserWindow } from "electron";
|
||||
import Store from "electron-store";
|
||||
import AutoLaunch from "auto-launch";
|
||||
|
||||
import { AppLocalization } from "../language-helper.js";
|
||||
import { AppLocalization } from "../language-helper";
|
||||
|
||||
// global type extensions need to use var for whatever reason
|
||||
/* eslint-disable no-var */
|
||||
|
||||
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type { Streams } from "electron";
|
||||
import { Streams } from "electron";
|
||||
|
||||
type DisplayMediaCallback = (streams: Streams) => void;
|
||||
|
||||
|
||||
@@ -9,34 +9,31 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
// Squirrel on windows starts the app with various flags as hooks to tell us when we've been installed/uninstalled etc.
|
||||
import "./squirrelhooks.js";
|
||||
import "./squirrelhooks";
|
||||
import { app, BrowserWindow, Menu, autoUpdater, protocol, dialog, Input, Event, session } from "electron";
|
||||
// eslint-disable-next-line n/file-extension-in-import
|
||||
import * as Sentry from "@sentry/electron/main";
|
||||
import AutoLaunch from "auto-launch";
|
||||
import path, { dirname } from "node:path";
|
||||
import path from "path";
|
||||
import windowStateKeeper from "electron-window-state";
|
||||
import Store from "electron-store";
|
||||
import fs, { promises as afs } from "node:fs";
|
||||
import { URL, fileURLToPath } from "node:url";
|
||||
import fs, { promises as afs } from "fs";
|
||||
import { URL } from "url";
|
||||
import minimist from "minimist";
|
||||
|
||||
import "./ipc.js";
|
||||
import "./keytar.js";
|
||||
import "./seshat.js";
|
||||
import "./settings.js";
|
||||
import * as tray from "./tray.js";
|
||||
import { buildMenuTemplate } from "./vectormenu.js";
|
||||
import webContentsHandler from "./webcontents-handler.js";
|
||||
import * as updater from "./updater.js";
|
||||
import { getProfileFromDeeplink, protocolInit } from "./protocol.js";
|
||||
import { _t, AppLocalization } from "./language-helper.js";
|
||||
import { setDisplayMediaCallback } from "./displayMediaCallback.js";
|
||||
import { setupMacosTitleBar } from "./macos-titlebar.js";
|
||||
import { loadJsonFile } from "./utils.js";
|
||||
import { setupMediaAuth } from "./media-auth.js";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
import "./ipc";
|
||||
import "./keytar";
|
||||
import "./seshat";
|
||||
import "./settings";
|
||||
import * as tray from "./tray";
|
||||
import { buildMenuTemplate } from "./vectormenu";
|
||||
import webContentsHandler from "./webcontents-handler";
|
||||
import * as updater from "./updater";
|
||||
import { getProfileFromDeeplink, protocolInit } from "./protocol";
|
||||
import { _t, AppLocalization } from "./language-helper";
|
||||
import { setDisplayMediaCallback } from "./displayMediaCallback";
|
||||
import { setupMacosTitleBar } from "./macos-titlebar";
|
||||
import { loadJsonFile } from "./utils";
|
||||
import { setupMediaAuth } from "./media-auth";
|
||||
|
||||
const argv = minimist(process.argv, {
|
||||
alias: { help: "h" },
|
||||
@@ -47,10 +44,6 @@ if (argv["help"]) {
|
||||
console.log(" --profile-dir {path}: Path to where to store the profile.");
|
||||
console.log(" --profile {name}: Name of alternate profile to use, allows for running multiple accounts.");
|
||||
console.log(" --devtools: Install and use react-devtools and react-perf.");
|
||||
console.log(
|
||||
` --config: Path to the config.json file. May also be specified via the ELEMENT_DESKTOP_CONFIG_JSON environment variable.\n` +
|
||||
` Otherwise use the default user location '${app.getPath("userData")}'`,
|
||||
);
|
||||
console.log(" --no-update: Disable automatic updating.");
|
||||
console.log(" --hidden: Start the application hidden in the system tray.");
|
||||
console.log(" --help: Displays this help message.");
|
||||
@@ -58,8 +51,6 @@ if (argv["help"]) {
|
||||
app.exit();
|
||||
}
|
||||
|
||||
const LocalConfigLocation = process.env.ELEMENT_DESKTOP_CONFIG_JSON ?? argv["config"];
|
||||
|
||||
// Electron creates the user data directory (with just an empty 'Dictionaries' directory...)
|
||||
// as soon as the app path is set, so pick a random path in it that must exist if it's a
|
||||
// real user data directory.
|
||||
@@ -106,7 +97,7 @@ async function tryPaths(name: string, root: string, rawPaths: string[]): Promise
|
||||
try {
|
||||
await afs.stat(p);
|
||||
return p + "/";
|
||||
} catch {}
|
||||
} catch (e) {}
|
||||
}
|
||||
console.log(`Couldn't find ${name} files in any of: `);
|
||||
for (const p of paths) {
|
||||
@@ -146,7 +137,7 @@ async function loadConfig(): Promise<void> {
|
||||
|
||||
try {
|
||||
global.vectorConfig = loadJsonFile(asarPath, "config.json");
|
||||
} catch {
|
||||
} catch (e) {
|
||||
// it would be nice to check the error code here and bail if the config
|
||||
// is unparsable, but we get MODULE_NOT_FOUND in the case of a missing
|
||||
// file or invalid json, so node is just very unhelpful.
|
||||
@@ -156,9 +147,7 @@ async function loadConfig(): Promise<void> {
|
||||
|
||||
try {
|
||||
// Load local config and use it to override values from the one baked with the build
|
||||
const localConfig = LocalConfigLocation
|
||||
? loadJsonFile(LocalConfigLocation)
|
||||
: loadJsonFile(app.getPath("userData"), "config.json");
|
||||
const localConfig = loadJsonFile(app.getPath("userData"), "config.json");
|
||||
|
||||
// If the local config has a homeserver defined, don't use the homeserver from the build
|
||||
// config. This is to avoid a problem where Riot thinks there are multiple homeservers
|
||||
@@ -376,9 +365,13 @@ app.on("ready", async () => {
|
||||
|
||||
if (argv["devtools"]) {
|
||||
try {
|
||||
const { installExtension, REACT_DEVELOPER_TOOLS } = await import("electron-devtools-installer");
|
||||
installExtension(REACT_DEVELOPER_TOOLS)
|
||||
.then((ext) => console.log(`Added Extension: ${ext.name}`))
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const { default: installExt, REACT_DEVELOPER_TOOLS, REACT_PERF } = require("electron-devtools-installer");
|
||||
installExt(REACT_DEVELOPER_TOOLS)
|
||||
.then((name: string) => console.log(`Added Extension: ${name}`))
|
||||
.catch((err: unknown) => console.log("An error occurred: ", err));
|
||||
installExt(REACT_PERF)
|
||||
.then((name: string) => console.log(`Added Extension: ${name}`))
|
||||
.catch((err: unknown) => console.log("An error occurred: ", err));
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@@ -452,7 +445,7 @@ app.on("ready", async () => {
|
||||
defaultHeight: 768,
|
||||
});
|
||||
|
||||
const preloadScript = path.normalize(`${__dirname}/preload.cjs`);
|
||||
const preloadScript = path.normalize(`${__dirname}/preload.js`);
|
||||
global.mainWindow = new BrowserWindow({
|
||||
// https://www.electronjs.org/docs/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do
|
||||
backgroundColor: "#fff",
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"about": "Über",
|
||||
"brand_help": "%(brand)s Hilfe",
|
||||
"help": "Hilfe",
|
||||
"preferences": "Präferenzen"
|
||||
"preferences": "Einstellungen"
|
||||
},
|
||||
"confirm_quit": "Wirklich beenden?",
|
||||
"edit_menu": {
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
},
|
||||
"common": {
|
||||
"about": "Over",
|
||||
"brand_help": "%(brand)s Hulp",
|
||||
"help": "Hulp",
|
||||
"preferences": "Voorkeuren"
|
||||
},
|
||||
"confirm_quit": "Weet u zeker dat u wilt stoppen?",
|
||||
@@ -57,7 +55,6 @@
|
||||
},
|
||||
"window_menu": {
|
||||
"bring_all_to_front": "Alles naar voren brengen",
|
||||
"label": "Venster",
|
||||
"zoom": "Zoom"
|
||||
"label": "Venster"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"action": {
|
||||
"cancel": "Cancelar",
|
||||
"close": "Fechar",
|
||||
"close_brand": "Fecha %(brand)s",
|
||||
"copy": "Copiar",
|
||||
"cut": "Cortar",
|
||||
"delete": "Apagar",
|
||||
"edit": "Editar",
|
||||
"minimise": "Minimizar",
|
||||
"paste": "Colar",
|
||||
"paste_match_style": "Colar e combinar o estilo",
|
||||
"quit": "Desistir",
|
||||
"redo": "Refazer",
|
||||
"select_all": "Selecionar tudo",
|
||||
"show_hide": "Mostrar/ocultar",
|
||||
"undo": "Desfazer",
|
||||
"zoom_in": "Ampliar",
|
||||
"zoom_out": "Reduzir"
|
||||
},
|
||||
"common": {
|
||||
"about": "Sobre",
|
||||
"brand_help": "%(brand)s Ajuda",
|
||||
"help": "Ajuda",
|
||||
"preferences": "Preferências"
|
||||
},
|
||||
"confirm_quit": "Tens a certeza de que queres desistir?",
|
||||
"edit_menu": {
|
||||
"speech": "Discurso",
|
||||
"speech_start_speaking": "Começa a falar",
|
||||
"speech_stop_speaking": "Pára de falar"
|
||||
},
|
||||
"file_menu": {
|
||||
"label": "Ficheiro"
|
||||
},
|
||||
"menu": {
|
||||
"hide": "Ocultar",
|
||||
"hide_others": "Ocultar Outros",
|
||||
"services": "Serviços",
|
||||
"unhide": "Mostrar"
|
||||
},
|
||||
"right_click_menu": {
|
||||
"add_to_dictionary": "Adicionar ao dicionário",
|
||||
"copy_email": "Copiar endereço de e-mail",
|
||||
"copy_image": "Copiar imagem",
|
||||
"copy_image_url": "Copiar endereço da imagem",
|
||||
"copy_link_url": "Copiar endereço do link",
|
||||
"save_image_as": "Salvar imagem como...",
|
||||
"save_image_as_error_description": "A imagem não foi salva",
|
||||
"save_image_as_error_title": "Falha ao salvar a imagem"
|
||||
},
|
||||
"view_menu": {
|
||||
"actual_size": "Tamanho original",
|
||||
"toggle_developer_tools": "Alternar ferramentas de desenvolvedor",
|
||||
"toggle_full_screen": "Alternar ecrã inteiro",
|
||||
"view": "Ver"
|
||||
},
|
||||
"window_menu": {
|
||||
"bring_all_to_front": "Traz tudo para a frente",
|
||||
"label": "Janela",
|
||||
"zoom": "Ampliação"
|
||||
}
|
||||
}
|
||||
20
src/ipc.ts
20
src/ipc.ts
@@ -9,11 +9,11 @@ import { app, autoUpdater, desktopCapturer, ipcMain, powerSaveBlocker, TouchBar,
|
||||
import { relaunchApp } from "electron-clear-data";
|
||||
|
||||
import IpcMainEvent = Electron.IpcMainEvent;
|
||||
import { recordSSOSession } from "./protocol.js";
|
||||
import { randomArray } from "./utils.js";
|
||||
import { Settings } from "./settings.js";
|
||||
import { keytar } from "./keytar.js";
|
||||
import { getDisplayMediaCallback, setDisplayMediaCallback } from "./displayMediaCallback.js";
|
||||
import { recordSSOSession } from "./protocol";
|
||||
import { randomArray } from "./utils";
|
||||
import { Settings } from "./settings";
|
||||
import { keytar } from "./keytar";
|
||||
import { getDisplayMediaCallback, setDisplayMediaCallback } from "./displayMediaCallback";
|
||||
|
||||
ipcMain.on("setBadgeCount", function (_ev: IpcMainEvent, count: number): void {
|
||||
if (process.platform !== "win32") {
|
||||
@@ -147,7 +147,7 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
|
||||
if (ret === null) {
|
||||
ret = await keytar?.getPassword("riot.im", `${args[0]}|${args[1]}`);
|
||||
}
|
||||
} catch {
|
||||
} catch (e) {
|
||||
// if an error is thrown (e.g. keytar can't connect to the keychain),
|
||||
// then return null, which means the default pickle key will be used
|
||||
ret = null;
|
||||
@@ -157,11 +157,9 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
|
||||
case "createPickleKey":
|
||||
try {
|
||||
const pickleKey = await randomArray(32);
|
||||
// We purposefully throw if keytar is not available so the caller can handle it
|
||||
// rather than sending them a pickle key we did not store on their behalf.
|
||||
await keytar!.setPassword("element.io", `${args[0]}|${args[1]}`, pickleKey);
|
||||
await keytar?.setPassword("element.io", `${args[0]}|${args[1]}`, pickleKey);
|
||||
ret = pickleKey;
|
||||
} catch {
|
||||
} catch (e) {
|
||||
ret = null;
|
||||
}
|
||||
break;
|
||||
@@ -172,7 +170,7 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
|
||||
// migrate from riot.im (remove once we think there will no longer be
|
||||
// logins from the time of riot.im)
|
||||
await keytar?.deletePassword("riot.im", `${args[0]}|${args[1]}`);
|
||||
} catch {}
|
||||
} catch (e) {}
|
||||
break;
|
||||
case "getDesktopCapturerSources":
|
||||
ret = (await desktopCapturer.getSources(args[0])).map((source) => ({
|
||||
|
||||
@@ -9,7 +9,8 @@ import type * as Keytar from "keytar"; // Hak dependency type
|
||||
|
||||
let keytar: typeof Keytar | undefined;
|
||||
try {
|
||||
({ default: keytar } = await import("keytar"));
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
keytar = require("keytar");
|
||||
} catch (e) {
|
||||
if ((<NodeJS.ErrnoException>e).code === "MODULE_NOT_FOUND") {
|
||||
console.log("Keytar isn't installed; secure key storage is disabled.");
|
||||
|
||||
@@ -7,14 +7,10 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
import counterpart from "counterpart";
|
||||
import { TranslationKey as TKey } from "matrix-web-i18n";
|
||||
import { dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import type Store from "electron-store";
|
||||
import type EN from "./i18n/strings/en_EN.json";
|
||||
import { loadJsonFile } from "./utils.js";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
import { loadJsonFile } from "./utils";
|
||||
|
||||
const FALLBACK_LOCALE = "en";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type { BrowserWindow } from "electron";
|
||||
import { BrowserWindow } from "electron";
|
||||
|
||||
export function setupMacosTitleBar(window: BrowserWindow): void {
|
||||
if (process.platform !== "darwin") return;
|
||||
@@ -93,8 +93,7 @@ export function setupMacosTitleBar(window: BrowserWindow): void {
|
||||
.mx_LeftPanel,
|
||||
.mx_RoomView,
|
||||
.mx_SpaceRoomView,
|
||||
.mx_AccessibleButton,
|
||||
.mx_Dialog {
|
||||
.mx_AccessibleButton {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
/* Exclude context menus and their backgrounds */
|
||||
|
||||
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { type BrowserWindow, ipcMain, session } from "electron";
|
||||
import { BrowserWindow, ipcMain, session } from "electron";
|
||||
|
||||
/**
|
||||
* Check for feature support from the server.
|
||||
@@ -33,74 +33,39 @@ async function getAccessToken(window: BrowserWindow): Promise<string | undefined
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the homeserver url
|
||||
* This requires asking the renderer process for the homeserver url.
|
||||
*/
|
||||
async function getHomeserverUrl(window: BrowserWindow): Promise<string> {
|
||||
return new Promise((resolve) => {
|
||||
ipcMain.once("homeserverUrl", (_, homeserver) => {
|
||||
resolve(homeserver);
|
||||
});
|
||||
window.webContents.send("homeserverUrl"); // ping now that the listener exists
|
||||
});
|
||||
}
|
||||
|
||||
export function setupMediaAuth(window: BrowserWindow): void {
|
||||
session.defaultSession.webRequest.onBeforeRequest(async (req, callback) => {
|
||||
// This handler emulates the element-web service worker, where URLs are rewritten late in the request
|
||||
// for backwards compatibility. As authenticated media becomes more prevalent, this should be replaced
|
||||
// by the app using authenticated URLs from the outset.
|
||||
try {
|
||||
const url = new URL(req.url);
|
||||
if (
|
||||
!url.pathname.startsWith("/_matrix/media/v3/download") &&
|
||||
!url.pathname.startsWith("/_matrix/media/v3/thumbnail")
|
||||
) {
|
||||
return callback({}); // not a URL we care about
|
||||
}
|
||||
let url = req.url;
|
||||
if (!url.includes("/_matrix/media/v3/download") && !url.includes("/_matrix/media/v3/thumbnail")) {
|
||||
return callback({}); // not a URL we care about
|
||||
}
|
||||
|
||||
const supportedVersions = await getSupportedVersions(window);
|
||||
// We have to check that the access token is truthy otherwise we'd be intercepting pre-login media request too,
|
||||
// e.g. those required for SSO button icons.
|
||||
const accessToken = await getAccessToken(window);
|
||||
if (supportedVersions.includes("v1.11") && accessToken) {
|
||||
url.href = url.href.replace(/\/media\/v3\/(.*)\//, "/client/v1/media/$1/");
|
||||
return callback({ redirectURL: url.toString() });
|
||||
} else {
|
||||
return callback({}); // no support == no modification
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
const supportedVersions = await getSupportedVersions(window);
|
||||
// We have to check that the access token is truthy otherwise we'd be intercepting pre-login media request too,
|
||||
// e.g. those required for SSO button icons.
|
||||
const accessToken = await getAccessToken(window);
|
||||
if (supportedVersions.includes("v1.11") && accessToken) {
|
||||
url = url.replace(/\/media\/v3\/(.*)\//, "/client/v1/media/$1/");
|
||||
return callback({ redirectURL: url });
|
||||
} else {
|
||||
return callback({}); // no support == no modification
|
||||
}
|
||||
});
|
||||
|
||||
session.defaultSession.webRequest.onBeforeSendHeaders(async (req, callback) => {
|
||||
try {
|
||||
const url = new URL(req.url);
|
||||
if (!url.pathname.startsWith("/_matrix/client/v1/media")) {
|
||||
return callback({}); // invoke unmodified
|
||||
}
|
||||
|
||||
// Is this request actually going to the homeserver?
|
||||
// We don't combine this check with the one above on purpose.
|
||||
// We're fetching the homeserver url through IPC and should do so
|
||||
// as sparingly as possible.
|
||||
const homeserver = await getHomeserverUrl(window);
|
||||
const isRequestToHomeServer = homeserver && url.origin === new URL(homeserver).origin;
|
||||
if (!isRequestToHomeServer) {
|
||||
return callback({}); // invoke unmodified
|
||||
}
|
||||
|
||||
// Only add authorization header to authenticated media URLs. This emulates the service worker
|
||||
// behaviour in element-web.
|
||||
const accessToken = await getAccessToken(window);
|
||||
// `accessToken` can be falsy, but if we're trying to download media without authentication
|
||||
// then we should expect failure anyway.
|
||||
const headers = { ...req.requestHeaders, Authorization: `Bearer ${accessToken}` };
|
||||
return callback({ requestHeaders: headers });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
if (!req.url.includes("/_matrix/client/v1/media")) {
|
||||
return callback({}); // invoke unmodified
|
||||
}
|
||||
|
||||
// Only add authorization header to authenticated media URLs. This emulates the service worker
|
||||
// behaviour in element-web.
|
||||
const accessToken = await getAccessToken(window);
|
||||
// `accessToken` can be falsy, but if we're trying to download media without authentication
|
||||
// then we should expect failure anyway.
|
||||
const headers = { ...req.requestHeaders, Authorization: `Bearer ${accessToken}` };
|
||||
return callback({ requestHeaders: headers });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
// This file is compiled to CommonJS rather than ESM otherwise the browser chokes on the import statement.
|
||||
|
||||
import { ipcRenderer, contextBridge, IpcRendererEvent } from "electron";
|
||||
|
||||
// Expose only expected IPC wrapper APIs to the renderer process to avoid
|
||||
@@ -30,7 +28,6 @@ const CHANNELS = [
|
||||
"userDownloadAction",
|
||||
"openDesktopCapturerSourcePicker",
|
||||
"userAccessToken",
|
||||
"homeserverUrl",
|
||||
"serverSupportedVersions",
|
||||
];
|
||||
|
||||
@@ -7,9 +7,9 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { app } from "electron";
|
||||
import { URL } from "node:url";
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
import { URL } from "url";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
const LEGACY_PROTOCOL = "element";
|
||||
const PROTOCOL = "io.element.desktop";
|
||||
@@ -50,7 +50,7 @@ function readStore(): Record<string, string> {
|
||||
const s = fs.readFileSync(storePath, { encoding: "utf8" });
|
||||
const o = JSON.parse(s);
|
||||
return typeof o === "object" ? o : {};
|
||||
} catch {
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { app, ipcMain } from "electron";
|
||||
import { promises as afs } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { promises as afs } from "fs";
|
||||
import path from "path";
|
||||
|
||||
import type {
|
||||
Seshat as SeshatType,
|
||||
@@ -15,8 +15,8 @@ import type {
|
||||
ReindexError as ReindexErrorType,
|
||||
} from "matrix-seshat"; // Hak dependency type
|
||||
import IpcMainEvent = Electron.IpcMainEvent;
|
||||
import { randomArray } from "./utils.js";
|
||||
import { keytar } from "./keytar.js";
|
||||
import { randomArray } from "./utils";
|
||||
import { keytar } from "./keytar";
|
||||
|
||||
let seshatSupported = false;
|
||||
let Seshat: typeof SeshatType;
|
||||
@@ -24,7 +24,8 @@ let SeshatRecovery: typeof SeshatRecoveryType;
|
||||
let ReindexError: typeof ReindexErrorType;
|
||||
|
||||
try {
|
||||
const seshatModule = await import("matrix-seshat");
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const seshatModule = require("matrix-seshat");
|
||||
Seshat = seshatModule.Seshat;
|
||||
SeshatRecovery = seshatModule.SeshatRecovery;
|
||||
ReindexError = seshatModule.ReindexError;
|
||||
@@ -59,17 +60,9 @@ async function getOrCreatePassphrase(key: string): Promise<string> {
|
||||
}
|
||||
|
||||
const deleteContents = async (p: string): Promise<void> => {
|
||||
try {
|
||||
for (const entry of await afs.readdir(p)) {
|
||||
const curPath = path.join(p, entry);
|
||||
try {
|
||||
await afs.unlink(curPath);
|
||||
} catch (e) {
|
||||
console.log("Error deleting a file in EventStore directory", e);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Error reading the files in EventStore directory", e);
|
||||
for (const entry of await afs.readdir(p)) {
|
||||
const curPath = path.join(p, entry);
|
||||
await afs.unlink(curPath);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -122,7 +115,10 @@ ipcMain.on("seshat", async function (_ev: IpcMainEvent, payload): Promise<void>
|
||||
// anyways so reindexing it is a waste of time.
|
||||
if (userVersion === 0) {
|
||||
await recoveryIndex.shutdown();
|
||||
await deleteContents(eventStorePath);
|
||||
|
||||
try {
|
||||
await deleteContents(eventStorePath);
|
||||
} catch (e) {}
|
||||
} else {
|
||||
await recoveryIndex.reindex();
|
||||
}
|
||||
@@ -151,7 +147,9 @@ ipcMain.on("seshat", async function (_ev: IpcMainEvent, payload): Promise<void>
|
||||
break;
|
||||
|
||||
case "deleteEventIndex": {
|
||||
await deleteContents(eventStorePath);
|
||||
try {
|
||||
await deleteContents(eventStorePath);
|
||||
} catch (e) {}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -266,7 +264,7 @@ ipcMain.on("seshat", async function (_ev: IpcMainEvent, payload): Promise<void>
|
||||
else {
|
||||
try {
|
||||
ret = await eventIndex.loadCheckpoints();
|
||||
} catch {
|
||||
} catch (e) {
|
||||
ret = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import * as tray from "./tray.js";
|
||||
import * as tray from "./tray";
|
||||
|
||||
interface Setting {
|
||||
read(): Promise<any>;
|
||||
|
||||
@@ -6,8 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import path from "node:path";
|
||||
import { spawn } from "node:child_process";
|
||||
import path from "path";
|
||||
import { spawn } from "child_process";
|
||||
import { app } from "electron";
|
||||
|
||||
export function getSquirrelExecutable(): string {
|
||||
|
||||
@@ -9,11 +9,11 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
import { app, Tray, Menu, nativeImage } from "electron";
|
||||
import pngToIco from "png-to-ico";
|
||||
import path from "node:path";
|
||||
import fs from "node:fs";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import { v5 as uuidv5 } from "uuid";
|
||||
|
||||
import { _t } from "./language-helper.js";
|
||||
import { _t } from "./language-helper";
|
||||
|
||||
let trayIcon: Tray | null = null;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
import { app, autoUpdater, ipcMain } from "electron";
|
||||
import fs from "node:fs/promises";
|
||||
|
||||
import { getSquirrelExecutable } from "./squirrelhooks.js";
|
||||
import { getSquirrelExecutable } from "./squirrelhooks";
|
||||
|
||||
const UPDATE_POLL_INTERVAL_MS = 60 * 60 * 1000;
|
||||
const INITIAL_UPDATE_DELAY_MS = 30 * 1000;
|
||||
@@ -31,8 +31,8 @@ async function safeCheckForUpdate(): Promise<void> {
|
||||
// To avoid this we check manually whether an update is available and call the
|
||||
// autoUpdater.checkForUpdates() when something new is there.
|
||||
try {
|
||||
const res = await fetch(feedUrl);
|
||||
const { currentRelease } = (await res.json()) as { currentRelease: string };
|
||||
const res = await global.fetch(feedUrl);
|
||||
const { currentRelease } = await res.json();
|
||||
const latestVersionDownloaded = latestUpdateDownloaded?.releaseName;
|
||||
console.info(
|
||||
`Latest version from release download: ${currentRelease} (current: ${app.getVersion()}, most recent downloaded ${latestVersionDownloaded}})`,
|
||||
|
||||
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import crypto from "node:crypto";
|
||||
import crypto from "crypto";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
import { app, shell, Menu, MenuItem, MenuItemConstructorOptions } from "electron";
|
||||
|
||||
import { _t } from "./language-helper.js";
|
||||
import { _t } from "./language-helper";
|
||||
|
||||
const isMac = process.platform === "darwin";
|
||||
|
||||
|
||||
@@ -21,12 +21,13 @@ import {
|
||||
IpcMainEvent,
|
||||
Event,
|
||||
} from "electron";
|
||||
import url from "node:url";
|
||||
import fs from "node:fs";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import path from "node:path";
|
||||
import url from "url";
|
||||
import fs from "fs";
|
||||
import fetch from "node-fetch";
|
||||
import { pipeline } from "stream/promises";
|
||||
import path from "path";
|
||||
|
||||
import { _t } from "./language-helper.js";
|
||||
import { _t } from "./language-helper";
|
||||
|
||||
const MAILTO_PREFIX = "mailto:";
|
||||
|
||||
@@ -175,18 +176,15 @@ function onLinkContextMenu(ev: Event, params: ContextMenuParams, webContents: We
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
function cutCopyPasteSelectContextMenus(
|
||||
params: ContextMenuParams,
|
||||
webContents: WebContents,
|
||||
): MenuItemConstructorOptions[] {
|
||||
function cutCopyPasteSelectContextMenus(params: ContextMenuParams): MenuItemConstructorOptions[] {
|
||||
const options: MenuItemConstructorOptions[] = [];
|
||||
|
||||
if (params.misspelledWord) {
|
||||
params.dictionarySuggestions.forEach((word) => {
|
||||
options.push({
|
||||
label: word,
|
||||
click: () => {
|
||||
webContents.replaceMisspelling(word);
|
||||
click: (menuItem, browserWindow) => {
|
||||
browserWindow?.webContents.replaceMisspelling(word);
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -196,8 +194,8 @@ function cutCopyPasteSelectContextMenus(
|
||||
},
|
||||
{
|
||||
label: _t("right_click_menu|add_to_dictionary"),
|
||||
click: () => {
|
||||
webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord);
|
||||
click: (menuItem, browserWindow) => {
|
||||
browserWindow?.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord);
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -239,8 +237,8 @@ function cutCopyPasteSelectContextMenus(
|
||||
return options;
|
||||
}
|
||||
|
||||
function onSelectedContextMenu(ev: Event, params: ContextMenuParams, webContents: WebContents): void {
|
||||
const items = cutCopyPasteSelectContextMenus(params, webContents);
|
||||
function onSelectedContextMenu(ev: Event, params: ContextMenuParams): void {
|
||||
const items = cutCopyPasteSelectContextMenus(params);
|
||||
const popupMenu = Menu.buildFromTemplate(items);
|
||||
|
||||
// popup() requires an options object even for no options
|
||||
@@ -248,12 +246,12 @@ function onSelectedContextMenu(ev: Event, params: ContextMenuParams, webContents
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
function onEditableContextMenu(ev: Event, params: ContextMenuParams, webContents: WebContents): void {
|
||||
function onEditableContextMenu(ev: Event, params: ContextMenuParams): void {
|
||||
const items: MenuItemConstructorOptions[] = [
|
||||
{ role: "undo" },
|
||||
{ role: "redo", enabled: params.editFlags.canRedo },
|
||||
{ type: "separator" },
|
||||
...cutCopyPasteSelectContextMenus(params, webContents),
|
||||
...cutCopyPasteSelectContextMenus(params),
|
||||
];
|
||||
|
||||
const popupMenu = Menu.buildFromTemplate(items);
|
||||
@@ -288,9 +286,9 @@ export default (webContents: WebContents): void => {
|
||||
if (params.linkURL || params.srcURL) {
|
||||
onLinkContextMenu(ev, params, webContents);
|
||||
} else if (params.selectionText) {
|
||||
onSelectedContextMenu(ev, params, webContents);
|
||||
onSelectedContextMenu(ev, params);
|
||||
} else if (params.isEditable) {
|
||||
onEditableContextMenu(ev, params, webContents);
|
||||
onEditableContextMenu(ev, params);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2,18 +2,17 @@
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "node16",
|
||||
"moduleResolution": "node16",
|
||||
"skipLibCheck": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"target": "es2022",
|
||||
"sourceMap": false,
|
||||
"outDir": "./lib",
|
||||
"rootDir": "./src",
|
||||
"declaration": true,
|
||||
"typeRoots": ["src/@types", "node_modules/@types"],
|
||||
"lib": ["es2022"],
|
||||
"lib": ["es2022", "dom"],
|
||||
"types": ["node"],
|
||||
"strict": true
|
||||
},
|
||||
"include": ["./src/**/*.ts", "./src/**/*.cts"]
|
||||
"include": ["./src/**/*.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user