Merge branch 'master' of github.com:imgfloat/client

This commit is contained in:
2026-01-15 14:29:43 +01:00
5 changed files with 23 additions and 93 deletions

View File

@@ -1,90 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>OBS Browser API Check</title>
<style>
body {
background: #111;
color: #eee;
font-family: monospace;
padding: 16px;
}
h1 {
color: #6cf;
}
.fail {
color: #f66;
}
.ok {
color: #6f6;
}
pre {
white-space: pre-wrap;
}
</style>
</head>
<body>
<h1>OBS Browser Source Missing API Report</h1>
<pre id="log"></pre>
<script>
const logEl = document.getElementById("log");
function log(line, cls = "") {
const span = document.createElement("div");
if (cls) span.className = cls;
span.textContent = line;
logEl.appendChild(span);
}
const apiChecks = {
"window.chrome": () => window.chrome,
"navigator.mediaDevices": () => navigator.mediaDevices,
"navigator.mediaDevices.getUserMedia": () => navigator.mediaDevices?.getUserMedia,
RTCPeerConnection: () => window.RTCPeerConnection,
WebSocket: () => window.WebSocket,
Notification: () => window.Notification,
PaymentRequest: () => window.PaymentRequest,
SharedArrayBuffer: () => SharedArrayBuffer,
ServiceWorker: () => navigator.serviceWorker,
"Clipboard API": () => navigator.clipboard,
WebGL2: () => {
const c = document.createElement("canvas");
return c.getContext("webgl2");
},
AudioWorklet: () => window.AudioWorklet,
"Gamepad API": () => navigator.getGamepads,
"Screen Orientation API": () => screen.orientation,
"Permissions API": () => navigator.permissions,
"File System Access API": () => window.showOpenFilePicker,
"WebRTC DataChannel": () => window.RTCPeerConnection && RTCPeerConnection.prototype.createDataChannel,
IndexedDB: () => window.indexedDB,
BroadcastChannel: () => window.BroadcastChannel,
"Web MIDI": () => navigator.requestMIDIAccess,
};
log("Running API availability check...\n");
let missing = 0;
for (const [name, test] of Object.entries(apiChecks)) {
let result;
try {
result = test();
} catch (e) {
result = undefined;
}
if (result === undefined || result === null) {
log(`${name} → undefined / unavailable`, "fail");
missing++;
} else {
log(`${name} → OK`, "ok");
}
}
log(`\nSummary: ${missing} APIs missing or unavailable.`);
</script>
</body>
</html>

View File

@@ -5,6 +5,7 @@
:root { :root {
--window-frame-height: 36px; --window-frame-height: 36px;
--window-control-size: 28px;
} }
p { p {
@@ -64,15 +65,17 @@ body {
} }
.window-control { .window-control {
width: 30px; width: var(--window-control-size);
height: 24px; height: var(--window-control-size);
padding: 0; padding: 0;
border-radius: 6px; border-radius: 6px;
background: rgba(148, 163, 184, 0.2); background: rgba(148, 163, 184, 0.2);
border: 1px solid rgba(148, 163, 184, 0.25); border: 1px solid rgba(148, 163, 184, 0.25);
color: #e2e8f0; color: #e2e8f0;
font-size: 16px; font-size: 14px;
line-height: 1; line-height: 1;
display: grid;
place-items: center;
box-shadow: none; box-shadow: none;
} }

View File

@@ -12,6 +12,9 @@
<button class="window-control" type="button" data-window-action="minimize" aria-label="Minimize"> <button class="window-control" type="button" data-window-action="minimize" aria-label="Minimize">
&minus; &minus;
</button> </button>
<button class="window-control" type="button" data-window-action="devtools" aria-label="Toggle dev tools">
&#9881;
</button>
<button <button
class="window-control window-control-close" class="window-control window-control-close"
type="button" type="button"
@@ -113,6 +116,9 @@
if (action === "minimize") { if (action === "minimize") {
window.store.minimizeWindow(); window.store.minimizeWindow();
} }
if (action === "devtools") {
window.store.toggleDevTools();
}
if (action === "close") { if (action === "close") {
window.store.closeWindow(); window.store.closeWindow();
} }

View File

@@ -70,6 +70,16 @@ ipcMain.handle("close-window", () => {
} }
}); });
ipcMain.handle("toggle-devtools", () => {
if (ELECTRON_WINDOW && !ELECTRON_WINDOW.isDestroyed()) {
if (ELECTRON_WINDOW.webContents.isDevToolsOpened()) {
ELECTRON_WINDOW.webContents.closeDevTools();
} else {
ELECTRON_WINDOW.webContents.openDevTools({ mode: "detach" });
}
}
});
ipcMain.handle("save-broadcaster", (_, broadcaster) => { ipcMain.handle("save-broadcaster", (_, broadcaster) => {
const store = readStore(STORE_PATH); const store = readStore(STORE_PATH);
store.lastBroadcaster = broadcaster; store.lastBroadcaster = broadcaster;

View File

@@ -9,4 +9,5 @@ contextBridge.exposeInMainWorld("store", {
setWindowSize: (width, height) => ipcRenderer.invoke("set-window-size", width, height), setWindowSize: (width, height) => ipcRenderer.invoke("set-window-size", width, height),
minimizeWindow: () => ipcRenderer.invoke("minimize-window"), minimizeWindow: () => ipcRenderer.invoke("minimize-window"),
closeWindow: () => ipcRenderer.invoke("close-window"), closeWindow: () => ipcRenderer.invoke("close-window"),
toggleDevTools: () => ipcRenderer.invoke("toggle-devtools"),
}); });