Ricerca dei profili con suggerimenti e foto (#37)
verifica / controlli (push) Successful in 20s
verifica / prove (push) Failing after 19m40s
verifica / installatore (push) Skipped
verifica / immagine (push) Skipped

«Aggiungi account» ha una sola casella: mentre Alberto scrive compaiono
subito i suggerimenti locali, poi i profili di Instagram con la foto, come
chiesto in #37. Il browser di Febe scrive nella casella «Cerca» di Instagram
con tasti veri da una mappa chiusa (mai Invio, Tab o Esc), controlla prima
il fuoco, legge la risposta della pagina e non clicca mai un risultato.

La ricerca ha una categoria propria nel Governatore, con tetti larghi che
non consumano quelli della raccolta, e si dà il turno con il motore
sull'unica pagina; a fine sessione la pagina torna comunque al riposo. Le
foto passano dal CDN con un permesso ciascuna e restano solo in memoria.

Le risposte di Alberto del 15 novembre (controllo del fuoco, turni, evento
requestWillBeSent, niente foto dei seguiti per ora) sono in §6.1 e in
docs/decisioni.md. Su Instagram vero la ricerca parte quando i bersagli
search-open e search-box saranno raccolti dal vivo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-15 16:30:03 +01:00
1 parent 5e417c666d
commit 9941a2fa1f
98 files changed
+8021 -229

No files matched your search

+26 -1
View File
@@ -152,8 +152,10 @@ public sealed class BrowserConnectionService : IConnectionService, IAsyncDisposa
_tracker.MarkUsed(_clock.Now);
if (openLogin)
{
// The engine ends its session when the lease starts; wait for it before taking the page.
// The engine ends its session when the lease starts; wait for it before taking the page. A search step
// in progress (issue #37) stops at its next check of the lease: the login page waits for its turn.
await WaitForSessionEndAsync(ct).ConfigureAwait(false);
using var turn = await TakePageAsync(ct).ConfigureAwait(false);
var result = await _browser.Cdp.NavigateAsync(_loginUrl, ct).ConfigureAwait(false);
_log.Info("collegamento", result.Succeeded
? "Alberto usa il browser: pagina di accesso aperta."
@@ -540,6 +542,29 @@ public sealed class BrowserConnectionService : IConnectionService, IAsyncDisposa
}
}
/// <summary>
/// The page turn for Alberto's login page, so that no step of the profile search runs under it; after 15 seconds
/// the page is taken anyway (Alberto asked for it), and null comes back.
/// </summary>
private async Task<PageTurn?> TakePageAsync(CancellationToken ct)
{
if (_engine is not { } engine)
{
return null;
}
using var limit = CancellationTokenSource.CreateLinkedTokenSource(ct);
limit.CancelAfter(TimeSpan.FromSeconds(15));
try
{
return await engine.Services.PageTurns.TakeAsync(PageUser.Engine, limit.Token).ConfigureAwait(false);
}
catch (OperationCanceledException) when (!ct.IsCancellationRequested)
{
return null;
}
}
private async Task<string?> CurrentUrlAsync(CancellationToken ct)
{
try
+23 -2
View File
@@ -5,6 +5,7 @@ using Febe.Core.Alerts;
using Febe.Core.Collection;
using Febe.Core.Collection.Diagnostics;
using Febe.Core.Collection.Downloads;
using Febe.Core.Collection.Search;
using Febe.Core.Domain;
using Febe.Core.Engine;
using Febe.Core.Import;
@@ -86,6 +87,9 @@ public sealed class FebeApp : IAsyncDisposable
public CollectionPipeline? Pipeline { get; private set; }
/// <summary>The profile search (issue #37): local suggestions at once, the site's own search box between engine actions.</summary>
public ProfileSearchService? Search { get; private set; }
public ImportService? Import { get; private set; }
public PerceptualHashIndex? HashIndex { get; private set; }
@@ -267,6 +271,9 @@ public sealed class FebeApp : IAsyncDisposable
var runner = new DeferredRecipeRunner();
var engine = new EngineHost(services, runner);
Engine = engine;
var search = new ProfileSearchService(services);
Search = search;
search.Start();
connection.AttachEngine(engine);
EventHandler<bool> drivingChanged = (_, _) => engine.NotifyUserDrivingChanged();
browser.UserDriving.Changed += drivingChanged;
@@ -282,6 +289,7 @@ public sealed class FebeApp : IAsyncDisposable
s.AddSingleton(Tracker);
s.AddSingleton(engine.Monitor);
s.AddSingleton<IEngineControl>(new EngineHostControl(engine));
s.AddSingleton<IProfileSearch>(search);
s.AddSingleton<IConnectionService>(connection);
s.AddSingleton<IEngineSettingsControl>(new EngineHostSettingsControl(engine));
s.AddSingleton(ingest);
@@ -324,7 +332,7 @@ public sealed class FebeApp : IAsyncDisposable
var lifetime = _lifetime.Token;
InBackground(() => CleanTemporaryFilesAsync(staging, layout, lifetime));
InBackground(() => BackupLoopAsync(new DailyBackup(Database, Clock, data.Backups), lifetime));
InBackground(() => BringUpBrowserAsync(ingest, staging, services, engine, runner, lifetime));
InBackground(() => BringUpBrowserAsync(ingest, staging, services, engine, runner, search, lifetime));
InBackground(() => Alerts.WatchDiskSpaceAsync(lifetime));
}
@@ -388,7 +396,7 @@ public sealed class FebeApp : IAsyncDisposable
}
/// <summary>The browser, then the pipeline, the downloads, the connection check and the engine.</summary>
private async Task BringUpBrowserAsync(LibraryIngest ingest, string staging, EngineServices services, EngineHost engine, DeferredRecipeRunner runner, CancellationToken ct)
private async Task BringUpBrowserAsync(LibraryIngest ingest, string staging, EngineServices services, EngineHost engine, DeferredRecipeRunner runner, ProfileSearchService search, CancellationToken ct)
{
var browser = Browser!;
await browser.RunAsync(ct).ConfigureAwait(false);
@@ -422,9 +430,16 @@ public sealed class FebeApp : IAsyncDisposable
UserOwnsPage = () => browser.UserIsDriving && services.Runtime.CurrentSession is null,
Log = Log.ForBrowser(),
Diagnostics = Diagnostics,
PageTurns = services.PageTurns,
SearchOptions = search.Options,
SearchPhotos = search.Photos,
},
ct).ConfigureAwait(false);
runner.Target = Pipeline.Runner;
if (Pipeline.Search is { } searchRunner)
{
search.Attach(searchRunner, Pipeline.SearchPhotos);
}
await CheckCollectionConfigurationAsync(Pipeline, engine, ct).ConfigureAwait(false);
var changes = Web.Services.GetRequiredService<LibraryChanges>();
DisposeOnStop(changes.Attach(Pipeline.Downloads, Clock));
@@ -722,6 +737,12 @@ public sealed class FebeApp : IAsyncDisposable
await Quietly(() => import.DisposeAsync().AsTask()).ConfigureAwait(false);
}
if (Search is { } profileSearch)
{
profileSearch.Detach();
await Quietly(() => profileSearch.DisposeAsync().AsTask()).ConfigureAwait(false);
}
if (Pipeline is { } pipeline)
{
await Quietly(() => pipeline.DisposeAsync().AsTask()).ConfigureAwait(false);