Loksi 2026.10.0 : source correspondante des quatre applis
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
Cette révision appartient à :
1 Parent
c3608b3938
révision
1c39f76f96
34 fichiers modifiés
+5093
-15
Aucun fichier ne correspond à votre recherche
@@ -92,6 +92,48 @@ def sha256(path):
|
||||
return digest.hexdigest()
|
||||
|
||||
|
||||
DASHES = re.compile("[\u2013\u2014]")
|
||||
GENERATOR_SCREEN = "app/src/main/kotlin/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt"
|
||||
# Textes de l'amont avec un tiret cadratin, relevés le 09/10/2026 sur la fiche Play
|
||||
# (« A\u2014Z » du générateur) puis dans les chaînes : règle d'écriture d'Aleop, aucun
|
||||
# tiret cadratin ni demi-cadratin nulle part dans l'app.
|
||||
DASH_FIXES = {
|
||||
"values-fr-rFR/strings.xml": [
|
||||
("bout à bout</annotation> \u2014 à vous de choisir\u00a0!",
|
||||
"bout à bout</annotation>, à vous de choisir\u00a0!"),
|
||||
("peuvent être enregistrés \u2014 jamais d\\\'informations",
|
||||
"peuvent être enregistrés, mais jamais d\\\'informations"),
|
||||
("ou continuez \u2014 la mise à jour", "ou continuez : la mise à jour"),
|
||||
],
|
||||
"values/strings.xml": [
|
||||
("one long word</annotation>\u2014your choice!", "one long word</annotation>. Your choice!"),
|
||||
("may be logged\u2014never sensitive", "may be logged, but never sensitive"),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def french_fixes():
|
||||
"""Traductions françaises de l'amont restées en anglais, et tirets cadratins. « Okay »
|
||||
vu le 09/10/2026 sur le bouton du dialogue de saisie automatique, en ajoutant un
|
||||
identifiant. Seul le français change : les autres langues gardent leur traduction."""
|
||||
replace_once(SRC / STRINGS / "values-fr-rFR/strings.xml",
|
||||
'<string name="okay">Okay</string>', '<string name="okay">OK</string>')
|
||||
for name, pairs in DASH_FIXES.items():
|
||||
for old, new in pairs:
|
||||
replace_once(SRC / STRINGS / name, old, new)
|
||||
for case in ("A", "a"):
|
||||
replace_once(SRC / GENERATOR_SCREEN, f'label = "{case}\u2014{case.translate(str.maketrans("Aa", "Zz"))}",',
|
||||
f'label = "{case}-{case.translate(str.maketrans("Aa", "Zz"))}",')
|
||||
# Contrôle, avec son canari : un texte qui en porte un doit être vu.
|
||||
if not DASHES.search("x \u2014 y") or not DASHES.search("x \u2013 y"):
|
||||
raise RuntimeError("Contrôle des tirets aveugle")
|
||||
for path in (SRC / STRINGS / "values-fr-rFR/strings.xml", SRC / STRINGS / "values/strings.xml",
|
||||
SRC / STRINGS / "values/strings_non_localized.xml", SRC / GENERATOR_SCREEN):
|
||||
found = DASHES.findall(path.read_text())
|
||||
if found:
|
||||
raise RuntimeError(f"Tiret cadratin restant : {path.relative_to(SRC)} ({len(found)})")
|
||||
|
||||
|
||||
def replace_once(path, old, new, count=1):
|
||||
value = path.read_text()
|
||||
if value.count(old) != count:
|
||||
@@ -855,6 +897,14 @@ def contact_texts():
|
||||
"en": f"Your email app opens with a message to {links['support']}. "
|
||||
f"For data protection, write to {links['dpo']}.",
|
||||
},
|
||||
"loksi_source_code": {"fr": "Code source", "en": "Source code"},
|
||||
"loksi_source_code_title": {"fr": "Ouvrir le code source ?", "en": "Open the source code?"},
|
||||
"loksi_source_code_message": {
|
||||
"fr": "Loksi est un logiciel libre sous licence GPL v3. Son code source est publié "
|
||||
"sur sources.gitsi.dev.",
|
||||
"en": "Loksi is free software under the GPL v3 licence. Its source code is published "
|
||||
"on sources.gitsi.dev.",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -877,6 +927,19 @@ def add_contact_row():
|
||||
.fillMaxWidth()
|
||||
.testTag(tag = "LoksiContactUsRow"),
|
||||
)
|
||||
// Loksi: source code row, the GPL v3 corresponding source (added 12/10/2026).
|
||||
BitwardenExternalLinkRow(
|
||||
text = stringResource(id = BitwardenString.loksi_source_code),
|
||||
onConfirmClick = {{ loksiIntentManager.launchUri("{CONFIG['links']['source']}".toUri()) }},
|
||||
dialogTitle = stringResource(id = BitwardenString.loksi_source_code_title),
|
||||
dialogMessage = stringResource(id = BitwardenString.loksi_source_code_message),
|
||||
withDivider = false,
|
||||
cardStyle = CardStyle.Middle(),
|
||||
modifier = Modifier
|
||||
.standardHorizontalMargin()
|
||||
.fillMaxWidth()
|
||||
.testTag(tag = "LoksiSourceCodeRow"),
|
||||
)
|
||||
""")
|
||||
|
||||
|
||||
@@ -1138,6 +1201,7 @@ def prepare():
|
||||
adapt_links()
|
||||
import_tutorial_address()
|
||||
add_contact_row()
|
||||
french_fixes()
|
||||
sys.path.insert(0, str(HERE))
|
||||
import graphics
|
||||
drawn = graphics.write_all(SRC, REPO / "brand")
|
||||
@@ -1188,6 +1252,7 @@ def changes():
|
||||
r"environment/EnvironmentViewModel|welcome/WelcomeScreen)\.kt|"
|
||||
r"app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/about/AboutViewModel\.kt|"
|
||||
r"app/src/main/kotlin/com/x8bit/bitwarden/ui/tools/feature/send/SendScreen\.kt|"
|
||||
r"app/src/main/kotlin/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen\.kt|"
|
||||
r"app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/about/AboutScreen\.kt|"
|
||||
r"app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/flightrecorder/FlightRecorderScreen\.kt|"
|
||||
r"app/src/main/kotlin/com/x8bit/bitwarden/ui/auth/feature/environment/EnvironmentScreen\.kt|"
|
||||
@@ -1268,8 +1333,14 @@ def build():
|
||||
APP_TESTS = ["*Environment*", "*RestrictionManager*", "*Landing*", "*Autofill*", "*Welcome*", "*About*",
|
||||
"*StartRegistration*", "*SendScreen*", "*SendViewModel*", "*AccountSecurity*",
|
||||
"*FlightRecorder*", "*ImportLogins*", "*LoksiClientVersion*", "*HeaderUtils*", "*HeadersInterceptor*",
|
||||
"*ExportVault*", "*AccessibilityNodeInfo*", "*CredentialManagerPendingIntent*", "*AutofillParser*"]
|
||||
"*ExportVault*", "*AccessibilityNodeInfo*", "*CredentialManagerPendingIntent*", "*AutofillParser*", "*GeneratorScreen*"]
|
||||
EXPECTED_APP_FAILURES = {
|
||||
# Ils cherchent les libellés « A\u2014Z » et « a\u2014z » du générateur : Loksi les écrit
|
||||
# « A-Z » et « a-z », sans tiret cadratin (french_fixes). Relevé le 09/10/2026.
|
||||
("GeneratorScreenTest", "in Password state, disabled elements should not send events"),
|
||||
("GeneratorScreenTest", "in Password state, the ViewModel state should update the UI correctly"),
|
||||
("GeneratorScreenTest", "in Password state, toggling the capital letters toggle should send ToggleCapitalLettersChange action"),
|
||||
("GeneratorScreenTest", "in Password state, toggling the use lowercase toggle should send ToggleLowercaseLettersChange action"),
|
||||
# Ils attendent le serveur US quand rien n'est enregistré : Loksi rend le marqueur
|
||||
# « adresse à saisir » (29/09/2026, avant : loksi.aleop.eu). Relevé le 28/09/2026.
|
||||
("BaseUrlsProviderTest", "getBaseApiUrl should return default value when preAuthEnvironmentUrlData is null()"),
|
||||
@@ -1531,6 +1602,8 @@ def verify(apk=None, package=DEBUG_ID, kind="debug", report_name="android-apk.js
|
||||
assert not remnants, f"restes Bitwarden retirables : {remnants}"
|
||||
# « Nous contacter » : courriel au support. Canari : l'APK précédent ne l'a pas.
|
||||
assert dex_literal("mailto:" + CONFIG["links"]["support"]) in dex, "ligne Nous contacter absente"
|
||||
assert dex_literal(CONFIG["links"]["source"]) in dex, "ligne Code source absente"
|
||||
assert dex_literal(CONFIG["links"]["source"] + "-canari") not in dex, "contrôle Code source aveugle"
|
||||
# Plus l'entrée du support client, qui rejette les inconnus. Canari : l'APK du 03/10 au matin la porte.
|
||||
assert dex_literal("mailto:support@aleop.eu") not in dex, "Nous contacter écrit encore à l'entrée du support client"
|
||||
with zipfile.ZipFile(apk) as archive:
|
||||
|
||||
@@ -345,6 +345,8 @@ SUPPORT_ADDRESS = CONFIG["links"]["support"].removeprefix("mailto:")
|
||||
CONTACT_STRINGS = {
|
||||
"LoksiOriginNotice": ORIGIN_NOTICE,
|
||||
"LoksiContactUs": {"en": "Contact us", "fr": "Nous contacter"},
|
||||
# Source GPL publiée (ordre de Romain du 12/10/2026), même ligne qu'Android.
|
||||
"LoksiSourceCode": {"en": "Source code", "fr": "Code source"},
|
||||
# Version de Bitwarden dans À propos, à côté de la mention d'origine (06/10/2026).
|
||||
"LoksiBasedOnBitwarden": {"en": f"Based on Bitwarden {BITWARDEN_VERSION}.",
|
||||
"fr": f"Basé sur Bitwarden {BITWARDEN_VERSION}."},
|
||||
@@ -657,9 +659,19 @@ FRAMEWORK_IDS = {
|
||||
}
|
||||
|
||||
|
||||
# Ligne d'À propos qui ouvre le coffre web : libellé choisi par Romain le 09/10/2026.
|
||||
WEB_VAULT_LABEL = {"fr": "Loksi : Coffre-fort Web", "en": "Loksi: Web vault"}
|
||||
|
||||
|
||||
def without_bitwarden():
|
||||
for relative, suffix in FRAMEWORK_IDS.items():
|
||||
replace_once(SRC / relative, f"{suffix}\n", suffix.replace("bitwarden", "loksi") + "\n")
|
||||
for language, label in WEB_VAULT_LABEL.items():
|
||||
strings = SRC / f"BitwardenResources/Localizations/{language}.lproj/Localizable.strings"
|
||||
text, count = re.subn(r'^"WebVault" = "[^"]*";$', f'"WebVault" = "{label}";', strings.read_text(), flags=re.M)
|
||||
if count != 1:
|
||||
raise RuntimeError(f"WebVault absent de {language}.lproj")
|
||||
strings.write_text(text)
|
||||
# Nom de l'appli qui exporte, montré par iOS lors d'un transfert d'identifiants.
|
||||
replace_once(SRC / "BitwardenShared/Core/Tools/Utilities/CredentialManagerFactory.swift",
|
||||
'exporterDisplayName: "Bitwarden",', 'exporterDisplayName: "Loksi",')
|
||||
@@ -968,11 +980,14 @@ public extension EnvironmentURLData {{
|
||||
f' /// Loksi: the support address, opened in the email app.\n'
|
||||
f' public static let loksiContactSupport = URL(string: "{CONFIG["links"]["support"]}")!\n\n'
|
||||
f' /// Loksi: the product page, for whoever is not a customer yet.\n'
|
||||
f' public static let loksiProduct = URL(string: "{LOKSI_PRODUCT}")!\n')
|
||||
f' public static let loksiProduct = URL(string: "{LOKSI_PRODUCT}")!\n\n'
|
||||
f' /// Loksi: the GPL source of the app, required before any distribution.\n'
|
||||
f' public static let loksiSourceCode = URL(string: "{CONFIG["links"]["source"]}")!\n')
|
||||
about = SRC / "BitwardenShared/UI/Platform/Settings/Settings/About"
|
||||
replace_once(about / "AboutAction.swift", " /// The privacy policy button was tapped.\n case privacyPolicyTapped\n",
|
||||
" /// The privacy policy button was tapped.\n case privacyPolicyTapped\n\n"
|
||||
" /// Loksi: the contact us button was tapped.\n case contactUsTapped\n")
|
||||
" /// Loksi: the contact us button was tapped.\n case contactUsTapped\n\n"
|
||||
" /// Loksi: the source code button was tapped.\n case sourceCodeTapped\n")
|
||||
replace_once(about / "AboutProcessor.swift", " case .privacyPolicyTapped:\n", """ case .contactUsTapped:
|
||||
coordinator.showAlert(Alert(
|
||||
title: Localizations.loksiEmailSupportTitle,
|
||||
@@ -984,12 +999,15 @@ public extension EnvironmentURLData {{
|
||||
},
|
||||
],
|
||||
))
|
||||
case .sourceCodeTapped:
|
||||
state.url = ExternalLinksConstants.loksiSourceCode
|
||||
case .privacyPolicyTapped:
|
||||
""")
|
||||
replace_once(about / "AboutView.swift",
|
||||
" externalLinkRow(Localizations.privacyPolicy, action: .privacyPolicyTapped)\n\n",
|
||||
" externalLinkRow(Localizations.privacyPolicy, action: .privacyPolicyTapped)\n\n"
|
||||
" externalLinkRow(Localizations.loksiContactUs, action: .contactUsTapped)\n\n")
|
||||
" externalLinkRow(Localizations.loksiContactUs, action: .contactUsTapped)\n\n"
|
||||
" externalLinkRow(Localizations.loksiSourceCode, action: .sourceCodeTapped)\n\n")
|
||||
# « En savoir plus sur les organisations » ouvre bitwarden.com : offre Bitwarden sans
|
||||
# objet pour Loksi, retirée (règle de brand/README.md, « Le nom Bitwarden »).
|
||||
replace_once(SRC / "BitwardenShared/UI/Platform/Settings/Settings/About/AboutView.swift",
|
||||
@@ -1275,6 +1293,7 @@ def verify():
|
||||
assert table.get("LoksiOriginNotice") == notice, f"avis de dérivation {language}"
|
||||
assert table.get("LoksiBasedOnBitwarden") == CONTACT_STRINGS["LoksiBasedOnBitwarden"][language], \
|
||||
f"version de Bitwarden dans À propos ({language})"
|
||||
assert table.get("WebVault") == WEB_VAULT_LABEL[language], f"libellé du coffre web ({language})"
|
||||
assert ORIGIN_NOTICE["fr"] not in git("show", "HEAD:BitwardenResources/Localizations/fr.lproj/Localizable.strings"), \
|
||||
"canari : l'avis de dérivation figure déjà dans l'amont"
|
||||
# Nom de coffre (04/10/2026) : domaine des coffres et page produit dans le code. Canari :
|
||||
@@ -1283,6 +1302,11 @@ def verify():
|
||||
"domaine loksi.fr ou lien Découvrir Loksi absent"
|
||||
assert "loksi.fr" not in git("show", "HEAD:BitwardenShared/UI/Auth/Landing/SelfHosted/SelfHostedProcessor.swift"), \
|
||||
"canari : loksi.fr déjà dans l'amont"
|
||||
# Source GPL (12/10/2026) : son adresse exacte dans le code, absente de l'amont figé.
|
||||
source = CONFIG["links"]["source"].encode()
|
||||
assert scan(executables, [source]), "adresse de la source GPL absente de l'application"
|
||||
assert source.decode() not in git("show", "HEAD:BitwardenKit/Core/Platform/Utilities/ExternalLinksConstants.swift"), \
|
||||
"canari : adresse de la source déjà dans l'amont"
|
||||
# Plus de Bitwarden sauf obligation (09/10/2026) : aucun identifiant de paquet hors SDK,
|
||||
# pas de User-Agent Bitwarden_Mobile. Canaris : l'amont figé a les deux.
|
||||
ids = {plistlib.loads(path.read_bytes()).get("CFBundleIdentifier", "") for path in app.rglob("Info.plist")
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Visuels de l'application iOS Loksi, rendus par Chromium depuis brand/.
|
||||
*
|
||||
* node render.mjs <dossier de sortie>
|
||||
*
|
||||
* - icon-1024.png : icône d'application, la version Apple pleine page de
|
||||
* brand/icones.mjs (carré sans ombre portée ni transparence, iOS pose son arrondi) ;
|
||||
* - logo-clair@{1,2,3}x.png et logo-sombre@{1,2,3}x.png : logo complet (icône et mot)
|
||||
* depuis brand/sources, 44 points de haut comme le logo amont qu'il remplace.
|
||||
*
|
||||
* Lancé par loksi.py depuis mobile/.cache/node, où playwright est installé à la
|
||||
* version de brand/package-lock.json. N'écrit que dans le dossier donné.
|
||||
*/
|
||||
import { readFileSync, mkdirSync } from 'fs';
|
||||
import { join, dirname, resolve } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { createRequire } from 'module';
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
const brand = resolve(here, '../../brand');
|
||||
const out = process.argv[2];
|
||||
if (!out) throw new Error('dossier de sortie manquant');
|
||||
mkdirSync(out, { recursive: true });
|
||||
|
||||
const { chromium } = createRequire(join(process.cwd(), 'package.json'))('playwright');
|
||||
const { apple } = await import(join(brand, 'icones.mjs'));
|
||||
|
||||
const browser = await chromium.launch();
|
||||
const page = await browser.newPage();
|
||||
|
||||
async function rendre(svg, largeur, hauteur, sortie, fond) {
|
||||
await page.setViewportSize({ width: largeur, height: hauteur });
|
||||
await page.setContent(`<style>html,body{margin:0;width:100%;height:100%;background:${fond}}svg{width:100%;height:100%;display:block}</style>${svg}`);
|
||||
await page.screenshot({ path: join(out, sortie), omitBackground: fond === 'transparent' });
|
||||
}
|
||||
|
||||
// Icône : opaque, iOS refuse la transparence dans une icône d'application.
|
||||
await rendre(apple(), 1024, 1024, 'icon-1024.png', '#ffffff');
|
||||
|
||||
for (const variante of ['clair', 'sombre']) {
|
||||
const svg = readFileSync(join(brand, 'sources', `loksi-logo-${variante}.svg`), 'utf8');
|
||||
const [, , w, h] = /viewBox="([-\d.]+) ([-\d.]+) ([\d.]+) ([\d.]+)"/.exec(svg).slice(1).map(Number);
|
||||
for (const echelle of [1, 2, 3]) {
|
||||
const hauteur = 44 * echelle;
|
||||
await rendre(svg, Math.round(hauteur * w / h), hauteur, `logo-${variante}@${echelle}x.png`, 'transparent');
|
||||
}
|
||||
}
|
||||
await browser.close();
|
||||
console.log('Visuels rendus dans', out);
|
||||
@@ -0,0 +1,95 @@
|
||||
// GPL-3.0-only. Loksi: vault name or address entered at login (decision of 04/10/2026).
|
||||
// Copied by mobile/ios/loksi.py into BitwardenShared. Same rule as the Loksi browser
|
||||
// extension (extensions/loksi-coffre.ts) and the Android app (LoksiVault.kt).
|
||||
import Foundation
|
||||
|
||||
/// Loksi: turns what the user typed into a vault address, and checks that a vault answers.
|
||||
///
|
||||
enum LoksiVault {
|
||||
/// Domain of the Loksi vaults. The vault name "abc" gives https://abc.loksi.fr.
|
||||
static let domain = "loksi.fr"
|
||||
|
||||
/// The name chosen in the order funnel: 2 to 20 lowercase letters or digits, a hyphen
|
||||
/// allowed but neither first nor last. Never interpolated as typed: it matches this
|
||||
/// pattern or it is refused.
|
||||
private static let namePattern = "^[a-z0-9](?:[a-z0-9-]{0,18}[a-z0-9])$"
|
||||
|
||||
/// Time allowed for the /api/config check.
|
||||
private static let timeout: TimeInterval = 10
|
||||
|
||||
/// Base address of the vault for what was typed, or `nil` if it is refused.
|
||||
///
|
||||
/// A vault name gives https://<name>.loksi.fr. Otherwise a full https address without
|
||||
/// credentials, query or fragment, for a customer with their own domain.
|
||||
///
|
||||
static func address(for input: String) -> URL? {
|
||||
let value = input.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
if value.range(of: namePattern, options: .regularExpression) != nil {
|
||||
return URL(string: "https://\(value).\(domain)")
|
||||
}
|
||||
guard value.hasPrefix("https://"),
|
||||
let components = URLComponents(string: value),
|
||||
components.scheme == "https",
|
||||
let host = components.host, !host.isEmpty,
|
||||
components.user == nil, components.password == nil,
|
||||
components.query == nil, components.fragment == nil
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
var path = components.percentEncodedPath
|
||||
while path.hasSuffix("/") {
|
||||
path.removeLast()
|
||||
}
|
||||
let port = components.port.map { ":\($0)" } ?? ""
|
||||
return URL(string: "https://\(host)\(port)\(path)")
|
||||
}
|
||||
|
||||
/// Whether a Vaultwarden server answers on /api/config at `base`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - base: The vault address returned by `address(for:)`.
|
||||
/// - fetch: Returns the body of a successful GET, or `nil`.
|
||||
///
|
||||
static func isVault(
|
||||
_ base: URL,
|
||||
fetch: (URL) async -> Data? = LoksiVault.get,
|
||||
) async -> Bool {
|
||||
guard let body = await fetch(base.appendingPathComponent("api/config")),
|
||||
let json = try? JSONSerialization.jsonObject(with: body) as? [String: Any],
|
||||
let server = json["server"] as? [String: Any]
|
||||
else {
|
||||
return false
|
||||
}
|
||||
return server["name"] as? String == "Vaultwarden"
|
||||
}
|
||||
|
||||
/// A GET without cookies or redirects, the body if the answer is 200.
|
||||
///
|
||||
static func get(_ url: URL) async -> Data? {
|
||||
let configuration = URLSessionConfiguration.ephemeral
|
||||
configuration.timeoutIntervalForRequest = timeout
|
||||
let session = URLSession(configuration: configuration, delegate: NoRedirect(), delegateQueue: nil)
|
||||
defer { session.finishTasksAndInvalidate() }
|
||||
var request = URLRequest(url: url)
|
||||
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||
guard let (data, response) = try? await session.data(for: request),
|
||||
(response as? HTTPURLResponse)?.statusCode == 200
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
/// Refuses redirects: the vault must answer at the address itself.
|
||||
///
|
||||
private final class NoRedirect: NSObject, URLSessionTaskDelegate {
|
||||
func urlSession(
|
||||
_ session: URLSession,
|
||||
task: URLSessionTask,
|
||||
willPerformHTTPRedirection response: HTTPURLResponse,
|
||||
newRequest request: URLRequest,
|
||||
) async -> URLRequest? {
|
||||
nil
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// GPL-3.0-only. Loksi: tests of the vault name rule, copied by mobile/ios/loksi.py.
|
||||
import BitwardenKit
|
||||
import Networking
|
||||
import UIKit
|
||||
import XCTest
|
||||
|
||||
@testable import BitwardenShared
|
||||
|
||||
class LoksiVaultTests: BitwardenTestCase {
|
||||
/// A vault name gives https://<name>.loksi.fr.
|
||||
func test_address_name() {
|
||||
XCTAssertEqual(LoksiVault.address(for: "aleop")?.absoluteString, "https://aleop.loksi.fr")
|
||||
XCTAssertEqual(LoksiVault.address(for: " mon-entreprise ")?.absoluteString, "https://mon-entreprise.loksi.fr")
|
||||
XCTAssertEqual(LoksiVault.address(for: "ab")?.absoluteString, "https://ab.loksi.fr")
|
||||
}
|
||||
|
||||
/// A full https address stays accepted, without its trailing slash.
|
||||
func test_address_fullHttps() {
|
||||
XCTAssertEqual(LoksiVault.address(for: "https://coffre.client.fr/")?.absoluteString, "https://coffre.client.fr")
|
||||
XCTAssertEqual(
|
||||
LoksiVault.address(for: "https://coffre.client.fr:8443/vault")?.absoluteString,
|
||||
"https://coffre.client.fr:8443/vault",
|
||||
)
|
||||
}
|
||||
|
||||
/// Canaries: these must be refused.
|
||||
func test_address_refused() {
|
||||
for input in [
|
||||
"ABC", "abc.evil.test", "ABC/../x", "http://", "http://abc.loksi.fr", "a", "-abc", "abc-",
|
||||
"abcdefghijklmnopqrstu", "https://user:pass@abc.loksi.fr", "https://abc.loksi.fr?x=1",
|
||||
"https://abc.loksi.fr#x", "", "https://",
|
||||
] {
|
||||
XCTAssertNil(LoksiVault.address(for: input), input)
|
||||
}
|
||||
}
|
||||
|
||||
/// Only a Vaultwarden answer on /api/config is a vault.
|
||||
func test_isVault() async {
|
||||
let base = URL(string: "https://aleop.loksi.fr")!
|
||||
var asked: URL?
|
||||
let vaultwarden = await LoksiVault.isVault(base) { url in
|
||||
asked = url
|
||||
return Data(#"{"server":{"name":"Vaultwarden"}}"#.utf8)
|
||||
}
|
||||
XCTAssertTrue(vaultwarden)
|
||||
XCTAssertEqual(asked?.absoluteString, "https://aleop.loksi.fr/api/config")
|
||||
}
|
||||
|
||||
/// The server sees the upstream Bitwarden version in Bitwarden-Client-Version, never the
|
||||
/// displayed Loksi one. Canary: the test host shows Loksi's own version, the header must differ.
|
||||
func test_serverVersion_isUpstream() async throws {
|
||||
let handler = DefaultHeadersRequestHandler(
|
||||
appVersion: LoksiUpstream.bitwardenVersion,
|
||||
userAgentBuilder: UserAgentBuilder(
|
||||
appName: "Loksi",
|
||||
appVersion: LoksiUpstream.bitwardenVersion,
|
||||
systemDevice: UIDevice.current,
|
||||
),
|
||||
)
|
||||
var request = HTTPRequest(url: URL(string: "https://aleop.loksi.fr/api/config")!)
|
||||
let handled = try await handler.handle(&request)
|
||||
let header = handled.headers["Bitwarden-Client-Version"]
|
||||
XCTAssertEqual(header, LoksiUpstream.bitwardenVersion)
|
||||
XCTAssertNotEqual(header, Bundle.main.appVersion)
|
||||
XCTAssertNotEqual(header, "2026.10.0")
|
||||
}
|
||||
|
||||
/// Canaries: another server, a non JSON answer or no answer is not a vault.
|
||||
func test_isVault_refused() async {
|
||||
let base = URL(string: "https://abc.loksi.fr")!
|
||||
for body in [#"{"server":{"name":"Bitwarden"}}"#, "<html>404</html>", #"{"server":null}"#] {
|
||||
let result = await LoksiVault.isVault(base) { _ in Data(body.utf8) }
|
||||
XCTAssertFalse(result, body)
|
||||
}
|
||||
let none = await LoksiVault.isVault(base) { _ in nil }
|
||||
XCTAssertFalse(none)
|
||||
}
|
||||
}
|
||||
@@ -13,14 +13,15 @@
|
||||
"application_id": "eu.aleop.loksi",
|
||||
"app_version": {
|
||||
"marketing": "2026.10.0",
|
||||
"code": 3,
|
||||
"code": 4,
|
||||
"note": "règle du 06/10/2026 : AAAA.M.n, n à 0 pour la première sortie du mois ; code monte à chaque AAB, loksi.py le contrôle"
|
||||
},
|
||||
"links": {
|
||||
"help": "https://www.aleop.eu/aide/loksi/",
|
||||
"privacy": "https://www.aleop.eu/loksi/confidentialite/",
|
||||
"support": "loksi@aleop.eu",
|
||||
"dpo": "dpo@aleop.eu"
|
||||
"dpo": "dpo@aleop.eu",
|
||||
"source": "https://sources.gitsi.dev/aleop/loksi"
|
||||
},
|
||||
"toolchain": {
|
||||
"jdk": "21",
|
||||
@@ -78,8 +79,8 @@
|
||||
},
|
||||
"app_version": {
|
||||
"marketing": "2026.10.0",
|
||||
"build": 17,
|
||||
"last_archived_build": 16,
|
||||
"build": 18,
|
||||
"last_archived_build": 18,
|
||||
"note": "AAAA.M.n sans zéro devant, n à 0 pour la première sortie du mois (règle de Romain du 06/10/2026). build : compteur entier, monte à chaque archive, jamais réutilisé ; loksi.py archive refuse un build qui ne dépasse pas last_archived_build puis l'y inscrit. La version de Bitwarden est le tag amont, affichée dans À propos"
|
||||
},
|
||||
"apple_team": {
|
||||
@@ -92,6 +93,7 @@
|
||||
"help": "https://www.aleop.eu/aide/loksi/",
|
||||
"privacy": "https://www.aleop.eu/loksi/confidentialite/",
|
||||
"support": "mailto:loksi@aleop.eu",
|
||||
"source": "https://sources.gitsi.dev/aleop/loksi",
|
||||
"dpo": "dpo@aleop.eu"
|
||||
}
|
||||
},
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur