Compare commits

...

10 Commits

Author SHA1 Message Date
Devin Binnie
750dede7ec [MM-65009] Force windows to run install-deps regardless of cache (#3479)
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
Electron Playwright Tests / determine-platforms (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
Electron Playwright Tests / e2e-tests (push) Has been cancelled
nightly-builds / tag-nightly-build (push) Has been cancelled
nightly-builds / nightly-main (push) Has been cancelled
nightly-builds / nightly-rainforest (push) Has been cancelled
nightly-builds / nightly-e2e (macos-15) (push) Has been cancelled
nightly-builds / nightly-e2e (ubuntu-22.04) (push) Has been cancelled
nightly-builds / nightly-e2e (windows-2022) (push) Has been cancelled
* Test file for PR

* asd

* [MM-65009] Force windows to run install-deps regardless of cache
2025-08-05 13:22:56 -04:00
Weblate (bot)
696e6d29e5 Translations update from Mattermost Weblate (#3478)
* Translated using Weblate (Portuguese)

Currently translated at 100.0% (333 of 333 strings)

Translation: Mattermost/mattermost-desktop
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-desktop/pt/

* Translated using Weblate (Danish)

Currently translated at 90.0% (300 of 333 strings)

Translation: Mattermost/mattermost-desktop
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-desktop/da/

---------

Co-authored-by: Manuela Silva <mmsrs@sky.com>
Co-authored-by: electronicmilk <emil.kjaehr@gmail.com>
2025-08-05 08:56:12 -04:00
Devin Binnie
5accb0e4df Bump development version to v6.0 (#3471) 2025-07-21 10:08:14 -04:00
unified-ci-app[bot]
9d4bdb3636 chore: Update NOTICE.txt file with updated dependencies (#3464)
Co-authored-by: unified-ci-app[bot] <121569378+unified-ci-app[bot]@users.noreply.github.com>
2025-07-21 10:00:50 -04:00
Devin Binnie
2be4e14d62 Remove @types/winreg (#3468) 2025-07-21 09:52:48 -04:00
Weblate (bot)
59c253e2be Translated using Weblate (Portuguese (Brazil)) (#3465)
Currently translated at 100.0% (333 of 333 strings)

Translation: Mattermost/mattermost-desktop
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-desktop/pt_BR/

Co-authored-by: Pineoak <marcel-carvalho@outlook.com>
2025-07-21 13:32:07 +00:00
Devin Binnie
ecf47e25b7 [MM-64617] Add enter key press handler to each of the modals (#3463) 2025-07-21 09:23:03 -04:00
Devin Binnie
af7009535d [MM-56389] Switch to registry-js native module for Windows registry reading (#3460) 2025-07-18 10:42:44 -04:00
Devin Binnie
7f91463c58 [MM-64867] Upgrade to Electron v37.2.2, some other package changes (#3462) 2025-07-18 10:41:16 -04:00
yasser khan
ceb00c6199 E2E: Run E2E tests with Server Init (#3452)
* Run mm server via Docker

* Run mm server via Docker

* test separate server setup for e2e jobs

* Revert "test separate server setup for e2e jobs"

This reverts commit efd23823ac65de8945d635ce9f699c7a9e4fbd77.

* Fix docker on windows

* test run

* test run

* fix

* try a script to trigger Server spinup

* try a script to trigger Server spinup

* test

* remove the trigger workflow

* Change Label

* test-run with disabled E2E/Run label

* test-run

* test-run

* Fixes desktop e2e

* Fixes desktop e2e

* Fixes desktop e2e

* Fixes desktop e2e

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2025-07-18 10:04:45 -04:00
27 changed files with 1130 additions and 950 deletions

View File

@@ -28,7 +28,7 @@ Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fie
- [ ] read and understood our [Contributing Guidelines](https://github.com/mattermost/desktop/blob/master/CONTRIBUTING.md)
- [ ] completed [Mattermost Contributor Agreement](https://mattermost.com/contribute/)
- [ ] executed `npm run lint:js` for proper code formatting
- [ ] Run E2E tests by adding label `Run Desktop E2E Tests`
- [ ] Run E2E tests by adding label `E2E/Run`
#### Device Information
This PR was tested on: <!-- Device name(s), OS version(s) -->

View File

@@ -72,7 +72,6 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: ci/install-dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
@@ -115,7 +114,6 @@ jobs:
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers"
node-gyp install --devdir="C:\Users\runneradmin\.electron-gyp" --target=$(jq -r .devDependencies.electron package.json) --dist-url="https://electronjs.org/headers" --arch arm64
- name: ci/install-dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |

View File

@@ -24,7 +24,7 @@ on:
type: string
description: "The E2E tests underlying OS"
required: true
default: "ubuntu-22.04"
default: "ubuntu-24.04"
nightly:
type: boolean
description: "True if this is nightly build"
@@ -43,7 +43,7 @@ on:
MM_SERVER_VERSION:
type: string
required: false
default: "9.9.1"
default: "10.5.0"
outputs:
NEW_FAILURES_LINUX:
description: "The output to comment"
@@ -96,7 +96,7 @@ on:
type: string
description: "The E2E tests underlying OS"
required: true
default: "ubuntu-22.04"
default: "ubuntu-24.04"
nightly:
type: boolean
description: "True if this is nightly build"
@@ -115,14 +115,14 @@ on:
MM_SERVER_VERSION:
type: string
required: false
default: "9.9.1"
default: "10.10.0"
env:
AWS_S3_BUCKET: "mattermost-cypress-report"
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_TAG: ${{ github.event.pull_request.head.sha || github.sha }}
JIRA_PROJECT_KEY: "MM"
MM_TEST_SERVER_URL: ${{ inputs.MM_TEST_SERVER_URL || secrets.MM_DESKTOP_E2E_SERVER_URL }}
MM_TEST_SERVER_URL: ${{ inputs.MM_TEST_SERVER_URL }}
MM_TEST_USER_NAME: ${{ inputs.MM_TEST_USER_NAME || secrets.MM_DESKTOP_E2E_USER_NAME }}
MM_TEST_PASSWORD: ${{ inputs.MM_TEST_PASSWORD || secrets.MM_DESKTOP_E2E_USER_CREDENTIALS }}
PULL_REQUEST: "https://github.com/mattermost/desktop/pull/${{ github.event.number }}"
@@ -136,7 +136,7 @@ env:
ZEPHYR_API_KEY: ${{ secrets.MM_DESKTOP_E2E_ZEPHYR_API_KEY }}
REPORT_LINK: "none"
NODE_VERSION: 18
SERVER_VERSION: ${{ inputs.MM_SERVER_VERSION || '9.9.1' }}
SERVER_VERSION: ${{ inputs.MM_SERVER_VERSION }}
DESKTOP_VERSION: ${{ inputs.DESKTOP_VERSION }}
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
@@ -249,12 +249,11 @@ jobs:
cd e2e && npm ci
npx electron-rebuild --platform=${{ env.RUNNER_OS }} -f -t prod,optional,dev -w robotjs --module-dir ../
- name: e2e/run-playright-tests-linux
- name: e2e/run-playwright-tests-linux
if: runner.os == 'Linux'
run: |
eval "$(dbus-launch --sh-syntax)"
export NO_AT_BRIDGE=1
npm run build-test
cd e2e
export PW_CHROMIUM_ARGS="--disable-gpu --no-sandbox --disable-dev-shm-usage"
@@ -264,7 +263,7 @@ jobs:
SERVER_VERSION: ${{ inputs.MM_SERVER_VERSION }}
DESKTOP_VERSION: ${{ inputs.DESKTOP_VERSION }}
- name: e2e/run-playright-tests-macos
- name: e2e/run-playwright-tests-macos
if: runner.os == 'macOS'
run: |
sudo spctl --master-disable
@@ -277,7 +276,7 @@ jobs:
SERVER_VERSION: ${{ inputs.MM_SERVER_VERSION }}
DESKTOP_VERSION: ${{ inputs.DESKTOP_VERSION }}
- name: e2e/run-playright-tests-windows
- name: e2e/run-playwright-tests-windows
if: runner.os == 'Windows'
run: |
npm run build-test
@@ -299,7 +298,6 @@ jobs:
process.chdir('./e2e');
const { analyzeFlakyTests } = require('./utils/analyze-flaky-test.js');
const { newFailedTests, os } = analyzeFlakyTests();
switch (os) {
case 'linux':
core.setOutput('NEW_FAILURES_LINUX', newFailedTests.length);

View File

@@ -9,156 +9,92 @@ on:
inputs:
version_name:
type: string
description: "Desktop Version name eg: 5.6"
description: "Desktop Version name eg: v5.11.0"
required: true
platform:
type: choice
description: "Choose platform to run tests"
required: true
default: "all"
options: [linux, macos, windows, all]
instance_details:
type: string
description: "JSON array of platform details"
required: false
MM_TEST_USER_NAME:
description: "The admin username of the test instance"
required: false
type: string
MM_TEST_PASSWORD:
description: "The admin password of the test instance"
required: false
type: string
MM_SERVER_VERSION:
type: string
description: "The server version to test against"
required: false
default: "10.5.0"
jobs:
update-initial-status-linux:
runs-on: ubuntu-22.04
if: contains(github.event.label.name, 'Run Desktop E2E Tests')
steps:
- uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ github.event.pull_request.head.sha }}
context: e2e/linux
description: E2E tests for Mattermost desktop app on Linux have started...
status: pending
update-initial-status-macos:
runs-on: ubuntu-22.04
if: contains(github.event.label.name, 'Run Desktop E2E Tests')
steps:
- uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ github.event.pull_request.head.sha }}
context: e2e/macOS
description: E2E tests for Mattermost desktop app on macOS have started...
status: pending
update-initial-status-windows:
runs-on: ubuntu-22.04
if: contains(github.event.label.name, 'Run Desktop E2E Tests')
steps:
- uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ github.event.pull_request.head.sha }}
context: e2e/windows
description: E2E tests for Mattermost desktop app on Windows have started...
status: pending
determine-platforms:
if: contains(github.event.label.name, 'Run Desktop E2E Tests')
needs: [update-initial-status-linux, update-initial-status-macos, update-initial-status-windows]
runs-on: ubuntu-latest
outputs:
platforms: ${{ steps.set-matrix.outputs.platforms }}
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ inputs.platform }}" == "all" ]]; then
echo "platforms=['ubuntu-24.04', 'macos-13', 'windows-2022']" >> $GITHUB_OUTPUT
if [[ -n "${{ inputs.instance_details }}" ]]; then
MATRIX=$(echo '${{ inputs.instance_details }}' | jq -c '[.[] | {os: .runner, platform: .platform, url: .url, installation_id: .installation_id}]')
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
else
case "${{ inputs.platform }}" in
linux) echo "platforms=['ubuntu-24.04']" ;;
macos) echo "platforms=['macos-13']" ;;
windows) echo "platforms=['windows-2022']"
esac >> $GITHUB_OUTPUT
MATRIX='[{"os":"ubuntu-24.04","platform":"linux","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"},
{"os":"macos-13","platform":"macos","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"},
{"os":"windows-2022","platform":"windows","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"}]'
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event_name }}" == "push" ]] || [[ "${{ contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests') }}" == "true" ]]; then
echo "platforms=['ubuntu-24.04', 'macos-13', 'windows-2022']" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "push" ]] || [[ "${{ contains(github.event.pull_request.labels.*.name, 'E2E/Run') }}" == "true" ]]; then
MATRIX='[{"os":"ubuntu-24.04","platform":"linux","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"},
{"os":"macos-13","platform":"macos","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"},
{"os":"windows-2022","platform":"windows","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"}]'
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
else
echo "platforms=[]" >> $GITHUB_OUTPUT
echo "matrix=[]" >> $GITHUB_OUTPUT
fi
e2e-tests:
needs: determine-platforms
strategy:
matrix:
os: ${{ fromJson(needs.determine-platforms.outputs.platforms) }}
platform: ${{ fromJson(needs.determine-platforms.outputs.matrix) }}
fail-fast: false
runs-on: ${{ matrix.platform.os }}
steps:
- name: Update initial commit status
uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ github.event.pull_request.head.sha || github.sha }}
context: e2e/${{ matrix.platform.platform }}
description: E2E tests for Mattermost desktop app on ${{ matrix.platform.platform }} have started...
status: pending
- name: Run E2E tests
id: run-tests
uses: ./.github/workflows/e2e-functional-template.yml
secrets: inherit
with:
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.platform.os }}
DESKTOP_VERSION: ${{ inputs.version_name || github.head_ref || github.ref }}
MM_TEST_SERVER_URL: ${{ matrix.platform.url }}
MM_TEST_USER_NAME: ${{ inputs.MM_TEST_USER_NAME || secrets.MM_DESKTOP_E2E_USER_NAME }}
MM_TEST_PASSWORD: ${{ inputs.MM_TEST_PASSWORD || secrets.MM_DESKTOP_E2E_USER_CREDENTIALS }}
MM_SERVER_VERSION: ${{ inputs.MM_SERVER_VERSION || '10.5.0' }}
update-final-status-linux:
runs-on: ubuntu-22.04
needs:
- e2e-tests
steps:
- uses: mattermost/actions/delivery/update-commit-status@main
- name: Update final commit status
if: always()
uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ github.event.pull_request.head.sha }}
context: e2e/linux
description: Completed with ${{ needs.e2e-tests.outputs.NEW_FAILURES_LINUX }} failures
status: ${{ needs.e2e-tests.outputs.STATUS_LINUX }}
target_url: ${{ needs.e2e-tests.outputs.REPORT_LINK_LINUX }}
update-final-status-macos:
runs-on: ubuntu-22.04
needs:
- e2e-tests
steps:
- uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ github.event.pull_request.head.sha }}
context: e2e/macOS
description: Completed with ${{ needs.e2e-tests.outputs.NEW_FAILURES_MACOS }} failures
status: ${{ needs.e2e-tests.outputs.STATUS_MACOS }}
target_url: ${{ needs.e2e-tests.outputs.REPORT_LINK_MACOS }}
update-final-status-windows:
runs-on: ubuntu-22.04
needs:
- e2e-tests
steps:
- uses: mattermost/actions/delivery/update-commit-status@main
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ github.event.pull_request.head.sha }}
context: e2e/windows
description: Completed with ${{ needs.e2e-tests.outputs.NEW_FAILURES_WINDOWS }} failures
status: ${{ needs.e2e-tests.outputs.STATUS_WINDOWS }}
target_url: ${{ needs.e2e-tests.outputs.REPORT_LINK_WINDOWS }}
e2e-remove-label:
if: ${{ always() && contains(github.event.pull_request.labels.*.name, 'Run Desktop E2E Tests') }}
needs: e2e-tests
runs-on: ubuntu-22.04
steps:
- name: Remove E2E test label
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
continue-on-error: true # Label might have been removed manually
with:
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'Run Desktop E2E Tests',
});
commit_sha: ${{ github.event.pull_request.head.sha || github.sha }}
context: e2e/${{ matrix.platform.platform }}
description: Completed with ${{ steps.run-tests.outputs.NEW_FAILURES }} failures
status: ${{ steps.run-tests.outputs.STATUS }}
target_url: ${{ steps.run-tests.outputs.REPORT_LINK }}

View File

@@ -822,26 +822,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
---
## @types/winreg
This product contains '@types/winreg' by DefinitelyTyped.
This package contains type definitions for Winreg (http://fresc81.github.io/node-winreg/).
* HOMEPAGE:
* https://github.com/DefinitelyTyped/DefinitelyTyped
* LICENSE: This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---
## auto-launch
This product contains 'auto-launch' by Donal Linehan.
@@ -1113,19 +1093,6 @@ SOFTWARE.
---
## electron-connect
This product contains 'electron-connect' by Yosuke Kurami.
Utility tool to develop applications with Electron.
* HOMEPAGE:
* https://github.com/Quramy/electron-connect
* LICENSE: MIT
---
## electron-context-menu
This product contains 'electron-context-menu' by Sindre Sorhus.
@@ -1149,14 +1116,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
---
## electron-extension-installer
## electron-devtools-installer
This product contains 'electron-extension-installer' by JonLuca De Caro.
This product contains 'electron-devtools-installer' by Samuel Attard.
This library is a modernized version of electron-devtools-installer.
An easy way to install Dev Tools extensions into Electron applications
* HOMEPAGE:
* https://github.com/jonluca/electron-extension-installer
* https://github.com/MarshallOfSound/electron-devtools-installer#readme
* LICENSE: MIT
@@ -1169,6 +1136,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---
## electron-is-dev
@@ -2081,6 +2049,42 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
## registry-js
This product contains 'registry-js'.
A simple and opinionated library for working with the Windows registry
* HOMEPAGE:
* https://github.com/desktop/registry-js#readme
* LICENSE: MIT
MIT License
Copyright (c) 2017 GitHub Desktop
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
## sass
@@ -2487,19 +2491,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
## winreg-utf8
This product contains 'winreg-utf8' by eskibear.
provides access to the windows registry through the REG tool, with additional unicode support.
* HOMEPAGE:
* https://github.com/eskibear/node-winreg-utf8
* LICENSE: BSD-2-Clause
---
## wix

View File

@@ -243,6 +243,9 @@ module.exports = {
return null;
}
const info = await window.testHelper.getViewInfoForTest();
if (!info) {
return null;
}
return {viewName: `${info.serverName}___${info.viewType}`, webContentsId: info.webContentsId};
}).then((result) => {
if (result) {
@@ -258,24 +261,7 @@ module.exports = {
await window.waitForSelector('#input_loginId');
await window.waitForSelector('#input_password-input');
await window.waitForSelector('#saveSetting');
let username = process.env.MM_TEST_USERNAME;
switch (process.platform) {
case 'darwin':
username = 'success+sysadmin+macos@simulator.amazonses.com';
break;
case 'linux':
username = 'success+sysadmin+linux@simulator.amazonses.com';
break;
case 'win32':
username = 'success+sysadmin+windows@simulator.amazonses.com';
break;
default:
throw new Error('Unsupported platform');
}
await window.type('#input_loginId', username);
await window.type('#input_loginId', process.env.MM_TEST_USER_NAME);
await window.type('#input_password-input', process.env.MM_TEST_PASSWORD);
await window.click('#saveSetting');
},

View File

@@ -20,12 +20,16 @@
"node_modules/file-uri-to-path/**/*",
"node_modules/macos-notification-state/**/*",
"node_modules/windows-focus-assist/**/*",
"node_modules/registry-js/**/*",
"!**/node_modules/macos-notification-state/bin/**/*",
"!**/node_modules/macos-notification-state/build/**/*",
"!**/node_modules/windows-focus-assist/bin/**/*",
"!**/node_modules/windows-focus-assist/build/**/*",
"!**/node_modules/registry-js/bin/**/*",
"!**/node_modules/registry-js/build/**/*",
"node_modules/macos-notification-state/build/**/*.node",
"node_modules/windows-focus-assist/build/Release/**/*.node",
"node_modules/registry-js/build/Release/**/*.node",
{
"from": "dist",
"to": ".",
@@ -55,7 +59,8 @@
},
"asarUnpack": [
"./node_modules/macos-notification-state/build/Release/**/*.node",
"./node_modules/windows-focus-assist/build/Release/**/*.node"
"./node_modules/windows-focus-assist/build/Release/**/*.node",
"./node_modules/registry-js/build/Release/**/*.node"
],
"linux": {
"category": "Network;InstantMessaging",

View File

@@ -36,6 +36,12 @@
"main.app.app.handleAppCertificateError.certNotTrusted.dialog.title": "Certifikat er ikke sikkert",
"main.app.app.handleAppCertificateError.dialog.extraDetail": "Certifikat er forskelligt fra det tidligere.\n\n",
"main.app.initialize.downloadBox.allFiles": "Alle filer",
"main.app.utils.clearAllData.cancel": "Annuller",
"main.app.utils.clearAllData.confirm": "Ryd alt data",
"main.app.utils.clearAllData.message": "Denne handling vil slette alt session, cache, cookie og opbevaret data for alle servere. Denne handling kræver genstart af applikationen. Er du sikker på at du vil slette alt data?",
"main.app.utils.clearDataForServer.cancel": "Annuller",
"main.app.utils.clearDataForServer.confirm": "Slet data",
"main.app.utils.clearDataForServer.message": "Denne handling vil slette alt session, cache, cookie og opbevaret data for serveren \"{serverName}\". Er du sikker på at du vil slette data for denne server?",
"main.app.utils.migrateMacAppStore.button.dontImport": "Importer ikke",
"main.app.utils.migrateMacAppStore.button.selectAndImport": "Vælg bibliotek og importer",
"main.app.utils.migrateMacAppStore.dialog.detail": "Det lader til der allerede eksisterer en {appName}-konfiguration. Vil du importere den? Du vil blive bedt om at vælge det rette konfigurationsbibliotek.",
@@ -69,22 +75,32 @@
"main.menus.app.help": "Hjæl&p",
"main.menus.app.help.RunDiagnostics": "Kør diagnostik",
"main.menus.app.help.ShowLogs": "Vis logninger",
"main.menus.app.help.academy": "Mattermost Akademi",
"main.menus.app.help.checkForUpdates": "Søg efter opdateringer",
"main.menus.app.help.commitString": " commit: {hashVersion}",
"main.menus.app.help.downloadUpdate": "Download opdatering",
"main.menus.app.help.learnMore": "Mere information...",
"main.menus.app.help.reportProblem": "Rapporter et problem",
"main.menus.app.help.restartAndUpdate": "Genstart og opdater",
"main.menus.app.help.userGuide": "Bruger guide",
"main.menus.app.help.versionString": "Version {version}{commit}",
"main.menus.app.history": "&Historik",
"main.menus.app.history.back": "Tilbage",
"main.menus.app.history.forward": "Fremad",
"main.menus.app.view": "&Vis",
"main.menus.app.view.actualSize": "Faktisk størrelse",
"main.menus.app.view.clearAllData": "Slet alt data",
"main.menus.app.view.clearCacheAndReload": "Tøm cache og genindlæs",
"main.menus.app.view.clearDataForServer": "Slet data for nuværende server",
"main.menus.app.view.devToolsAppWrapper": "Udviklingsværktøjer for Application Wrapper",
"main.menus.app.view.devToolsCurrentCallWidget": "Udviklingsværktøjer for Call Widget",
"main.menus.app.view.devToolsCurrentCallWidgetPopout": "Udvikler Værktøjer til Opkalds Widget Popout",
"main.menus.app.view.devToolsCurrentServer": "Udviklingsværktøjer for Current Server",
"main.menus.app.view.devToolsSubMenu": "Udviklingsværktøjer",
"main.menus.app.view.developerModeBrowserOnly": "Kun browsertilstand",
"main.menus.app.view.developerModeDisableContextMenu": "Deaktiver Kontekst Menu",
"main.menus.app.view.developerModeDisableNotificationStorage": "Deaktiver Notifikations Lagring",
"main.menus.app.view.developerModeDisableUserActivityMonitor": "Deaktiver brugeraktivitetsovervågning",
"main.menus.app.view.downloads": "Downloads",
"main.menus.app.view.find": "Søg...",
"main.menus.app.view.fullscreen": "Skift til fuld skærm",
@@ -133,6 +149,8 @@
"main.windows.mainWindow.minimizeToTray.dialog.checkboxLabel": "Vis ikke igen",
"main.windows.mainWindow.minimizeToTray.dialog.message": "{appName} vil fortsat køre i systembakken. Dette kan deaktiveres i Indstillinger.",
"main.windows.mainWindow.minimizeToTray.dialog.title": "Minimer til bakke",
"modal.cancel": "Annuller",
"modal.confirm": "Bekræft",
"renderer.components.autoSaveIndicator.saved": "Gemt",
"renderer.components.autoSaveIndicator.saving": "Gemmer...",
"renderer.components.configureServer.cardtitle": "Angiv detaljer om server",
@@ -151,12 +169,20 @@
"renderer.components.configureServer.url.urlNotMatched": "Den angivne server-URL stemmer ikke overens med den konfigurerede websteds-URL på din Mattermost-server. Serverversion: {serverVersion}",
"renderer.components.configureServer.url.urlUpdated": "Den angivne server-URL er blevet opdateret, så den matcher den konfigurerede websteds-URL på din Mattermost-server. Serverversion: {serverVersion}",
"renderer.components.configureServer.url.validating": "Validerer...",
"renderer.components.developerModeIndicator.tooltip": "Udvikler tilstand er aktiveret. Du bør kun have denne tilstand aktiv hvis en Mattermost udvikler har bedt dig om at gøre dette.",
"renderer.components.errorView.cannotConnectToAppName": "Kan ikke forbinde til {appName}",
"renderer.components.errorView.cannotConnectToThisServer": "Kunne ikke forbinde til denne server",
"renderer.components.errorView.contactAdmin": "Hvis dette problem fortsætter så kontakt din administrator",
"renderer.components.errorView.contactAdminUpgrade": "Hvis dette problem fortsætter, så kontakt din {appName} Administrator eller IT-afdeling for at opgradere denne {appName} Server.",
"renderer.components.errorView.havingTroubleConnecting": "Der er problemer med at forbinde til {appName}. Vi forsøger fortsat med at forbinde.",
"renderer.components.errorView.incompatibleServerVersion": "Inkompatibel serverversion",
"renderer.components.errorView.refreshThenVerify": "Hvis ikke det virker at opdatere denne side (Ctrl+R eller Command+R), skal du kontrollere at:",
"renderer.components.errorView.serverVersionIsIncompatible": "Den {appName} Server, du tilgår, er ikke kompatibel med denne version af {appName}-Desktop App. For at oprette forbindelse til denne server skal du prøve følgende:",
"renderer.components.errorView.troubleshooting.browserView.canReachFromBrowserWindow": "Du kan nå <link>{url}</link> fra et browservindue.",
"renderer.components.errorView.troubleshooting.computerIsConnected": "Din computer er forbundet til internettet.",
"renderer.components.errorView.troubleshooting.downgradeApp": "<link>Nedgrader din {appName} desktop app</link> til version v5.10 eller tidligere.",
"renderer.components.errorView.troubleshooting.urlIsCorrect.appNameIsCorrect": "Verify that the URL <link>{url}</link> is correct.",
"renderer.components.errorView.troubleshooting.webContentsView.canReachFromBrowserWindow": "Prøv at åbne <link>{url}</link> i et browservindue.",
"renderer.components.extraBar.back": "Tilbage",
"renderer.components.input.required": "Feltet er obligatorisk",
"renderer.components.mainPage.contextMenu.ariaLabel": "Kontekstmenu",
@@ -192,15 +218,20 @@
"renderer.components.saveButton.save": "Gem",
"renderer.components.saveButton.saving": "Gemmer",
"renderer.components.serverDropdownButton.noServersConfigured": "Ingen servere er konfigurerede",
"renderer.components.settingsPage.advanced": "Avanceret",
"renderer.components.settingsPage.afterRestart": "Indstillingen træder i kraft, når appen genstartes.",
"renderer.components.settingsPage.appLanguage": "Indstil appens sprog (beta)",
"renderer.components.settingsPage.appLanguage.description": "Vælger det sprog, som Desktop-appen skal bruge til menupunkter og popups. Stadig i beta, nogle sprog vil mangle oversættelsesstrenge.",
"renderer.components.settingsPage.appLanguage.placeholder": "Anvend standardopsætning",
"renderer.components.settingsPage.appLanguage.useSystemDefault": "Anvend systemets standardindstillinger",
"renderer.components.settingsPage.appOptions": "App-indstillinger",
"renderer.components.settingsPage.bounceIcon": "Få Dock-ikonet til at hoppe",
"renderer.components.settingsPage.bounceIcon.description": "Hvis aktiveret, hopper Dock-ikonet én gang, eller indtil brugeren åbner appen, når der modtages en ny notifikation.",
"renderer.components.settingsPage.bounceIcon.never": "Aldrig",
"renderer.components.settingsPage.bounceIcon.once": "En gang",
"renderer.components.settingsPage.bounceIcon.untilOpenApp": "indtil jeg åbner appen",
"renderer.components.settingsPage.bounceIconType": "Animer ikonet i Dock...",
"renderer.components.settingsPage.changesSaved": "Ændringer gemt",
"renderer.components.settingsPage.checkSpelling": "Kontroller stavning",
"renderer.components.settingsPage.checkSpelling.description": "Fremhæv forkert stavede ord i dine beskeder baseret på dit systemsprog eller sprogindstillinger.",
"renderer.components.settingsPage.checkSpelling.editSpellcheckUrl": "Brug en alternativ ordbogs-URL",
@@ -211,6 +242,7 @@
"renderer.components.settingsPage.downloadLocation.description": "Angiv mappen, hvor downloadede filer skal gemmes.",
"renderer.components.settingsPage.enableHardwareAcceleration": "Brug GPU-hardwareacceleration",
"renderer.components.settingsPage.enableHardwareAcceleration.description": "Hvis aktiveret, gengives {appName}-brugergrænsefladen mere effektivt, men det kan føre til nedsat stabilitet for nogle systemer.",
"renderer.components.settingsPage.enableMetrics": "Send anonyme brugsdata til dine konfigurerede servere",
"renderer.components.settingsPage.flashWindow": "Lad proceslinje-ikonet blinke, når der modtages en ny besked",
"renderer.components.settingsPage.flashWindow.description": "Hvis aktiveret, vil proceslinje-ikonet blinke i nogle sekunder, når der er modtaget en ny besked.",
"renderer.components.settingsPage.flashWindow.description.linuxFunctionality": "Denne funktionalitet fungerer muligvis ikke med alle Linux-vinduesadministratorer.",

View File

@@ -268,7 +268,7 @@
"renderer.components.settingsPage.loggingLevel.description": "Os registros de logs são úteis para desenvolvedores e oferece suporte para isolar problemas que você pode encontrar com o aplicativo de computador.",
"renderer.components.settingsPage.loggingLevel.description.subtitle": "Aumentar o nível de registros de log aumenta o uso do espaço em disco e pode afetar o desempenho. Recomendamos apenas aumentar o nível de registros de log se você estiver tendo problemas.",
"renderer.components.settingsPage.loggingLevel.level.debug": "Depurar",
"renderer.components.settingsPage.loggingLevel.level.error": "Errors (error)",
"renderer.components.settingsPage.loggingLevel.level.error": "Erros (error)",
"renderer.components.settingsPage.loggingLevel.level.info": "Informações (INFO)",
"renderer.components.settingsPage.loggingLevel.level.silly": "Detalhado (SILLY)",
"renderer.components.settingsPage.loggingLevel.level.verbose": "Verbose (VERBOSE)",

View File

@@ -1,5 +1,5 @@
{
"common.permissions.canBasicAuth": "Autenticação via Web",
"common.permissions.canBasicAuth": "Autenticação da Web",
"common.tabs.TAB_FOCALBOARD": "Boards",
"common.tabs.TAB_MESSAGING": "Channels",
"common.tabs.TAB_PLAYBOOKS": "Playbooks",
@@ -317,7 +317,7 @@
"renderer.components.showCertificateModal.notValidBefore": "Não Válido Antes de",
"renderer.components.showCertificateModal.publicKeyInfo": "Informação Sobre Chave Pública",
"renderer.components.showCertificateModal.serialNumber": "Número de Série",
"renderer.components.showCertificateModal.subjectName": "Nome",
"renderer.components.showCertificateModal.subjectName": "Nome do Assunto",
"renderer.components.showCertificateModal.title": "Informação do certificado",
"renderer.components.teamDropdownButton.noServersConfigured": "Sem servidores configurados",
"renderer.components.welcomeScreen.button.getStarted": "Começar",

1413
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "mattermost-desktop",
"productName": "Mattermost",
"version": "5.13.0-develop.1",
"version": "6.0.0-develop.1",
"description": "Mattermost",
"main": "dist/index.js",
"author": "Mattermost, Inc. <feedback@mattermost.com>",
@@ -125,15 +125,13 @@
"@types/react-dom": "17.0.14",
"@types/uuid": "9.0.8",
"@types/valid-url": "1.0.7",
"@types/winreg": "1.2.36",
"7zip-bin": "5.1.1",
"babel-loader": "9.1.3",
"copy-webpack-plugin": "10.2.4",
"cross-env": "7.0.3",
"css-loader": "6.7.1",
"electron": "35.2.0",
"electron": "37.2.2",
"electron-builder": "24.13.3",
"electron-connect": "0.6.3",
"eslint": "8.57.0",
"eslint-import-resolver-webpack": "0.13.8",
"eslint-plugin-formatjs": "4.12.2",
@@ -154,7 +152,7 @@
"style-loader": "3.3.1",
"ts-prune": "0.10.3",
"typescript": "5.3.3",
"webpack": "5.90.3",
"webpack": "5.100.2",
"webpack-cli": "4.10.0",
"webpack-merge": "5.8.0"
},
@@ -165,7 +163,7 @@
"auto-launch": "5.0.6",
"classnames": "2.5.1",
"electron-context-menu": "4.0.4",
"electron-extension-installer": "1.2.0",
"electron-devtools-installer": "4.0.0",
"electron-is-dev": "2.0.0",
"electron-log": "5.2.0",
"electron-updater": "6.3.0",
@@ -177,10 +175,10 @@
"react-dom": "17.0.2",
"react-intl": "6.6.2",
"react-select": "5.8.0",
"registry-js": "1.16.1",
"uuid": "9.0.1",
"valid-url": "1.0.9",
"windows-focus-assist": "1.4.0",
"winreg-utf8": "0.1.1",
"yargs": "17.7.2"
}
}

View File

@@ -1,13 +1,39 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
const electron = require('electron-connect').server.create({path: 'dist/'});
const {spawn} = require('child_process');
const path = require('path');
const webpack = require('webpack');
const mainConfig = require('../webpack.config.main.js');
const preloadConfig = require('../webpack.config.preload.js');
const rendererConfig = require('../webpack.config.renderer.js');
let electronProcess = null;
function startElectron() {
if (electronProcess) {
electronProcess.removeAllListeners();
}
electronProcess = spawn(
process.platform === 'win32' ? 'electron.cmd' : 'electron',
[path.resolve('dist/')],
{stdio: 'inherit'},
);
}
function restartElectron() {
if (electronProcess) {
electronProcess.kill();
electronProcess.on('close', () => {
startElectron();
});
} else {
startElectron();
}
}
Promise.all([mainConfig, preloadConfig, rendererConfig].map((config) => {
return new Promise((resolve) => {
const compiler = webpack(config);
@@ -18,9 +44,11 @@ Promise.all([mainConfig, preloadConfig, rendererConfig].map((config) => {
process.stdout.write(stats.toString({colors: true}));
process.stdout.write('\n');
if (!stats.hasErrors()) {
electron.restart();
restartElectron();
}
resolve();
});
});
})).then(() => electron.start());
})).then(() => {
startElectron();
});

View File

@@ -3,54 +3,55 @@
import RegistryConfig from 'common/config/RegistryConfig';
jest.mock('winreg', () => {
return jest.fn().mockImplementation(({hive, key}) => {
jest.mock('registry-js', () => {
return {
values: (fn) => {
HKEY: {
HKEY_LOCAL_MACHINE: 'HKEY_LOCAL_MACHINE',
HKEY_CURRENT_USER: 'HKEY_CURRENT_USER',
},
enumerateValues: jest.fn().mockImplementation((hive, key) => {
if (hive === 'correct-hive') {
fn(null, [
return [
{
name: `${key}-name-1`,
value: `${key}-value-1`,
data: `${key}-value-1`,
},
{
name: `${key}-name-2`,
value: `${key}-value-2`,
data: `${key}-value-2`,
},
]);
];
} else if (hive === 'mattermost-hive') {
if (key.endsWith('DefaultServerList')) {
fn(null, [
return [
{
name: 'server-1',
value: 'http://server-1.com',
data: 'http://server-1.com',
},
]);
} else {
fn(null, [
];
}
return [
{
name: 'EnableServerManagement',
value: '0x1',
data: '0x1',
},
{
name: 'EnableAutoUpdater',
value: '0x1',
data: '0x1',
},
]);
}
];
} else if (hive === 'really-bad-hive') {
throw new Error('This is an error');
} else {
fn('Error', []);
}
},
return [];
}),
};
});
});
describe('common/config/RegistryConfig', () => {
it('should initialize correctly', async () => {
it('should initialize correctly', () => {
const originalPlatform = process.platform;
Object.defineProperty(process, 'platform', {
value: 'win32',
@@ -59,7 +60,7 @@ describe('common/config/RegistryConfig', () => {
const registryConfig = new RegistryConfig();
const originalFn = registryConfig.getRegistryEntryValues;
registryConfig.getRegistryEntryValues = (hive, key, name) => originalFn.apply(registryConfig, ['mattermost-hive', key, name, false]);
await registryConfig.init();
registryConfig.init();
Object.defineProperty(process, 'platform', {
value: originalPlatform,
@@ -76,32 +77,32 @@ describe('common/config/RegistryConfig', () => {
const registryConfig = new RegistryConfig();
it('should return correct values', () => {
expect(registryConfig.getRegistryEntryValues('correct-hive', 'correct-key', null, false)).resolves.toStrictEqual([
expect(registryConfig.getRegistryEntryValues('correct-hive', 'correct-key', null, false)).toStrictEqual([
{
name: 'correct-key-name-1',
value: 'correct-key-value-1',
data: 'correct-key-value-1',
},
{
name: 'correct-key-name-2',
value: 'correct-key-value-2',
data: 'correct-key-value-2',
},
]);
});
it('should return correct value by name', () => {
expect(registryConfig.getRegistryEntryValues('correct-hive', 'correct-key', 'correct-key-name-1', false)).resolves.toBe('correct-key-value-1');
expect(registryConfig.getRegistryEntryValues('correct-hive', 'correct-key', 'correct-key-name-1', false)).toBe('correct-key-value-1');
});
it('should return undefined with wrong name', () => {
expect(registryConfig.getRegistryEntryValues('correct-hive', 'correct-key', 'wrong-key-name-1', false)).resolves.toBe(undefined);
expect(registryConfig.getRegistryEntryValues('correct-hive', 'correct-key', 'wrong-key-name-1', false)).toBe(undefined);
});
it('should return undefined with bad hive', () => {
expect(registryConfig.getRegistryEntryValues('bad-hive', 'correct-key', null, false)).resolves.toBe(undefined);
expect(registryConfig.getRegistryEntryValues('bad-hive', 'correct-key', null, false)).toBe(undefined);
});
it('should call reject when an error occurs', () => {
expect(registryConfig.getRegistryEntryValues('really-bad-hive', 'correct-key', null, false)).rejects.toThrow(new Error('This is an error'));
it('should return undefined when an error occurs', () => {
expect(registryConfig.getRegistryEntryValues('really-bad-hive', 'correct-key', null, false)).toBe(undefined);
});
});
});

View File

@@ -3,16 +3,16 @@
// See LICENSE.txt for license information.
import {EventEmitter} from 'events';
import WindowsRegistry from 'winreg';
import WindowsRegistryUTF8 from 'winreg-utf8';
import type {RegistryValue} from 'registry-js';
import {HKEY, enumerateValues} from 'registry-js';
import {Logger} from 'common/log';
import type {RegistryConfig as RegistryConfigType, Server} from 'types/config';
const log = new Logger('RegistryConfig');
const REGISTRY_HIVE_LIST = [WindowsRegistry.HKLM, WindowsRegistry.HKCU];
const BASE_REGISTRY_KEY_PATH = '\\Software\\Policies\\Mattermost';
const REGISTRY_HIVE_LIST = [HKEY.HKEY_LOCAL_MACHINE, HKEY.HKEY_CURRENT_USER];
const BASE_REGISTRY_KEY_PATH = 'SOFTWARE\\Policies\\Mattermost';
export const REGISTRY_READ_EVENT = 'registry-read';
/**
@@ -31,15 +31,15 @@ export default class RegistryConfig extends EventEmitter {
}
/**
* Triggers loading data from Windows registry, supports async/await
* Triggers loading data from Windows registry
*
* @emits {update} emitted once all data has been loaded from the registry
*/
async init() {
init() {
if (process.platform === 'win32') {
// extract DefaultServerList from the registry
try {
const servers = await this.getServersListFromRegistry();
const servers = this.getServersListFromRegistry();
if (servers.length) {
this.data.servers!.push(...servers);
}
@@ -49,7 +49,7 @@ export default class RegistryConfig extends EventEmitter {
// extract EnableServerManagement from the registry
try {
const enableServerManagement = await this.getEnableServerManagementFromRegistry();
const enableServerManagement = this.getEnableServerManagementFromRegistry();
if (enableServerManagement !== null) {
this.data.enableServerManagement = enableServerManagement;
}
@@ -59,7 +59,7 @@ export default class RegistryConfig extends EventEmitter {
// extract EnableAutoUpdater from the registry
try {
const enableAutoUpdater = await this.getEnableAutoUpdatorFromRegistry();
const enableAutoUpdater = this.getEnableAutoUpdatorFromRegistry();
if (enableAutoUpdater !== null) {
this.data.enableAutoUpdater = enableAutoUpdater;
}
@@ -76,13 +76,13 @@ export default class RegistryConfig extends EventEmitter {
/**
* Extracts a list of servers
*/
async getServersListFromRegistry() {
const defaultServers = await this.getRegistryEntry(`${BASE_REGISTRY_KEY_PATH}\\DefaultServerList`);
private getServersListFromRegistry() {
const defaultServers = this.getRegistryEntry(`${BASE_REGISTRY_KEY_PATH}\\DefaultServerList`);
return defaultServers.flat(2).reduce((servers: Server[], server) => {
if (server) {
servers.push({
name: (server as WindowsRegistry.RegistryItem).name,
url: (server as WindowsRegistry.RegistryItem).value,
name: (server as RegistryValue).name,
url: (server as RegistryValue).data as string,
});
}
return servers;
@@ -92,8 +92,8 @@ export default class RegistryConfig extends EventEmitter {
/**
* Determines whether server management has been enabled, disabled or isn't configured
*/
async getEnableServerManagementFromRegistry() {
const entries = (await this.getRegistryEntry(BASE_REGISTRY_KEY_PATH, 'EnableServerManagement'));
private getEnableServerManagementFromRegistry() {
const entries = this.getRegistryEntry(BASE_REGISTRY_KEY_PATH, 'EnableServerManagement');
const entry = entries.pop();
return entry ? entry === '0x1' : null;
}
@@ -101,8 +101,8 @@ export default class RegistryConfig extends EventEmitter {
/**
* Determines whether the auto updated has been enabled, disabled or isn't configured
*/
async getEnableAutoUpdatorFromRegistry() {
const entries = (await this.getRegistryEntry(BASE_REGISTRY_KEY_PATH, 'EnableAutoUpdater'));
private getEnableAutoUpdatorFromRegistry() {
const entries = this.getRegistryEntry(BASE_REGISTRY_KEY_PATH, 'EnableAutoUpdater');
const entry = entries.pop();
return entry ? entry === '0x1' : null;
}
@@ -113,13 +113,12 @@ export default class RegistryConfig extends EventEmitter {
* @param {string} key Path to the registry key to return
* @param {string} name Name of specific entry in the registry key to retrieve (optional)
*/
async getRegistryEntry(key: string, name?: string) {
private getRegistryEntry(key: string, name?: string) {
const results = [];
for (const hive of REGISTRY_HIVE_LIST) {
results.push(this.getRegistryEntryValues(hive, key, name));
}
const entryValues = await Promise.all(results);
return entryValues.filter((value) => value);
return results.filter((value) => value);
}
/**
@@ -128,54 +127,22 @@ export default class RegistryConfig extends EventEmitter {
* @param {WindowsRegistry} regKey A configured instance of the WindowsRegistry class
* @param {string} name Name of the specific entry to retrieve (optional)
*/
getRegistryEntryValues(hive: string, key: string, name?: string, utf8 = true) {
return new Promise<string | WindowsRegistry.RegistryItem[] | undefined>((resolve, reject) => {
private getRegistryEntryValues(hive: HKEY, key: string, name?: string) {
try {
const registry = this.createRegistry(hive, key, utf8);
registry.values((error: Error, results: WindowsRegistry.RegistryItem[]) => {
if (error) {
this.handleRegistryEntryError(error, hive, key, name, utf8).then((result) => {
resolve(result);
});
return;
}
const results = enumerateValues(hive, key);
if (!results || results.length === 0) {
resolve(undefined);
return;
return undefined;
}
if (name) { // looking for a single entry value
const registryItem = results.find((item) => item.name === name);
resolve(registryItem && registryItem.value ? registryItem.value : undefined);
} else { // looking for an entry list
resolve(results);
return registryItem && registryItem.data ? registryItem.data : undefined;
}
});
// looking for an entry list
return results;
} catch (e) {
this.handleRegistryEntryError(e as Error, hive, key, name, utf8).then((result) => {
if (result) {
resolve(result);
log.debug('There was an error accessing the registry for', {hive, key, name}, e);
return undefined;
}
reject(e);
});
}
});
}
handleRegistryEntryError(e: Error, hive: string, key: string, name?: string, utf8?: boolean) {
log.debug('There was an error accessing the registry for', {hive, key, name, utf8}, e);
if (utf8) {
log.debug('Trying without UTF-8...', {hive, key, name});
return this.getRegistryEntryValues(hive, key, name, false);
}
return Promise.resolve(undefined);
}
createRegistry(hive: string, key: string, utf8 = true) {
if (utf8) {
return new WindowsRegistryUTF8({hive, key, utf8});
}
return new WindowsRegistry({hive, key});
}
}

View File

@@ -85,7 +85,7 @@ jest.mock('main/i18nManager', () => ({
setLocale: jest.fn(),
}));
jest.mock('electron-extension-installer', () => {
jest.mock('electron-devtools-installer', () => {
return () => ({
REACT_DEVELOPER_TOOLS: 'react-developer-tools',
});

View File

@@ -5,7 +5,7 @@ import path from 'path';
import {pathToFileURL} from 'url';
import {app, ipcMain, nativeTheme, net, protocol, session} from 'electron';
import installExtension, {REACT_DEVELOPER_TOOLS} from 'electron-extension-installer';
import installExtension, {REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS} from 'electron-devtools-installer';
import isDev from 'electron-is-dev';
import {
@@ -250,7 +250,6 @@ function initializeBeforeAppReady() {
if (process.platform === 'darwin' || process.platform === 'win32') {
nativeTheme.on('updated', handleUpdateTheme);
handleUpdateTheme();
}
protocol.registerSchemesAsPrivileged([
@@ -380,15 +379,16 @@ async function initializeAfterAppReady() {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (global.isDev || __IS_NIGHTLY_BUILD__) {
installExtension(REACT_DEVELOPER_TOOLS, {
installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS], {
loadExtensionOptions: {
allowFileAccess: true,
},
}).
then((name) => log.info(`Added Extension: ${name}`)).
then(([react, redux]) => log.info(`Added Extension: ${react.name}, ${redux.name}`)).
catch((err) => log.error('An error occurred: ', err));
}
handleUpdateTheme();
MainWindow.show();
let deeplinkingURL;

View File

@@ -12,7 +12,7 @@ import CallsWidgetWindow from 'main/windows/callsWidgetWindow';
import {createTemplate} from './app';
jest.mock('electron-extension-installer', () => {
jest.mock('electron-devtools-installer', () => {
return () => ({
REACT_DEVELOPER_TOOLS: 'react-developer-tools',
});

View File

@@ -36,6 +36,7 @@ export default function DestructiveConfirmationModal(props: Props) {
modalHeaderText={title}
handleCancel={onCancel}
handleConfirm={onAccept}
handleEnterKeyPress={onAccept}
confirmButtonText={acceptLabel}
cancelButtonText={cancelLabel}
confirmButtonClassName='btn-danger'

View File

@@ -124,7 +124,7 @@ export const Modal: React.FC<Props> = ({
const handleConfirmClick = async (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
event.preventDefault();
if (autoCloseOnConfirmButton) {
if (autoCloseOnConfirmButton && !isConfirmDisabled) {
await onHide();
}
handleConfirm?.();
@@ -135,7 +135,7 @@ export const Modal: React.FC<Props> = ({
if (event.nativeEvent.isComposing) {
return;
}
if (autoCloseOnConfirmButton) {
if (autoCloseOnConfirmButton && !isConfirmDisabled) {
await onHide();
}
if (handleEnterKeyPress) {

View File

@@ -361,6 +361,7 @@ class NewServerModal extends React.PureComponent<Props, State> {
onExited={this.props.unremoveable ? () => {} : this.props.onClose}
modalHeaderText={this.getModalTitle()}
confirmButtonText={this.getSaveButtonLabel()}
handleEnterKeyPress={this.save}
handleConfirm={this.save}
isConfirmDisabled={!this.state.serverName.length || !this.state.validationResult || this.isServerURLErrored()}
handleCancel={this.props.onClose}

View File

@@ -156,6 +156,7 @@ export default function SettingsModal({
defaultMessage='Desktop App Settings'
/>
}
autoCloseOnConfirmButton={false}
headerContent={savingText}
bodyDivider={true}
bodyPadding={false}

View File

@@ -79,6 +79,7 @@ export default class ShowCertificateModal extends React.PureComponent<Props, Sta
/>
}
handleConfirm={this.handleOk}
handleEnterKeyPress={this.handleOk}
>
<dl>
{certificateSection(

View File

@@ -110,6 +110,7 @@ class LoginModal extends React.PureComponent<Props, State> {
/>
}
handleConfirm={this.handleSubmit}
handleEnterKeyPress={this.handleSubmit}
confirmButtonText={
<FormattedMessage
id='label.login'

View File

@@ -104,6 +104,7 @@ class PermissionModal extends React.PureComponent<Props, State> {
onExited={() => {}}
modalHeaderText={this.getModalTitle()}
handleConfirm={this.props.handleGrant}
handleEnterKeyPress={this.props.handleGrant}
confirmButtonText={
<FormattedMessage
id='label.accept'

View File

@@ -1,34 +0,0 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
declare module 'winreg-utf8' {
import WindowsRegistry from 'winreg';
export = WindowsRegistry;
}
declare namespace Winreg {
export interface Options {
/**
* Optional hostname, must start with '\\' sequence.
*/
host?: string;
/**
* Optional hive ID, default is HKLM.
*/
hive?: string;
/**
* Optional key, default is the root key.
*/
key?: string;
/**
* Optional registry hive architecture ('x86' or 'x64'; only valid on Windows 64 Bit Operating Systems).
*/
arch?: string;
utf8?: boolean;
}
}

View File

@@ -14,6 +14,7 @@ module.exports = merge(base, {
externals: {
'macos-notification-state': 'require("macos-notification-state")',
'windows-focus-assist': 'require("windows-focus-assist")',
'registry-js': 'require("registry-js")',
},
externalsPresets: {
electronMain: true,