tis-element icon

Element

Paquet d’installation silencieuse pour Element

1.11.112-1

  • package: tis-element
  • name: Element
  • version: 1.11.112-1
  • categories: Utilities
  • maintainer: WAPT Team,Tranquil IT,Ingrid TALBOT
  • locale: all
  • target_os: windows
  • impacted_process: Element
  • architecture: x64
  • signature_date:
  • size: 174.06 Mo
  • installed_size: 674.87 Mo

package           : tis-element
version           : 1.11.112-1
architecture      : x64
section           : base
priority          : optional
name              : Element
categories        : Utilities
maintainer        : WAPT Team,Tranquil IT,Ingrid TALBOT
description       : Element is a free and open-source software instant messaging client implementing the Matrix protocol
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.3
sources           : 
installed_size    : 674868071
impacted_process  : Element
description_fr    : 
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : 
keywords          : messaging
licence           : 
homepage          : 
package_uuid      : 32970b4f-d604-4de9-a334-7e932e239f00
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 97bc7b132a900ec71b17a423ad8c979dac0134bdde3a89726d263874c7fd2f3e
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2025-09-21T13:00:20.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         : KWYQ9b0LfFH1MaM+YN8xPPzcv9TBiX/LnfT4b0xho8KoSXfJcmqxJkSkhTRZc8tk/Jh/Mfy0iqjO2cu7kC2FiyjbT2RrFr/ZoTE8M9HIupcQ/yy9uP9dj2JBYxnJdp4GSrcMoKxurx8ubJfdpgheTwfBMBLC6lStam53qQQrQBv1EUaug0E4PuHhlkXoGvjJS9qUgzIF9hS8T1JHnj/jRViDQ146UBncJSqYZ+NpuEE4/UmNgGLrPfUdCq3YEBHNr/EOLxeQx7bUXzqzgYzQikj/Q+WFg9cJh0IscLXIOk+Stb5VJysNrYiEYg3HpvKXjKB+bWp04FHhmReMgxnQvA==

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

element_install_dir = makepath(programfiles32, "element_install")
element_install_path = makepath(element_install_dir, "ElementSetup.exe")


def install():
    mkdirs(element_install_dir)
    filecopyto("ElementSetup.exe", element_install_path)
    element_squirrel_remove()


def session_setup():
    
    programdata_user_dir = makepath(programdata, get_current_user)
    programdata_app_dir = makepath(programdata_user_dir, "Element")

    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 Element in: %s" % programdata_app_dir)
        remove_tree(programdata_app_dir)

    if dir_is_empty(programdata_user_dir):
        remove_tree(programdata_user_dir)

    # Install app
    user_app_dir = makepath(user_local_appdata, "Element")
    element_versions = glob.glob(makepath(user_app_dir, "**/ElementSetup.exe"))
    if element_versions:
        element_version = "1.0"
        for d in element_versions:
            if Version(get_file_properties(d)["ProductVersion"]) > Version(element_version):
                element_version = get_file_properties(d)["ProductVersion"]
        if Version(control.get_software_version()) > Version(element_version):
            run('"%s"' % element_install_path)
        else:
            print("Element already up-to-date (%s)" % element_version)
    else:
        run('"%s"' % element_install_path + " --silent")


    # Element interact differently if user is admin
    if running_as_admin():
        element_squirrel_remove()


def uninstall():
    if isdir(element_install_dir):
        remove_tree(element_install_dir)
    element_squirrel_remove()


    # if element 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\element-desktop\Update.exe"
        local_appdata_app_dir = makepath(user_dir, "AppData", "Local", "element-desktop")
        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 Element 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\Element Inc"
        start_shortcut = makepath(user_dir, r"AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Element")
        desktop_shortcut = makepath(user_dir, r"Desktop\Element.lnk")
        if isfile(desktop_shortcut):
            remove_file(desktop_shortcut)
        if isdir(start_shortcut):
            remove_tree(start_shortcut)


def element_squirrel_remove():
    squirrel_dir = makepath(programdata, "SquirrelMachineInstalls")
    element_old_installer = makepath(programdata, "Element.exe")
    if isfile(element_old_installer):
        remove_file(element_old_installer)
    if dir_is_empty(squirrel_dir):
        remove_tree(squirrel_dir)

from setuphelpers import *
import waptlicences


def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    update_dict = {"windows": ".exe"}
    download_url = "https://packages.element.io/desktop/install/win32/x64/Element%20Setup.exe"

    latest_bin = download_url.rsplit("/")[-1].replace("%20","")

    version_url = "https://api.github.com/repos/element-hq/element-web/releases/latest"


    # Getting latest version information from official sources

    json_load = wgets(version_url, proxies=proxies, as_json=True)
    version = json_load["tag_name"].replace("v", "").replace(".windows", "")

    # Downloading latest binaries
    print(f"Latest version of {control.name} is: {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)

    
    # Check signature bin
    expected_issuer = 'NEW VECTOR LTD'
    sign_name = waptlicences.check_exe_signing_certificate(latest_bin)[0]
    if sign_name != expected_issuer:
        error('Bad issuer %s != %s ' % (sign_name,expected_issuer))



    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print(f"Software version updated (from: {control.get_software_version()} to: {Version(version)})")
        package_updated = True
    else:
        print(f"Software version up-to-date ({Version(version)})")

    # Deleting binaries
    for f in glob.glob("*.exe"):
        if f != latest_bin:
            remove_file(f)
    
    control.set_software_version(version)
    control.save_control_to_wapt()

    return package_updated

bc47eb34aee2f28c23590d407e65fd49f4123b0bba753556dbe4b9de2b59118e : ElementSetup.exe
38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
88613e63d1fdc8ea5c3f84ad9809e76a12e76870ad800e81f88c2c2f51615c1b : WAPT/control
97bc7b132a900ec71b17a423ad8c979dac0134bdde3a89726d263874c7fd2f3e : WAPT/icon.png
07ea0ef31866c5f3417eee3730044261205f485677b889f4b5066908640aae5a : luti.json
0da3704f700b966254a0b9372407bf876386ca5cb29ea7474726c7d6bc6a445e : setup.py
33193804fc4455a9ec5a929946a08e1d0278dc452831ab9c7d917a0536319dbb : update_package.py