Export du dépôt interne d'Aleop, révision 0936ea1 (fichiers publiés identiques à e46bc12). Paquets construits depuis cette source : - Android : AAB 2026.10.0, code 4 - iPhone : archive 2026.10.0 (18) - Bureau : macOS universel build 13, Windows build 14, MSIX build 15 - Extensions Chrome, Edge et Firefox : 2026.10.0.3
1427 lignes
83 KiB
Python
1427 lignes
83 KiB
Python
#!/usr/bin/env python3
|
|
"""Application de bureau Loksi, adaptée du client desktop Bitwarden. GPL-3.0-only.
|
|
|
|
loksi.py prepare extraction de l'archive vérifiée et adaptations
|
|
loksi.py native [win] modules Rust (napi, proxy), pour ce Mac ou pour Windows x64
|
|
loksi.py build mac|win webpack, électron-builder, puis verify
|
|
loksi.py verify mac|win contrôles du paquet produit
|
|
mac prend une architecture en plus : arm64 (défaut), x64 ou universal.
|
|
loksi.py changes refuse toute différence avec l'archive hors des fichiers prévus
|
|
loksi.py canari montre que verify refuse les textes et dessins de l'amont
|
|
|
|
Sources amont épinglées dans upstream.json. Ni la cryptographie, ni le SDK, ni les API,
|
|
ni la synchronisation ne sont touchés : seulement l'identité, le serveur, les textes,
|
|
les visuels et les identifiants qui feraient cohabiter Loksi avec l'appli Bitwarden.
|
|
"""
|
|
import hashlib
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
from platform import machine as platform_machine
|
|
import plistlib
|
|
import re
|
|
import shutil
|
|
import struct
|
|
import subprocess
|
|
import sys
|
|
import tarfile
|
|
import tempfile
|
|
|
|
ROOT = Path(__file__).resolve().parent
|
|
REPO = ROOT.parent
|
|
CONFIG = json.loads((ROOT / "upstream.json").read_text())
|
|
CACHE = ROOT / ".cache"
|
|
ARCHIVE = CACHE / "upstream.tar.gz"
|
|
SOURCE = CACHE / ("clients-" + CONFIG["tag"])
|
|
APP = SOURCE / "apps/desktop"
|
|
# Cache de mise à jour d'electron-builder : appInfo.updaterCacheDirName, nom du package en
|
|
# minuscules suivi de « -updater ».
|
|
UPDATER_DIR = CONFIG["executable_name"].lower() + "-updater"
|
|
NATIVE = APP / "desktop_native"
|
|
DIST = ROOT / "dist"
|
|
REPORTS = ROOT / "reports"
|
|
TOUCHED = CACHE / "touched.json"
|
|
UNSET = CONFIG["unset_server"]
|
|
HOST = CONFIG["native_messaging"]["host"]
|
|
APP_ID = CONFIG["app_id"]
|
|
TEAM_BITWARDEN = "LTZ2PFU5D6"
|
|
# Numérotation, règle de Romain du 06/10/2026 : version affichée AAAA.M.n, compteur de
|
|
# build entier dans upstream.json. La version Bitwarden de la base reste celle du tag.
|
|
BITWARDEN_VERSION = CONFIG["tag"].removeprefix("desktop-v")
|
|
VERSION = CONFIG["app_version"]["marketing"]
|
|
VERSION_RE = re.compile(r"20\d\d\.(?:[1-9]|1[0-2])\.(?:0|[1-9]\d*)")
|
|
AIDE = "https://www.aleop.eu/aide/loksi/"
|
|
CONFIDENTIALITE = "https://www.aleop.eu/loksi/confidentialite/"
|
|
CONDITIONS = "https://www.aleop.eu/cgv"
|
|
# Passkeys Windows : AAGUID propre à Loksi, tiré le 09/10/2026. Celui de l'amont fait
|
|
# afficher « Bitwarden » par les sites qui listent les fournisseurs de passkeys.
|
|
AAGUID = "4dd988f4-e397-4b27-9042-ef76ea009d6e"
|
|
AAGUID_BITWARDEN = "d548826e-79b4-db40-a3d8-11116f7e8349"
|
|
# Exécutables Windows livrés : noms Loksi à l'installation (« to » d'electron-builder).
|
|
WIN_EXE_NOMS = {"bitwarden_chromium_import_helper.exe": "loksi_chromium_import_helper.exe",
|
|
"bitwarden_plugin_authenticator.exe": "loksi_plugin_authenticator.exe"}
|
|
RUSTUP = "/opt/homebrew/opt/rustup/bin"
|
|
# Build Windows sur Windows (runner VSOP-SIG01, depuis le 08/10/2026) : MSVC natif au
|
|
# lieu de cargo-xwin, NSIS d'electron-builder au lieu de celui de brew, pas d'iconutil.
|
|
WINDOWS_HOST = sys.platform == "win32"
|
|
# Architectures macOS : cibles Rust, noms lipo exigés sur chaque binaire du paquet.
|
|
MAC_ARCHS = {
|
|
"arm64": {"rust": ("aarch64-apple-darwin",), "lipo": {"arm64"}},
|
|
"x64": {"rust": ("x86_64-apple-darwin",), "lipo": {"x86_64"}},
|
|
"universal": {"rust": ("aarch64-apple-darwin", "x86_64-apple-darwin"), "lipo": {"arm64", "x86_64"}},
|
|
}
|
|
NAPI_LIPO = {"arm64": "arm64", "x64": "x86_64"}
|
|
# Fusibles Electron (V1) : sentinelle du fil dans Electron Framework, puis l'état attendu
|
|
# de ceux que after-pack.js amont pose. Index dans le fil : 0 RunAsNode, 1 chiffrement
|
|
# des cookies, 2 NODE_OPTIONS, 3 --inspect, 4 intégrité asar, 5 appli seulement en asar.
|
|
FUSE_SENTINEL = b"dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX"
|
|
FUSES = {0: "0", 1: "1", 2: "0", 3: "0", 4: "1", 5: "1"}
|
|
|
|
# Réutilise la charte déjà portée par l'extension : palette, illustrations et leur
|
|
# table, dessins clair et sombre réunis. Lecture seule, rien n'est écrit dans extensions/.
|
|
sys.path.insert(0, str(REPO / "extensions"))
|
|
import prototype as extension # noqa: E402
|
|
import fonts as extension_fonts # noqa: E402
|
|
|
|
# Textes où Bitwarden reste (brand/README.md, « Le nom Bitwarden ») : la mention
|
|
# d'origine, un produit Bitwarden réel cité comme tel, l'éditeur lui-même.
|
|
BITWARDEN_GARDE = {
|
|
"loksiAboutOrigin", "loksiBasedOn", "authenticatorAppDescV2", "newDeviceVerificationNoticeContentPage1",
|
|
"premiumPurchaseAlertV2", "bitwardenSupport",
|
|
}
|
|
# Mention d'origine validée par Romain le 30/09/2026, la même dans tous les clients
|
|
# (brand/README.md, « Le nom Bitwarden »), suivie de l'avis de copyright amont.
|
|
MENTION = {
|
|
"fr": "Loksi, par Aleop. Application de bureau Bitwarden® modifiée par Aleop, sous licence GPL v3. "
|
|
"Aleop n'est pas affilié à Bitwarden Inc.\n© Bitwarden Inc. 2015-2026",
|
|
"en": "Loksi, by Aleop. Bitwarden® desktop app modified by Aleop, under the GPL v3. "
|
|
"Aleop is not affiliated with Bitwarden Inc.\n© Bitwarden Inc. 2015-2026",
|
|
}
|
|
# Source GPL publique, citée dans À propos de chaque client avant les envois aux Stores
|
|
# (orchestration, ordre de Romain du 12/10/2026).
|
|
SOURCE_GPL = "https://sources.gitsi.dev/aleop/loksi"
|
|
TEXTES = {
|
|
"fr": {
|
|
"loksiConnectingTo": "Connexion sur",
|
|
"loksiAddressToEnter": "adresse à saisir",
|
|
"loksiAccountByAdmin": "Votre compte est créé par l'administrateur de votre entreprise.",
|
|
"loksiAboutOrigin": MENTION["fr"],
|
|
"loksiBasedOn": "Basé sur Bitwarden " + BITWARDEN_VERSION,
|
|
"loksiSourceCode": "Code source (GPL v3) : " + SOURCE_GPL,
|
|
"loksiVaultTitle": "Votre coffre Loksi",
|
|
"loksiContactUs": "Nous contacter",
|
|
"loksiContactTitle": "Écrire au support ?",
|
|
"loksiContactBody": "Votre messagerie s'ouvre avec un courriel pour loksi@aleop.eu. "
|
|
"Pour la protection des données, écrivez à dpo@aleop.eu.",
|
|
"selfHostedBaseUrlHint": "L'adresse de votre coffre Loksi vous est donnée par "
|
|
"l'administrateur de votre entreprise. Exemple : https://loksi-entreprise.aleop.eu",
|
|
},
|
|
"en": {
|
|
"loksiConnectingTo": "Logging in to",
|
|
"loksiAddressToEnter": "address to enter",
|
|
"loksiAccountByAdmin": "Your account is created by your company's administrator.",
|
|
"loksiAboutOrigin": MENTION["en"],
|
|
"loksiBasedOn": "Based on Bitwarden " + BITWARDEN_VERSION,
|
|
"loksiSourceCode": "Source code (GPL v3): " + SOURCE_GPL,
|
|
"loksiVaultTitle": "Your Loksi vault",
|
|
"loksiContactUs": "Contact us",
|
|
"loksiContactTitle": "Email support?",
|
|
"loksiContactBody": "Your email app opens with a message to loksi@aleop.eu. "
|
|
"For data protection, write to dpo@aleop.eu.",
|
|
"selfHostedBaseUrlHint": "Your company's administrator gives you the address of your "
|
|
"Loksi vault. Example: https://loksi-company.aleop.eu",
|
|
},
|
|
}
|
|
# Identifiants Chrome, Edge et Opera des extensions Bitwarden officielles : jamais admis.
|
|
CHROME_BITWARDEN = ("nngceckbapebfimnlniiiahkandclblb", "hccnnhgbibccigepcmlgppchkpfdophk",
|
|
"jbkfoedolllekgbhcbcoahefnbanhhlh", "ccnckbpmaceehanjmeomladnmlffdjgn")
|
|
|
|
touched = set()
|
|
|
|
|
|
def rel(path):
|
|
# as_posix : sous Windows str() rend des « \ », et changes() compare aux noms de
|
|
# l'archive, en « / ». Tout passait « hors périmètre » (vu le 09/10/2026).
|
|
return Path(path).relative_to(SOURCE).as_posix()
|
|
|
|
|
|
def write(path, text):
|
|
Path(path).write_text(text)
|
|
touched.add(rel(path))
|
|
|
|
|
|
def write_bytes(path, data):
|
|
Path(path).write_bytes(data)
|
|
touched.add(rel(path))
|
|
|
|
|
|
def write_json(path, value):
|
|
write(path, json.dumps(value, indent=2, ensure_ascii=False) + "\n")
|
|
|
|
|
|
def replace_count(path, old, new, expected=1):
|
|
value = Path(path).read_text()
|
|
if value.count(old) != expected:
|
|
raise RuntimeError(f"Point d'adaptation amont modifié ({value.count(old)} au lieu de "
|
|
f"{expected}) : {rel(path)} : {old[:60]!r}")
|
|
write(path, value.replace(old, new))
|
|
|
|
|
|
def replace_once(path, old, new):
|
|
replace_count(path, old, new, 1)
|
|
|
|
|
|
def run(cmd, **kwargs):
|
|
print("+", " ".join(str(c) for c in cmd), flush=True)
|
|
cmd = [str(c) for c in cmd]
|
|
if WINDOWS_HOST:
|
|
# npm et npx sont des .cmd sous Windows : CreateProcess ne les trouve pas sous
|
|
# leur nom nu. which() rend le chemin complet, extension comprise.
|
|
found = shutil.which(cmd[0], path=kwargs.get("env", os.environ).get("PATH"))
|
|
if found:
|
|
cmd[0] = found
|
|
subprocess.run(cmd, check=True, **kwargs)
|
|
|
|
|
|
def tool_env():
|
|
return dict(os.environ, PATH=os.pathsep.join([RUSTUP, str(Path.home() / ".cargo/bin"),
|
|
os.environ["PATH"]]))
|
|
|
|
|
|
# ---------------------------------------------------------------- identité
|
|
|
|
def identity():
|
|
data = json.loads((APP / "src/package.json").read_text())
|
|
data.update(name="loksi", productName=CONFIG["product_name"], desktopName="loksi.desktop",
|
|
description="Loksi, le coffre de mots de passe de votre entreprise.",
|
|
author="Aleop", homepage=CONFIG["homepage"], version=VERSION)
|
|
write_json(APP / "src/package.json", data)
|
|
# Le package.json de développement donne à electron-builder l'éditeur et la
|
|
# description des métadonnées Windows. Son nom de workspace npm reste.
|
|
data = json.loads((APP / "package.json").read_text())
|
|
data.update(author="Aleop", homepage=CONFIG["homepage"], version=VERSION,
|
|
description="Loksi, le coffre de mots de passe de votre entreprise.")
|
|
data["keywords"] = ["loksi", "password", "vault", "password manager"]
|
|
write_json(APP / "package.json", data)
|
|
replace_once(APP / "src/index.html", "<title>Bitwarden</title>", "<title>Loksi</title>")
|
|
builder_config()
|
|
# Signature ad hoc sur ce Mac tant qu'il n'y a pas de Developer ID : l'identité vient
|
|
# de CSC_NAME, jamais de la recherche amont qui prendrait la première identité
|
|
# Apple du trousseau (celle de la Personal Team iOS, par exemple).
|
|
after_pack = APP / "scripts/after-pack.js"
|
|
text = after_pack.read_text()
|
|
start = text.index(" // Only use the Bitwarden Identities on CI\n")
|
|
end = text.index(" id = identities[0].id;\n }\n") + len(" id = identities[0].id;\n }\n")
|
|
text = (text[:start] + " // Loksi : CSC_NAME quand un Developer ID existera, signature ad hoc sinon.\n"
|
|
" id = process.env.CSC_NAME || \"-\";\n" + text[end:])
|
|
if text.count("--timestamp") != 4:
|
|
raise RuntimeError("after-pack.js : 4 --timestamp attendus")
|
|
text = text.replace("--timestamp", "${id === \"-\" ? \"\" : \"--timestamp\"}")
|
|
# Fusibles Electron : l'amont ne les pose sur macOS que pour le paquet universel. Le
|
|
# paquet arm64 notarisé le 03/10/2026 est sorti sans aucun (RunAsNode actif, intégrité
|
|
# asar coupée), vu le 04/10. Loksi les pose aussi sur un paquet d'une seule
|
|
# architecture ; les deux moitiés d'un universel restent sans, comme l'amont.
|
|
old = "context.packager.platform.nodeName !== \"darwin\" || context.arch === builder.Arch.universal"
|
|
if text.count(old) != 1:
|
|
raise RuntimeError("after-pack.js : condition des fusibles amont modifiée")
|
|
text = text.replace(old, old + " || process.env.LOKSI_MAC_ARCH !== \"universal\"")
|
|
old = "resetAdHocDarwinSignature: platform === \"darwin\" && context.arch === builder.Arch.universal,"
|
|
if text.count(old) != 1:
|
|
raise RuntimeError("after-pack.js : resetAdHocDarwinSignature amont modifié")
|
|
text = text.replace(old, "resetAdHocDarwinSignature: platform === \"darwin\",")
|
|
write(after_pack, text)
|
|
# Entitlements macOS : ceux de l'équipe Apple de Bitwarden retirés, le JIT reste.
|
|
plist = APP / "resources/entitlements.mac.plist"
|
|
data = plistlib.loads(plist.read_bytes())
|
|
if data.pop("com.apple.application-identifier") != TEAM_BITWARDEN + ".com.bitwarden.desktop":
|
|
raise RuntimeError("entitlements.mac.plist amont modifié")
|
|
data.pop("com.apple.developer.team-identifier")
|
|
write_bytes(plist, plistlib.dumps(data))
|
|
|
|
|
|
def builder_config():
|
|
"""electron-builder.loksi.json : la config amont, réduite à macOS et Windows."""
|
|
config = json.loads((APP / "electron-builder.json").read_text())
|
|
for key in ("afterSign", "publish", "mas", "appx", "snap", "deb", "rpm", "appImage",
|
|
"linux", "nsisWeb", "portable", "dmg"):
|
|
config.pop(key)
|
|
config["afterPack"] = "after-pack.loksi.cjs"
|
|
config.update(
|
|
extraMetadata={"name": CONFIG["executable_name"]}, productName=CONFIG["product_name"],
|
|
# Panneau À propos natif de macOS (NSHumanReadableCopyright) et LegalCopyright de
|
|
# Loksi.exe : la mention commune, en une ligne.
|
|
appId=APP_ID, copyright=MENTION["fr"].replace("\n", " "),
|
|
publish=None, protocols=config["protocols"])
|
|
# Licence de la police Loksi (OFL) et avis de dérivation, livrés dans les ressources.
|
|
shutil.copy2(REPO / "brand/propositions/harmonisation-klepsi/sources/OFL-Raleway.txt",
|
|
APP / "resources/OFL-police-Loksi.txt")
|
|
touched.add(rel(APP / "resources/OFL-police-Loksi.txt"))
|
|
write(APP / "resources/LOKSI-NOTICE.txt",
|
|
"Loksi, application de bureau adaptée par Aleop.\n"
|
|
"Basée sur Bitwarden clients " + CONFIG["tag"] + " (" + CONFIG["commit"] + ").\n"
|
|
"Code amont et adaptations : GPL v3, licences tierces conservées.\n"
|
|
"Modifications : identité, serveur à saisir, textes, visuels, identifiants locaux.\n"
|
|
"Police Loksi : instances de Raleway renommées, SIL Open Font License 1.1\n"
|
|
"(OFL-police-Loksi.txt).\n"
|
|
"Ni affiliée ni approuvée par Bitwarden.\n")
|
|
notices = [{"from": "resources/OFL-police-Loksi.txt", "to": "OFL-police-Loksi.txt"},
|
|
{"from": "resources/LOKSI-NOTICE.txt", "to": "LOKSI-NOTICE.txt"}]
|
|
mac = config["mac"]
|
|
mac["extraResources"] = list(notices)
|
|
config["win"]["extraResources"] = config["win"]["extraResources"] + notices
|
|
for key in ("provisioningProfile",):
|
|
mac.pop(key)
|
|
# Nom du zip avec l'architecture, x64 compris (electron-builder l'omet pour x64).
|
|
mac.update(identity="-", target=["zip"], artifactName="${productName}-${version}-${arch}-mac.${ext}")
|
|
win = config["win"]
|
|
win.pop("signtoolOptions")
|
|
# Noms Loksi des exécutables installés. Le binaire construit garde le nom de son
|
|
# crate (« from ») ; l'importeur Chromium cherche le sien sous le nouveau nom.
|
|
renommes = [f for f in win["extraFiles"] if f.get("to") in WIN_EXE_NOMS]
|
|
if len(renommes) != len(WIN_EXE_NOMS):
|
|
raise RuntimeError("Point d'adaptation amont modifié : extraFiles Windows")
|
|
for fichier in renommes:
|
|
fichier["to"] = WIN_EXE_NOMS[fichier["to"]]
|
|
# Signature et paquet Store : ajoutés par electron-builder.loksi.cjs, sur variables
|
|
# d'environnement seulement. Sans elles, un installateur NSIS non signé.
|
|
win.update(target=[{"target": "nsis", "arch": ["x64"]}], signExts=[".dll", ".node"])
|
|
config["nsis"] = {
|
|
"oneClick": False, "perMachine": False, "allowToChangeInstallationDirectory": False,
|
|
"artifactName": "${productName}-Setup-${version}-${arch}.${ext}",
|
|
"uninstallDisplayName": "${productName}", "deleteAppDataOnUninstall": True,
|
|
"include": "installer.nsh", "installerSidebar": "installerSidebar.bmp",
|
|
"uninstallerSidebar": "installerSidebar.bmp",
|
|
# makensis 3.13 de brew : des chaînes de langue manquent dans ses fichiers
|
|
# de langue, simples avertissements que l'option -WX rendrait bloquants.
|
|
"warningsAsErrors": False, "installerLanguages": ["fr_FR", "en_US"],
|
|
"multiLanguageInstaller": True,
|
|
}
|
|
config["appx"] = {
|
|
"artifactName": "${productName}-${version}-${arch}.${ext}", "applicationId": "Loksi",
|
|
"backgroundColor": "#003087", "displayName": "Loksi",
|
|
"languages": ["fr-FR", "en-US"],
|
|
}
|
|
# Le schéma bitwarden:// reste : retour SSO du bureau (DESKTOP_SSO_CALLBACK), Duo et
|
|
# cookie SSO. Vaultwarden 1.37.3 attend ce retour, comme pour les applis mobiles.
|
|
config["protocols"] = [{"name": "Loksi", "schemes": ["bitwarden"]}]
|
|
write_json(APP / "electron-builder.loksi.json", config)
|
|
# L'installateur NSIS d'electron-builder copie l'exe d'installation dans
|
|
# %LOCALAPPDATA%\<nom>-updater\installer.exe (mises à jour différentielles), et la
|
|
# désinstallation ne le retire jamais : 115 Mo laissés sur VSOP-SIG01 le 09/10/2026.
|
|
# Loksi n'a pas de canal de mise à jour, le dossier part avec l'appli. Même
|
|
# contexte que la copie (installer.nsh d'electron-builder) : utilisateur courant.
|
|
replace_once(APP / "installer.nsh", " ${endIf}\n!macroend", f"""\
|
|
${{if}} $installMode == "all"
|
|
SetShellVarContext current
|
|
${{endif}}
|
|
RMDir /r "$LOCALAPPDATA\\{UPDATER_DIR}"
|
|
${{if}} $installMode == "all"
|
|
SetShellVarContext all
|
|
${{endif}}
|
|
${{endIf}}
|
|
!macroend""")
|
|
for source, target in (("electron-builder.cjs", "electron-builder.loksi.cjs"),
|
|
("after-pack.cjs", "after-pack.loksi.cjs")):
|
|
shutil.copy2(ROOT / source, APP / target)
|
|
touched.add(rel(APP / target))
|
|
|
|
|
|
# ---------------------------------------------------------------- natif (Rust)
|
|
|
|
def native_sources():
|
|
ipc = NATIVE / "core/src/ipc/mod.rs"
|
|
# Tuyaux et sockets propres à Loksi : sans cela l'appli Bitwarden installée sur le
|
|
# même poste répondrait aux messages de l'extension Loksi, et inversement.
|
|
replace_once(ipc, r'format!(r"\\.\pipe\{hash_b64}.s.{name}").into()',
|
|
r'format!(r"\\.\pipe\{hash_b64}.loksi.s.{name}").into()')
|
|
replace_once(ipc, 'home.join("Library/Group Containers/' + TEAM_BITWARDEN + '.com.bitwarden.desktop")',
|
|
'home.join("Library/Group Containers/' + APP_ID + '")')
|
|
replace_once(ipc, 'let path_dir = home.join("com.bitwarden.desktop");',
|
|
'let path_dir = home.join("' + APP_ID + '");')
|
|
# Agent SSH : socket et dossier Flatpak propres à Loksi (~/.loksi-ssh-agent.sock).
|
|
for path, count in (("core/src/ssh_agent/unix.rs", 2), ("ssh_agent/src/server/listener/unix.rs", 2)):
|
|
replace_count(NATIVE / path, ".bitwarden-ssh-agent.sock", ".loksi-ssh-agent.sock", count)
|
|
replace_once(NATIVE / path, '".var/app/com.bitwarden.desktop/data"', '".var/app/' + APP_ID + '/data"')
|
|
# Windows Hello : la clé biométrique a son propre nom dans le coffre d'identifiants.
|
|
replace_count(NATIVE / "biometric/src/windows.rs", "BitwardenBiometricsV2", "LoksiBiometricsV2", 2)
|
|
# Info.plist incrusté dans le binaire du proxy (embed_plist) : identifiant Loksi.
|
|
replace_once(APP / "resources/info.desktop_proxy.plist", "<string>com.bitwarden.desktop</string>",
|
|
"<string>" + APP_ID + "</string>")
|
|
proxy = NATIVE / "proxy/src/main.rs"
|
|
replace_once(proxy, 'path.set_extension("bitwarden.log");', 'path.set_extension("loksi.log");')
|
|
replace_once(proxy, 'info!("Starting Bitwarden IPC Proxy.");', 'info!("Starting Loksi IPC Proxy.");')
|
|
# Inventaire du 09/10/2026, décision de Romain : plus de « bitwarden » visible hors
|
|
# obligation. Variable de l'agent SSH, dossier de données et AAGUID de la passkey
|
|
# Windows, tuyau et nom de l'aide à l'import Chromium, clé de préférences macOS.
|
|
replace_count(NATIVE / "core/src/ssh_agent/unix.rs", "BITWARDEN_SSH_AUTH_SOCK", "LOKSI_SSH_AUTH_SOCK", 4)
|
|
replace_count(NATIVE / "ssh_agent/src/server/listener/unix.rs", "BITWARDEN_SSH_AUTH_SOCK",
|
|
"LOKSI_SSH_AUTH_SOCK", 7)
|
|
plugin = NATIVE / "windows_plugin_authenticator/src"
|
|
replace_once(plugin / "main.rs", 'std::env::var("BITWARDEN_APPDATA_DIR")', 'std::env::var("LOKSI_APPDATA_DIR")')
|
|
replace_once(plugin / "main.rs", ' "Bitwarden",\n', ' "Loksi",\n')
|
|
replace_once(plugin / "lib.rs", '"' + AAGUID_BITWARDEN + '"', '"' + AAGUID + '"')
|
|
importer = NATIVE / "chromium_importer/src/chromium/platform/windows"
|
|
replace_once(importer / "abe_config.rs", r"\\.\pipe\bitwarden-to-bitwarden-chromium-importer-helper",
|
|
r"\\.\pipe\loksi-chromium-importer-helper")
|
|
for amont, loksi in WIN_EXE_NOMS.items():
|
|
if "chromium" in amont:
|
|
replace_once(importer / "mod.rs", 'const ADMIN_EXE_FILENAME: &str = "' + amont + '";',
|
|
'const ADMIN_EXE_FILENAME: &str = "' + loksi + '";')
|
|
replace_once(NATIVE / "objc/src/native/chromium_importer/browser_access_manager.m",
|
|
'@"com.bitwarden.chromiumImporter.bookmarks"', '@"' + APP_ID + '.chromiumImporter.bookmarks"')
|
|
|
|
|
|
# ---------------------------------------------------------------- processus principal
|
|
|
|
def main_process():
|
|
main = APP / "src/main.ts"
|
|
replace_once(main, ' this.desktopCredentialStorageListener = new DesktopCredentialStorageListener(\n'
|
|
' "Bitwarden",',
|
|
' this.desktopCredentialStorageListener = new DesktopCredentialStorageListener(\n'
|
|
' "Loksi",')
|
|
replace_once(main, '"bitwarden-appdata"', '"loksi-appdata"')
|
|
replace_once(APP / "src/platform/main/desktop-credential-storage-listener.ts",
|
|
'if (serviceName == "Bitwarden_biometric") {', 'if (serviceName == "Loksi_biometric") {')
|
|
replace_once(APP / "src/key-management/biometrics/os-biometrics-mac.service.ts",
|
|
'const SERVICE = "Bitwarden_biometric";', 'const SERVICE = "Loksi_biometric";')
|
|
# Pas de mise à jour automatique : le canal amont installerait l'appli Bitwarden.
|
|
replace_once(APP / "src/main/updater.main.ts",
|
|
" this.canUpdate =\n !this.userDisabledUpdates() &&",
|
|
" // Loksi : aucun canal de mise à jour, celui de l'amont installerait Bitwarden.\n"
|
|
" this.canUpdate =\n false &&\n !this.userDisabledUpdates() &&")
|
|
about = APP / "src/main/menu/menu.about.ts"
|
|
replace_once(about, ' "\\nArchitecture " +\n process.arch;',
|
|
' "\\nArchitecture " +\n process.arch +\n "\\n\\n" +\n'
|
|
' this.localize("loksiBasedOn") +\n "\\n" +\n'
|
|
' this.localize("loksiAboutOrigin") +\n "\\n\\n" +\n'
|
|
' this.localize("loksiSourceCode");')
|
|
# « Version AAAA.M.n (build) » (règle du 06/10/2026). Le numéro de build est posé dans
|
|
# le package.json de l'asar par electron-builder.cjs (extraMetadata.loksiBuild).
|
|
replace_once(about, 'import { BrowserWindow, clipboard, dialog, MenuItemConstructorOptions } from "electron";\n',
|
|
'import * as fs from "fs";\nimport * as path from "path";\n\n'
|
|
'import { app, BrowserWindow, clipboard, dialog, MenuItemConstructorOptions } from "electron";\n')
|
|
replace_once(about, "export class AboutMenu implements IMenubarMenu {",
|
|
"// Loksi : numéro de build du paquet, lu dans le package.json de l'asar.\n"
|
|
"function loksiBuild(): string {\n try {\n"
|
|
' const file = path.join(app.getAppPath(), "package.json");\n'
|
|
' return String(JSON.parse(fs.readFileSync(file, "utf8")).loksiBuild);\n'
|
|
' } catch {\n return "?";\n }\n}\n\n'
|
|
"export class AboutMenu implements IMenubarMenu {")
|
|
replace_once(about, 'this.localize("version", this._version) +',
|
|
'this.localize("version", this._version + " (" + loksiBuild() + ")") +')
|
|
# En-tête Bitwarden-Client-Version et version cliente du SDK : la version Bitwarden de
|
|
# la base de code, pas celle de Loksi. Le serveur décide de fonctionnalités selon elle,
|
|
# il doit voir ce que le code sait faire.
|
|
replace_once(APP / "src/platform/services/electron-platform-utils.service.ts",
|
|
" async getApplicationVersionNumber(): Promise<string> {\n"
|
|
" return (await this.getApplicationVersion()).split(/[+|-]/)[0].trim();\n }\n",
|
|
" async getApplicationVersionNumber(): Promise<string> {\n"
|
|
" // Loksi : version Bitwarden de la base, envoyée au serveur et au SDK.\n"
|
|
" return " + json.dumps(BITWARDEN_VERSION) + ";\n }\n")
|
|
# Menu Aide : l'aide et la confidentialité de Loksi. Les réseaux, magasins et
|
|
# rapports de bogue de Bitwarden sont retirés (brand/README.md).
|
|
help_menu = APP / "src/main/menu/menu.help.ts"
|
|
replace_once(help_menu, " this.helpAndFeedback,\n this.fileBugReport,\n this.legal,\n"
|
|
" this.separator,\n this.followUs,\n this.separator,\n"
|
|
" this.goToWebVault,\n this.separator,\n this.getMobileApp,\n"
|
|
" this.getBrowserExtension,\n this.separator,\n",
|
|
" this.helpAndFeedback,\n this.legal,\n this.contactUs,\n this.separator,\n"
|
|
" this.goToWebVault,\n this.separator,\n")
|
|
# « Nous contacter », comme les autres clients (demande de Romain du 30/09/2026) :
|
|
# confirmation, puis la messagerie sur loksi@aleop.eu.
|
|
replace_once(help_menu, 'import { MenuItemConstructorOptions, app } from "electron";',
|
|
'import { MenuItemConstructorOptions, app, dialog, shell } from "electron";')
|
|
replace_once(help_menu, " private get separator(): MenuItemConstructorOptions {",
|
|
" private get contactUs(): MenuItemConstructorOptions {\n return {\n"
|
|
' id: "loksiContactUs",\n label: this.localize("loksiContactUs"),\n'
|
|
" click: async () => {\n const result = await dialog.showMessageBox({\n"
|
|
' type: "question",\n message: this.localize("loksiContactTitle"),\n'
|
|
' detail: this.localize("loksiContactBody"),\n'
|
|
' buttons: [this.localize("ok"), this.localize("cancel")],\n'
|
|
" defaultId: 0,\n cancelId: 1,\n noLink: true,\n });\n"
|
|
" if (result.response === 0) {\n"
|
|
' void shell.openExternal("mailto:loksi@aleop.eu");\n }\n },\n'
|
|
" };\n }\n\n private get separator(): MenuItemConstructorOptions {")
|
|
replace_once(help_menu, 'this.shell.openExternal("https://bitwarden.com/help", UrlType.WebUrl)',
|
|
'this.shell.openExternal(' + json.dumps(AIDE) + ', UrlType.WebUrl)')
|
|
replace_once(help_menu, ' visible: isMacAppStore(),\n submenu: this.legalSubmenu,',
|
|
' visible: true || isMacAppStore(),\n submenu: this.legalSubmenu,')
|
|
text = help_menu.read_text()
|
|
start = text.index(' {\n id: "termsOfService",')
|
|
end = text.index(' {\n id: "privacyPolicy",')
|
|
write(help_menu, text[:start] + text[end:])
|
|
replace_once(help_menu, 'this.shell.openExternal("https://bitwarden.com/privacy/", UrlType.WebUrl)',
|
|
'this.shell.openExternal(' + json.dumps(CONFIDENTIALITE) + ', UrlType.WebUrl)')
|
|
# Variable de dossier de données (lue aussi par la passkey Windows), partition de
|
|
# session Electron, nom du rapport de diagnostic, liens de l'écran d'inscription.
|
|
replace_count(main, "BITWARDEN_APPDATA_DIR", "LOKSI_APPDATA_DIR", 2)
|
|
replace_once(APP / "src/main/window.main.ts", '"persist:bitwarden"', '"persist:loksi"')
|
|
# Barre de menus native de Windows (Fichier, Édition...) masquée, Alt l'affiche :
|
|
# demande de Romain du 09/10/2026, vue blanche et hors charte dans l'appli Store. La
|
|
# sortie du mode fenêtre réduite (popup-modal-styles) la remettait visible.
|
|
replace_once(APP / "src/main/window.main.ts", ' titleBarStyle: isMac() ? "hiddenInset" : undefined,\n',
|
|
' titleBarStyle: isMac() ? "hiddenInset" : undefined,\n autoHideMenuBar: true,\n')
|
|
replace_once(APP / "src/platform/popup-modal-styles.ts",
|
|
" window.setWindowButtonVisibility?.(true);\n window.setMenuBarVisibility?.(true);\n",
|
|
" window.setWindowButtonVisibility?.(true);\n window.setMenuBarVisibility?.(false);\n")
|
|
replace_count(SOURCE / "libs/logging/src/flight-recorder-export.ts", "Bitwarden-diagnostic-report-",
|
|
"Loksi-diagnostic-report-", 2)
|
|
inscription = SOURCE / "libs/auth/src/angular/registration/registration-start/registration-start.component.html"
|
|
replace_once(inscription, 'href="https://bitwarden.com/terms/"', 'href="' + CONDITIONS + '"')
|
|
replace_once(inscription, 'href="https://bitwarden.com/privacy/"', 'href="' + CONFIDENTIALITE + '"')
|
|
replace_once(inscription, 'href="https://bitwarden.com/email-preferences"', 'href="' + CONFIDENTIALITE + '"')
|
|
# Liens d'aide bitwarden.com/help des écrans (réglages biométrie, création de
|
|
# compte, import, etc.) : tous vers l'aide Loksi. 34 dans les sources au 09/10/2026.
|
|
motif = re.compile(r"https?://(www\.)?bitwarden\.com/help(/[^\"'`\s)]*)?")
|
|
liens = 0
|
|
for dossier in (APP / "src", SOURCE / "libs"):
|
|
for chemin in sorted(dossier.rglob("*")):
|
|
if chemin.suffix not in (".ts", ".html") or ".spec." in chemin.name or ".stories." in chemin.name:
|
|
continue
|
|
texte = chemin.read_text()
|
|
nouveau, n = motif.subn(AIDE, texte)
|
|
if n:
|
|
write(chemin, nouveau)
|
|
liens += n
|
|
if liens < 20:
|
|
raise RuntimeError(f"Liens d'aide Bitwarden : {liens} trouvés, l'amont a changé")
|
|
native_messaging()
|
|
|
|
|
|
def native_messaging():
|
|
path = APP / "src/main/native-messaging.main.ts"
|
|
# Hôte de messagerie native propre à Loksi, clés de registre et fichiers compris.
|
|
replace_count(path, "com.8bit.bitwarden", HOST, 20)
|
|
replace_count(path, '"Bitwarden desktop <-> browser bridge"', '"Loksi desktop <-> browser bridge"', 2)
|
|
replace_once(path, '"Bitwarden desktop <-> DuckDuckGo bridge"', '"Loksi desktop <-> DuckDuckGo bridge"')
|
|
replace_once(path, 'allowed_extensions: ["{446900e4-71c2-419f-a6a7-df9c091e268b}"],',
|
|
"allowed_extensions: " + json.dumps(CONFIG["native_messaging"]["firefox_extension_ids"]) + ",")
|
|
text = path.read_text()
|
|
start = text.index(" const ids: Set<string> = new Set([\n")
|
|
end = text.index(" ]);\n", start) + len(" ]);\n")
|
|
chrome = ["chrome-extension://" + i + "/" for i in CONFIG["native_messaging"]["chrome_extension_ids"]]
|
|
text = text[:start] + " const ids: Set<string> = new Set(" + json.dumps(chrome) + ");\n" + text[end:]
|
|
write(path, text)
|
|
# L'extension Loksi est chargée non empaquetée : son identifiant Chromium dépend du
|
|
# poste. Le balayage des profils que l'amont réserve au développement tourne donc
|
|
# toujours, et les extensions Bitwarden officielles sont écartées du résultat.
|
|
replace_once(path, " if (!isDev()) {\n return Array.from(ids);\n }\n", "")
|
|
replace_once(path, " return Array.from(ids);\n }\n\n private binaryPath() {",
|
|
" const bitwarden = " + json.dumps(list(CHROME_BITWARDEN)) + ";\n"
|
|
" return Array.from(ids).filter((id) => !bitwarden.some((b) => id.includes(b)));\n"
|
|
" }\n\n private binaryPath() {")
|
|
|
|
|
|
# ---------------------------------------------------------------- serveur et connexion
|
|
|
|
def server_entry():
|
|
"""Pas de serveur par défaut ni de choix de région : le client saisit son coffre."""
|
|
env = SOURCE / "libs/common/src/platform/services/default-environment.service.ts"
|
|
# Sans rien de saisi, un marqueur en .invalid (RFC 6761) qui ne se résout jamais,
|
|
# comme les applis mobiles. Les régions Bitwarden restent dans le code, non proposées.
|
|
replace_count(env, " if (region == Region.SelfHosted && isEmpty(urls)) {\n region = DEFAULT_REGION;\n }\n",
|
|
" if (region == Region.SelfHosted && isEmpty(urls)) {\n"
|
|
" urls = { base: " + json.dumps(UNSET) + " };\n }\n", 2)
|
|
selector = SOURCE / "libs/angular/src/auth/environment-selector/environment-selector.component"
|
|
html = Path(str(selector) + ".html")
|
|
if html.read_text().count("toggle(ServerEnvironmentType.SelfHosted)") != 1:
|
|
raise RuntimeError("Sélecteur de région amont modifié")
|
|
write(html, '<div class="tw-mb-1">\n <div bitTypography="body2">\n'
|
|
' {{ "loksiConnectingTo" | i18n }} :\n'
|
|
' <button type="button" bitLink (click)="toggle(ServerEnvironmentType.SelfHosted)"'
|
|
' data-loksi="serveur">\n'
|
|
' <b class="tw-text-primary-600 tw-font-medium">{{\n'
|
|
' (loksiHost$ | async) || ("loksiAddressToEnter" | i18n)\n }}</b>\n'
|
|
' <bit-icon name="bwi-pencil" class="bwi-fw bwi-sm"></bit-icon>\n'
|
|
' </button>\n </div>\n</div>\n')
|
|
ts = Path(str(selector) + ".ts")
|
|
replace_once(ts, " private destroy$ = new Subject<void>();\n",
|
|
" // Loksi : l'adresse du coffre saisi, rien tant que c'est le marqueur.\n"
|
|
" protected loksiHost$: Observable<string | null> = this.environmentService.globalEnvironment$.pipe(\n"
|
|
" map((env) => (env.getUrls().base === " + json.dumps(UNSET) + " ? null : env.getHostname())),\n"
|
|
" );\n\n private destroy$ = new Subject<void>();\n")
|
|
dialog = SOURCE / "libs/angular/src/auth/self-hosted-env-config-dialog/self-hosted-env-config-dialog.component.ts"
|
|
replace_once(dialog, ' baseUrl: urls.base || "",',
|
|
' baseUrl: urls.base === ' + json.dumps(UNSET) + ' ? "" : urls.base || "",')
|
|
replace_once(Path(str(SOURCE / "libs/angular/src/auth/self-hosted-env-config-dialog/"
|
|
"self-hosted-env-config-dialog.component.html")),
|
|
"<span bitDialogTitle> Self-hosted environment</span>",
|
|
'<span bitDialogTitle>{{ "loksiVaultTitle" | i18n }}</span>')
|
|
# Pas de création de compte : un compte Loksi est créé par l'administrateur.
|
|
secondary = SOURCE / "libs/auth/src/angular/login/login-secondary-content.component.ts"
|
|
text = secondary.read_text()
|
|
start = text.index(" template: `\n")
|
|
end = text.index(" `,\n", start) + len(" `,\n")
|
|
write(secondary, text[:start] + ' template: `\n <div class="tw-text-center" data-loksi="compte-admin">\n'
|
|
' {{ "loksiAccountByAdmin" | i18n }}\n </div>\n `,\n' + text[end:])
|
|
|
|
|
|
def locales():
|
|
for path in sorted((APP / "src/locales").glob("*/messages.json")):
|
|
lang = path.parent.name
|
|
data = json.loads(path.read_text())
|
|
for key, value in data.items():
|
|
message = value.get("message", "")
|
|
if key in BITWARDEN_GARDE or "bitwarden" not in message.lower():
|
|
continue
|
|
# « le coffre web de bitwarden.com » devient « le coffre web de Loksi ».
|
|
value["message"] = (message.replace("bitwarden.company.com", "loksi.company.com")
|
|
.replace("bitwarden.com", "Loksi").replace("Bitwarden", "Loksi"))
|
|
# Langues non proposées : quelques « bitwarden » en minuscules, et
|
|
# bitwarden.net (nb). Tout reste en Loksi, sans égard à la casse.
|
|
value["message"] = re.sub(r"bitwarden(\.(com|net|eu))?", "Loksi", value["message"],
|
|
flags=re.IGNORECASE)
|
|
for key, text in TEXTES["fr" if lang == "fr" else "en"].items():
|
|
if lang in ("en", "fr") or key == "selfHostedBaseUrlHint":
|
|
data[key] = {"message": text}
|
|
write_json(path, data)
|
|
|
|
|
|
# ---------------------------------------------------------------- charte
|
|
|
|
def prefixed(drawing, prefix):
|
|
"""Identifiants internes d'un SVG préfixés, pour qu'un dessin n'aille pas chercher
|
|
ses dégradés ou masques dans un autre de la même page."""
|
|
if "`" in drawing or "${" in drawing:
|
|
raise RuntimeError("Dessin Loksi inattendu")
|
|
drawing = re.sub(r'id="([^"]+)"', lambda m: 'id="' + prefix + m.group(1) + '"', drawing)
|
|
return re.sub(r"url\(#([^)]+)\)", lambda m: "url(#" + prefix + m.group(1) + ")", drawing)
|
|
|
|
|
|
def charte():
|
|
svgs = SOURCE / "libs/assets/src/svg/svgs"
|
|
wordmark = extension.theme_pair(REPO / "brand/sources/loksi-logo-clair.svg",
|
|
REPO / "brand/sources/loksi-logo-sombre.svg", "logo")
|
|
for name, export in (("bitwarden-logo.icon.ts", "BitwardenLogo"),
|
|
("bitwarden-logo-beta.icon.ts", "BitwardenLogoBeta")):
|
|
write(svgs / name, 'import { svg } from "../svg";\nexport const ' + export + ' = svg`' + wordmark + '`;\n')
|
|
# Logo de la barre latérale, toujours sur le navy de la navigation : le logo sombre.
|
|
nav = (REPO / "brand/sources/loksi-logo-sombre.svg").read_text().strip()
|
|
nav = re.sub(r'id="([^"]+)"', lambda m: 'id="loksi-nav-' + m.group(1) + '"', nav)
|
|
nav = re.sub(r"url\(#([^)]+)\)", lambda m: "url(#loksi-nav-" + m.group(1) + ")", nav)
|
|
nav = nav.replace("<svg ", '<svg data-loksi="nav" ', 1)
|
|
if "`" in nav or "${" in nav:
|
|
raise RuntimeError("Logo Loksi inattendu")
|
|
pm = svgs / "password-manager.ts"
|
|
if "const PasswordManagerLogo = svg`" not in pm.read_text():
|
|
raise RuntimeError("Logo de navigation amont modifié")
|
|
write(pm, 'import { svg } from "../svg";\n\nconst PasswordManagerLogo = svg`' + nav
|
|
+ '`;\n\nexport default PasswordManagerLogo;\n')
|
|
signatures = {}
|
|
for filename, (export, name) in extension.ILLUSTRATION_TABLE.items():
|
|
path = svgs / filename
|
|
original = path.read_text()
|
|
if original.count("export const " + export + " = svg`") != 1 or original.count("svg`") != 1:
|
|
raise RuntimeError("Illustration amont modifiée : " + export)
|
|
signatures[export] = re.search(r' d="([^"]{40})', original).group(1)
|
|
write(path, 'import { svg } from "../svg";\n\nexport const ' + export + ' = svg`'
|
|
+ extension.illustration(name) + '`;\n')
|
|
# Pages de connexion : l'icône Loksi sculptée à la place du bouclier (demande de
|
|
# Romain du 30/09/2026), et un fond fait de la charte à la place du décor Bitwarden.
|
|
icone = prefixed((REPO / "brand/loksi-icon.svg").read_text().strip(), "loksi-page-")
|
|
write(svgs / "vault.icon.ts", 'import { svg } from "../svg";\n\nexport const VaultIcon = svg`'
|
|
+ icone.replace("<svg ", '<svg data-loksi="icone" ', 1) + '`;\n')
|
|
for filename, export in (("background-left-illustration.ts", "BackgroundLeftIllustration"),
|
|
("background-right-illustration.ts", "BackgroundRightIllustration")):
|
|
original = (svgs / filename).read_text()
|
|
if original.count("export const " + export + " = svg`") != 1:
|
|
raise RuntimeError("Fond amont modifié : " + export)
|
|
signatures[export] = re.search(r' d="([^"]{40})', original).group(1)
|
|
# À gauche le symbole en silhouette, navy en clair et cyan en sombre par la couleur
|
|
# primaire du thème ; à droite l'illustration du coffre. Le calque amont les pose
|
|
# en bas de page, à 11 % d'opacité.
|
|
mono = (REPO / "brand/sources/loksi-icon-mono.svg").read_text().strip()
|
|
corps = mono[mono.index(">") + 1:mono.rindex("</svg>")]
|
|
if corps.count('fill="#0B1120"') != 1:
|
|
raise RuntimeError("loksi-icon-mono.svg inattendu")
|
|
corps = corps.replace('fill="#0B1120"', 'style="fill: rgb(var(--color-primary-600))"')
|
|
gauche = prefixed('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 250 113" data-loksi="fond">'
|
|
'<g transform="translate(14 8)">' + corps + "</g></svg>", "loksi-fond-")
|
|
write(svgs / "background-left-illustration.ts",
|
|
'import { svg } from "../svg";\n\nexport const BackgroundLeftIllustration = svg`' + gauche + '`;\n')
|
|
write(svgs / "background-right-illustration.ts",
|
|
'import { svg } from "../svg";\n\nexport const BackgroundRightIllustration = svg`'
|
|
+ extension.illustration("coffre").replace('data-loksi="coffre"', 'data-loksi="fond-coffre"') + '`;\n')
|
|
(CACHE / "illustrations-amont.json").write_text(json.dumps(signatures, indent=2) + "\n")
|
|
with (APP / "src/scss/styles.scss").open("a") as scss:
|
|
scss.write("\n.loksi-illustration-sombre,\n.theme_dark .loksi-illustration-clair {\n"
|
|
" display: none;\n}\n\n.theme_dark .loksi-illustration-sombre {\n display: block;\n}\n")
|
|
touched.add(rel(APP / "src/scss/styles.scss"))
|
|
# Palette de l'extension, mêmes blocs de tw-theme.css.
|
|
theme = SOURCE / "libs/components/src/tw-theme.css"
|
|
css = theme.read_text()
|
|
for block, values in extension.PALETTE.items():
|
|
start = css.index("\n" + block + "\n")
|
|
end = css.index("\n}\n", start)
|
|
body = css[start:end]
|
|
for name, value in values.items():
|
|
body, count = re.subn(r"(\n " + re.escape(name) + r": )[^;]+;", lambda m: m.group(1) + value + ";", body)
|
|
if count != 1:
|
|
raise RuntimeError("Couleur amont introuvable : " + block + " " + name)
|
|
css = css[:start] + body + css[end:]
|
|
write(theme, css)
|
|
variables = APP / "src/scss/variables.scss"
|
|
replace_once(variables, "$brand-primary: #175ddc;", "$brand-primary: #003087;")
|
|
replace_once(variables, " primaryColor: #6f9df1,\n primaryAccentColor: #6f9df1,",
|
|
" primaryColor: #009cde,\n primaryAccentColor: #009cde,")
|
|
replace_once(variables, '$font-family-sans-serif: Inter, ', '$font-family-sans-serif: Loksi, Inter, ')
|
|
# Police : Raleway renommée « Loksi », mêmes fichiers que l'extension.
|
|
extension_fonts.CACHE = CACHE / "fonts"
|
|
extension_fonts.VENV = CACHE / "fonts-venv"
|
|
extension_fonts.PYTHON = extension_fonts.VENV / ("Scripts/python.exe" if WINDOWS_HOST else "bin/python")
|
|
extension_fonts.OUT = extension_fonts.CACHE / "out"
|
|
extension_fonts.WOFF2 = extension_fonts.CACHE / "woff2"
|
|
extension_fonts.main()
|
|
webfonts = SOURCE / "libs/components/src/webfonts"
|
|
faces = []
|
|
for filename, weight, style in (("loksi-400.woff2", 400, "normal"), ("loksi-600.woff2", 600, "normal"),
|
|
("loksi-700.woff2", 700, "normal"), ("loksi-400-italic.woff2", 400, "italic")):
|
|
shutil.copy2(extension_fonts.WOFF2 / filename, webfonts / filename)
|
|
touched.add(rel(webfonts / filename))
|
|
faces.append('@font-face {\n font-family: Loksi;\n src: url("~@bitwarden/components/src/webfonts/'
|
|
+ filename + '") format("woff2");\n font-display: swap;\n font-weight: '
|
|
+ str(weight) + ';\n font-style: ' + style + ';\n}\n')
|
|
fonts_css = SOURCE / "libs/components/src/theme.css"
|
|
replace_once(fonts_css, " --font-sans:\n Inter, ", " --font-sans:\n Loksi, Inter, ")
|
|
replace_once(fonts_css, "/**\n * CSS variables\n */", "".join(faces) + "\n/**\n * CSS variables\n */")
|
|
|
|
|
|
def ico(pngs):
|
|
"""Fichier ICO à entrées PNG, lu par Windows depuis Vista."""
|
|
entries, blobs = [], []
|
|
offset = 6 + 16 * len(pngs)
|
|
for size, data in pngs:
|
|
entries.append(struct.pack("<BBBBHHII", size % 256, size % 256, 0, 0, 1, 32, len(data), offset))
|
|
blobs.append(data)
|
|
offset += len(data)
|
|
return struct.pack("<HHH", 0, 1, len(pngs)) + b"".join(entries) + b"".join(blobs)
|
|
|
|
|
|
def bmp24(png, node):
|
|
"""PNG vers BMP 24 bits de bas en haut, le seul format du bandeau NSIS."""
|
|
code = ("const sharp = require('sharp');\n"
|
|
"sharp(process.argv[1]).removeAlpha().raw().toBuffer({resolveWithObject: true})"
|
|
".then(({data, info}) => process.stdout.write(JSON.stringify({w: info.width, h: info.height,"
|
|
" c: info.channels, d: data.toString('base64')})));\n")
|
|
out = json.loads(subprocess.run(["node", "-e", code, str(png)], cwd=node, check=True,
|
|
capture_output=True, text=True).stdout)
|
|
w, h, c, raw = out["w"], out["h"], out["c"], __import__("base64").b64decode(out["d"])
|
|
if c != 3:
|
|
raise RuntimeError("bandeau : 3 canaux attendus")
|
|
stride = (w * 3 + 3) & ~3
|
|
rows = []
|
|
for y in range(h - 1, -1, -1):
|
|
row = bytearray()
|
|
for x in range(w):
|
|
r, g, b = raw[(y * w + x) * 3:(y * w + x) * 3 + 3]
|
|
row += bytes((b, g, r))
|
|
rows.append(bytes(row) + b"\0" * (stride - w * 3))
|
|
pixels = b"".join(rows)
|
|
header = struct.pack("<2sIHHI", b"BM", 54 + len(pixels), 0, 0, 54)
|
|
info = struct.pack("<IiiHHIIiiII", 40, w, h, 1, 24, 0, len(pixels), 2835, 2835, 0, 0)
|
|
return header + info + pixels
|
|
|
|
|
|
def icons():
|
|
node = CACHE / "node"
|
|
node.mkdir(exist_ok=True)
|
|
for name in ("package.json", "package-lock.json"):
|
|
shutil.copy2(REPO / "brand" / name, node / name)
|
|
if not (node / "node_modules/playwright").exists():
|
|
run(["npm", "ci", "--no-audit", "--no-fund"], cwd=node)
|
|
if WINDOWS_HOST:
|
|
# npm ci n'apporte pas le navigateur de Playwright. Sur le Mac il a été posé une
|
|
# fois à la main ; sur un runner neuf il manque. Idempotent s'il est déjà là.
|
|
run(["npx", "playwright", "install", "chromium"], cwd=node)
|
|
out = CACHE / "graphics"
|
|
if out.exists():
|
|
shutil.rmtree(out)
|
|
run(["node", ROOT / "render.mjs", out], cwd=node)
|
|
png = lambda t: (out / f"icon-{t}.png").read_bytes() # noqa: E731
|
|
mac = lambda t: (out / f"mac-{t}.png").read_bytes() # noqa: E731
|
|
win = lambda t: (out / f"win-{t}.png").read_bytes() # noqa: E731
|
|
res = APP / "resources"
|
|
# macOS : .icns par iconutil, aux tailles de l'iconset amont, depuis le jeu système
|
|
# pleine page (render.mjs) : macOS pose lui-même son masque arrondi.
|
|
iconset = CACHE / "loksi.iconset"
|
|
if iconset.exists():
|
|
shutil.rmtree(iconset)
|
|
iconset.mkdir()
|
|
for base in (16, 32, 64, 128, 256, 512):
|
|
(iconset / f"icon_{base}x{base}.png").write_bytes(mac(base))
|
|
(iconset / f"icon_{base}x{base}@2x.png").write_bytes(mac(base * 2))
|
|
write_bytes(res / "icon.iconset" / f"icon_{base}x{base}.png", mac(base))
|
|
write_bytes(res / "icon.iconset" / f"icon_{base}x{base}@2x.png", mac(base * 2))
|
|
# iconutil n'existe que sous macOS. Le build Windows n'emploie pas icon.icns :
|
|
# il garde celui des sources amont.
|
|
if not WINDOWS_HOST:
|
|
run(["iconutil", "-c", "icns", iconset, "-o", CACHE / "icon.icns"])
|
|
write_bytes(res / "icon.icns", (CACHE / "icon.icns").read_bytes())
|
|
write_bytes(res / "icon.png", png(1024))
|
|
for t in (16, 32, 64, 128, 256, 512, 1024):
|
|
write_bytes(res / "icons" / f"{t}x{t}.png", png(t))
|
|
write_bytes(res / "icon.ico", ico([(t, win(t)) for t in (16, 24, 32, 48, 64, 128, 256)]))
|
|
write_bytes(res / "installerSidebar.bmp", bmp24(out / "installer-sidebar.png", node))
|
|
for name in ("Square44x44Logo", "Square150x150Logo", "StoreLogo", "Wide310x150Logo", "SplashScreen"):
|
|
write_bytes(res / "appx" / f"{name}.png", (out / f"appx-{name}.png").read_bytes())
|
|
# Fournisseur de clés d'accès Windows : son propre CLSID COM, son nom, son logo.
|
|
write_json(res / "windows_plugin_authenticator_config.json",
|
|
{"clsid": CONFIG["windows_plugin_authenticator_clsid"], "name": "Loksi"})
|
|
write(res / "windows_plugin_authenticator_logo.svg", (REPO / "brand/loksi-icon-16.svg").read_text())
|
|
images = APP / "src/images"
|
|
write_bytes(images / "icon.png", png(512))
|
|
write_bytes(images / "icon.ico", ico([(t, win(t)) for t in (16, 32, 48, 256)]))
|
|
for kind in ("template", "highlight"):
|
|
write_bytes(images / f"icon-{kind}.png", (out / f"tray-{kind}.png").read_bytes())
|
|
write_bytes(images / f"icon-{kind}@2x.png", (out / f"tray-{kind}@2x.png").read_bytes())
|
|
|
|
|
|
# ---------------------------------------------------------------- commandes
|
|
|
|
def prepare():
|
|
if hashlib.sha256(ARCHIVE.read_bytes()).hexdigest() != CONFIG["archive_sha256"]:
|
|
raise RuntimeError("Archive amont incorrecte : SHA-256 différent")
|
|
# Réextraction des sources d'origine : adaptations idempotentes, node_modules et
|
|
# target/ de Cargo conservés.
|
|
with tarfile.open(ARCHIVE) as tar:
|
|
tar.extractall(CACHE, filter="data")
|
|
identity()
|
|
native_sources()
|
|
main_process()
|
|
server_entry()
|
|
locales()
|
|
charte()
|
|
icons()
|
|
TOUCHED.write_text(json.dumps(sorted(touched), indent=2) + "\n")
|
|
print(f"Sources Loksi préparées : {SOURCE} ({len(touched)} fichiers adaptés)")
|
|
|
|
|
|
def changes():
|
|
allowed = set(json.loads(TOUCHED.read_text()))
|
|
changed, seen = [], set()
|
|
with tarfile.open(ARCHIVE) as tar:
|
|
for member in tar:
|
|
if not member.isfile():
|
|
continue
|
|
relative = member.name.split("/", 1)[1]
|
|
seen.add(relative)
|
|
if tar.extractfile(member).read() != (SOURCE / relative).read_bytes():
|
|
if relative not in allowed:
|
|
raise RuntimeError("Modification hors périmètre : " + relative)
|
|
changed.append(relative)
|
|
added = sorted(allowed - seen)
|
|
# Fichiers apparus dans les sources suivies sans être dans la liste de prepare.
|
|
for folder in ("apps/desktop/src", "apps/desktop/resources", "apps/desktop/scripts", "libs"):
|
|
for path in (SOURCE / folder).rglob("*"):
|
|
relative = rel(path)
|
|
if (path.is_file() and relative not in seen and relative not in allowed
|
|
and "/node_modules/" not in relative and "/.angular/" not in relative):
|
|
raise RuntimeError("Fichier ajouté hors périmètre : " + relative)
|
|
REPORTS.mkdir(exist_ok=True)
|
|
(REPORTS / "desktop-upstream-changes.json").write_text(
|
|
json.dumps({"modifies": changed, "ajoutes": added}, indent=2) + "\n")
|
|
print(f"{len(changed)} fichiers amont adaptés, {len(added)} ajoutés, rien hors périmètre.")
|
|
|
|
|
|
WIN_TARGET = "x86_64-pc-windows-msvc"
|
|
WIN_BINARIES = ("desktop_proxy", "windows_plugin_authenticator", "bitwarden_chromium_import_helper")
|
|
|
|
|
|
def native(platform="mac", arch="arm64"):
|
|
if platform == "mac":
|
|
# Modules d'une autre architecture laissés par un build précédent : retirés, pour
|
|
# que le paquet ne prenne que ce qui vient d'être compilé.
|
|
for old in [*(NATIVE / "napi").glob("desktop_napi.darwin-*.node"),
|
|
*(NATIVE / "dist").glob("desktop_proxy.darwin-*")]:
|
|
old.unlink()
|
|
for triple in MAC_ARCHS[arch]["rust"]:
|
|
run(["node", "build.js", "--release", "--target=" + triple], cwd=NATIVE, env=tool_env())
|
|
return
|
|
if WINDOWS_HOST:
|
|
# Windows sur Windows : MSVC des Build Tools, pas de cross-compilation.
|
|
run(["rustup", "target", "add", WIN_TARGET], cwd=NATIVE, env=tool_env())
|
|
run(["npm", "run", "build", "--", "--release", "--target=" + WIN_TARGET],
|
|
cwd=NATIVE / "napi", env=tool_env())
|
|
(NATIVE / "dist").mkdir(exist_ok=True)
|
|
for binary in WIN_BINARIES:
|
|
run(["cargo", "build", "--bin", binary, "--release", "--target=" + WIN_TARGET],
|
|
cwd=NATIVE, env=tool_env())
|
|
shutil.copy2(NATIVE / "target" / WIN_TARGET / "release" / (binary + ".exe"),
|
|
NATIVE / "dist" / (binary + ".win32-x64.exe"))
|
|
return
|
|
# Windows depuis macOS : les étapes de build.js pour cette cible, sans son
|
|
# « brew install » d'outils MSIX et osslsigncode dont on n'a pas besoin. cargo-xwin
|
|
# (version épinglée par l'amont) fournit le CRT MSVC et le SDK Windows, licence
|
|
# Microsoft acceptée avec l'accord de Romain le 30/09/2026. clang et lld-link de LLVM.
|
|
env = dict(tool_env(), XWIN_CROSS_COMPILER="clang")
|
|
env["PATH"] = os.pathsep.join(["/opt/homebrew/opt/llvm/bin", "/opt/homebrew/opt/lld/bin", env["PATH"]])
|
|
run(["rustup", "target", "add", WIN_TARGET], cwd=NATIVE, env=env)
|
|
run(["npm", "run", "build", "--", "--cross-compile", "--release", "--target=" + WIN_TARGET],
|
|
cwd=NATIVE / "napi", env=env)
|
|
(NATIVE / "dist").mkdir(exist_ok=True)
|
|
for binary in WIN_BINARIES:
|
|
run(["cargo", "xwin", "build", "--bin", binary, "--release", "--target=" + WIN_TARGET],
|
|
cwd=NATIVE, env=env)
|
|
shutil.copy2(NATIVE / "target" / WIN_TARGET / "release" / (binary + ".exe"),
|
|
NATIVE / "dist" / (binary + ".win32-x64.exe"))
|
|
|
|
|
|
def webpack():
|
|
env = dict(tool_env(), NODE_ENV="production", NODE_OPTIONS="--max-old-space-size=8192")
|
|
run(["node", SOURCE / "node_modules/webpack-cli/bin/cli.js", "--config", ROOT / "webpack-oss.cjs"],
|
|
cwd=APP, env=env)
|
|
|
|
|
|
def nsis_dir():
|
|
"""NSIS pour electron-builder sur Apple Silicon.
|
|
|
|
Le makensis qu'electron-builder télécharge (NSIS 3.0.4.1) est un binaire x86_64,
|
|
refusé sans Rosetta (vu le 30/09/2026, erreur -86). On lui donne le makensis natif
|
|
de brew (3.13, avec ses propres Stubs, Include et Plugins), et le elevate.exe
|
|
qu'electron-builder livre avec son NSIS.
|
|
"""
|
|
prefix = Path(subprocess.run(["brew", "--prefix", "makensis"], capture_output=True, text=True,
|
|
check=True).stdout.strip())
|
|
share = prefix / "share/nsis"
|
|
target = CACHE / "nsis"
|
|
if target.exists():
|
|
shutil.rmtree(target)
|
|
(target / "mac").mkdir(parents=True)
|
|
for item in share.iterdir():
|
|
(target / item.name).symlink_to(item)
|
|
(target / "mac/makensis").symlink_to(prefix / "bin/makensis")
|
|
elevate = sorted((Path.home() / "Library/Caches/electron-builder/nsis").glob("nsis-3.0.4.1*/elevate.exe"))
|
|
if not elevate:
|
|
raise RuntimeError("elevate.exe absent : lancer une fois electron-builder --win pour qu'il "
|
|
"télécharge son NSIS, puis relancer")
|
|
shutil.copy2(elevate[0], target / "elevate.exe")
|
|
return target
|
|
|
|
|
|
def developer_id():
|
|
"""SHA-1 de l'identité « Developer ID Application » de l'équipe Aleop, ou None.
|
|
|
|
Le SHA-1 plutôt que le nom : codesign prend tout nom qui contient le texte donné,
|
|
et une identité « Apple Distribution » de la même équipe le rendrait ambigu. Un
|
|
SHA-1 de certificat n'est pas un secret.
|
|
"""
|
|
out = subprocess.run(["security", "find-identity", "-v", "-p", "codesigning"],
|
|
capture_output=True, text=True, check=True).stdout
|
|
team = re.escape(CONFIG["apple_team"]["id"])
|
|
found = sorted(set(re.findall(r'\b([0-9A-F]{40}) "Developer ID Application: [^"]*\(' + team + r'\)"', out)))
|
|
if len(found) > 1:
|
|
raise RuntimeError("Plusieurs Developer ID Application de l'équipe Aleop : en garder un seul")
|
|
return found[0] if found else None
|
|
|
|
|
|
def notary_profile():
|
|
"""Nom du profil notarytool s'il existe dans le trousseau, sinon None. Sa sortie
|
|
(liste des envois) n'est jamais affichée."""
|
|
name = CONFIG["apple_notary_profile"]["name"]
|
|
probe = subprocess.run(["xcrun", "notarytool", "history", "--keychain-profile", name],
|
|
capture_output=True, text=True)
|
|
return name if probe.returncode == 0 else None
|
|
|
|
|
|
def mac_signing(env):
|
|
"""Developer ID et notarisation quand ils existent, signature ad hoc sinon."""
|
|
identity = developer_id()
|
|
if identity is None:
|
|
print("Loksi : pas de Developer ID Application de l'équipe "
|
|
+ CONFIG["apple_team"]["id"] + ", signature ad hoc, paquet de test seulement.")
|
|
return
|
|
env["CSC_NAME"] = identity
|
|
profile = notary_profile()
|
|
if profile:
|
|
env["APPLE_KEYCHAIN_PROFILE"] = profile
|
|
print("Loksi : signature Developer ID de l'équipe " + CONFIG["apple_team"]["id"]
|
|
+ " et notarisation par le profil " + profile)
|
|
elif os.environ.get("LOKSI_SANS_NOTARISATION") == "1":
|
|
print("Loksi : signature Developer ID SANS notarisation (LOKSI_SANS_NOTARISATION=1).")
|
|
else:
|
|
raise RuntimeError("Developer ID présent mais profil notarytool « "
|
|
+ CONFIG["apple_notary_profile"]["name"] + " » absent du trousseau. "
|
|
"Le créer (README, section Signature) ou poser LOKSI_SANS_NOTARISATION=1")
|
|
|
|
|
|
def check_version(version, build, previous):
|
|
"""Règle du 06/10/2026 : AAAA.M.n sans zéro devant, build entier qui monte. Refus."""
|
|
refus = []
|
|
if not isinstance(version, str) or not VERSION_RE.fullmatch(version):
|
|
refus.append(f"version {version!r} : AAAA.M.n attendu, sans zéro devant (2026.10.0)")
|
|
if not isinstance(build, int) or isinstance(build, bool) or build <= previous:
|
|
refus.append(f"build {build!r} : doit dépasser {previous}, jamais réutilisé")
|
|
return refus
|
|
|
|
|
|
def check_client_version(code):
|
|
"""Version envoyée au serveur (Bitwarden-Client-Version) et au SDK : la version
|
|
Bitwarden de la base, en dur dans getApplicationVersionNumber. Vaultwarden décide de
|
|
fonctionnalités selon elle. Refus si une définition de la méthode ne la rend pas."""
|
|
refus, found = [], 0
|
|
for match in re.finditer(r"getApplicationVersionNumber\(\)(?:: Promise<string>)?\s*\{", code):
|
|
found += 1
|
|
body = code[match.end():match.end() + 200]
|
|
literal = re.search(r'return\s*"([^"]*)"', body)
|
|
if "split(" in body or not literal or literal.group(1) != BITWARDEN_VERSION:
|
|
refus.append("getApplicationVersionNumber ne rend pas " + BITWARDEN_VERSION + " : "
|
|
+ " ".join(body.split())[:90])
|
|
if not found:
|
|
refus.append("getApplicationVersionNumber introuvable")
|
|
return refus
|
|
|
|
|
|
def next_build():
|
|
"""Monte le compteur de build d'upstream.json et l'écrit. Le numéro part du plus
|
|
grand entre ce fichier et origin/main, pour qu'une branche ne reprenne pas un numéro
|
|
déjà livré depuis une autre. Un build qui échoue garde son numéro consommé."""
|
|
current = CONFIG["app_version"]["build"]
|
|
main = subprocess.run(["git", "show", "origin/main:desktop/upstream.json"], cwd=REPO,
|
|
capture_output=True, text=True)
|
|
on_main = json.loads(main.stdout)["app_version"].get("build", 0) if main.returncode == 0 else 0
|
|
previous = max(current, on_main)
|
|
number = previous + 1
|
|
refus = check_version(VERSION, number, previous)
|
|
if refus:
|
|
raise RuntimeError("Numérotation : " + " ; ".join(refus))
|
|
path = ROOT / "upstream.json"
|
|
text, count = re.subn(r'("build": )\d+', lambda m: m.group(1) + str(number), path.read_text())
|
|
if count != 1:
|
|
raise RuntimeError("upstream.json : un seul champ build attendu")
|
|
path.write_text(text)
|
|
CONFIG["app_version"]["build"] = number
|
|
print(f"Loksi {VERSION}, build {previous} vers {number} (upstream.json, à commiter)")
|
|
return number
|
|
|
|
|
|
def dist_dir(platform, arch="arm64"):
|
|
"""dist/mac pour arm64 (comme avant), dist/mac-x64 et dist/mac-universal sinon."""
|
|
return DIST / (platform if platform == "win" or arch == "arm64" else platform + "-" + arch)
|
|
|
|
|
|
def build(platform, arch="arm64"):
|
|
if platform not in ("mac", "win") or arch not in MAC_ARCHS:
|
|
raise ValueError("Plateforme : mac [arm64|x64|universal] ou win")
|
|
changes()
|
|
number = next_build()
|
|
native(platform, arch)
|
|
webpack()
|
|
env = dict(tool_env(), CSC_IDENTITY_AUTO_DISCOVERY="false", LOKSI_MAC_ARCH=arch,
|
|
LOKSI_BUILD=str(number), LOKSI_VERSION=VERSION)
|
|
if platform == "win":
|
|
if not WINDOWS_HOST:
|
|
env["ELECTRON_BUILDER_NSIS_DIR"] = str(nsis_dir())
|
|
else:
|
|
mac_signing(env)
|
|
target = ["--mac", "--" + arch] if platform == "mac" else ["--win", "--x64"]
|
|
out = APP / "dist"
|
|
if out.exists():
|
|
shutil.rmtree(out)
|
|
run(["node", SOURCE / "node_modules/electron-builder/cli.js", "--config", "electron-builder.loksi.cjs",
|
|
*target, "-p", "never"], cwd=APP, env=env)
|
|
target_dir = dist_dir(platform, arch)
|
|
if target_dir.exists():
|
|
shutil.rmtree(target_dir)
|
|
target_dir.mkdir(parents=True)
|
|
for item in out.iterdir():
|
|
if item.is_dir() and item.name.endswith("-unpacked") or item.name.startswith("mac"):
|
|
shutil.copytree(item, target_dir / item.name, symlinks=True)
|
|
elif item.suffix in (".zip", ".exe", ".appx"):
|
|
shutil.copy2(item, target_dir / item.name)
|
|
verify(platform, arch)
|
|
run([sys.executable, ROOT / "dependencies.py", platform] + ([arch] if platform == "mac" else []))
|
|
|
|
|
|
def asar_files(asar):
|
|
work = Path(tempfile.mkdtemp(prefix="loksi-asar-"))
|
|
run(["node", SOURCE / "node_modules/@electron/asar/bin/asar.js", "extract", asar, work])
|
|
return work
|
|
|
|
|
|
def check_source(messages, where):
|
|
"""Ligne « Code source » d'À propos : l'adresse de la source GPL publique."""
|
|
message = messages.get("loksiSourceCode", {}).get("message", "")
|
|
if not message.endswith(SOURCE_GPL):
|
|
raise AssertionError(where + " : Code source absent d'À propos")
|
|
|
|
|
|
def check_texts(messages, where):
|
|
restes = [k for k, v in messages.items()
|
|
if "bitwarden" in v.get("message", "").lower() and k not in BITWARDEN_GARDE]
|
|
if restes:
|
|
raise AssertionError(where + " : Bitwarden dans " + ", ".join(restes[:8]))
|
|
|
|
|
|
def check_renderer(bundle):
|
|
signatures = json.loads((CACHE / "illustrations-amont.json").read_text())
|
|
for export, signature in signatures.items():
|
|
if signature in bundle:
|
|
raise AssertionError("Illustration Bitwarden : " + export)
|
|
# Le bureau n'importe qu'une partie des illustrations, le reste est élagué : aucune
|
|
# signature amont ne doit rester, et ces trois dessins-là doivent être présents.
|
|
for name in ("logo", "nav", "verrou", "icone", "fond", "fond-coffre"):
|
|
if 'data-loksi="' + name + '"' not in bundle:
|
|
raise AssertionError("Dessin Loksi absent : " + name)
|
|
return sorted({name for _, name in extension.ILLUSTRATION_TABLE.values()
|
|
if 'data-loksi="' + name + '"' in bundle})
|
|
|
|
|
|
def macho_archs(path):
|
|
"""Architectures d'un fichier Mach-O selon lipo, None si ce n'en est pas un."""
|
|
with open(path, "rb") as handle:
|
|
magic = handle.read(4)
|
|
if magic not in (b"\xcf\xfa\xed\xfe", b"\xce\xfa\xed\xfe", b"\xca\xfe\xba\xbe", b"\xca\xfe\xba\xbf"):
|
|
return None
|
|
out = subprocess.run(["lipo", "-archs", str(path)], capture_output=True, text=True)
|
|
if out.returncode != 0:
|
|
return None # 0xcafebabe d'une classe Java, par exemple
|
|
return set(out.stdout.split())
|
|
|
|
|
|
def check_archs(app, arch):
|
|
"""Chaque binaire Mach-O du paquet porte toutes les architectures demandées.
|
|
|
|
Exception, celle de l'amont (singleArchFiles, x64ArchFiles) : les modules napi sont un
|
|
fichier par architecture, desktop_napi.darwin-<arch>.node. Chacun doit porter
|
|
l'architecture de son nom, et il en faut un pour chaque architecture demandée.
|
|
Retourne le nombre de binaires vus et la liste des refus.
|
|
"""
|
|
wanted = MAC_ARCHS[arch]["lipo"]
|
|
refus, seen, napi = [], 0, set()
|
|
for path in sorted(Path(app).rglob("*")):
|
|
if path.is_symlink() or not path.is_file():
|
|
continue
|
|
archs = macho_archs(path)
|
|
if archs is None:
|
|
continue
|
|
seen += 1
|
|
name = str(path.relative_to(app))
|
|
match = re.fullmatch(r"desktop_napi\.darwin-(arm64|x64)\.node", path.name)
|
|
if match:
|
|
if archs != {NAPI_LIPO[match.group(1)]}:
|
|
refus.append(name + " : " + " ".join(sorted(archs)) + " au lieu de " + NAPI_LIPO[match.group(1)])
|
|
napi |= archs
|
|
elif not wanted <= archs:
|
|
refus.append(name + " : " + " ".join(sorted(archs)) + ", manque " + " ".join(sorted(wanted - archs)))
|
|
for missing in sorted(wanted - napi):
|
|
refus.append("module napi absent pour " + missing)
|
|
return seen, refus
|
|
|
|
|
|
def check_fuses(framework):
|
|
"""Fusibles Electron posés dans chaque tranche de Electron Framework. Liste des refus."""
|
|
refus, start, found = [], 0, 0
|
|
while (index := framework.find(FUSE_SENTINEL, start)) >= 0:
|
|
found += 1
|
|
wire = framework[index + len(FUSE_SENTINEL) + 2:index + len(FUSE_SENTINEL) + 2 + framework[index + len(FUSE_SENTINEL) + 1]]
|
|
for position, expected in FUSES.items():
|
|
if wire[position:position + 1].decode() != expected:
|
|
refus.append(f"tranche {found} : fusible {position} à {wire[position:position + 1].decode()!r}, "
|
|
f"attendu {expected!r} (fil {wire.decode()})")
|
|
start = index + 1
|
|
if not found:
|
|
refus.append("fil de fusibles introuvable")
|
|
return found, refus
|
|
|
|
|
|
def file_version(exe):
|
|
"""Valeur de la chaîne FileVersion de la ressource de version, ou None.
|
|
|
|
Chercher « AAAA.M.n.build » n'importe où dans l'exe ne suffit pas : sous Windows
|
|
natif, ProductVersion la portait et FileVersion valait « 3 », le contrôle passait
|
|
(vu le 09/10/2026). Structure String de VS_VERSIONINFO : wLength, wValueLength
|
|
(en caractères, zéro final compris), wType, la clé en UTF-16 terminée par zéro,
|
|
alignement sur 4 octets depuis le début de la structure, puis la valeur.
|
|
"""
|
|
key = "FileVersion\0".encode("utf-16-le")
|
|
at = exe.find(key)
|
|
while at >= 6:
|
|
start = at - 6
|
|
length, chars, kind = struct.unpack_from("<HHH", exe, start)
|
|
if kind == 1 and 0 < chars < 64 and length >= 6 + len(key):
|
|
offset = start + ((6 + len(key) + 3) & ~3)
|
|
return exe[offset:offset + 2 * chars].decode("utf-16-le", "replace").rstrip("\0")
|
|
at = exe.find(key, at + 2)
|
|
return None
|
|
|
|
|
|
def verify(platform, arch="arm64"):
|
|
target = dist_dir(platform, arch)
|
|
if platform == "mac":
|
|
app = next(target.glob("mac*/Loksi.app"))
|
|
seen, refus = check_archs(app, arch)
|
|
assert not refus, "architectures : " + " ; ".join(refus[:8])
|
|
print(f"Architectures : {seen} binaires Mach-O, tous {'+'.join(sorted(MAC_ARCHS[arch]['lipo']))}")
|
|
slices, refus = check_fuses((app / "Contents/Frameworks/Electron Framework.framework/Versions/A/"
|
|
"Electron Framework").read_bytes())
|
|
assert not refus, "fusibles Electron : " + " ; ".join(refus)
|
|
print(f"Fusibles Electron posés dans {slices} tranche(s)")
|
|
info = plistlib.loads((app / "Contents/Info.plist").read_bytes())
|
|
assert info["CFBundleIdentifier"] == APP_ID, info["CFBundleIdentifier"]
|
|
assert info["CFBundleName"] == "Loksi" and info["CFBundleExecutable"] == "Loksi"
|
|
# Le build se lit dans le paquet : un autre build a pu monter le compteur depuis.
|
|
assert info["CFBundleShortVersionString"] == VERSION, "version : " + info["CFBundleShortVersionString"]
|
|
assert info["CFBundleVersion"].isdigit(), "CFBundleVersion : " + info["CFBundleVersion"]
|
|
build_number = int(info["CFBundleVersion"])
|
|
assert info["NSHumanReadableCopyright"] == MENTION["fr"].replace("\n", " "), "mention du panneau À propos"
|
|
signature = subprocess.run(["codesign", "-d", "--entitlements", "-", "--xml", str(app)],
|
|
capture_output=True).stdout.decode(errors="replace")
|
|
assert TEAM_BITWARDEN not in signature and "application-identifier" not in signature, "entitlements"
|
|
subprocess.run(["codesign", "--verify", "--deep", "--strict", str(app)], check=True)
|
|
for lipo in sorted(MAC_ARCHS[arch]["lipo"]):
|
|
# Signature de chaque tranche, celle que vérifiera un Mac de cette architecture.
|
|
subprocess.run(["codesign", "--verify", "--deep", "--strict", "--arch", lipo, str(app)], check=True)
|
|
details = subprocess.run(["codesign", "-dv", "--verbose=2", str(app)],
|
|
capture_output=True, text=True).stderr
|
|
team = re.search(r"^TeamIdentifier=(.*)$", details, re.M).group(1)
|
|
if team == "not set":
|
|
print("Signature ad hoc : paquet de test, refusé par Gatekeeper hors de ce Mac.")
|
|
else:
|
|
assert team == CONFIG["apple_team"]["id"], "équipe de signature inattendue : " + team
|
|
assert "Developer ID Application" in details, "pas un certificat Developer ID"
|
|
assert "runtime" in details, "hardened runtime absent"
|
|
proxy_team = subprocess.run(["codesign", "-dv", str(app / "Contents/MacOS/desktop_proxy")],
|
|
capture_output=True, text=True).stderr
|
|
assert "TeamIdentifier=" + team in proxy_team, "desktop_proxy pas signé par l'équipe"
|
|
gatekeeper = subprocess.run(["spctl", "-a", "-t", "exec", "-vv", str(app)],
|
|
capture_output=True, text=True)
|
|
if "source=Notarized Developer ID" in gatekeeper.stderr:
|
|
subprocess.run(["xcrun", "stapler", "validate", str(app)], check=True)
|
|
print("Signature Developer ID " + team + ", notarisée et agrafée, acceptée par Gatekeeper.")
|
|
else:
|
|
assert os.environ.get("LOKSI_SANS_NOTARISATION") == "1", \
|
|
"Gatekeeper refuse le paquet : " + gatekeeper.stderr.strip()[:200]
|
|
print("Signature Developer ID " + team + " sans notarisation : Gatekeeper refusera.")
|
|
# codesign --verify accepte une appli que dyld refuse ensuite de lancer (vu le
|
|
# 30/09/2026 avec le hardened runtime) : on la lance vraiment, 10 secondes, dans
|
|
# l'architecture de ce Mac. La tranche x86_64 n'est lancée nulle part ici : pas de
|
|
# Rosetta sur ce Mac, décision de Romain du 04/10/2026.
|
|
host = platform_machine()
|
|
if host not in MAC_ARCHS[arch]["lipo"]:
|
|
print(f"Lancement : non fait, paquet {arch} et ce Mac est {host} sans Rosetta.")
|
|
else:
|
|
# Dossier de données à part (LOKSI_APPDATA_DIR, lu par main.ts) : le
|
|
# Loksi installé et ouvert sur ce Mac fait sinon quitter cette seconde instance
|
|
# (verrou d'instance unique, vu le 03/10 puis le 06/10), et le test lisait ses
|
|
# vraies données.
|
|
appdata = tempfile.mkdtemp(prefix="loksi-verify-")
|
|
process = subprocess.Popen(["arch", "-" + host, str(app / "Contents/MacOS/Loksi")],
|
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
|
env=dict(os.environ, LOKSI_APPDATA_DIR=appdata))
|
|
try:
|
|
process.wait(10)
|
|
raise AssertionError("Loksi s'arrête au lancement : "
|
|
+ process.stdout.read().decode(errors="replace")[:400])
|
|
except subprocess.TimeoutExpired:
|
|
process.terminate()
|
|
try:
|
|
process.wait(10)
|
|
except subprocess.TimeoutExpired:
|
|
# Paquet universel du 04/10 : toujours là 10 s après SIGTERM.
|
|
process.kill()
|
|
process.wait(10)
|
|
print(f"Lancement : Loksi tient 10 s en {host}, données dans {appdata}.")
|
|
finally:
|
|
shutil.rmtree(appdata, ignore_errors=True)
|
|
resources = app / "Contents/Resources"
|
|
proxy = (app / "Contents/MacOS/desktop_proxy").read_bytes()
|
|
napi = b"".join(p.read_bytes() for p in (resources / "app.asar.unpacked").rglob("desktop_napi.darwin-*.node"))
|
|
assert napi, "module napi absent"
|
|
icon = (resources / "icon.icns").read_bytes()
|
|
else:
|
|
unpacked = target / "win-unpacked"
|
|
resources = unpacked / "resources"
|
|
exe = (unpacked / "Loksi.exe").read_bytes()
|
|
assert MENTION["fr"].replace("\n", " ").encode("utf-16-le") in exe, "LegalCopyright de Loksi.exe"
|
|
for text in ("Loksi", "Aleop"):
|
|
assert ("CompanyName\0" if text == "Aleop" else "ProductName\0").encode("utf-16-le") in exe
|
|
assert text.encode("utf-16-le") in exe, "métadonnées de Loksi.exe : " + text
|
|
assert "GitHub, Inc.".encode("utf-16-le") not in exe, "métadonnées Electron dans Loksi.exe"
|
|
build_number = None # lu dans l'asar plus bas, puis cherché dans Loksi.exe
|
|
assert list(target.glob("Loksi-Setup-*-x64.exe")), "installateur NSIS absent"
|
|
assert f'RMDir /r "$LOCALAPPDATA\\{UPDATER_DIR}"' in (APP / "installer.nsh").read_text(), \
|
|
"désinstallation : cache " + UPDATER_DIR + " non retiré"
|
|
proxy = (unpacked / "desktop_proxy.exe").read_bytes()
|
|
napi = next((resources / "app.asar.unpacked").rglob("desktop_napi.win32-x64*.node")).read_bytes()
|
|
assert b"LoksiBiometricsV2" in napi.replace(b"\0", b""), "clé Windows Hello"
|
|
config = json.loads((resources / "plugin_authenticator_config.json").read_text())
|
|
assert config == {"clsid": CONFIG["windows_plugin_authenticator_clsid"], "name": "Loksi"}
|
|
# Inventaire du 09/10/2026 : exécutables installés sous leur nom Loksi, plus
|
|
# aucun bitwarden_*.exe ; AAGUID, dossier de données et tuyau de l'importeur.
|
|
restes = sorted(p.name for p in unpacked.rglob("*") if p.is_file() and p.name.lower().startswith("bitwarden"))
|
|
assert not restes, "fichiers Bitwarden dans le paquet : " + ", ".join(restes[:6])
|
|
for nom in WIN_EXE_NOMS.values():
|
|
assert (unpacked / nom).is_file(), nom + " absent"
|
|
plugin = (unpacked / WIN_EXE_NOMS["bitwarden_plugin_authenticator.exe"]).read_bytes()
|
|
# L'AAGUID est dans le napi, qui inscrit la passkey (relevé sur le build du 03/10).
|
|
assert AAGUID.encode() in napi and AAGUID_BITWARDEN.encode() not in napi, "AAGUID de la passkey"
|
|
assert b"LOKSI_APPDATA_DIR" in plugin and b"BITWARDEN_APPDATA_DIR" not in plugin, "dossier de la passkey"
|
|
helper = (unpacked / WIN_EXE_NOMS["bitwarden_chromium_import_helper.exe"]).read_bytes()
|
|
for binary, name in ((helper, "aide à l'import"), (napi, "napi")):
|
|
assert b"bitwarden-to-bitwarden" not in binary, name + " : tuyau de l'importeur Chromium"
|
|
assert b"loksi-chromium-importer-helper" in binary, name + " : tuyau Loksi absent"
|
|
icon = None
|
|
for binary, name in ((proxy, "proxy"), (napi, "napi")):
|
|
assert b"com.bitwarden.desktop" not in binary, name + " : chemin IPC Bitwarden"
|
|
assert b"BITWARDEN_SSH_AUTH_SOCK" not in napi, "napi : variable de l'agent SSH"
|
|
assert b"com.bitwarden.chromiumImporter" not in napi, "napi : préférences de l'importeur"
|
|
if platform == "mac":
|
|
assert APP_ID.encode() in proxy, "proxy : chemin IPC Loksi absent"
|
|
with tarfile.open(ARCHIVE) as tar:
|
|
upstream = tar.extractfile(tar.getmember(SOURCE.name + "/apps/desktop/resources/icon.icns")).read()
|
|
assert icon != upstream, "icône Bitwarden"
|
|
for name in ("OFL-police-Loksi.txt", "LOKSI-NOTICE.txt"):
|
|
assert (resources / name).is_file(), name + " absent du paquet"
|
|
work = asar_files(resources / "app.asar")
|
|
try:
|
|
package = json.loads((work / "package.json").read_text())
|
|
assert package["productName"] == "Loksi" and package["name"] == CONFIG["executable_name"]
|
|
if build_number is None:
|
|
build_number = package.get("loksiBuild")
|
|
assert file_version(exe) == VERSION + "." + str(build_number), "FileVersion de Loksi.exe"
|
|
refus = check_version(package["version"], package.get("loksiBuild"), 0)
|
|
assert not refus, "numérotation : " + " ; ".join(refus)
|
|
assert package["version"] == VERSION and package["loksiBuild"] == build_number, "version de l'asar"
|
|
assert build_number <= CONFIG["app_version"]["build"], "build au-delà du compteur d'upstream.json"
|
|
print(f"Numérotation : version {VERSION}, build {build_number}")
|
|
main = (work / "main.js").read_text()
|
|
assert HOST in main and "com.8bit.bitwarden" not in main, "hôte de messagerie native"
|
|
for ident in CONFIG["native_messaging"]["chrome_extension_ids"]:
|
|
assert "chrome-extension://" + ident + "/" in main, "extension Chromium admise : " + ident
|
|
for ident in CONFIG["native_messaging"]["firefox_extension_ids"]:
|
|
assert json.dumps(ident) in main, "extension Firefox admise : " + ident
|
|
assert "Loksi_biometric" in main and "Bitwarden_biometric" not in main, "trousseau"
|
|
assert "artifacts.bitwarden.com" not in main, "canal de mise à jour"
|
|
assert "bitwarden.com/help" not in main and AIDE in main, "menu Aide"
|
|
# Décision du 03/10/2026 : support@ n'accepte que les clients connus.
|
|
assert "mailto:loksi@aleop.eu" in main and "support@aleop.eu" not in main, "Nous contacter"
|
|
assert "loksiBuild" in main and "loksiBasedOn" in main, "À propos : build et base Bitwarden"
|
|
assert 'this.localize("loksiSourceCode")' in main, "À propos : ligne Code source"
|
|
assert "LOKSI_APPDATA_DIR" in main and "BITWARDEN_APPDATA_DIR" not in main, "variable du dossier de données"
|
|
assert '"persist:loksi"' in main and "persist:bitwarden" not in main, "partition de session"
|
|
assert "autoHideMenuBar: true" in main, "barre de menus masquée"
|
|
assert not re.search(r"setMenuBarVisibility\)[^;]{0,80}call\(window, true\)", main), \
|
|
"barre de menus réaffichée en sortie de fenêtre réduite"
|
|
# Schéma bitwarden:// gardé, obligatoire : Vaultwarden 1.37.3 impose
|
|
# bitwarden://sso-callback aux clients desktop et mobile (src/sso.rs:198), et le
|
|
# coffre web renvoie le Duo du bureau sur bitwarden://duo-callback
|
|
# (apps/web/src/connectors/duo-redirect.ts:4). Inventaire du 09/10/2026.
|
|
assert 'setAsDefaultProtocolClient("bitwarden"' in main, "schéma de retour SSO et Duo"
|
|
renderer = "".join(p.read_text() for p in (work / "app").glob("*.js"))
|
|
refus = check_client_version(renderer)
|
|
assert not refus, "version envoyée au serveur : " + " ; ".join(refus)
|
|
assert UNSET in renderer and UNSET in main, "marqueur adresse à saisir"
|
|
assert "loksi.aleop.eu" not in renderer + main, "adresse du coffre d'Aleop"
|
|
assert "Bitwarden-diagnostic-report" not in renderer + main, "rapport de diagnostic"
|
|
for lien in ("bitwarden.com/terms", "bitwarden.com/privacy", "bitwarden.com/email-preferences",
|
|
"bitwarden.com/help"):
|
|
assert lien not in renderer, "lien " + lien
|
|
print("Illustrations Loksi dans le bundle :", ", ".join(check_renderer(renderer)))
|
|
css = "".join(p.read_text() for p in (work / "app").glob("*.css")).replace(" ", "")
|
|
assert "--color-brand-700:#003087" in css and "--color-brand-700:#175ddc" not in css, "palette"
|
|
assert "font-family:Loksi" in css or "Loksi,Inter" in css, "police"
|
|
assert list((work / "app").rglob("loksi-400*.woff2")) or list(work.rglob("loksi-400*.woff2")), "police"
|
|
for chemin in sorted((work / "locales").glob("*/messages.json")):
|
|
check_texts(json.loads(chemin.read_text()), chemin.parent.name)
|
|
for lang in ("en", "fr"):
|
|
messages = json.loads((work / "locales" / lang / "messages.json").read_text())
|
|
assert messages["loksiAboutOrigin"]["message"] == MENTION[lang], "mention d'origine " + lang
|
|
assert messages["loksiBasedOn"]["message"].endswith("Bitwarden " + BITWARDEN_VERSION), "base " + lang
|
|
check_source(messages, lang)
|
|
assert "<title>Loksi</title>" in (work / "index.html").read_text()
|
|
finally:
|
|
shutil.rmtree(work)
|
|
print(f"Vérifications réussies : {target}")
|
|
|
|
|
|
def canari_archs():
|
|
"""Mini paquet : un exécutable arm64 seul et un napi mal nommé doivent être refusés
|
|
pour x64 et universal, un exécutable universel accepté."""
|
|
work = Path(tempfile.mkdtemp(prefix="loksi-canari-archs-"))
|
|
try:
|
|
source = work / "main.c"
|
|
source.write_text("int main(void) { return 0; }\n")
|
|
macos = work / "Canari.app/Contents/MacOS"
|
|
napi = work / "Canari.app/Contents/Resources/app.asar.unpacked"
|
|
macos.mkdir(parents=True)
|
|
napi.mkdir(parents=True)
|
|
run(["cc", "-arch", "arm64", "-o", macos / "arm64-seul", source])
|
|
run(["cc", "-arch", "arm64", "-arch", "x86_64", "-o", macos / "universel", source])
|
|
run(["cc", "-arch", "arm64", "-o", napi / "desktop_napi.darwin-x64.node", source])
|
|
seen, refus = check_archs(work / "Canari.app", "x64")
|
|
ok = (seen == 3 and any("arm64-seul" in r for r in refus) and not any("universel" in r for r in refus)
|
|
and any("desktop_napi.darwin-x64.node : arm64 au lieu de x86_64" in r for r in refus))
|
|
print("canari architectures", "OK, refus attendus :" if ok else "RATÉ :", " ; ".join(refus))
|
|
(macos / "arm64-seul").unlink()
|
|
(napi / "desktop_napi.darwin-x64.node").unlink()
|
|
run(["cc", "-arch", "x86_64", "-o", napi / "desktop_napi.darwin-x64.node", source])
|
|
seen, refus = check_archs(work / "Canari.app", "x64")
|
|
print("témoin architectures", "OK, accepté" if not refus else "RATÉ : " + " ; ".join(refus))
|
|
return ok and not refus
|
|
finally:
|
|
shutil.rmtree(work)
|
|
|
|
|
|
def canari():
|
|
"""Les contrôles doivent refuser l'amont, sinon un contrôle muet passerait pour vert."""
|
|
ratés = []
|
|
# Fil de fusibles d'un Electron non modifié (relevé dans le paquet arm64 du 03/10),
|
|
# puis celui que pose after-pack.js amont.
|
|
found, refus = check_fuses(b"x" + FUSE_SENTINEL + b"\x01\x09101100011" + b"y")
|
|
print("canari fusibles", "OK, refus attendu :" if refus else "RATÉ", " ; ".join(refus[:2]))
|
|
if not refus:
|
|
ratés.append("fusibles")
|
|
if check_fuses(FUSE_SENTINEL + b"\x01\x09010011011")[1] or check_fuses(b"rien")[0]:
|
|
ratés.append("fusibles (témoin)")
|
|
if not canari_archs():
|
|
ratés.append("architectures")
|
|
# Numérotation : un zéro devant et un build qui ne monte pas doivent être refusés.
|
|
for version, build, previous in (("2026.09.01", 8, 7), ("2026.10.0", 7, 7), ("2026.10.00", 8, 7)):
|
|
refus = check_version(version, build, previous)
|
|
print(f"canari numérotation {version} build {build} après {previous}",
|
|
"OK, refus attendu : " + " ; ".join(refus) if refus else "RATÉ, accepté")
|
|
if not refus:
|
|
ratés.append("numérotation " + version)
|
|
if check_version("2026.10.0", 8, 7) or check_version("2026.11.12", 9, 8):
|
|
ratés.append("numérotation (témoin)")
|
|
# En-tête Bitwarden-Client-Version : le code amont (version dérivée de celle de l'appli)
|
|
# et un bundle qui rendrait la version Loksi doivent être refusés.
|
|
with tarfile.open(ARCHIVE) as tar:
|
|
amont = tar.extractfile(SOURCE.name + "/apps/desktop/src/platform/services/"
|
|
"electron-platform-utils.service.ts").read().decode()
|
|
for name, code in (("amont", amont),
|
|
("version Loksi", 'getApplicationVersionNumber(){return"' + VERSION + '"}')):
|
|
refus = check_client_version(code)
|
|
print(f"canari en-tête {name}", "OK, refus attendu : " + refus[0][:110] if refus else "RATÉ, accepté")
|
|
if not refus:
|
|
ratés.append("en-tête " + name)
|
|
if check_client_version('getApplicationVersionNumber(){return r(this,void 0,void 0,function*(){return"'
|
|
+ BITWARDEN_VERSION + '"})}'):
|
|
ratés.append("en-tête (témoin)")
|
|
with tarfile.open(ARCHIVE) as tar:
|
|
en = json.loads(tar.extractfile(SOURCE.name + "/apps/desktop/src/locales/en/messages.json").read())
|
|
logo = tar.extractfile(SOURCE.name + "/libs/assets/src/svg/svgs/lock.icon.ts").read().decode()
|
|
for name, check, value in (("textes", check_texts, en), ("dessins", check_renderer, logo),
|
|
("code source", check_source, en)):
|
|
try:
|
|
check(value, "amont") if name != "dessins" else check(value)
|
|
ratés.append(name)
|
|
except AssertionError as error:
|
|
print(f"canari {name} OK, refus attendu : {error}")
|
|
if ratés:
|
|
sys.exit("canari raté, contrôle muet : " + ", ".join(ratés))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
command = sys.argv[1] if len(sys.argv) > 1 else "help"
|
|
if command in ("prepare", "changes", "canari", "webpack"):
|
|
globals()[command]()
|
|
elif command == "native":
|
|
native(sys.argv[2] if len(sys.argv) > 2 else "mac")
|
|
elif command in ("build", "verify") and sys.argv[2:3] == ["mac"] and len(sys.argv) in (3, 4):
|
|
globals()[command]("mac", sys.argv[3] if len(sys.argv) == 4 else "arm64")
|
|
elif command in ("build", "verify") and len(sys.argv) == 3:
|
|
globals()[command](sys.argv[2])
|
|
else:
|
|
sys.exit(__doc__)
|