tis-discord icon

Discord

Silent install package for Discord

1.0.9059-25

  • package: tis-discord
  • name: Discord
  • version: 1.0.9059-25
  • categories: Media,Messaging
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ,Pierre COSSON
  • editor: Discord Inc.
  • licence: Proprietary
  • locale: all
  • target_os: windows
  • impacted_process: Discord
  • architecture: all
  • signature_date:
  • size: 106.89 Mo
  • installed_size: 367.31 Mo
  • homepage : https://www.spotify.com/download

package           : tis-discord
version           : 1.0.9059-25
architecture      : all
section           : base
priority          : optional
name              : Discord
categories        : Media,Messaging
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ,Pierre COSSON
description       : Discord is a VoIP and instant messaging social platform. Users have the ability to communicate with voice calls, video calls, text messaging, media and files in private chats or as part of communities called "servers"
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.0
sources           : https://discord.com/download
installed_size    : 367309728
impacted_process  : Discord
description_fr    : Discord est une plateforme sociale de VoIP et de messagerie instantanée. Les utilisateurs ont la possibilité de communiquer par des appels vocaux, des appels vidéo, des messages texte, des médias et des fichiers dans des chats privés ou en tant que membres de communautés appelées "serveurs"
description_pl    : Discord to platforma społecznościowa VoIP i komunikatorów internetowych. Użytkownicy mają możliwość komunikacji za pomocą połączeń głosowych, połączeń wideo, wiadomości tekstowych, mediów i plików w prywatnych czatach lub w ramach społeczności zwanych "serwerami"
description_de    : Discord ist eine soziale VoIP- und Instant-Messaging-Plattform. Benutzer haben die Möglichkeit, mit Sprachanrufen, Videoanrufen, Textnachrichten, Medien und Dateien in privaten Chats oder als Teil von Gemeinschaften, die "Server" genannt werden, zu kommunizieren
description_es    : Discord es una plataforma social de VoIP y mensajería instantánea. Los usuarios tienen la posibilidad de comunicarse con llamadas de voz, videollamadas, mensajes de texto, medios y archivos en chats privados o como parte de comunidades llamadas "servidores"
description_pt    : O Discord é uma plataforma social VoIP e de mensagens instantâneas. Os utilizadores têm a capacidade de comunicar com chamadas de voz, videochamadas, mensagens de texto, media e ficheiros em chats privados ou como parte de comunidades chamadas "servidores"
description_it    : Discord è una piattaforma sociale VoIP e di messaggistica istantanea. Gli utenti hanno la possibilità di comunicare con chiamate vocali, videochiamate, messaggi di testo, media e file in chat private o come parte di comunità chiamate "server"
description_nl    : Discord is een sociaal platform voor VoIP en instant messaging. Gebruikers hebben de mogelijkheid om te communiceren met spraakgesprekken, videogesprekken, tekstberichten, media en bestanden in privéchats of als onderdeel van gemeenschappen die "servers" worden genoemd
description_ru    : Discord - это социальная платформа VoIP и обмена мгновенными сообщениями. Пользователи имеют возможность общаться с помощью голосовых звонков, видеозвонков, текстовых сообщений, медиа и файлов в частных чатах или в составе сообществ, называемых "серверами"
audit_schedule    : 
editor            : Discord Inc.
keywords          : chat,vocal,voice,channel,voip
licence           : Proprietary
homepage          : https://www.spotify.com/download
package_uuid      : b10e8492-ecb8-4806-86a7-f82a6aa0b486
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://discord.com/developers/docs/change-log
min_os_version    : 10
max_os_version    : 
icon_sha256sum    : 10af643692be619dcaabdf732b81c7544b4bf399e301051590dcc767f5bb32dc
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2024-09-11T16:32:55.000000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
signature         : g4xKwFEcC78cDYaOcR4KfaLPirwLsL/pIz3VNJvcS1gyZwgu5E3NqX+ItU7IwcGhdo8alB/0OwKL8lZvNkPMWJ2pqN3+/ijzb6n3DuJUALzJrOiZqnlnf2oYevzuXjMilW6ZAEkYr0k5/tp3mgswWkZXiyhtKHnvpMn8JivgNqPYRosp1QzQkFgYhvkVGO76ssOsHi4DZWC8xPWocMOPBqjZgga9Yq5rd4sEWb/G7Ka9JDPES4nasvTOl+K32rpnlY7VnCN+VD9YZjURZ+MzjqnL4leSnsVd+PWCypWg0u6n58f4/VS8u95uATrG3em9CWUUT66rBHDeOz5WlEEDzg==

# -*- coding: utf-8 -*-
from setuphelpers import *
import time

discord_install_dir = makepath(programfiles32, "discord_install")
discord_install_path = makepath(discord_install_dir, "DiscordSetup.exe")


def install():
    mkdirs(discord_install_dir)
    filecopyto("DiscordSetup.exe", discord_install_path)
    discord_squirrel_remove()


def session_setup():
    # Remove programdata installs
    programdata_user_dir = makepath(programdata, get_current_user)
    programdata_app_dir = makepath(programdata_user_dir, "Discord")
    programdata_squirrel_dir = makepath(programdata, get_current_user, "SquirrelTemp")

    if isdir(programdata_app_dir):
        if not isfile(makepath(programdata_app_dir, ".dead")):
            try:
                app_uninstall_cmd = rf'"{programdata_app_dir}\Update.exe" --uninstall -s'
                run(app_uninstall_cmd)
            except:
                print("Unable to remove Discord in: %s" % programdata_app_dir)
        remove_tree(programdata_app_dir)

    if isdir(programdata_squirrel_dir):
        remove_tree(programdata_squirrel_dir)
    if dir_is_empty(programdata_user_dir):
        remove_tree(programdata_user_dir)

    # Install app
    user_app_dir = makepath(user_local_appdata, "Discord")
    discord_versions = glob.glob(makepath(user_app_dir, "**/Discord.exe"))
    if discord_versions:
        discord_version = "1.0"
        for d in discord_versions:
            if Version(get_file_properties(d)["ProductVersion"]) > Version(discord_version):
                discord_version = get_file_properties(d)["ProductVersion"]
        if Version(control.get_software_version()) > Version(discord_version):
            run('"%s"' % discord_install_path)
        else:
            print("Discord already up-to-date (%s)" % discord_version)
    else:
        run('"%s"' % discord_install_path)

    # Disable app run at startup
    reg_app_run = None
    loop = 0
    loop_timer = 1
    max_loop = 120
    while not reg_app_run:
        reg_app_run = registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Discord")
        loop += loop_timer
        if loop >= max_loop:
            break
        time.sleep(loop_timer)
    if reg_app_run:
        registry_setstring(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run\AutorunsDisabled", "Discord", reg_app_run)
        registry_delete(HKEY_CURRENT_USER, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Discord")

    # Discord interact differently if user is admin
    if running_as_admin():
        discord_squirrel_remove()


def uninstall():
    if isdir(discord_install_dir):
        remove_tree(discord_install_dir)
    discord_squirrel_remove()
    registry_delete(HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", "Discord")
    registry_delete(HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32", "Discord")

    # if discord was uninstalled a .dead file is left behind to prevent automatic reinstall
    for user_dir in glob.glob(makepath(systemdrive, "Users", "*")):
        # "C:\Users\username\AppData\Local\Discord\Update.exe"
        local_appdata_app_dir = makepath(user_dir, "AppData", "Local", "Discord")
        if isdir(local_appdata_app_dir):
            if not isfile(makepath(local_appdata_app_dir, ".dead")):
                try:
                    app_uninstall_cmd = rf'"{local_appdata_app_dir}\Update.exe" --uninstall -s'
                    print(app_uninstall_cmd)
                    run(app_uninstall_cmd)
                except:
                    print("Unable to remove Discord for user: %s" % user_dir.split(os.sep)[-1])
            remove_tree(local_appdata_app_dir)

        # "C:\Users\jpadmin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Discord Inc"
        start_shortcut = makepath(user_dir, r"AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Discord Inc")
        desktop_shortcut = makepath(user_dir, r"Desktop\Discord.lnk")
        if isfile(desktop_shortcut):
            remove_file(desktop_shortcut)
        if isdir(start_shortcut):
            remove_tree(start_shortcut)


def discord_squirrel_remove():
    squirrel_dir = makepath(programdata, "SquirrelMachineInstalls")
    discord_old_installer = makepath(programdata, "Discord.exe")
    if isfile(discord_old_installer):
        remove_file(discord_old_installer)
    if dir_is_empty(squirrel_dir):
        remove_tree(squirrel_dir)

    registry_delete(HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Discord")
    registry_delete(HKEY_LOCAL_MACHINE, r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run", "Discord")

# -*- coding: utf-8 -*-
from setuphelpers import *
import requests


def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name
    # download_url = "https://discord.com/api/download?platform=win"
    download_url = "https://discord.com/api/downloads/distributions/app/installers/latest?arch=x86&channel=stable&platform=win"

    # Getting latest version information from download url
    requests_result = requests.head(download_url, proxies=proxies, allow_redirects=True)
    latest_bin = requests_result.url.split("/")[-1]
    version = requests_result.url.split("/")[-2]

    # Deleting binaries
    for f in glob.glob("*.exe") + glob.glob("*.msi"):
        print("Removing: %s" % f)
        remove_file(f)

    # Downloading latest binaries
    print("Latest %s version is: %s" % (app_name, version))
    print("Download URL is: %s" % download_url)
    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies)
    else:
        print("Binary is present: %s" % latest_bin)

    # Checking version from file
    version_from_file = get_version_from_binary(latest_bin)
    # if not version_from_file.startswith(version) and version_from_file != '':
    if Version(version_from_file) != Version(version) and version_from_file != "":
        print("Changing version to the version number of the binary (from: %s to: %s)" % (version, version_from_file))
        os.rename(latest_bin, latest_bin.replace(version, version_from_file))
        version = version_from_file
    else:
        print("Binary file version corresponds to online version")

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        package_updated = True
    else:
        print("Software version up-to-date (%s)" % Version(version))
    control.set_software_version(version)
    control.save_control_to_wapt()

    # Deleting outdated binaries
    for exe in glob.glob('*.exe'):
        if get_version_from_binary(exe) != Version(control.get_software_version()):
            remove_file(exe)

    # Validating or not update-package-sources
    return package_updated

85060117d7c75378fcbf8b3824e79549002bc5298ae46fcaa2524c83c476596a : DiscordSetup.exe
38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
e50c2d5b5667780d6484cab3724e67344a9831e6bc16283f761be97890b6c843 : WAPT/changelog.txt
32012b44e6868aa8a7964c493669d0d97741149987d56bd0ef6f1057371a4816 : WAPT/control
10af643692be619dcaabdf732b81c7544b4bf399e301051590dcc767f5bb32dc : WAPT/icon.png
fca22297f18505296590636e8b81554aafb241c63e4cdde24c582c6112e9b439 : luti.json
1bd1fbc8e069186ca85e6975732d94e6ab573c7eb3ac488b1dee9217d0edb608 : setup.py
1ec925d8fdbfabf4bf564ba76a035b7af31626ecd766f35a16e3b1e82ee3ad54 : update_package.py

https://discord.com/developers/docs/change-log
1.0.9010-25
===
No longer silent install as it seems to break the installation, avoid installation on up-to-date installations


1.0.9008-23
===
No longer use SquirrelMachineInstalls
Disable app run at startup
Better discord_squirrel_remove() handling
Cleanup programdata


1.0.9007-17
===
Fixing multiple install scenarios
Killing before install
Killing firstrun for system install
Uninstalling system install when installed with WAPT service


1.0.9006-10
===
Migrate user install to machine install
update_package reworked