style: auto-fix linting issues

This commit is contained in:
JulienMaille 2026-02-10 17:46:26 +00:00 committed by github-actions[bot]
parent 89548fa0d3
commit 63e9a71456
2 changed files with 138 additions and 134 deletions

View file

@ -65,7 +65,7 @@ const _window = {
},
setTitle: async (title) => {
window.parent.postMessage({ type: 'NL_WINDOW_SET_TITLE', title }, '*');
}
},
};
// Expose generically for other modules
@ -75,5 +75,5 @@ export default {
events,
extensions,
app,
window: _window
window: _window,
};

View file

@ -1,147 +1,151 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Monochrome Shell</title>
<style>
body,
html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
/* Seamless blend */
}
iframe {
width: 100%;
height: 100%;
border: none;
display: block;
}
</style>
</head>
<body>
<script src="/__neutralino_globals.js"></script>
<script src="/neutralino.js"></script>
<!-- Load the app from the local Neutralino server -->
<iframe id="app-frame" allow="autoplay; fullscreen; microphone; clipboard-read; clipboard-write"></iframe>
<script>
// initialize Neutralino in the Shell (Local Context)
try {
Neutralino.init();
console.log('[Shell] Neutralino initialized.');
} catch (e) {
console.error('[Shell] Failed to init Neutralino:', e);
}
// Point iframe to local server using the port from Neutralino
// NL_PORT is available globally after init (or we can parse it/wait for it)
// Neutralino.init() usually populates window.NL_PORT or we read it from sessionStorage
const initFrame = async () => {
// Wait a tick for globals
await new Promise(r => setTimeout(r, 100));
let port = window.NL_PORT || sessionStorage.getItem('NL_PORT');
// Fallback if missing (shouldn't happen after init)
if (!port) {
// Try reading from window.location if passed (it isn't in shell mode usually)
// But Neutralino fills globals.
// If not, default to 5050
port = '5050';
<head>
<meta charset="UTF-8" />
<title>Monochrome Shell</title>
<style>
body,
html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
/* Seamless blend */
}
iframe {
width: 100%;
height: 100%;
border: none;
display: block;
}
</style>
</head>
<body>
<script src="/__neutralino_globals.js"></script>
<script src="/neutralino.js"></script>
<!-- Load the app from the local Neutralino server -->
<iframe id="app-frame" allow="autoplay; fullscreen; microphone; clipboard-read; clipboard-write"></iframe>
<script>
// initialize Neutralino in the Shell (Local Context)
try {
Neutralino.init();
console.log('[Shell] Neutralino initialized.');
} catch (e) {
console.error('[Shell] Failed to init Neutralino:', e);
}
// Point iframe to local server using the port from Neutralino
// NL_PORT is available globally after init (or we can parse it/wait for it)
// Neutralino.init() usually populates window.NL_PORT or we read it from sessionStorage
const initFrame = async () => {
// Wait a tick for globals
await new Promise((r) => setTimeout(r, 100));
let port = window.NL_PORT || sessionStorage.getItem('NL_PORT');
// Fallback if missing (shouldn't happen after init)
if (!port) {
// Try reading from window.location if passed (it isn't in shell mode usually)
// But Neutralino fills globals.
// If not, default to 5050
port = '5050';
}
const iframe = document.getElementById('app-frame');
// Load the local index.html
iframe.src = `http://localhost:${port}/?mode=neutralino`;
console.log(`[Shell] Loading local app from http://localhost:${port}/?mode=neutralino`);
};
initFrame();
const iframe = document.getElementById('app-frame');
// Load the local index.html
iframe.src = `http://localhost:${port}/?mode=neutralino`;
console.log(`[Shell] Loading local app from http://localhost:${port}/?mode=neutralino`);
};
initFrame();
// Forward generic Neutralino events to the Iframe
const forwardEvent = (eventName, detail) => {
if (iframe && iframe.contentWindow) {
iframe.contentWindow.postMessage(
{
type: 'NL_EVENT',
eventName: eventName,
detail: detail,
},
'*'
);
}
};
const iframe = document.getElementById('app-frame');
// Listen for specific events to forward
// Add more here if the app needs them (e.g., tray events)
Neutralino.events.on('windowClose', () => forwardEvent('windowClose'));
Neutralino.events.on('windowFocus', () => forwardEvent('windowFocus'));
Neutralino.events.on('windowBlur', () => forwardEvent('windowBlur'));
// Forward generic Neutralino events to the Iframe
const forwardEvent = (eventName, detail) => {
if (iframe && iframe.contentWindow) {
iframe.contentWindow.postMessage({
type: 'NL_EVENT',
eventName: eventName,
detail: detail
}, '*');
}
};
// Handle commands from the Iframe (via Bridge)
window.addEventListener('message', async (event) => {
const { type, eventName, data, extensionId } = event.data;
// Listen for specific events to forward
// Add more here if the app needs them (e.g., tray events)
Neutralino.events.on('windowClose', () => forwardEvent('windowClose'));
Neutralino.events.on('windowFocus', () => forwardEvent('windowFocus'));
Neutralino.events.on('windowBlur', () => forwardEvent('windowBlur'));
// Security: In a real scenario, check event.origin if possible.
// But since this loads valid HTTPS content, it's generally safe for this context.
// Handle commands from the Iframe (via Bridge)
window.addEventListener('message', async (event) => {
const { type, eventName, data, extensionId } = event.data;
switch (type) {
case 'NL_INIT':
console.log('[Shell] Bridge connected.');
break;
// Security: In a real scenario, check event.origin if possible.
// But since this loads valid HTTPS content, it's generally safe for this context.
case 'NL_BROADCAST':
// e.g. Discord RPC updates
try {
// console.log('[Shell] Broadcasting:', eventName, data);
await Neutralino.events.broadcast(eventName, data);
} catch (e) {
console.error('[Shell] Broadcast failed:', e);
}
break;
switch (type) {
case 'NL_INIT':
console.log('[Shell] Bridge connected.');
break;
case 'NL_EXTENSION':
// e.g. specific extension dispatch
try {
// console.log('[Shell] Dispatching to extension:', extensionId, eventName);
await Neutralino.extensions.dispatch(extensionId, eventName, data);
} catch (e) {
console.error('[Shell] Extension dispatch failed:', e);
}
break;
case 'NL_BROADCAST':
// e.g. Discord RPC updates
try {
// console.log('[Shell] Broadcasting:', eventName, data);
await Neutralino.events.broadcast(eventName, data);
} catch (e) {
console.error('[Shell] Broadcast failed:', e);
}
break;
case 'NL_APP_EXIT':
Neutralino.app.exit();
break;
case 'NL_EXTENSION':
// e.g. specific extension dispatch
try {
// console.log('[Shell] Dispatching to extension:', extensionId, eventName);
await Neutralino.extensions.dispatch(extensionId, eventName, data);
} catch (e) {
console.error('[Shell] Extension dispatch failed:', e);
}
break;
case 'NL_WINDOW_MIN':
Neutralino.window.minimize();
break;
case 'NL_APP_EXIT':
Neutralino.app.exit();
break;
case 'NL_WINDOW_MAX':
try {
const isMax = await Neutralino.window.isMaximized();
if (isMax) Neutralino.window.unmaximize();
else Neutralino.window.maximize();
} catch (e) {
console.error('[Shell] Window toggle failed:', e);
}
break;
case 'NL_WINDOW_MIN':
Neutralino.window.minimize();
break;
case 'NL_WINDOW_MAX':
try {
const isMax = await Neutralino.window.isMaximized();
if (isMax) Neutralino.window.unmaximize();
else Neutralino.window.maximize();
} catch (e) { console.error('[Shell] Window toggle failed:', e); }
break;
case 'NL_WINDOW_SET_TITLE':
try {
await Neutralino.window.setTitle(event.data.title);
} catch (e) { console.error('[Shell] Set title failed:', e); }
break;
}
});
</script>
</body>
</html>
case 'NL_WINDOW_SET_TITLE':
try {
await Neutralino.window.setTitle(event.data.title);
} catch (e) {
console.error('[Shell] Set title failed:', e);
}
break;
}
});
</script>
</body>
</html>