diff --git a/ee/maintained-apps/inputs/homebrew/telegram.json b/ee/maintained-apps/inputs/homebrew/telegram.json new file mode 100644 index 0000000000..70d545675d --- /dev/null +++ b/ee/maintained-apps/inputs/homebrew/telegram.json @@ -0,0 +1,8 @@ +{ + "name": "Telegram", + "unique_identifier": "ru.keepcoder.Telegram", + "token": "telegram", + "installer_format": "zip", + "slug": "telegram/darwin", + "default_categories": ["Communication"] +} diff --git a/ee/maintained-apps/inputs/winget/scripts/telegram_install.ps1 b/ee/maintained-apps/inputs/winget/scripts/telegram_install.ps1 new file mode 100644 index 0000000000..bb8e2891fe --- /dev/null +++ b/ee/maintained-apps/inputs/winget/scripts/telegram_install.ps1 @@ -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 +} diff --git a/ee/maintained-apps/inputs/winget/scripts/telegram_uninstall.ps1 b/ee/maintained-apps/inputs/winget/scripts/telegram_uninstall.ps1 new file mode 100644 index 0000000000..199d53c943 --- /dev/null +++ b/ee/maintained-apps/inputs/winget/scripts/telegram_uninstall.ps1 @@ -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 diff --git a/ee/maintained-apps/inputs/winget/telegram.json b/ee/maintained-apps/inputs/winget/telegram.json new file mode 100644 index 0000000000..5147d6e559 --- /dev/null +++ b/ee/maintained-apps/inputs/winget/telegram.json @@ -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"] +} diff --git a/ee/maintained-apps/outputs/apps.json b/ee/maintained-apps/outputs/apps.json index 8c149bfb41..6315f67eef 100644 --- a/ee/maintained-apps/outputs/apps.json +++ b/ee/maintained-apps/outputs/apps.json @@ -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", diff --git a/ee/maintained-apps/outputs/telegram/darwin.json b/ee/maintained-apps/outputs/telegram/darwin.json new file mode 100644 index 0000000000..534276ef68 --- /dev/null +++ b/ee/maintained-apps/outputs/telegram/darwin.json @@ -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" + } +} diff --git a/ee/maintained-apps/outputs/telegram/windows.json b/ee/maintained-apps/outputs/telegram/windows.json new file mode 100644 index 0000000000..7c7b1b3398 --- /dev/null +++ b/ee/maintained-apps/outputs/telegram/windows.json @@ -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" + } +} diff --git a/frontend/pages/SoftwarePage/components/icons/Telegram.tsx b/frontend/pages/SoftwarePage/components/icons/Telegram.tsx new file mode 100644 index 0000000000..cf8109ca21 --- /dev/null +++ b/frontend/pages/SoftwarePage/components/icons/Telegram.tsx @@ -0,0 +1,14 @@ +import * as React from "react"; + +import type { SVGProps } from "react"; + +const Telegram = (props: SVGProps) => ( + + + +); +export default Telegram; diff --git a/website/assets/images/app-icon-telegram-60x60@2x.png b/website/assets/images/app-icon-telegram-60x60@2x.png new file mode 100644 index 0000000000..ad94eda4da Binary files /dev/null and b/website/assets/images/app-icon-telegram-60x60@2x.png differ