Add Telegram as a macOS and Windows FMA (#35968)

Introduces Telegram as a maintained app for both macOS and Windows
platforms. Adds input definitions, install/uninstall scripts, output
manifests, icon component, and app icon asset. Updates the apps.json
output to include Telegram with appropriate metadata and descriptions.

<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] If paths of existing endpoints are modified without backwards
compatibility, checked the frontend/CLI for any necessary changes

## Testing

- [ ] Added/updated automated tests
- [ ] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)

- [ ] QA'd all new/changed functionality manually

For unreleased bug fixes in a release candidate, one of:

- [ ] Confirmed that the fix is not expected to adversely impact load
test results
- [ ] Alerted the release DRI if additional load testing is needed

## Database migrations

- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).

## New Fleet configuration settings

- [ ] Setting(s) is/are explicitly excluded from GitOps

If you didn't check the box above, follow this checklist for
GitOps-enabled settings:

- [ ] Verified that the setting is exported via `fleetctl
generate-gitops`
- [ ] Verified the setting is documented in a separate PR to [the GitOps
documentation](https://github.com/fleetdm/fleet/blob/main/docs/Configuration/yaml-files.md#L485)
- [ ] Verified that the setting is cleared on the server if it is not
supplied in a YAML file (or that it is documented as being optional)
- [ ] Verified that any relevant UI is disabled when GitOps mode is
enabled

## fleetd/orbit/Fleet Desktop

- [ ] Verified compatibility with the latest released version of Fleet
(see [Must
rule](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/workflows/fleetd-development-and-release-strategy.md))
- [ ] If the change applies to only one platform, confirmed that
`runtime.GOOS` is used as needed to isolate changes
- [ ] Verified that fleetd runs on macOS, Linux and Windows
- [ ] Verified auto-update works from the released version of component
to the new version (see [tools/tuf/test](../tools/tuf/test/README.md))
This commit is contained in:
Allen Houchins
2025-11-19 10:17:54 -06:00
committed by GitHub
parent 29fa208a0a
commit bbdd7dbf37
9 changed files with 255 additions and 0 deletions
@@ -0,0 +1,8 @@
{
"name": "Telegram",
"unique_identifier": "ru.keepcoder.Telegram",
"token": "telegram",
"installer_format": "zip",
"slug": "telegram/darwin",
"default_categories": ["Communication"]
}
@@ -0,0 +1,68 @@
# Learn more about .exe install scripts:
# http://fleetdm.com/learn-more-about/exe-install-scripts
$exeFilePath = "${env:INSTALLER_PATH}"
try {
# Verify installer file exists
if (-not (Test-Path $exeFilePath)) {
Write-Host "Error: Installer file not found at: $exeFilePath"
Exit 1
}
Write-Host "Installing Telegram Desktop from: $exeFilePath"
# Add arguments to install silently
# Telegram uses an Inno Setup-based installer
# Try /VERYSILENT first (more reliable for Inno Setup), fall back to /S if needed
$processOptions = @{
FilePath = "$exeFilePath"
ArgumentList = "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART"
PassThru = $true
Wait = $true
NoNewWindow = $true
}
# Start process and track exit code
Write-Host "Starting installation with arguments: $($processOptions.ArgumentList)"
$process = Start-Process @processOptions
if ($null -eq $process) {
Write-Host "Error: Failed to start installer process"
Exit 1
}
$exitCode = $process.ExitCode
# Prints the exit code
Write-Host "Install exit code: $exitCode"
if ($exitCode -ne 0) {
Write-Host "Warning: Installer exited with non-zero code: $exitCode"
# Try with /S as fallback for user-scope installs
Write-Host "Attempting fallback with /S switch..."
$fallbackOptions = @{
FilePath = "$exeFilePath"
ArgumentList = "/S"
PassThru = $true
Wait = $true
NoNewWindow = $true
}
$fallbackProcess = Start-Process @fallbackOptions
if ($null -ne $fallbackProcess) {
$fallbackExitCode = $fallbackProcess.ExitCode
Write-Host "Fallback install exit code: $fallbackExitCode"
Exit $fallbackExitCode
}
}
Exit $exitCode
} catch {
Write-Host "Error: $_"
Write-Host "Error details: $($_.Exception.Message)"
if ($_.Exception.InnerException) {
Write-Host "Inner exception: $($_.Exception.InnerException.Message)"
}
Exit 1
}
@@ -0,0 +1,97 @@
# Attempts to locate Telegram Desktop's uninstaller from registry and execute it silently
$displayName = "Telegram Desktop"
$publisher = "Telegram FZ-LLC"
$paths = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall',
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
'HKCU:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
)
$uninstall = $null
foreach ($p in $paths) {
$items = Get-ItemProperty "$p\*" -ErrorAction SilentlyContinue | Where-Object {
$_.DisplayName -and ($_.DisplayName -eq $displayName -or $_.DisplayName -like "$displayName*") -and ($publisher -eq "" -or $_.Publisher -eq $publisher)
}
if ($items) { $uninstall = $items | Select-Object -First 1; break }
}
if (-not $uninstall -or -not $uninstall.UninstallString) {
Write-Host "Uninstall entry not found"
Exit 0
}
# Kill any running Telegram processes before uninstalling
Stop-Process -Name "Telegram" -Force -ErrorAction SilentlyContinue
$uninstallString = $uninstall.UninstallString
$exePath = ""
$arguments = ""
# Parse the uninstall string to extract executable path and existing arguments
# Handles both quoted and unquoted paths
if ($uninstallString -match '^"([^"]+)"(.*)') {
$exePath = $matches[1]
$arguments = $matches[2].Trim()
} elseif ($uninstallString -match '^([^\s]+)(.*)') {
$exePath = $matches[1]
$arguments = $matches[2].Trim()
} else {
Write-Host "Error: Could not parse uninstall string: $uninstallString"
Exit 1
}
# Build argument list array, preserving existing arguments and adding /S for silent (Inno Setup)
$baseArgumentList = @()
if ($arguments -ne '') {
# Split existing arguments and add them
$baseArgumentList += $arguments -split '\s+'
}
function Invoke-Uninstall {
param(
[string]$Executable,
[array]$BaseArgs,
[array]$ExtraArgs
)
$finalArgs = @()
if ($BaseArgs) {
$finalArgs += $BaseArgs
}
if ($ExtraArgs) {
$finalArgs += $ExtraArgs
}
Write-Host "Uninstall executable: $Executable"
Write-Host "Uninstall arguments: $($finalArgs -join ' ')"
try {
$processOptions = @{
FilePath = $Executable
ArgumentList = $finalArgs
NoNewWindow = $true
PassThru = $true
Wait = $true
WorkingDirectory = (Split-Path -Path $Executable -Parent)
}
$process = Start-Process @processOptions
return $process.ExitCode
} catch {
Write-Host "Error running uninstaller: $_"
return 1
}
}
$preferredSilentArgs = @("/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART")
$exitCode = Invoke-Uninstall -Executable $exePath -BaseArgs $baseArgumentList -ExtraArgs $preferredSilentArgs
if ($exitCode -ne 0) {
Write-Host "Preferred silent uninstall failed with exit code $exitCode. Retrying with /S."
$exitCode = Invoke-Uninstall -Executable $exePath -BaseArgs $baseArgumentList -ExtraArgs @("/S")
}
Exit $exitCode
@@ -0,0 +1,12 @@
{
"name": "Telegram",
"slug": "telegram/windows",
"package_identifier": "Telegram.TelegramDesktop",
"unique_identifier": "Telegram Desktop",
"install_script_path": "ee/maintained-apps/inputs/winget/scripts/telegram_install.ps1",
"uninstall_script_path": "ee/maintained-apps/inputs/winget/scripts/telegram_uninstall.ps1",
"installer_arch": "x64",
"installer_type": "exe",
"installer_scope": "user",
"default_categories": ["Communication"]
}
+14
View File
@@ -498,6 +498,20 @@
"unique_identifier": "TeamViewer",
"description": "TeamViewer is a versatile remote access and connectivity platform trusted for secure remote desktop control, support, and collaboration."
},
{
"name": "Telegram",
"slug": "telegram/darwin",
"platform": "darwin",
"unique_identifier": "ru.keepcoder.Telegram",
"description": "Telegram is a messaging app with a focus on speed and security."
},
{
"name": "Telegram",
"slug": "telegram/windows",
"platform": "windows",
"unique_identifier": "Telegram Desktop",
"description": "Telegram is a messaging app with a focus on speed and security."
},
{
"name": "Thunderbird",
"slug": "thunderbird/darwin",
@@ -0,0 +1,21 @@
{
"versions": [
{
"version": "12.2",
"queries": {
"exists": "SELECT 1 FROM apps WHERE bundle_identifier = 'ru.keepcoder.Telegram';"
},
"installer_url": "https://osx.telegram.org/updates/Telegram-12.2.277101.app.zip",
"install_script_ref": "8e5525d9",
"uninstall_script_ref": "a39fa3ea",
"sha256": "583a3dd9600445059a4a6829a51f026b0451bc8679599a5b653781e99959beed",
"default_categories": [
"Communication"
]
}
],
"refs": {
"8e5525d9": "#!/bin/sh\n\n# variables\nAPPDIR=\"/Applications/\"\nTMPDIR=$(dirname \"$(realpath $INSTALLER_PATH)\")\n# functions\n\nquit_application() {\n local bundle_id=\"$1\"\n local timeout_duration=10\n\n # check if the application is running\n if ! osascript -e \"application id \\\"$bundle_id\\\" is running\" 2>/dev/null; then\n return\n fi\n\n local console_user\n console_user=$(stat -f \"%Su\" /dev/console)\n if [[ $EUID -eq 0 && \"$console_user\" == \"root\" ]]; then\n echo \"Not logged into a non-root GUI; skipping quitting application ID '$bundle_id'.\"\n return\n fi\n\n echo \"Quitting application '$bundle_id'...\"\n\n # try to quit the application within the timeout period\n local quit_success=false\n SECONDS=0\n while (( SECONDS < timeout_duration )); do\n if osascript -e \"tell application id \\\"$bundle_id\\\" to quit\" >/dev/null 2>&1; then\n if ! pgrep -f \"$bundle_id\" >/dev/null 2>&1; then\n echo \"Application '$bundle_id' quit successfully.\"\n quit_success=true\n break\n fi\n fi\n sleep 1\n done\n\n if [[ \"$quit_success\" = false ]]; then\n echo \"Application '$bundle_id' did not quit.\"\n fi\n}\n\n\n# extract contents\nunzip \"$INSTALLER_PATH\" -d \"$TMPDIR\"\n# copy to the applications folder\nquit_application 'ru.keepcoder.Telegram'\nif [ -d \"$APPDIR/Telegram.app\" ]; then\n\tsudo mv \"$APPDIR/Telegram.app\" \"$TMPDIR/Telegram.app.bkp\"\nfi\nsudo cp -R \"$TMPDIR/Telegram.app\" \"$APPDIR\"\n",
"a39fa3ea": "#!/bin/sh\n\n# variables\nAPPDIR=\"/Applications/\"\nLOGGED_IN_USER=$(scutil <<< \"show State:/Users/ConsoleUser\" | awk '/Name :/ { print $3 }')\n# functions\n\nquit_application() {\n local bundle_id=\"$1\"\n local timeout_duration=10\n\n # check if the application is running\n if ! osascript -e \"application id \\\"$bundle_id\\\" is running\" 2>/dev/null; then\n return\n fi\n\n local console_user\n console_user=$(stat -f \"%Su\" /dev/console)\n if [[ $EUID -eq 0 && \"$console_user\" == \"root\" ]]; then\n echo \"Not logged into a non-root GUI; skipping quitting application ID '$bundle_id'.\"\n return\n fi\n\n echo \"Quitting application '$bundle_id'...\"\n\n # try to quit the application within the timeout period\n local quit_success=false\n SECONDS=0\n while (( SECONDS < timeout_duration )); do\n if osascript -e \"tell application id \\\"$bundle_id\\\" to quit\" >/dev/null 2>&1; then\n if ! pgrep -f \"$bundle_id\" >/dev/null 2>&1; then\n echo \"Application '$bundle_id' quit successfully.\"\n quit_success=true\n break\n fi\n fi\n sleep 1\n done\n\n if [[ \"$quit_success\" = false ]]; then\n echo \"Application '$bundle_id' did not quit.\"\n fi\n}\n\n\ntrash() {\n local logged_in_user=\"$1\"\n local target_file=\"$2\"\n local timestamp=\"$(date +%Y-%m-%d-%s)\"\n local rand=\"$(jot -r 1 0 99999)\"\n\n # replace ~ with /Users/$logged_in_user\n if [[ \"$target_file\" == ~* ]]; then\n target_file=\"/Users/$logged_in_user${target_file:1}\"\n fi\n\n local trash=\"/Users/$logged_in_user/.Trash\"\n local file_name=\"$(basename \"${target_file}\")\"\n\n if [[ -e \"$target_file\" ]]; then\n echo \"removing $target_file.\"\n mv -f \"$target_file\" \"$trash/${file_name}_${timestamp}_${rand}\"\n else\n echo \"$target_file doesn't exist.\"\n fi\n}\n\nquit_application 'ru.keepcoder.Telegram'\nsudo rm -rf \"$APPDIR/Telegram.app\"\ntrash $LOGGED_IN_USER '~/Library/Application Scripts/*.ru.keepcoder.Telegram'\ntrash $LOGGED_IN_USER '~/Library/Application Scripts/*.ru.keepcoder.Telegram.TelegramShare'\ntrash $LOGGED_IN_USER '~/Library/Application Scripts/ru.keepcoder.Telegram'\ntrash $LOGGED_IN_USER '~/Library/Application Scripts/ru.keepcoder.Telegram.TelegramShare'\ntrash $LOGGED_IN_USER '~/Library/Application Support/ru.keepcoder.Telegram'\ntrash $LOGGED_IN_USER '~/Library/Caches/com.plausiblelabs.crashreporter.data/ru.keepcoder.Telegram'\ntrash $LOGGED_IN_USER '~/Library/Caches/ru.keepcoder.Telegram'\ntrash $LOGGED_IN_USER '~/Library/Containers/ru.keepcoder.Telegram'\ntrash $LOGGED_IN_USER '~/Library/Containers/ru.keepcoder.Telegram.TelegramShare'\ntrash $LOGGED_IN_USER '~/Library/Cookies/ru.keepcoder.Telegram.binarycookies'\ntrash $LOGGED_IN_USER '~/Library/Group Containers/*.ru.keepcoder.Telegram'\ntrash $LOGGED_IN_USER '~/Library/Group Containers/*.ru.keepcoder.Telegram.TelegramShare'\ntrash $LOGGED_IN_USER '~/Library/HTTPStorages/ru.keepcoder.Telegram'\ntrash $LOGGED_IN_USER '~/Library/Preferences/ru.keepcoder.Telegram.plist'\ntrash $LOGGED_IN_USER '~/Library/Saved Application State/ru.keepcoder.Telegram.savedState'\n"
}
}
@@ -0,0 +1,21 @@
{
"versions": [
{
"version": "6.3.1",
"queries": {
"exists": "SELECT 1 FROM programs WHERE name = 'Telegram Desktop' AND publisher = 'Telegram FZ-LLC';"
},
"installer_url": "https://td.telegram.org/tx64/tsetup-x64.6.3.1.exe",
"install_script_ref": "0b88a95e",
"uninstall_script_ref": "42311f1b",
"sha256": "507487cd543d04282bab696465703b06b86eb742355fbc4e73c5a7a97937b8e9",
"default_categories": [
"Communication"
]
}
],
"refs": {
"0b88a95e": "# Learn more about .exe install scripts:\n# http://fleetdm.com/learn-more-about/exe-install-scripts\n\n$exeFilePath = \"${env:INSTALLER_PATH}\"\n\ntry {\n # Verify installer file exists\n if (-not (Test-Path $exeFilePath)) {\n Write-Host \"Error: Installer file not found at: $exeFilePath\"\n Exit 1\n }\n\n Write-Host \"Installing Telegram Desktop from: $exeFilePath\"\n \n # Add arguments to install silently\n # Telegram uses an Inno Setup-based installer\n # Try /VERYSILENT first (more reliable for Inno Setup), fall back to /S if needed\n $processOptions = @{\n FilePath = \"$exeFilePath\"\n ArgumentList = \"/VERYSILENT /SUPPRESSMSGBOXES /NORESTART\"\n PassThru = $true\n Wait = $true\n NoNewWindow = $true\n }\n \n # Start process and track exit code\n Write-Host \"Starting installation with arguments: $($processOptions.ArgumentList)\"\n $process = Start-Process @processOptions\n \n if ($null -eq $process) {\n Write-Host \"Error: Failed to start installer process\"\n Exit 1\n }\n \n $exitCode = $process.ExitCode\n \n # Prints the exit code\n Write-Host \"Install exit code: $exitCode\"\n \n if ($exitCode -ne 0) {\n Write-Host \"Warning: Installer exited with non-zero code: $exitCode\"\n # Try with /S as fallback for user-scope installs\n Write-Host \"Attempting fallback with /S switch...\"\n $fallbackOptions = @{\n FilePath = \"$exeFilePath\"\n ArgumentList = \"/S\"\n PassThru = $true\n Wait = $true\n NoNewWindow = $true\n }\n $fallbackProcess = Start-Process @fallbackOptions\n if ($null -ne $fallbackProcess) {\n $fallbackExitCode = $fallbackProcess.ExitCode\n Write-Host \"Fallback install exit code: $fallbackExitCode\"\n Exit $fallbackExitCode\n }\n }\n \n Exit $exitCode\n\n} catch {\n Write-Host \"Error: $_\"\n Write-Host \"Error details: $($_.Exception.Message)\"\n if ($_.Exception.InnerException) {\n Write-Host \"Inner exception: $($_.Exception.InnerException.Message)\"\n }\n Exit 1\n}\n",
"42311f1b": "# Attempts to locate Telegram Desktop's uninstaller from registry and execute it silently\n\n$displayName = \"Telegram Desktop\"\n$publisher = \"Telegram FZ-LLC\"\n\n$paths = @(\n 'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKCU:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall'\n)\n\n$uninstall = $null\nforeach ($p in $paths) {\n $items = Get-ItemProperty \"$p\\*\" -ErrorAction SilentlyContinue | Where-Object {\n $_.DisplayName -and ($_.DisplayName -eq $displayName -or $_.DisplayName -like \"$displayName*\") -and ($publisher -eq \"\" -or $_.Publisher -eq $publisher)\n }\n if ($items) { $uninstall = $items | Select-Object -First 1; break }\n}\n\nif (-not $uninstall -or -not $uninstall.UninstallString) {\n Write-Host \"Uninstall entry not found\"\n Exit 0\n}\n\n# Kill any running Telegram processes before uninstalling\nStop-Process -Name \"Telegram\" -Force -ErrorAction SilentlyContinue\n\n$uninstallString = $uninstall.UninstallString\n$exePath = \"\"\n$arguments = \"\"\n\n# Parse the uninstall string to extract executable path and existing arguments\n# Handles both quoted and unquoted paths\nif ($uninstallString -match '^\"([^\"]+)\"(.*)') {\n $exePath = $matches[1]\n $arguments = $matches[2].Trim()\n} elseif ($uninstallString -match '^([^\\s]+)(.*)') {\n $exePath = $matches[1]\n $arguments = $matches[2].Trim()\n} else {\n Write-Host \"Error: Could not parse uninstall string: $uninstallString\"\n Exit 1\n}\n\n# Build argument list array, preserving existing arguments and adding /S for silent (Inno Setup)\n$baseArgumentList = @()\nif ($arguments -ne '') {\n # Split existing arguments and add them\n $baseArgumentList += $arguments -split '\\s+'\n}\n\nfunction Invoke-Uninstall {\n param(\n [string]$Executable,\n [array]$BaseArgs,\n [array]$ExtraArgs\n )\n\n $finalArgs = @()\n if ($BaseArgs) {\n $finalArgs += $BaseArgs\n }\n if ($ExtraArgs) {\n $finalArgs += $ExtraArgs\n }\n\n Write-Host \"Uninstall executable: $Executable\"\n Write-Host \"Uninstall arguments: $($finalArgs -join ' ')\"\n\n try {\n $processOptions = @{\n FilePath = $Executable\n ArgumentList = $finalArgs\n NoNewWindow = $true\n PassThru = $true\n Wait = $true\n WorkingDirectory = (Split-Path -Path $Executable -Parent)\n }\n\n $process = Start-Process @processOptions\n return $process.ExitCode\n } catch {\n Write-Host \"Error running uninstaller: $_\"\n return 1\n }\n}\n\n$preferredSilentArgs = @(\"/VERYSILENT\", \"/SUPPRESSMSGBOXES\", \"/NORESTART\")\n$exitCode = Invoke-Uninstall -Executable $exePath -BaseArgs $baseArgumentList -ExtraArgs $preferredSilentArgs\n\nif ($exitCode -ne 0) {\n Write-Host \"Preferred silent uninstall failed with exit code $exitCode. Retrying with /S.\"\n $exitCode = Invoke-Uninstall -Executable $exePath -BaseArgs $baseArgumentList -ExtraArgs @(\"/S\")\n}\n\nExit $exitCode\n"
}
}
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB