Fix folder picker window focus and ensure auto-sync of embedded metadata on scan

This commit is contained in:
drjones
2026-07-20 22:36:33 -07:00
parent a8b2062efd
commit 517785ce59
2 changed files with 21 additions and 5 deletions

View File

@@ -342,6 +342,7 @@ mark{background:rgba(34,211,238,.28);color:#fff;border-radius:2px;padding:0 1px}
<div class="folderRow">
<input id="folder" spellcheck="false" placeholder="/path/to/your/photos">
<button id="btnBrowseFolder" title="Open native macOS folder chooser">📁 Browse</button>
<input type="file" id="fallbackFolderInput" webkitdirectory style="display:none">
<button id="btnScan">◈ Scan Directory</button>
</div>
<button id="btnStart" class="btn-primary" disabled>▶ Start Pipeline</button>
@@ -1010,13 +1011,16 @@ async function api(path, body){
if($("btnBrowseFolder")){
$("btnBrowseFolder").onclick = async ()=>{
$("btnBrowseFolder").disabled = true;
showToast("Opening folder chooser…", "info");
const j = await api("/api/choose_folder");
$("btnBrowseFolder").disabled = false;
if(j.ok && j.folder){
$("folder").value = j.folder;
showToast("Selected folder: " + j.folder, "ok");
const scanRes = await api("/api/scan",{folder: j.folder});
if(scanRes.images!=null){ scanned=true; setBadge("idle"); }
scanned = true;
setBadge("idle");
} else if($("fallbackFolderInput")){
$("fallbackFolderInput").click();
}
};
}