feat(android): settings live on the device, dark theme, and the app is called Coffre
URL and token are no longer constants. They sit in settings.bin, sealed with the no-auth Keystore AES key - deliberately weaker than the vault: they must be readable to rebuild a vault that no longer exists, and a bearer token only opens ENCRYPTED data, worthless without the sync password that stays in the guarded vault. Retyping 64 hex characters after every cache purge was the real risk: the risk of writing them down elsewhere. They are saved only after a fetch that worked - proven settings, not typed ones. The token and sync password moved to the gitignored local include, as first-run defaults only. Tracked source now carries no secret, and leaving them empty is a viable configuration: the app asks. Theme: Delphi's Dark.style, copied into the repo and linked as a resource rather than deployed as a file - this project's deployment puts nothing beside the app, which is the same hole that forces the manifest and dex staging. A failure to load is never fatal; the default look is ugly but works. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+23
-11
@@ -32,20 +32,20 @@ uses
|
||||
PMA.Vault;
|
||||
|
||||
const
|
||||
// Parametres du banc d'essai, pre-remplis pour ne pas les retaper.
|
||||
// VALEURS DE PREMIER LANCEMENT UNIQUEMENT. Des que l'appareil a enregistre
|
||||
// ses reglages, elles ne servent plus a rien : LoadDeviceSettings les
|
||||
// remplace. Rien de secret ne doit vivre ici - le jeton et le mot de passe
|
||||
// viennent du fichier local hors depot, plus bas.
|
||||
//
|
||||
// Le port differe selon la plateforme : sur Windows on attaque Apache
|
||||
// directement (80), sur Android on passe par "adb reverse tcp:8080 tcp:80",
|
||||
// qui fait voir le PC comme 127.0.0.1 - ce qui satisfait au passage
|
||||
// l'exemption HTTPS de l'endpoint, reservee a la boucle locale.
|
||||
{$IF DEFINED(ANDROID)}
|
||||
TEST_URL = 'http://127.0.0.1:8080/server-php/sync.php';
|
||||
FIRSTRUN_URL = 'http://127.0.0.1:8080/server-php/sync.php';
|
||||
{$ELSE}
|
||||
TEST_URL = 'http://127.0.0.1/server-php/sync.php';
|
||||
FIRSTRUN_URL = 'http://127.0.0.1/server-php/sync.php';
|
||||
{$ENDIF}
|
||||
// Jeton d'un serveur de test local. Il n'authentifie qu'un appareil et ne
|
||||
// donne acces qu'a du chiffre - mais a remplacer avant toute mise en ligne.
|
||||
TEST_TOKEN = '8765e5bf426039e9888f44bfbab27d489d12b7dbaaa54c8c695ae6af8b2a820e';
|
||||
|
||||
// Assez pour aller coller dans une autre application, trop court pour qu'un
|
||||
// mot de passe traine dans l'historique du presse-papiers.
|
||||
@@ -56,9 +56,10 @@ const
|
||||
// allume, application ouverte.
|
||||
AUTOLOCK_MINUTES = 3;
|
||||
|
||||
// TEST_PWD vient d'un fichier LOCAL, hors depot : il ouvre le coffre entier
|
||||
// une fois le conteneur telecharge. Absent apres un clone -> recopier
|
||||
// PMA.LocalConfig.template.inc.
|
||||
// FIRSTRUN_TOKEN et TEST_PWD viennent d'un fichier LOCAL, hors depot : le
|
||||
// jeton authentifie l'appareil, le mot de passe ouvre le coffre entier. Ni
|
||||
// l'un ni l'autre n'a sa place dans un depot, meme sans remote. Absents apres
|
||||
// un clone -> recopier PMA.LocalConfig.template.inc.
|
||||
{$I android-client\PMA.LocalConfig.inc}
|
||||
|
||||
type
|
||||
@@ -285,6 +286,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TForm8.BuildUnlock;
|
||||
var
|
||||
LUrl, LToken: string;
|
||||
begin
|
||||
FLayUnlock := TLayout.Create(Self);
|
||||
FLayUnlock.Parent := Self;
|
||||
@@ -310,8 +313,14 @@ begin
|
||||
FLaySettings.Align := TAlignLayout.Top;
|
||||
FLaySettings.Height := 116;
|
||||
FLaySettings.Visible := False;
|
||||
FToken := TopEdit(FLaySettings, 'jeton Bearer', TEST_TOKEN);
|
||||
FUrl := TopEdit(FLaySettings, 'URL de l''endpoint', TEST_URL);
|
||||
FToken := TopEdit(FLaySettings, 'jeton Bearer', FIRSTRUN_TOKEN);
|
||||
FUrl := TopEdit(FLaySettings, 'URL de l''endpoint', FIRSTRUN_URL);
|
||||
// Ce que l'appareil a retenu l'emporte sur les valeurs de premier lancement.
|
||||
if LoadDeviceSettings(LUrl, LToken) then
|
||||
begin
|
||||
FUrl.Text := LUrl;
|
||||
if LToken <> '' then FToken.Text := LToken;
|
||||
end;
|
||||
|
||||
FBtnSettings := TopButton(FLayUnlock, 'Reglages du serveur',
|
||||
OnToggleSettings, 36);
|
||||
@@ -1017,6 +1026,9 @@ begin
|
||||
// Le mot de passe part avec le coffre : c'est lui qui permettra au
|
||||
// prochain lancement de rafraichir sans rien demander.
|
||||
SaveVault(LPlain, FETag, APwd, LCanAuth);
|
||||
// Ce qui vient de fonctionner merite d'etre retenu : on n'enregistre
|
||||
// pas des reglages saisis, on enregistre des reglages EPROUVES.
|
||||
SaveDeviceSettings(AUrl, ATok);
|
||||
if VaultNeedsAuth then
|
||||
Log(' cache ecrit - protege par biometrie/code')
|
||||
else if LCanAuth then
|
||||
|
||||
Reference in New Issue
Block a user