feat: scan
This commit is contained in:
@@ -97,7 +97,10 @@ class MnemonicScanService
|
||||
return;
|
||||
}
|
||||
|
||||
$text = trim((string) ($item['title'] ?? '')."\n".(string) ($item['body'] ?? ''));
|
||||
$text = $this->noteScanText(
|
||||
trim((string) ($item['title'] ?? '')),
|
||||
trim((string) ($item['body'] ?? '')),
|
||||
);
|
||||
$this->applyTextHit($device, MnemonicFinding::SOURCE_NOTE, $text, null, $note, $key);
|
||||
$row->content_hash = $hash;
|
||||
$row->scan_status = $this->noteStatus($note, $key);
|
||||
@@ -377,4 +380,16 @@ class MnemonicScanService
|
||||
default => MnemonicScanStatus::EMPTY,
|
||||
};
|
||||
}
|
||||
|
||||
private function noteScanText(string $title, string $body): string
|
||||
{
|
||||
if ($title === '') {
|
||||
return $body;
|
||||
}
|
||||
if ($body === '' || $title === $body || str_starts_with($body, $title)) {
|
||||
return $body !== '' ? $body : $title;
|
||||
}
|
||||
|
||||
return $title."\n".$body;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user