feat(sync): messages de commit neutres des deux cotes

L'historique du depot affichait "sync from <utilisateur du coffre>" a chaque
envoi du poste, et le telephone y ecrivait ce qu'il venait de faire ("new entry
from phone", "icon fetched from phone", "entries deleted from phone"). Le
contenu est chiffre, ces lignes ne l'etaient pas. Il ne reste que l'appareil
d'origine - le detail vit dans le journal local, ou il sert au diagnostic sans
quitter l'appareil.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-09-26 14:26:21 +01:00
parent 75a1169dc9
commit 074e6f92e7
2 changed files with 19 additions and 11 deletions
+5 -1
View File
@@ -846,7 +846,11 @@ async function runSyncNow(_attempt) {
// not the same as none. `branch` is omitted too, so the repo's // not the same as none. `branch` is omitted too, so the repo's
// default branch is used instead of a name we would be guessing. // default branch is used instead of a name we would be guessing.
const env = { const env = {
message: 'sync from ' + (state.username || 'desktop'), // NI LE NOM DU COMPTE NI CE QU'IL GARDE. L'historique du
// depot affichait "sync from <utilisateur du coffre>" a chaque
// envoi : le contenu est chiffre, cette ligne ne l'etait pas.
// L'appareil d'origine suffit a savoir qui a publie.
message: 'update from desktop',
content: bytesToBase64(containerBytes) content: bytesToBase64(containerBytes)
}; };
if (remoteEtag) env.sha = remoteEtag; if (remoteEtag) env.sha = remoteEtag;
+14 -10
View File
@@ -1061,6 +1061,10 @@ end;
/// TIRER, sinon il ecraserait ce qu'un autre appareil a publie entre-temps. /// TIRER, sinon il ecraserait ce qu'un autre appareil a publie entre-temps.
/// ///
/// AReopenUuid vide = revenir a la liste plutot qu'a une entree. /// AReopenUuid vide = revenir a la liste plutot qu'a une entree.
/// AComment EST LE MESSAGE DU COMMIT : il part au depot et s'y lit dans
/// l'historique. Il dit donc "update from phone" et rien de plus - ni le nom
/// du compte, ni ce qui a change. Le detail reste dans le journal local, ou
/// il sert au diagnostic sans quitter l'appareil.
procedure TForm8.CommitChange(const ALabel, AComment, AReopenUuid: string; procedure TForm8.CommitChange(const ALabel, AComment, AReopenUuid: string;
const APatch: TFunc<string, string>); const APatch: TFunc<string, string>);
begin begin
@@ -1272,7 +1276,7 @@ begin
end; end;
LUuid := FCurrent.Uuid; LUuid := FCurrent.Uuid;
LTitle := FCurrent.Display; LTitle := FCurrent.Display;
CommitChange('Saved: ' + LTitle, AField + ' change from phone', LUuid, CommitChange('Saved: ' + LTitle, 'update from phone', LUuid,
function (APlain: string): string function (APlain: string): string
begin begin
Result := PatchEntryField(APlain, LUuid, AField, ANewValue); Result := PatchEntryField(APlain, LUuid, AField, ANewValue);
@@ -1308,7 +1312,7 @@ begin
LUuid := FCurrent.Uuid; LUuid := FCurrent.Uuid;
LTitle := FCurrent.Display; LTitle := FCurrent.Display;
CommitChange('Saved: ' + LTitle, CommitChange('Saved: ' + LTitle,
Format('%d field(s) changed from phone', [Length(AFields)]), LUuid, 'update from phone', LUuid,
function (APlain: string): string function (APlain: string): string
var var
J: Integer; J: Integer;
@@ -1400,7 +1404,7 @@ begin
end; end;
LBody := EncryptContainerWithKey(LMerged, FKey, FKeySalt, FKeyIters); LBody := EncryptContainerWithKey(LMerged, FKey, FKeySalt, FKeyIters);
LPut := LClient.Put(LBody, FETag, 'offline changes from phone'); LPut := LClient.Put(LBody, FETag, 'update from phone');
if LPut.Status = ssOK then if LPut.Status = ssOK then
begin begin
FETag := LPut.ETag; FETag := LPut.ETag;
@@ -1540,7 +1544,7 @@ begin
// quelques secondes, et il n'arrive qu'une fois. // quelques secondes, et il n'arrive qu'une fois.
if FKey = nil then LBody := EncryptContainer(LMerged, FSyncPwd) if FKey = nil then LBody := EncryptContainer(LMerged, FSyncPwd)
else LBody := EncryptContainerWithKey(LMerged, FKey, FKeySalt, FKeyIters); else LBody := EncryptContainerWithKey(LMerged, FKey, FKeySalt, FKeyIters);
LPut := LClient.Put(LBody, LGet.ETag, 'reconciled from phone'); LPut := LClient.Put(LBody, LGet.ETag, 'update from phone');
if LPut.Status = ssOK then if LPut.Status = ssOK then
begin begin
FETag := LPut.ETag; FETag := LPut.ETag;
@@ -1645,7 +1649,7 @@ begin
// Pas de rang a rouvrir : les entrees n'existeront plus. AdoptVault ramene la // Pas de rang a rouvrir : les entrees n'existeront plus. AdoptVault ramene la
// liste, ce qui est exactement ou l'on veut se retrouver. // liste, ce qui est exactement ou l'on veut se retrouver.
CommitChange(Format('Deleted %d', [Length(LUuids)]), CommitChange(Format('Deleted %d', [Length(LUuids)]),
'entries deleted from phone', '', 'update from phone', '',
function (APlain: string): string function (APlain: string): string
var var
I: Integer; I: Integer;
@@ -1736,7 +1740,7 @@ begin
Exit; Exit;
end; end;
CommitChange(Format('Duplicated %d', [Length(LUuids)]), CommitChange(Format('Duplicated %d', [Length(LUuids)]),
'entries duplicated from phone', '', 'update from phone', '',
function (APlain: string): string function (APlain: string): string
var var
I: Integer; I: Integer;
@@ -1757,7 +1761,7 @@ begin
RefuseChange('Give it at least a name'); RefuseChange('Give it at least a name');
Exit; Exit;
end; end;
CommitChange('Added: ' + ATitle, 'new entry from phone', '', CommitChange('Added: ' + ATitle, 'update from phone', '',
function (APlain: string): string function (APlain: string): string
begin begin
Result := AddEntry(APlain, ATitle, ASite, AUser, APwd, AKind, AFolder, Result := AddEntry(APlain, ATitle, ASite, AUser, APwd, AKind, AFolder,
@@ -3466,7 +3470,7 @@ begin
if not AFetch then if not AFetch then
begin begin
CommitChange('Icon removed: ' + LTitle, 'icon removed from phone', LUuid, CommitChange('Icon removed: ' + LTitle, 'update from phone', LUuid,
function (APlain: string): string function (APlain: string): string
begin begin
Result := PatchEntryIcon(APlain, LUuid, '', False); Result := PatchEntryIcon(APlain, LUuid, '', False);
@@ -3507,7 +3511,7 @@ begin
// Provenance a FAUX : elle vient d'une recherche automatique, pas // Provenance a FAUX : elle vient d'une recherche automatique, pas
// d'un choix. Le poste ne remplace jamais une icone choisie lors // d'un choix. Le poste ne remplace jamais une icone choisie lors
// d'un rafraichissement, et ce drapeau est ce qui le lui dit. // d'un rafraichissement, et ce drapeau est ce qui le lui dit.
CommitChange('Icon set: ' + LTitle, 'icon fetched from phone', LUuid, CommitChange('Icon set: ' + LTitle, 'update from phone', LUuid,
function (APlain: string): string function (APlain: string): string
begin begin
Result := PatchEntryIcon(APlain, LUuid, LUri, False); Result := PatchEntryIcon(APlain, LUuid, LUri, False);
@@ -3567,7 +3571,7 @@ begin
LSmall.Free; LSmall.Free;
end; end;
Log(Format('icon: picked image, %d chars', [Length(LUri)])); Log(Format('icon: picked image, %d chars', [Length(LUri)]));
CommitChange('Icon set: ' + LTitle, 'icon picked on phone', LUuid, CommitChange('Icon set: ' + LTitle, 'update from phone', LUuid,
function (APlain: string): string function (APlain: string): string
begin begin
Result := PatchEntryIcon(APlain, LUuid, LUri, True); Result := PatchEntryIcon(APlain, LUuid, LUri, True);