mattermost/mattermost

[Bug]: Exec in desktop entry for generix linux seems to be buggy

开放

#28,446 创建于 2024年1月8日

 (20 条评论) (2 个反应) (0 位负责人)TypeScript (7,823 个派生)batch import
Area/DesktopDifficulty/2:MediumHacktoberfestHelp WantedTech/ElectronJSUp For Grabs

仓库指标

星标
 (32,880 个星标)
PR 合并指标
 (平均合并 6天 5小时) (30 天内合并 318 个 PR)

描述

Checks before filing an issue

Mattermost Desktop Version

5.6.0

Operating System

NixOS 23.05

Mattermost Server Version

No response

Steps to reproduce

  1. Login using Gitlab SSO.
  2. Authorize Mattermost in Gitlab
  3. Allow the Browser to open in...

Expected behavior

The Browser asks to be allowed to open Mattermost. We get redirected to the Mattermost Desktop App with a logged-in user.

Observed behavior

The Browser asks us to allow it to open xdg-open (instead of Mattermost). After we allow it, the default Browser is opened with the following url in the address bar:
mattermost-dev://mattermost.example.de/login/desktop?client_token=dev-<client_token>&isDesktopDev=true&server_token=<server_token>

Log Output

I forgot to save the log outputs.

Additional Information

Two things are still wrong in the current master while writing this. I'll explain what, using two patches that fixed my local installation.

  1. The binaries packaged in the released tar archive use mattermost-dev:// as prefix for the mattermost desktop app, a possible fix could be to build the mattermost-desktop app with the ELECTRON_IS_DEV environment variable set to 0 to get rid of the -dev (I also explain a workaround using another MimeType in the code explained below)
modified   package.json
@@ -59,7 +59,7 @@
     "package:mac-with-universal": "npm-run-all build-prod && electron-builder --mac --x64 --arm64 --universal --publish=never",
     "package:mas": "cross-env NODE_ENV=production IS_MAC_APP_STORE=true npm-run-all check-build-config build && electron-builder --mac mas --universal --publish=never",
     "package:mas-dev": "cross-env NODE_ENV=production IS_MAC_APP_STORE=true npm-run-all check-build-config build && electron-builder --mac mas-dev --universal --publish=never",
-    "package:linux": "npm-run-all package:linux-all package:linux-appImage",
+    "package:linux": "set ELECTRON_IS_DEV=0 && npm-run-all package:linux-all package:linux-appImage",
     "package:linux-appImage": "npm-run-all build-prod-upgrade package:linux-appImage-x64 package:linux-appImage-arm64",
     "package:linux-appImage-x64": "electron-builder --linux tar.gz appimage --x64 --publish=never",
     "package:linux-appImage-arm64": "cross-env CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ electron-builder --linux tar.gz appimage --arm64 --publish=never",
  1. The Desktop Entry Exec Attribute does not need double quotes surrounding the mattermost-desktop path. See: https://wiki.archlinux.org/title/desktop_entries#Modify_command_line_arguments
modified   src/assets/linux/create_desktop_file.sh
@@ -9,7 +9,7 @@ cat <<EOS > Mattermost.desktop
 [Desktop Entry]
 Name=Mattermost
 Comment=Mattermost Desktop application for Linux
-Exec="${FULL_PATH}/mattermost-desktop" %U
+Exec=${FULL_PATH}/mattermost-desktop %U
 Terminal=false
 Type=Application
 # I am using `MimeType=x-scheme-handler/mattermost-dev` as a workaround. 
 # The following line is still missing in v5.6.0
 MimeType=x-scheme-handler/mattermost

Also beware of the last three lines in the code above.

贡献者指南