fix(qr): dire "ce QR n'est pas un code 2FA" au lieu de "aucun QR"

Un QR de texte, ou un QR dynamique qui encode un lien de suivi, etait lu puis
ecarte en silence : l'exe repondait "aucun QR 2FA trouve", l'APK continuait de
viser sans rien dire. Le texte d'un autre QR ne part toujours pas a la page ;
seul le fait qu'un QR a ete lu est signale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-09-28 11:29:12 +01:00
parent 3acf78b1ca
commit 5e4fcfad0f
3 changed files with 24 additions and 5 deletions
+10 -3
View File
@@ -1404,9 +1404,14 @@ begin
procedure
var
LText: string;
LFound: Boolean;
begin
Sleep(400); // laisser Windows retirer la fenetre de l'ecran
LText := ScanScreenForQr;
// UN QR LU N'EST PAS UN QR DE 2FA. Le texte d'un autre QR ne part pas a
// la page - il n'a rien a y faire -, mais le FAIT qu'un QR a ete lu,
// si : "aucun QR" alors qu'il y en avait un envoyait chercher ailleurs.
LFound := LText <> '';
if Pos('otpauth://', LowerCase(LText)) <> 1 then LText := '';
TThread.Queue(nil,
procedure
@@ -1414,12 +1419,14 @@ begin
LJs: TJSONString;
begin
RestoreWindowFromTray;
if LText = '' then LogLine('qr/screen: no otpauth QR found')
else LogLine('qr/screen: otpauth QR found');
if LText <> '' then LogLine('qr/screen: otpauth QR found')
else if LFound then LogLine('qr/screen: a QR code, but not a 2FA one')
else LogLine('qr/screen: no QR code on screen');
LJs := TJSONString.Create(LText);
try
WebBrowser.ExecuteJavaScript(
'if(window.Bridge&&Bridge.onScreenQr)Bridge.onScreenQr(' + LJs.ToJSON + ')');
'if(window.Bridge&&Bridge.onScreenQr)Bridge.onScreenQr(' + LJs.ToJSON
+ ',' + BoolToStr(LFound, True).ToLower + ')');
finally
LJs.Free;
end;