#!/usr/bin/env python3 """Vérifie que seules les zones d'adaptation prévues diffèrent de l'archive.""" import json import re import tarfile from prototype import ROOT, SOURCE # Présentation : gabarits, styles, dessins, polices, textes. Ne portent pas de logique. presentation = re.compile( r"apps/browser/src/.+\.(?:html|ejs|scss)|libs/[^/]+/src/.+\.html|" r"libs/components/src/(?:tw-)?theme\.css|libs/components/src/webfonts/loksi-[^/]+\.woff2|" r"libs/assets/src/svg/svgs/[^/]+\.ts|apps/browser/src/images/icon[^/]+\.png|" r"apps/browser/src/_locales/[^/]+/messages\.json" ) # Code : chaque fichier est nommé. Ce sont des libellés, des adresses de liens ou le choix # du serveur, relus le 30/09/2026. Tout autre fichier, cryptographie comprise, est refusé. allowed_code = { "apps/browser/src/manifest.json", "apps/browser/src/manifest.v3.json", "apps/browser/src/platform/services/browser-initial-install.service.ts", "apps/browser/src/platform/badge/badge-browser-api.ts", "apps/browser/tailwind.config.js", "apps/browser/src/background/nativeMessaging.background.ts", "apps/browser/src/platform/ipc/transports/desktop-ipc.transport.ts", "apps/browser/src/autofill/content/autofill.css", "apps/browser/src/autofill/services/insert-autofill-content.service.ts", "libs/tools/export-vault-core/src/services/export-helper.ts", "libs/logging/src/flight-recorder-export.ts", "libs/common/src/tools/password-strength/password-strength.service.ts", "apps/browser/src/platform/services/platform-utils/browser-platform-utils.service.ts", "apps/browser/src/autofill/browser/main-context-menu-handler.ts", "apps/browser/src/autofill/utils/svg-icons.ts", "apps/browser/src/auth/popup/settings/account-security.component.ts", "apps/browser/src/autofill/popup/settings/fill-assist-popover/fill-assist-popover.component.ts", "apps/browser/src/tools/popup/settings/about-page/about-page-v2.component.ts", "libs/auth/src/angular/input-password/input-password.component.ts", "libs/auth/src/angular/login/login-secondary-content.component.ts", "libs/auto-confirm/src/angular/components/auto-confirm-extension-dialog.component.ts", "libs/common/src/autofill/constants/index.ts", "libs/common/src/models/domain/domain-service.ts", "libs/common/src/platform/services/default-available-regions.service.ts", "libs/common/src/platform/services/default-environment.service.ts", "libs/angular/src/auth/environment-selector/environment-selector.component.ts", "libs/angular/src/auth/self-hosted-env-config-dialog/self-hosted-env-config-dialog.component.ts", "libs/importer/src/models/import-options.ts", "libs/key-management-ui/src/key-rotation/key-rotation-dialog.component.ts", "libs/vault/src/cipher-form/components/autofill-options/advanced-uri-option-dialog.component.ts", "libs/vault/src/cipher-form/components/new-item-nudge/new-item-nudge.component.ts", "libs/vault/src/components/permit-cipher-details-popover/permit-cipher-details-popover.component.ts", "libs/vault/src/components/show-quick-copy-actions-details-popover/show-quick-copy-actions-details-popover.component.ts", "libs/vault/src/components/vault-items-transfer/leave-confirmation-dialog.component.ts", "libs/vault/src/components/vault-items-transfer/transfer-items-dialog.component.ts", } class Allowed: @staticmethod def fullmatch(path): return path in allowed_code or presentation.fullmatch(path) allowed = Allowed() changed = [] with tarfile.open(ROOT / '.cache/upstream.tar.gz') as archive: for member in archive: if not member.isfile(): continue relative = member.name.split('/', 1)[1] if archive.extractfile(member).read() != (SOURCE / relative).read_bytes(): if not allowed.fullmatch(relative): raise RuntimeError('Modification hors périmètre : ' + relative) changed.append(relative) (ROOT / 'reports').mkdir(exist_ok=True) (ROOT / 'reports/upstream-changes.json').write_text(json.dumps(changed, indent=2) + '\n') print(f'{len(changed)} fichiers adaptés ; aucune modification hors identité/environnement.')