feat: the Kanban asks for the folder again on the first click after a reload
All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Successful in 7m35s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m12s
All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Successful in 7m35s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m12s
After a reload the browser forgets the folder's permission and the machines stopped writing until someone opened Integrações and clicked "Liberar pasta" (Marcus, 2026-11-16). The first click or key anywhere in the signed-in Kanban now makes that request; refused, the next click asks again, and the "Liberar pasta" button shares the same request. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -311,9 +311,23 @@ async function restoreFolder(){
|
||||
try{FOLDER.handle=await kv.get('folder')||null;
|
||||
if(FOLDER.handle){FOLDER.granted=(await FOLDER.handle.queryPermission({mode:'readwrite'}))==='granted';
|
||||
FOLDER.saved=await loadSaved();await folderSince();
|
||||
if(!FOLDER.granted)setTimeout(()=>say('Para voltar a salvar os arquivos nas pastas, abra Integrações e clique em “Liberar pasta”.',false,10000),2500);}}
|
||||
if(!FOLDER.granted)armFolderRelease();}}
|
||||
catch{FOLDER.handle=null;}
|
||||
}
|
||||
// After a reload the browser forgets the folder's permission and only gives
|
||||
// it back on a click. Nobody at the machines opens Integrações (Marcus,
|
||||
// 2026-11-16), so the first click or key anywhere in the signed-in Kanban asks
|
||||
// for it; Chrome may then offer to allow it on every visit.
|
||||
function armFolderRelease(){
|
||||
const ask=event=>{
|
||||
if(!FOLDER.handle||FOLDER.granted){stop();return;}
|
||||
if($('app').hidden||event.key==='Escape')return;
|
||||
stop();
|
||||
releaseFolder().catch(()=>{}).finally(()=>{if(FOLDER.handle&&!FOLDER.granted)armFolderRelease();});
|
||||
};
|
||||
const stop=()=>{removeEventListener('pointerup',ask,true);removeEventListener('keydown',ask,true);};
|
||||
addEventListener('pointerup',ask,true);addEventListener('keydown',ask,true);
|
||||
}
|
||||
// The folder's row in Integrações, redrawn whenever its state changes. The
|
||||
// row says what is happening; the how-to and the secondary buttons are under
|
||||
// "Detalhes".
|
||||
@@ -386,9 +400,15 @@ async function chooseFolder(){
|
||||
await makeStageFolders();
|
||||
paintFolder();say('Pastas '+[...new Set(Object.values(STAGE_FOLDERS))].join(', ')+' criadas dentro de “'+handle.name+'”.');syncFolder(true);
|
||||
}
|
||||
async function releaseFolder(){
|
||||
FOLDER.granted=(await FOLDER.handle.requestPermission({mode:'readwrite'}))==='granted';
|
||||
FOLDER.lastSig=null;FOLDER.error='';if(FOLDER.granted)await makeStageFolders();paintFolder();if(FOLDER.granted)syncFolder(true);
|
||||
// One request at a time: the first click on "Liberar pasta" is also the click
|
||||
// armFolderRelease waits for.
|
||||
let folderReleasing=null;
|
||||
function releaseFolder(){
|
||||
return folderReleasing||=(async()=>{
|
||||
try{FOLDER.granted=(await FOLDER.handle.requestPermission({mode:'readwrite'}))==='granted';}
|
||||
finally{folderReleasing=null;}
|
||||
FOLDER.lastSig=null;FOLDER.error='';if(FOLDER.granted)await makeStageFolders();paintFolder();if(FOLDER.granted)syncFolder(true);
|
||||
})();
|
||||
}
|
||||
async function forgetFolder(){
|
||||
FOLDER.handle=null;FOLDER.granted=false;FOLDER.error='';FOLDER.status='';
|
||||
|
||||
Reference in New Issue
Block a user