Folder image slideshow sites; Electron 42 -> 44
Slideshow: a site whose path is a local folder (/home/kiosk/photos/, or any existing directory) plays its images full-screen instead of showing Chromium's directory listing. kiosk-app/slideshow.js maps the folder URL to slideshow.html (resolveSiteUrl - used where main.js loads a view and where attachView re-checks the configured URL) and pushes the image list into the page from the main process (the page has no fs access), re-read every minute so added/removed images show up without a restart. Natural file-name order, crossfade, letterboxed by default; optional slideshow.json in the folder: interval, shuffle, fit, transition, recursive. provision_install_app already copies kiosk-app/*.js/*.html, so new installs and Advanced -> Upgrade pick it up. Electron: ^42.0.0 -> ^44.0.0. Electron supports the latest three majors (44/43/42), so 42 drops out when 45 ships. Checked the 43/44 breaking changes against kiosk-app: nothing it uses changed (no clipboard, safeStorage, net.request, utilityProcess; BrowserView is deprecated but still present through 46). The offline bundle builder now retries Electron's install.js download, which crashes outright if a large download is cut off mid-stream. Tested with the real main.js on Electron 44.5.1 under Xvfb + Openbox: slideshow fills the screen, cycles in order (01, 02, 10) skipping a .txt file, honours slideshow.json, and an image added mid-run joined the rotation after the refresh. Offline bundle rebuilt with Electron 44.5.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cjz8a58eB5P9sUweqd3NHm
This commit is contained in:
+5
-1
@@ -4,6 +4,8 @@ const fs=require('fs');
|
||||
const path=require('path');
|
||||
const os=require('os');
|
||||
const crypto=require('crypto');
|
||||
// Sites that are a local folder show as an image slideshow (slideshow.js).
|
||||
const slideshow=require('./slideshow');
|
||||
|
||||
// Suppress EPIPE errors (happen when no terminal attached)
|
||||
process.stdout.on('error',(e)=>{if(e.code!=='EPIPE')throw e;});
|
||||
@@ -782,7 +784,7 @@ function attachView(i){
|
||||
|
||||
const tabIdx=viewIndexToTabIndex(i);
|
||||
if(tabIdx>=0&&tabs[tabIdx]){
|
||||
const configuredUrl=tabs[tabIdx].url;
|
||||
const configuredUrl=slideshow.resolveSiteUrl(tabs[tabIdx].url);
|
||||
const currentUrl=views[i].webContents.getURL();
|
||||
|
||||
if(currentUrl&&!currentUrl.startsWith(configuredUrl)){
|
||||
@@ -1334,6 +1336,7 @@ async function createWindow(){
|
||||
url=u.toString();
|
||||
}catch(e){}
|
||||
}
|
||||
url=slideshow.resolveSiteUrl(url);
|
||||
|
||||
const initialOrigin=new URL(t.url).origin;
|
||||
|
||||
@@ -1367,6 +1370,7 @@ async function createWindow(){
|
||||
});
|
||||
|
||||
view.webContents.setAudioMuted(false);
|
||||
slideshow.attach(view.webContents);
|
||||
view.webContents.loadURL(url);
|
||||
|
||||
view.webContents.on('did-finish-load',()=>{
|
||||
|
||||
Reference in New Issue
Block a user