Compare commits

...

38 Commits

Author SHA1 Message Date
Michael Telatynski
13157b6a72 Merge branch 'develop' of ssh://github.com/vector-im/element-desktop into renovate/electron-builder
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

# Conflicts:
#	package.json
#	yarn.lock
2025-12-04 15:34:04 +00:00
Michael Telatynski
1d236b691f Update to electron-builder 26.3.4
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-12-04 15:31:54 +00:00
renovate[bot]
d9fb40bf07 Update dependency chokidar to v5 (#2722)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-04 09:13:08 +00:00
RiotRobot
ce5016f734 Merge branch 'master' into develop 2025-12-03 18:02:01 +00:00
RiotRobot
545bf3f30c Merge branch 'master' into develop 2025-12-02 15:10:08 +00:00
Michael Telatynski
3dbcc4233b Merge conflict 2025-12-02 14:10:17 +00:00
Michael Telatynski
0d800f9999 Try with yarn berry 2025-12-02 14:07:21 +00:00
Michael Telatynski
d7a95473df Update to 26.3.3
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-12-02 09:56:45 +00:00
renovate[bot]
90194bbd64 Update dependency @playwright/test to v1.57.0 (#2719)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 16:06:13 +00:00
Michael Telatynski
c827e806ea Remove keytar-forked (#2723) 2025-11-28 14:52:35 +00:00
Michael Telatynski
22b5cc730e Revert back to yarn classic
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-28 09:34:36 +00:00
Michael Telatynski
62546482f7 Bump electron-builder to 26.3.2
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-28 09:09:20 +00:00
Michael Telatynski
e84aa49d86 Fix Windows test
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 12:49:00 +00:00
Michael Telatynski
e9547d1a83 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 12:27:46 +00:00
Michael Telatynski
ff44baaf96 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 12:14:57 +00:00
Michael Telatynski
a485adb121 Bump corepack on windows
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 11:58:59 +00:00
Michael Telatynski
ce5cb414a3 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 11:53:20 +00:00
Michael Telatynski
201a5005a8 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 11:45:57 +00:00
Michael Telatynski
639ac560ec Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 11:22:06 +00:00
Michael Telatynski
360fddeac8 Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 11:12:57 +00:00
Michael Telatynski
9bddd89d7d Run corepack enable in CI
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 11:03:24 +00:00
Michael Telatynski
85b165069c Merge branch 'develop' of ssh://github.com/vector-im/element-desktop into renovate/electron-builder
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

# Conflicts:
#	yarn.lock
2025-11-27 10:58:53 +00:00
Michael Telatynski
48c771414d Migrate to yarn berry
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-27 10:48:18 +00:00
renovate[bot]
e63d76558b Update dependency prettier to v3.7.0 (#2720)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-27 10:39:18 +00:00
renovate[bot]
746f4aa30f Update electron-builder to v26.3.0 2025-11-27 10:18:01 +00:00
renovate[bot]
f2a28e33d7 Update electron-builder to v26.3.0 (#2710)
* Update electron-builder to v26.3.0

* Bump to 26.3.1 to pick up ESM fix

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Drop to 26.2.0

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2025-11-26 20:41:20 +00:00
Michael Telatynski
d5e27e5b16 Update snapshot (#2717) 2025-11-26 20:08:07 +00:00
renovate[bot]
17a16d6750 Update dependency glob to v13 (#2714)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 16:10:21 +00:00
renovate[bot]
a2cc5d6dc5 Update actions/checkout action to v6 (#2713)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 16:02:40 +00:00
renovate[bot]
b99964c827 Update electron (#2709)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 15:49:19 +00:00
renovate[bot]
fde8bc40c8 Update mcr.microsoft.com/playwright Docker tag to v1.57.0 (#2711)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 15:41:05 +00:00
renovate[bot]
92ff9d19b1 Update typescript-eslint monorepo to v8.47.0 (#2712)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 15:40:16 +00:00
renovate[bot]
db40cee64e Update peter-evans/repository-dispatch digest to 28959ce (#2705)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 15:38:27 +00:00
renovate[bot]
3eed0b6d43 Update dependency @stylistic/eslint-plugin to v5.6.1 (#2708)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 15:38:02 +00:00
renovate[bot]
a219672e88 Update all non-major dependencies (#2707)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 15:37:44 +00:00
renovate[bot]
5f1178a834 Update aws-actions/configure-aws-credentials digest to 61815dc (#2704)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 15:36:58 +00:00
renovate[bot]
eabdab4db7 Update actions/setup-python digest to 83679a8 (#2703)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 15:36:25 +00:00
renovate[bot]
8499e091c9 Update rust:bullseye Docker digest to 4886b15 (#2706)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-25 15:33:38 +00:00
27 changed files with 10171 additions and 7594 deletions

View File

@@ -216,7 +216,7 @@ jobs:
- name: Notify packages.element.io of new files
if: needs.prepare.outputs.deploy == 'true'
uses: peter-evans/repository-dispatch@5fc4efd1a4797ddb68ffd0714a238564e4cc0e6f # v4
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4
with:
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
repository: element-hq/packages.element.io
@@ -274,7 +274,7 @@ jobs:
id-token: write # This is required for requesting the JWT
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5
with:
role-to-assume: arn:aws:iam::264135176173:role/Push-ElementDesktop-MSI
role-session-name: githubaction-run-${{ github.run_id }}

View File

@@ -53,8 +53,9 @@ jobs:
runs-on: ubuntu-24.04
if: ${{ !cancelled() }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
cache: "yarn"

View File

@@ -105,7 +105,7 @@ jobs:
}
}
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
with:
repository: element-hq/element-desktop
ref: ${{ inputs.ref }}
@@ -122,6 +122,7 @@ jobs:
path: |
./.hak
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: .node-version

View File

@@ -75,7 +75,7 @@ jobs:
runs-on: macos-14 # M1
environment: ${{ inputs.sign && 'packages.element.io' || '' }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
with:
repository: element-hq/element-desktop
ref: ${{ inputs.ref }}
@@ -101,10 +101,11 @@ jobs:
rustup target add x86_64-apple-darwin
# M1 macos-14 comes without Python preinstalled
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
with:
python-version: "3.13"
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: .node-version
@@ -113,10 +114,6 @@ jobs:
- name: Install Deps
run: "yarn install --frozen-lockfile"
# Python 3.12 drops distutils which keytar relies on
- name: Install setuptools
run: pip3 install setuptools
- name: Build Natives
if: steps.cache.outputs.cache-hit != 'true'
run: yarn build:native:universal

View File

@@ -54,8 +54,9 @@ jobs:
outputs:
nightly-version: ${{ steps.versions.outputs.nightly }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: .node-version

View File

@@ -36,10 +36,14 @@ jobs:
name: Test ${{ inputs.project }}
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
with:
repository: ${{ github.repository == 'element-hq/element-web-pro' && 'element-hq/element-desktop' || github.repository }}
# https://github.com/actions/setup-node/issues/480#issuecomment-2907867335
- run: npm install -g corepack@0.34.5 --force
if: runner.os == 'Windows'
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: .node-version

View File

@@ -108,7 +108,7 @@ jobs:
}
}
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
with:
repository: element-hq/element-desktop
ref: ${{ inputs.ref }}
@@ -148,6 +148,9 @@ jobs:
rustup default stable
rustup target add ${{ steps.config.outputs.target }}
# https://github.com/actions/setup-node/issues/480#issuecomment-2907867335
- run: npm install -g corepack@0.34.5 --force
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: .node-version

View File

@@ -19,7 +19,7 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3

View File

@@ -9,8 +9,9 @@ jobs:
name: "Typescript Syntax Check"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: package.json
@@ -25,7 +26,7 @@ jobs:
i18n_lint:
name: "i18n Check"
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@main
uses: matrix-org/matrix-web-i18n/.github/workflows/i18n_check.yml@t3chguy/corepack
permissions:
pull-requests: read
with:
@@ -35,8 +36,9 @@ jobs:
name: "ESLint"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: package.json
@@ -53,8 +55,9 @@ jobs:
name: "Workflow Lint"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: package.json
@@ -71,8 +74,9 @@ jobs:
name: "Analyse Dead Code"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- run: corepack enable
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: package.json

2
.gitignore vendored
View File

@@ -18,3 +18,5 @@ yarn-error.log
/hak/**/*.js
/scripts/hak/**/*.js
.DS_Store
/playwright-report
/.yarn/install-state.gz

1
.yarnrc.yml Normal file
View File

@@ -0,0 +1 @@
nodeLinker: node-modules

View File

@@ -1,16 +1,13 @@
# 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@sha256:8d9b5e80062dcdb7f037b4eef92a6649632034d6811652e028706ea93db64159
FROM rust:bullseye@sha256:4886b155a84b46ad61df6a2249905bea8c61fc1eaa903398713233858ff6306b
ENV DEBIAN_FRONTEND=noninteractive
RUN curl --proto "=https" -L https://yarnpkg.com/latest.tar.gz | tar xvz && mv yarn-* /yarn && ln -s /yarn/bin/yarn /usr/bin/yarn
RUN apt-get -qq update && apt-get -y -qq dist-upgrade && \
apt-get -y -qq install --no-install-recommends \
# tclsh is required for building SQLite as part of SQLCipher
tcl \
# libsecret-1-dev is required even for prebuild keytar
libsecret-1-dev \
# Used by seshat (when not SQLCIPHER_STATIC) \
libsqlcipher-dev && \
apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*
@@ -18,6 +15,7 @@ RUN ln -s /usr/bin/python3 /usr/bin/python & ln -s /usr/bin/pip3 /usr/bin/pip
ENV DEBUG_COLORS=true
ENV FORCE_COLOR=true
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
WORKDIR /project

View File

@@ -9,3 +9,4 @@ ARCH="${archMap["$TARGETARCH"]}"
NODE_VERSION=$(cat /.node-version | sed -e 's/^v//')
curl --proto "=https" -L "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-$TARGETOS-$ARCH.tar.gz" | tar xz -C /usr/local --strip-components=1 && \
unlink /usr/local/CHANGELOG.md && unlink /usr/local/LICENSE && unlink /usr/local/README.md
corepack enable

View File

@@ -17,7 +17,8 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
}
console.log("Running yarn install");
await hakEnv.spawn("yarn", ["install"], {
await hakEnv.spawn("corepack", ["yarn@1.22.22", "install"], {
cwd: moduleInfo.moduleBuildDir,
env,
shell: true,
@@ -26,7 +27,7 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
const buildTarget = hakEnv.wantsStaticSqlCipher() ? "build-bundled" : "build";
console.log("Running yarn build");
await hakEnv.spawn("yarn", ["run", buildTarget], {
await hakEnv.spawn("corepack", ["yarn@1.22.22", "run", buildTarget], {
cwd: moduleInfo.moduleBuildDir,
env,
shell: true,

View File

@@ -56,7 +56,7 @@
"test": "playwright test",
"test:open": "yarn test --ui",
"test:screenshots:build": "docker build playwright -t element-desktop-playwright --platform linux/amd64",
"test:screenshots:run": "docker run --rm --network host -v $(pwd):/work/element-desktop -v /var/run/docker.sock:/var/run/docker.sock --platform linux/amd64 -it element-desktop-playwright",
"test:screenshots:run": "docker run --rm --network host -v $(pwd):/work/element-desktop -v element-desktop-playwright:/work/element-desktop/node_modules -v /var/run/docker.sock:/var/run/docker.sock --platform linux/amd64 -it element-desktop-playwright",
"postinstall": "patch-package && electron-builder install-app-deps"
},
"dependencies": {
@@ -65,7 +65,6 @@
"counterpart": "^0.18.6",
"electron-store": "^11.0.0",
"electron-window-state": "^5.0.3",
"keytar-forked": "7.10.0",
"minimist": "^1.2.6",
"png-to-ico": "^3.0.0",
"uuid": "^13.0.0"
@@ -77,7 +76,7 @@
"@babel/preset-env": "^7.18.10",
"@babel/preset-typescript": "^7.18.6",
"@electron/asar": "4.0.1",
"@playwright/test": "1.56.1",
"@playwright/test": "1.57.0",
"@stylistic/eslint-plugin": "^5.0.0",
"@types/auto-launch": "^5.0.1",
"@types/counterpart": "^0.18.1",
@@ -86,12 +85,12 @@
"@types/pacote": "^11.1.1",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"app-builder-lib": "26.1.0",
"chokidar": "^4.0.0",
"app-builder-lib": "26.3.4",
"chokidar": "^5.0.0",
"detect-libc": "^2.0.0",
"electron": "39.1.1",
"electron-builder": "26.1.0",
"electron-builder-squirrel-windows": "26.1.0",
"electron": "39.2.3",
"electron-builder": "26.3.4",
"electron-builder-squirrel-windows": "26.3.4",
"electron-devtools-installer": "^4.0.0",
"eslint": "^8.26.0",
"eslint-config-google": "^0.14.0",
@@ -100,7 +99,7 @@
"eslint-plugin-matrix-org": "^3.0.0",
"eslint-plugin-n": "^17.12.0",
"eslint-plugin-unicorn": "^56.0.0",
"glob": "^11.0.0",
"glob": "^13.0.0",
"husky": "^9.1.6",
"knip": "^5.0.0",
"lint-staged": "^16.0.0",
@@ -121,6 +120,7 @@
"resolutions": {
"@types/node": "18.19.130",
"config-file-ts": "0.2.8-rc1",
"node-abi": "4.17.0"
}
"node-abi": "4.24.0"
},
"packageManager": "yarn@4.12.0"
}

View File

@@ -1,8 +1,11 @@
FROM mcr.microsoft.com/playwright:v1.56.1-jammy@sha256:d518367161e599b64e4e8b83ff180be45bfe22efb78dde77fc4c2942340fe8ca
FROM mcr.microsoft.com/playwright:v1.57.0-jammy@sha256:6aca677c27a967caf7673d108ac67ffaf8fed134f27e17b27a05464ca0ace831
WORKDIR /work/element-desktop
RUN apt-get update && apt-get -y install xvfb && apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get -y install xvfb dbus-x11 && apt-get purge -y --auto-remove && rm -rf /var/lib/apt/lists/*
# Create node_modules & dist dirs so that the volumes have the correct permissions
RUN mkdir node_modules dist && chown 1000:1000 node_modules dist
USER 1000:1000

View File

@@ -8,4 +8,11 @@ sleep 2
export DISPLAY=:99
npx playwright test --update-snapshots --reporter line $1
yarn install --frozen-lockfile
yarn build -l --dir
PLAYWRIGHT_HTML_OPEN=never ELEMENT_DESKTOP_EXECUTABLE="./dist/linux-unpacked/element-desktop" \
npx playwright test --update-snapshots --reporter line,html "$1"
# Clean up
rm -R core qemu_* || exit 0

View File

@@ -6,8 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import keytar from "keytar-forked";
import { test, expect } from "../../element-desktop-test.js";
declare global {
@@ -61,34 +59,6 @@ test.describe("App launch", () => {
),
).resolves.not.toBeNull();
});
test.describe("migrate from keytar", () => {
test.skip(
process.env.GITHUB_ACTIONS && ["linux", "darwin"].includes(process.platform),
"GitHub Actions hosted runner are not a compatible environment for this test",
);
const pickleKey = "DEADBEEF1234";
const keytarService = "element.io";
const keytarKey = `${userId}|${deviceId}`;
test.beforeAll(async () => {
await keytar.setPassword(keytarService, keytarKey, pickleKey);
await expect(keytar.getPassword(keytarService, keytarKey)).resolves.toBe(pickleKey);
});
test.afterAll(async () => {
await keytar.deletePassword(keytarService, keytarKey);
});
test("should migrate successfully", async ({ page }) => {
await expect(
page.evaluate(
([userId, deviceId]) => window.mxPlatformPeg.get().getPickleKey(userId, deviceId),
[userId, deviceId],
),
).resolves.toBe(pickleKey);
});
});
});
test.describe("--no-update", () => {

View File

@@ -84,7 +84,7 @@ export const test = base.extend<Fixtures>({
args.unshift(path.join(__dirname, "..", "lib", "electron-main.js"));
}
console.log(`Launching '${executablePath}' with args ${args.join(" ")}`);
console.log(`Launching '${executablePath || "electron"}' with args ${args.join(" ")}`);
const app = await electron.launch({
env: {

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -40,7 +40,7 @@ the npm 'install' phase - modules that do this will typically end up with native
targeted to the build platform and the node that npm/yarn is using, which is no good for an
electron app.
It does this by installing it with `--ignore-scripts` and then using `yarn link` to keep the
It does this by installing it with `--mode=skip-build` and then using `yarn link` to keep the
dependency module separate so yarn doesn't try to run its install / postinstall script
at other points (eg. whenever you `yarn add` a random other dependency).

View File

@@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import fsProm from "node:fs/promises";
import pacote from "pacote";
import pacote, { type Packument } from "pacote";
import type HakEnv from "./hakEnv.js";
import type { DependencyInfo } from "./dep.js";
@@ -25,13 +25,13 @@ export default async function fetch(hakEnv: HakEnv, moduleInfo: DependencyInfo):
console.log("Fetching " + moduleInfo.name + "@" + moduleInfo.version);
const packumentCache = new Map();
const packumentCache = new Map<string, Packument>();
await pacote.extract(`${moduleInfo.name}@${moduleInfo.version}`, moduleInfo.moduleBuildDir, {
packumentCache,
});
console.log("Running yarn install in " + moduleInfo.moduleBuildDir);
await hakEnv.spawn("yarn", ["install", "--ignore-scripts"], {
await hakEnv.spawn("corepack", ["yarn@1.22.22", "install", "--mode=skip-build"], {
cwd: moduleInfo.moduleBuildDir,
});
@@ -45,6 +45,7 @@ export default async function fetch(hakEnv: HakEnv, moduleInfo: DependencyInfo):
// actual runtime dependencies will have to be added to the main app's
// dependencies. We can't tell what dependencies are real runtime deps
// and which are just used for native module building.
console.log("@@ Pacote2", moduleInfo.moduleOutDir);
await pacote.extract(`${moduleInfo.name}@${moduleInfo.version}`, moduleInfo.moduleOutDir, {
packumentCache,
});

View File

@@ -84,6 +84,7 @@ export default class HakEnv {
npm_config_target: this.runtimeVersion,
npm_config_build_from_source: "true",
npm_config_devdir: path.join(os.homedir(), ".electron-gyp"),
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0",
};
}

View File

@@ -38,10 +38,11 @@ export default async function link(hakEnv: HakEnv, moduleInfo: DependencyInfo):
);
}
await hakEnv.spawn("yarn", ["link"], {
console.log("@@", moduleInfo.moduleOutDir);
await hakEnv.spawn("corepack", ["yarn@1.22.22", "link"], {
cwd: moduleInfo.moduleOutDir,
});
await hakEnv.spawn("yarn", ["link", moduleInfo.name], {
await hakEnv.spawn("corepack", ["yarn@1.22.22", "link", moduleInfo.name], {
cwd: hakEnv.projectRoot,
});
}

View File

@@ -111,7 +111,7 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
try {
ret = await store.getSecret(`${args[0]}|${args[1]}`);
} catch {
// if an error is thrown (e.g. keytar can't connect to the keychain),
// if an error is thrown (e.g. we can't initialise safeStorage),
// then return null, which means the default pickle key will be used
ret = null;
}

View File

@@ -15,22 +15,10 @@ limitations under the License.
*/
import ElectronStore from "electron-store";
import keytar from "keytar-forked";
import { app, safeStorage, dialog, type SafeStorage, type Session } from "electron";
import { _t } from "./language-helper.js";
/**
* Legacy keytar service name for storing secrets.
* @deprecated
*/
const KEYTAR_SERVICE = "element.io";
/**
* Super legacy keytar service name for reading secrets.
* @deprecated
*/
const LEGACY_KEYTAR_SERVICE = "riot.im";
/**
* String union type representing all the safeStorage backends.
* + The "unknown" backend shouldn't exist in practice once the app is ready
@@ -147,7 +135,7 @@ const enum Mode {
/**
* JSON-backed store for settings which need to be accessible by the main process.
* Secrets are stored within the `safeStorage` object, encrypted with safeStorage.
* Any secrets operations are blocked on Electron app ready emit, and keytar migration if still needed.
* Any secrets operations are blocked on Electron app ready emit.
*/
class Store extends ElectronStore<StoreData> {
private static internalInstance?: Store;
@@ -283,8 +271,6 @@ class Store extends ElectronStore<StoreData> {
/**
* Prepare the safeStorage backend for use.
* We don't eagerly import from keytar as that would bring in data for all Element profiles and not just the current one,
* so we import lazily in getSecret.
*
* This will relaunch the app in some cases, in which case it will return false and the caller should abort startup.
*
@@ -462,7 +448,6 @@ class Store extends ElectronStore<StoreData> {
/**
* Get the stored secret for the key.
* Lazily migrates keys from keytar if they are not yet in the store.
*
* @param key The string key name.
*
@@ -470,25 +455,11 @@ class Store extends ElectronStore<StoreData> {
*/
public async getSecret(key: string): Promise<string | undefined> {
await this.safeStorageReady();
let secret = this.secrets!.get(key);
if (secret) return secret;
try {
secret = await this.getSecretKeytar(key);
} catch (e) {
console.warn(`Failed to read data from keytar with key='${key}'`, e);
}
if (secret) {
console.debug("Migrating secret from keytar", key);
this.secrets!.set(key, secret);
}
return secret;
return this.secrets!.get(key);
}
/**
* Add the secret for the key to the keychain.
* We write to both safeStorage & keytar to support downgrading the application.
*
* @param key The string key name.
* @param secret The string password.
@@ -498,46 +469,16 @@ class Store extends ElectronStore<StoreData> {
public async setSecret(key: string, secret: string): Promise<void> {
await this.safeStorageReady();
this.secrets!.set(key, secret);
try {
await keytar.setPassword(KEYTAR_SERVICE, key, secret);
} catch (e) {
console.warn(`Failed to write safeStorage backwards-compatibility key='${key}' data to keytar`, e);
}
}
/**
* Delete the stored password for the key.
* Removes from safeStorage, keytar & keytar legacy.
*
* @param key The string key name.
*/
public async deleteSecret(key: string): Promise<void> {
await this.safeStorageReady();
this.secrets!.delete(key);
try {
await this.deleteSecretKeytar(key);
} catch (e) {
console.warn(`Failed to delete secret with key='${key}' from keytar`, e);
}
}
/**
* @deprecated will be removed in the near future
*/
private async getSecretKeytar(key: string): Promise<string | undefined> {
return (
(await keytar.getPassword(KEYTAR_SERVICE, key)) ??
(await keytar.getPassword(LEGACY_KEYTAR_SERVICE, key)) ??
undefined
);
}
/**
* @deprecated will be removed in the near future
*/
private async deleteSecretKeytar(key: string): Promise<void> {
await keytar.deletePassword(LEGACY_KEYTAR_SERVICE, key);
await keytar.deletePassword(KEYTAR_SERVICE, key);
}
}

17551
yarn.lock
View File

File diff suppressed because it is too large Load Diff