Add FileBow Windows app, Store identity and optional Ko-fi link

This commit is contained in:
nordik committed 2026-10-27 01:13:56 +01:00
commit 65cebb31ca
139 files changed
+375057

No files matched your search

+261
View File
@@ -0,0 +1,261 @@
const { app, BrowserWindow, ipcMain, dialog, globalShortcut, Menu, Tray, Notification, screen, shell, nativeTheme } = require('electron');
const fs = require('node:fs');
const path = require('node:path');
const crypto = require('node:crypto');
const { Engine } = require('./main/engine.cjs');
const { Wheel } = require('./main/wheel.cjs');
const { wheelContent, categoryOf, dominantCategory } = require('./main/wheel-options.cjs');
const theme = require('./main/theme.cjs');
const { openDialog } = require('./main/dialogs.cjs');
const { WindowsBridge } = require('./main/windows.cjs');
app.setName('FileBow');
app.setPath('userData', process.env.FILEBOW_USER_DATA || path.join(app.getPath('appData'), 'FileBow'));
const dataPath = app.getPath('userData');
const configFile = path.join(dataPath, 'settings.json');
const historyFile = path.join(dataPath, 'history.json');
function readJSON(file, fallback) { try { return JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return fallback; } }
let settings = { theme: 'dark', autoStart: false, dragWheel: true, shortcuts: true,
closeToTray: true, rememberHistory: true, hardwareAcceleration: true, ...readJSON(configFile, {}) };
if (!settings.hardwareAcceleration) app.disableHardwareAcceleration();
let history = settings.rememberHistory ? readJSON(historyFile, []).slice(0, 50) : [];
let mainWindow, tray, wheel, native, engine, selected = [], activeJob = null;
let quitting = false, lastShortcut = 0, controller = null, nativeMonitor = false;
let nativeError = '', shortcutStatus = {}, packageIdentity = { packaged: false };
let startupState = 'Disabled';
function saveJSON(file, data) {
fs.mkdirSync(dataPath, { recursive: true });
const tmp = `${file}.tmp`;
fs.writeFileSync(tmp, JSON.stringify(data, null, 2));
fs.renameSync(tmp, file);
}
function validFiles(files) {
if (!Array.isArray(files)) return [];
return [...new Set(files.filter(file => typeof file === 'string' && path.isAbsolute(file)))].filter(file => {
try { return fs.statSync(file).isFile(); } catch { return false; }
}).slice(0, 1000);
}
function publicState() {
return { name: 'FileBow', version: app.getVersion(), settings, theme: theme.getThemeMode(),
files: selected.map(file => ({ path: file, name: path.basename(file), kind: categoryOf(file),
size: (() => { try { return fs.statSync(file).size; } catch { return 0; } })() })),
quick: wheelContent(selected, 'quick').options,
tools: wheelContent(selected, 'tools').options,
history, activeJob, native: { available: !!native, monitoring: nativeMonitor, error: nativeError },
shortcuts: shortcutStatus, packageIdentity, startupState };
}
function publish() {
if (mainWindow && !mainWindow.isDestroyed()) mainWindow.webContents.send('orbit:state', publicState());
}
function notice(message, error = false) {
if (mainWindow && !mainWindow.isDestroyed()) mainWindow.webContents.send('orbit:notice', { message, error });
if (!mainWindow?.isFocused() && Notification.isSupported()) {
new Notification({ title: error ? 'FileBow · Fehler' : 'FileBow', body: message, icon: theme.appIconImage() }).show();
}
}
function showHome() { mainWindow?.show(); mainWindow?.focus(); }
async function runAction(files, option) {
if (activeJob) throw new Error('Bitte den aktuellen Auftrag beenden oder abbrechen.');
files = validFiles(files);
if (!files.length) throw new Error('Bitte mindestens eine Datei auswählen.');
activeJob = { id: crypto.randomUUID(), label: option.label, phase: 'preparing', done: 0, total: files.length };
publish();
let job;
try {
if (option.editor) {
const file = files.find(file => categoryOf(file) === 'image' || (option.editor === 'resize' && categoryOf(file) === 'video'));
if (!file) throw new Error('Dieses Werkzeug unterstützt die ausgewählten Dateien nicht.');
let editorError;
const result = await openDialog(engine, 'edit', [file], option.editor);
if (editorError) throw new Error(editorError);
if (!result) return;
job = { op: 'edit', files: [file], options: result };
} else {
if (['frame', 'extract-audio'].includes(option.op)) files = files.filter(file => categoryOf(file) === 'video');
else if (option.op === 'pdf-password') files = files.filter(file => categoryOf(file) === 'pdf');
else if (['compress', 'strip-metadata'].includes(option.op)) files = files.filter(file => ['image', 'video', 'audio', 'pdf'].includes(categoryOf(file)));
else if (option.op === 'convert') {
const kind = dominantCategory(files); files = files.filter(file => categoryOf(file) === kind);
}
if (!files.length) throw new Error('Keine passenden Dateien für diese Aktion.');
job = { op: option.op, files, target: option.target, options: {} };
if (option.op === 'compress') {
const result = await openDialog(engine, 'compress', files);
if (!result) return;
job.options = result;
} else if (option.op === 'frame') {
const result = await openDialog(engine, 'frame', [files[0]]);
if (!result) return;
job.files = [files[0]]; job.options = result;
} else if (option.op === 'combine-manage') {
const result = await openDialog(engine, 'combine', files);
if (!result?.files?.length) return;
const allowed = new Set(files);
job = { op: 'combine', files: validFiles(result.files).filter(file => allowed.has(file)), target: result.format, options: {} };
} else if (option.op === 'pdf-password') {
const password = await openDialog(engine, 'password', [files[0]], option.target);
if (!password) return;
job.files = [files[0]]; job.options = { password, mode: option.target };
}
}
controller = new AbortController();
activeJob.phase = 'running'; activeJob.total = job.files.length; publish();
const results = await engine.run(job, progress => {
if (activeJob) { activeJob = { ...activeJob, done: progress.done, total: progress.total, file: path.basename(progress.file || '') }; publish(); }
}, controller.signal);
const success = results.filter(result => result.ok && result.output);
const failed = results.filter(result => !result.ok);
const entry = { id: activeJob.id, date: new Date().toISOString(), label: option.label,
status: success.length ? (failed.length ? 'partial' : 'success') : 'error',
inputs: job.files, outputs: success.map(result => result.output),
errors: failed.map(result => ({ file: path.basename(result.input || ''), message: result.error })),
count: success.length, total: results.length };
history.unshift(entry); history = history.slice(0, 50);
if (settings.rememberHistory) saveJSON(historyFile, history);
const exceeded = success.filter(result => result.targetMet === false).length;
if (success.length) notice(`${success.length} Datei(en) gespeichert.${failed.length ? ` ${failed.length} fehlgeschlagen.` : ''}${exceeded ? ' Die Zielgröße wurde nicht erreicht.' : ''}`);
else notice(failed[0]?.error || 'Es wurden keine Dateien erstellt.', true);
return entry;
} catch (error) {
notice(error.message, true);
if (job && error.message !== 'Cancelled') {
history.unshift({ id: activeJob.id, date: new Date().toISOString(), label: option.label, status: 'error',
inputs: job.files, outputs: [], count: 0, total: job.files.length, errors: [{ message: error.message }] });
history = history.slice(0, 50);
if (settings.rememberHistory) saveJSON(historyFile, history);
}
throw error;
} finally { controller = null; activeJob = null; publish(); }
}
async function openWheel(mode, point, files) {
const now = Date.now(); if (now - lastShortcut < 250) return;
lastShortcut = now;
if (wheel.visible && wheel.mode === mode) { wheel.hide(); return; }
const explorer = files || (native ? await native.getExplorerSelection() : []);
const selection = validFiles(explorer.length ? explorer : (mainWindow?.isFocused() ? selected : []));
if (!selection.length) { notice('Bitte Dateien im Explorer oder in FileBow auswählen.'); return; }
selected = selection; publish();
await wheel.show(selection, mode, point, true);
}
async function configureIntegration() {
globalShortcut.unregisterAll();
shortcutStatus = {};
if (settings.shortcuts && process.env.FILEBOW_TEST !== '1') for (const [mode, accelerator] of [['quick', 'Control+Space'], ['tools', 'Alt+Space']]) {
shortcutStatus[mode] = globalShortcut.register(accelerator, () => openWheel(mode).catch(error => notice(error.message, true)));
}
if (nativeMonitor) { try { await native.stopFileDragMonitor(); } catch {} nativeMonitor = false; }
if (settings.dragWheel && native && process.env.FILEBOW_TEST !== '1') {
try {
await native.startFileDragMonitor(async event => {
if (activeJob) return;
if (event.phase === 'shortcut') {
if (settings.shortcuts) openWheel(event.tools ? 'tools' : 'quick', { x: event.x, y: event.y }).catch(error => notice(error.message, true));
return;
}
if (event.phase === 'end') { if (!wheel.interactive) wheel.hide(); return; }
if (event.phase === 'drop') { wheel.dragEnded({ x: event.x, y: event.y }); return; }
const files = validFiles(event.files || await native.getExplorerSelection());
if (files.length) wheel.show(files, event.tools ? 'tools' : 'quick', screen.screenToDipPoint({ x: event.x, y: event.y }), false).catch(error => notice(error.message, true));
});
nativeMonitor = true;
} catch (error) { nativeError = error.message; }
}
}
function registerIpc() {
const handle = (channel, fn) => ipcMain.handle(`orbit:${channel}`, async (event, arg) => {
if (event.sender !== mainWindow.webContents) throw new Error('Unexpected sender');
return fn(arg);
});
handle('state', publicState);
handle('licenses', () => shell.openPath(path.join(app.getAppPath(), 'licenses/THIRD_PARTY.html')));
handle('support', () => shell.openExternal('https://ko-fi.com/E0Z827VO8I'));
handle('pick', async () => {
const result = await dialog.showOpenDialog(mainWindow, { title: 'Dateien auswählen', properties: ['openFile', 'multiSelections'] });
if (!result.canceled) { selected = validFiles(result.filePaths); publish(); }
return publicState();
});
handle('select', files => { selected = validFiles(files); publish(); return publicState(); });
handle('choose', id => {
const option = [...wheelContent(selected, 'quick').options, ...wheelContent(selected, 'tools').options].find(option => option.id === id);
if (!option) throw new Error('Diese Aktion ist für die Auswahl nicht verfügbar.');
return runAction([...selected], option);
});
handle('wheel', mode => openWheel(mode === 'tools' ? 'tools' : 'quick', screen.getCursorScreenPoint(), selected));
handle('cancel', () => controller?.abort());
handle('reveal', file => {
const known = [...selected, ...history.flatMap(entry => entry.outputs || [])];
if (typeof file === 'string' && known.includes(file) && fs.existsSync(file)) shell.showItemInFolder(file);
});
handle('clear-history', () => { history = []; saveJSON(historyFile, []); publish(); });
handle('settings', async changes => {
if (!changes || typeof changes !== 'object') return;
if (['dark', 'light', 'system'].includes(changes.theme)) settings.theme = changes.theme;
for (const key of ['autoStart','dragWheel','shortcuts','closeToTray','rememberHistory','hardwareAcceleration']) {
if (typeof changes[key] === 'boolean') settings[key] = changes[key];
}
theme.setSelectedTheme(settings.theme);
if ('autoStart' in changes) {
if (packageIdentity.packaged) {
startupState = await native.request('startup', { enabled: settings.autoStart });
settings.autoStart = startupState === 'Enabled';
if (changes.autoStart && !settings.autoStart) notice('Autostart wurde in Windows deaktiviert. Bitte in Einstellungen > Apps > Autostart aktivieren.', true);
} else app.setLoginItemSettings({ openAtLogin: settings.autoStart, path: process.execPath, args: ['--hidden'] });
}
if (!settings.rememberHistory) saveJSON(historyFile, []);
saveJSON(configFile, settings);
if ('dragWheel' in changes || 'shortcuts' in changes) await configureIntegration();
for (const window of BrowserWindow.getAllWindows()) window.webContents.send('filebow-theme:changed', theme.getThemeMode());
mainWindow.setBackgroundColor(theme.themeBackgroundColor()); publish();
return publicState();
});
}
if (!app.requestSingleInstanceLock()) app.quit();
else {
app.on('second-instance', showHome);
app.whenReady().then(async () => {
app.setAppUserModelId('dev.nordik.filebow'); Menu.setApplicationMenu(null);
theme.setSelectedTheme(settings.theme);
engine = new Engine(app.getAppPath(), app.isPackaged);
try {
native = new WindowsBridge(app.getAppPath()); await native.ready;
packageIdentity = await native.request('identity');
if (packageIdentity.packaged) {
app.setAppUserModelId(packageIdentity.family + '!App');
startupState = await native.request('startup'); settings.autoStart = startupState === 'Enabled';
}
}
catch (error) { nativeError = error.message; native?.close(); native = null; }
wheel = new Wheel((files, option) => runAction(files, option).catch(() => {}), validFiles,
handle => native?.fixWindowInput?.(handle));
mainWindow = new BrowserWindow({ title: 'FileBow', width: 1120, height: 800, minWidth: 860, minHeight: 650,
show: false, backgroundColor: theme.themeBackgroundColor(), icon: theme.appIconImage(),
autoHideMenuBar: true, webPreferences: { preload: path.join(__dirname, 'preload/home.cjs'),
nodeIntegration: false, contextIsolation: true, sandbox: true } });
mainWindow.webContents.setWindowOpenHandler(() => ({ action: 'deny' }));
mainWindow.webContents.on('will-navigate', event => event.preventDefault());
mainWindow.on('close', event => {
if (!quitting && settings.closeToTray && tray) { event.preventDefault(); mainWindow.hide(); }
});
registerIpc(); await configureIntegration();
tray = new Tray(theme.appIconImage().resize({ width: 32, height: 32 }));
tray.setToolTip('FileBow');
tray.setContextMenu(Menu.buildFromTemplate([{ label: 'FileBow öffnen', click: showHome },
{ label: 'Konvertieren · Strg+Leertaste', click: () => openWheel('quick').catch(() => {}) },
{ type: 'separator' }, { label: 'Beenden', click: () => { quitting = true; app.quit(); } }]));
tray.on('double-click', showHome);
nativeTheme.on('updated', () => { if (settings.theme === 'system') publish(); });
await mainWindow.loadFile(path.join(__dirname, 'renderer/home/index.html'));
if (!process.argv.includes('--hidden')) showHome();
if (process.env.FILEBOW_TEST === '1') global.__orbitTest = { engine, wheel, runAction, publicState };
}).catch(error => { console.error(error); app.exit(1); });
app.on('before-quit', () => {
quitting = true; controller?.abort(); engine?.stop(); globalShortcut.unregisterAll();
native?.close();
wheel?.destroy();
});
app.on('window-all-closed', () => { if (quitting || !settings.closeToTray) app.quit(); });
app.on('activate', showHome);
}
+36
View File
@@ -0,0 +1,36 @@
const { BrowserWindow, ipcMain } = require('electron');
const path = require('node:path');
const { pathToFileURL } = require('node:url');
const theme = require('./theme.cjs');
const dialogs = new Map();
ipcMain.handle('filebow-dialog:initialize', event => {
const dialog = dialogs.get(event.sender.id); if (!dialog) throw new Error('Unexpected sender'); return dialog.config;
});
ipcMain.handle('filebow-dialog:preview', async event => {
const dialog = dialogs.get(event.sender.id); if (!dialog) throw new Error('Unexpected sender');
const result = (await dialog.engine.run({ op: 'preview', files: [dialog.file] }))[0];
if (!result.ok) throw new Error(result.error); return result;
});
async function openDialog(engine, type, files, mode) {
const window = new BrowserWindow({ title: 'FileBow', width: 840, height: 740, minWidth: 700, minHeight: 620,
show: false, backgroundColor: theme.themeBackgroundColor(), icon: theme.appIconImage(), autoHideMenuBar: true,
webPreferences: { preload: path.join(__dirname, '../preload/dialog.cjs'), contextIsolation: true, sandbox: true, nodeIntegration: false } });
window.webContents.setWindowOpenHandler(() => ({ action: 'deny' }));
window.webContents.on('will-navigate', event => event.preventDefault());
const config = { type, files: files.map(file => ({ path: file, name: path.basename(file), url: pathToFileURL(file).href })), mode, theme: theme.getThemeMode() };
dialogs.set(window.webContents.id, { config, engine, file: files[0] });
return new Promise(async (resolve,reject) => {
let result = null;
const submit = (event, value) => {
if (event.sender !== window.webContents) return;
result = value; window.close();
};
ipcMain.on('filebow-dialog:submit', submit);
const windowId = window.webContents.id;
window.on('closed', () => { ipcMain.off('filebow-dialog:submit', submit);
dialogs.delete(windowId); resolve(result); });
try { await window.loadFile(path.join(__dirname,'../renderer/dialog/index.html')); window.show(); }
catch (error) { window.destroy(); reject(error); }
});
}
module.exports = { openDialog };
+76
View File
@@ -0,0 +1,76 @@
const { spawn } = require('node:child_process');
const fs = require('node:fs/promises');
const path = require('node:path');
const os = require('node:os');
const crypto = require('node:crypto');
class Engine {
constructor(root, packaged = false) {
this.root = root;
this.packaged = packaged;
this.children = new Set();
}
async run(job, onProgress = () => {}, signal) {
if (signal?.aborted) throw new Error('Cancelled');
const temp = await fs.mkdtemp(path.join(os.tmpdir(), 'filebow-job-'));
const jobFile = path.join(temp, 'job.json');
const jobId = crypto.randomUUID(), stages = new Set();
const allowedParents = new Set((job.files || []).map(file => path.dirname(path.resolve(file)).toLowerCase()));
await fs.writeFile(jobFile, JSON.stringify(job), { encoding: 'utf8', mode: 0o600 });
const command = this.packaged ? path.join(this.root, 'vendor/engine/FileBowEngine.exe')
: path.join(this.root, '.venv/Scripts/python.exe');
const args = this.packaged ? ['--job', jobFile]
: [path.join(this.root, 'engine/filebow_engine.py'), '--job', jobFile];
try {
return await new Promise((resolve, reject) => {
const child = spawn(command, args, { windowsHide: true, cwd: this.root,
env: { ...process.env, PYTHONUTF8: '1', PYTHONIOENCODING: 'utf-8',
FILEBOW_FFMPEG: path.join(this.root, 'vendor/ffmpeg/ffmpeg.exe'), FILEBOW_JOB_ID: jobId } });
this.children.add(child);
let pending = '', stderr = '', result, engineError;
const receive = line => {
let message;
try { message = JSON.parse(line); } catch { return; }
if (message.type === 'stage' && typeof message.directory === 'string') {
const directory = path.resolve(message.directory);
if (allowedParents.has(path.dirname(directory).toLowerCase()) && path.basename(directory).startsWith(`.filebow-${jobId}-`)) stages.add(directory);
}
else if (message.type === 'progress') onProgress(message);
else if (message.type === 'result') result = message.results;
else if (message.type === 'error') engineError = message.message;
};
const abort = () => this.kill(child);
signal?.addEventListener('abort', abort, { once: true });
if (signal?.aborted) abort();
child.stdout.setEncoding('utf8');
child.stderr.setEncoding('utf8');
child.stdout.on('data', chunk => {
pending += chunk;
const lines = pending.split(/\r?\n/); pending = lines.pop();
lines.forEach(receive);
});
child.stderr.on('data', chunk => { stderr = (stderr + chunk).slice(-12000); });
child.on('error', error => reject(new Error(`Conversion engine could not start: ${error.message}`)));
child.on('close', code => {
this.children.delete(child); signal?.removeEventListener('abort', abort);
if (pending) receive(pending);
if (signal?.aborted) reject(new Error('Cancelled'));
else if (Array.isArray(result)) resolve(result);
else reject(new Error(engineError || stderr.trim().split('\n').slice(-3).join(' ') || `Engine exited with code ${code}`));
});
});
} finally {
await fs.rm(temp, { recursive: true, force: true });
for (const directory of stages) await fs.rm(directory, { recursive: true, force: true, maxRetries: 3, retryDelay: 150 });
}
}
kill(child) {
if (!child.pid || child.exitCode !== null) return;
if (process.platform === 'win32') {
const killer = spawn('taskkill.exe', ['/pid', String(child.pid), '/t', '/f'], { windowsHide: true, stdio: 'ignore' });
killer.on('error', () => child.kill());
} else child.kill();
}
stop() { for (const child of this.children) this.kill(child); }
}
module.exports = { Engine };
+7
View File
@@ -0,0 +1,7 @@
const { app, nativeTheme, nativeImage } = require('electron');
const path = require('node:path');
let selectedTheme = 'dark';
const getThemeMode = () => selectedTheme === 'system' ? (nativeTheme.shouldUseDarkColors ? 'dark' : 'light') : selectedTheme;
const appIconImage = () => nativeImage.createFromPath(path.join(app.getAppPath(), 'assets/icon.png'));
module.exports = { getThemeMode, appIconImage, setSelectedTheme: value => { selectedTheme = value; },
themeBackgroundColor: () => getThemeMode() === 'dark' ? '#14161b' : '#f7f7f9' };
+48
View File
@@ -0,0 +1,48 @@
const path = require('node:path');
const types = {
image: 'png jpg jpeg jfif webp bmp tif tiff gif avif heic heif ico',
video: 'mp4 mov avi mkv webm wmv m4v flv mpg mpeg',
audio: 'mp3 wav flac ogg m4a aac wma opus',
pdf: 'pdf', text: 'txt md markdown log csv json xml html htm',
office: 'docx xlsx pptx xls epub rtf',
};
const categoryOf = file => Object.keys(types).find(kind => types[kind].split(' ').includes(path.extname(file).slice(1).toLowerCase())) || 'other';
function dominantCategory(files) {
const counts = {};
for (const file of files) { const kind = categoryOf(file); counts[kind] = (counts[kind] || 0) + 1; }
return Object.keys(counts).sort((a,b) => counts[b] - counts[a])[0] || 'other';
}
const action = (id, label, op, extra = {}) => ({ id, label, op, ...extra });
const convert = target => action(`convert-${target}`, target.toUpperCase(), 'convert', { target });
const zip = action('zip', 'ZIP erstellen', 'zip');
const compress = action('compress', 'Komprimieren', 'compress');
const clean = action('metadata', 'Metadaten entfernen', 'strip-metadata');
const combine = action('combine', 'Zusammenfügen', 'combine-manage');
const edit = (mode, label) => action(`edit-${mode}`, label, 'edit', { editor: mode });
function describeSelection(files) {
return { title: files.length === 1 ? path.basename(files[0]) : `${files.length} Dateien`,
subtitle: files.length ? 'Ergebnisse werden neben den Originalen gespeichert.' : 'Dateien auswählen' };
}
function wheelContent(files, mode = 'quick') {
const kind = dominantCategory(files);
const formats = {
image: ['jpg','png','webp','avif','tiff','ico','pdf'],
video: ['mp4','webm','gif'], audio: ['mp3','wav','m4a','flac','ogg'],
pdf: ['txt','md','docx'], text: ['txt','md','pdf','docx'], office: ['txt','md','pdf'], other: [],
};
let options = formats[kind].map(convert);
if (mode === 'tools') {
options = {
image: [compress, edit('crop','Zuschneiden'), edit('resize','Größe ändern'), edit('rotate','Drehen / Spiegeln'),clean,action('image-pdf','Bilder als PDF','image-to-pdf'),zip],
video: [compress, edit('resize','Größe ändern'), action('frame','Einzelbild','frame'),action('extract-audio','Audio extrahieren','extract-audio',{target:'mp3'}),clean,zip],
audio: [compress,clean,zip],
pdf: [compress,combine,clean,action('password-add','Passwort setzen','pdf-password',{target:'add'}),action('password-remove','Passwort entfernen','pdf-password',{target:'remove'}),zip],
text: [combine,zip], office:[combine,zip], other:[zip],
}[kind];
} else {
if (kind === 'pdf' && files.length > 1) options.push(combine);
if (options.length < 7) options.push(zip);
}
return { ...describeSelection(files), mode, category: kind, options };
}
module.exports = { categoryOf, dominantCategory, wheelContent, describeSelection };
+76
View File
@@ -0,0 +1,76 @@
const { BrowserWindow, screen, ipcMain } = require('electron');
const path = require('node:path');
const { wheelContent } = require('./wheel-options.cjs');
class Wheel {
constructor(onChoose, validateFiles, fixInput) {
this.onChoose = onChoose; this.validateFiles = validateFiles; this.fixInput = fixInput;
this.visible = false; this.mode = 'quick'; this.files = []; this.options = [];
const on = (suffix, fn) => ipcMain.on(`filebow-wheel:${suffix}`, (event, data) => {
if (this.window && event.sender === this.window.webContents && this.visible) fn(data);
});
on('cancel', () => this.hide());
on('choose', id => this.choose(id));
on('files', data => {
const files = this.validateFiles(data?.files);
if (files.length) { this.files = files; this.interactive = true; this.publish(); }
});
on('drop', data => {
const files = this.validateFiles(data?.files);
if (files.length) this.files = files;
this.publish(); this.choose(data?.optionId);
});
}
async ensure() {
if (this.window && !this.window.isDestroyed()) return;
this.window = new BrowserWindow({ title: 'FileBow Wheel', show: false, frame: false,
transparent: true, backgroundColor: '#00000000', hasShadow: false, resizable: false,
movable: false, skipTaskbar: true, alwaysOnTop: true, fullscreenable: false,
webPreferences: { preload: path.join(__dirname, '../renderer/wheel/preload.js'),
nodeIntegration: false, contextIsolation: true, sandbox: true, backgroundThrottling: false } });
this.window.setAlwaysOnTop(true, 'screen-saver');
this.window.setMenuBarVisibility(false);
this.window.webContents.setWindowOpenHandler(() => ({ action: 'deny' }));
this.window.webContents.on('will-navigate', event => event.preventDefault());
await this.window.loadFile(path.join(__dirname, '../renderer/wheel/index.html'));
}
async show(files, mode = 'quick', point = screen.getCursorScreenPoint(), interactive = true) {
await this.ensure(); this.files = this.validateFiles(files); this.mode = mode;
if (!this.files.length) return;
this.interactive = interactive;
const display = screen.getDisplayNearestPoint(point), area = display.workArea;
this.window.setBounds(display.bounds);
this.center = { x: Math.max(area.x + 250, Math.min(area.x + area.width - 250, point.x)),
y: Math.max(area.y + 250, Math.min(area.y + area.height - 250, point.y)) };
this.visible = true; this.publish(); if (interactive) { this.window.show(); this.window.focus(); } else this.window.showInactive();
try { this.fixInput?.(this.window.getNativeWindowHandle()); } catch {}
clearTimeout(this.timer); this.timer = setTimeout(() => this.hide(), 45000);
}
publish() {
const content = wheelContent(this.files, this.mode); this.options = content.options;
const bounds = this.window.getBounds();
this.window.webContents.send('filebow-wheel:state', { ...content,
center: { x: this.center.x - bounds.x, y: this.center.y - bounds.y },
ready: true, interactive: this.interactive,
subtitle: this.interactive ? 'Aktion wählen · Esc zum Schließen' : content.subtitle });
}
choose(id) {
const option = this.options.find(item => item.id === id);
if (!option) return;
const files = [...this.files]; this.hide(); this.onChoose(files, option);
}
dragEnded(point) {
if (!this.visible) return;
point = screen.screenToDipPoint(point);
const dx = point.x - this.center.x, dy = point.y - this.center.y, radius = Math.hypot(dx, dy);
if (radius < 96) { this.interactive = true; this.publish(); return; }
if (radius > 250) { this.hide(); return; }
const segment = 360 / this.options.length;
const index = ((Math.floor((Math.atan2(dy, dx) * 180 / Math.PI + 90 + segment / 2) / segment) % this.options.length) + this.options.length) % this.options.length;
const id = this.options[index]?.id;
if (this.visible) this.choose(id);
}
hide() { clearTimeout(this.timer); this.visible = false; this.window?.hide(); }
destroy() { this.hide(); this.window?.destroy(); }
}
module.exports = { Wheel };
+46
View File
@@ -0,0 +1,46 @@
const { spawn } = require('node:child_process');
const path = require('node:path');
class WindowsBridge {
constructor(root) {
this.next = 1; this.pending = new Map(); this.onDrag = () => {};
this.process = spawn(path.join(root, 'vendor/windows/FileBow.Windows.exe'), [], { windowsHide: true, stdio: ['pipe','pipe','pipe'] });
let buffer = '';
this.ready = new Promise((resolve, reject) => {
this.process.on('error', reject);
this.process.stdout.setEncoding('utf8');
this.process.stdout.on('data', chunk => {
buffer += chunk;
const lines = buffer.split(/\r?\n/); buffer = lines.pop();
for (const line of lines) {
let message; try { message = JSON.parse(line); } catch { continue; }
if (message.type === 'ready') resolve();
else if (message.type === 'drag') this.onDrag(message);
else if (this.pending.has(message.id)) {
const pending = this.pending.get(message.id); this.pending.delete(message.id); clearTimeout(pending.timer);
if (message.error) pending.reject(new Error(message.error)); else pending.resolve(message.result);
}
}
});
this.process.stderr.resume();
this.process.on('exit', () => {
reject(new Error('Windows-Hilfsprozess wurde beendet.'));
for (const pending of this.pending.values()) { clearTimeout(pending.timer); pending.reject(new Error('Windows-Hilfsprozess wurde beendet.')); }
this.pending.clear();
});
});
}
async request(command, extra = {}) {
await this.ready;
return new Promise((resolve,reject) => {
const id = this.next++;
const timer = setTimeout(() => { this.pending.delete(id); reject(new Error('Windows antwortet nicht.')); }, 10000);
this.pending.set(id, { resolve,reject,timer });
this.process.stdin.write(JSON.stringify({ id, command, ...extra }) + '\n');
});
}
getExplorerSelection() { return this.request('selection'); }
startFileDragMonitor(callback) { this.onDrag = callback; return this.request('monitor', { enabled: true }); }
stopFileDragMonitor() { return this.request('monitor', { enabled: false }); }
close() { this.process.stdin.end(); }
}
module.exports = { WindowsBridge };
+6
View File
@@ -0,0 +1,6 @@
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('filebowDialog', {
init: () => ipcRenderer.invoke('filebow-dialog:initialize'),
preview: () => ipcRenderer.invoke('filebow-dialog:preview'),
submit: value => ipcRenderer.send('filebow-dialog:submit', value),
});
+17
View File
@@ -0,0 +1,17 @@
const { contextBridge, ipcRenderer, webUtils } = require('electron');
contextBridge.exposeInMainWorld('orbit', {
support: () => ipcRenderer.invoke('orbit:support'),
licenses: () => ipcRenderer.invoke('orbit:licenses'),
state: () => ipcRenderer.invoke('orbit:state'),
pickFiles: () => ipcRenderer.invoke('orbit:pick'),
selectFiles: files => ipcRenderer.invoke('orbit:select', files),
pathsForFiles: files => Array.from(files).map(file => webUtils.getPathForFile(file)).filter(Boolean),
choose: id => ipcRenderer.invoke('orbit:choose', id),
wheel: mode => ipcRenderer.invoke('orbit:wheel', mode),
settings: changes => ipcRenderer.invoke('orbit:settings', changes),
reveal: file => ipcRenderer.invoke('orbit:reveal', file),
clearHistory: () => ipcRenderer.invoke('orbit:clear-history'),
cancel: () => ipcRenderer.invoke('orbit:cancel'),
onState: callback => ipcRenderer.on('orbit:state', (_event, state) => callback(state)),
onNotice: callback => ipcRenderer.on('orbit:notice', (_event, message) => callback(message)),
});
+8
View File
@@ -0,0 +1,8 @@
<!doctype html>
<html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; media-src file:;">
<title>FileBow</title><link rel="stylesheet" href="../shared.css"><link rel="stylesheet" href="style.css"></head>
<body><header><div class="eyebrow">FILEBOW</div><h1 id="title">Bearbeiten</h1><p id="filename" class="muted"></p></header>
<main><div id="error" class="error" role="alert" hidden></div><div id="content"></div></main>
<footer><p class="muted">Das Original bleibt erhalten.</p><button id="cancel">Abbrechen</button><button id="save" class="primary">Speichern</button></footer>
<script src="index.js"></script></body></html>
+61
View File
@@ -0,0 +1,61 @@
const $ = selector => document.querySelector(selector);
const api = window.filebowDialog;
let config, preview, crop, items, aspect = 1;
const field = (label, id, type = 'number', value = '') => {
const box = document.createElement('label'); box.className='field';
const span=document.createElement('span');span.textContent=label;
const input=document.createElement('input');input.id=id;input.type=type;input.value=value;
if(type==='number'){input.min='0';input.max='30000';input.step='1';}
box.append(span,input);return box;
};
function text(value, cls='info'){const node=document.createElement('p');node.className=cls;node.textContent=value;return node;}
function check(label,id){const node=document.createElement('label');node.className='check';const input=document.createElement('input');input.type='checkbox';input.id=id;node.append(input,document.createTextNode(label));return node;}
function error(message){$('#error').hidden=false;$('#error').textContent=message;}
function list(){const box=$('#files');box.replaceChildren();items.forEach((file,index)=>{
const row=document.createElement('div');row.className='file-row';const name=document.createElement('span');name.textContent=file.name;row.append(name);
for(const [label,offset] of [['↑',-1],['↓',1],['Entfernen',0]]){const b=document.createElement('button');b.textContent=label;b.title=offset?'Reihenfolge ändern':'Datei entfernen';b.disabled=offset ? index+offset<0||index+offset>=items.length : items.length===1;b.onclick=()=>{if(offset)[items[index],items[index+offset]]=[items[index+offset],items[index]];else items.splice(index,1);list();};row.append(b);}box.append(row);
});}
async function init(){
config=await api.init();document.documentElement.dataset.theme=config.theme;items=[...config.files];
$('#filename').textContent=items.length===1?items[0].name:`${items.length} Dateien`;
const content=$('#content');
if(config.type==='compress'){
$('#title').textContent='Komprimieren';content.append(text('Bilder werden als JPEG, Videos als MP4 und Audio als MP3 gespeichert. PDFs behalten ihr Format.'));
const q=field('Qualität: 75 %','quality','range',75);q.lastChild.min=5;q.lastChild.max=95;q.lastChild.oninput=e=>q.firstChild.textContent=`Qualität: ${e.target.value} %`;content.append(q,field('Maximale Größe pro Datei (MB, optional)','maxSizeMB','number',''));
$('#maxSizeMB').step='.1';content.append(text('Eine Zielgröße ist bei manchen Dateien nicht erreichbar. Das Ergebnis wird dann entsprechend gekennzeichnet.'));
}else if(config.type==='password'){
$('#title').textContent=config.mode==='add'?'PDF mit Passwort schützen':'PDF-Passwort entfernen';
content.append(field(config.mode==='add'?'Neues Passwort':'Aktuelles Passwort','password','password'));
if(config.mode==='add')content.append(field('Passwort wiederholen','confirm','password'));
}else if(config.type==='combine'){
$('#title').textContent='Dateien zusammenfügen';content.append(text('Die Dateien werden in dieser Reihenfolge zusammengefügt.'));
const row=document.createElement('label');row.className='field';row.append(document.createTextNode('Ausgabeformat'));const select=document.createElement('select');select.id='format';for(const fmt of ['pdf','txt','md']){const option=document.createElement('option');option.value=fmt;option.textContent=fmt.toUpperCase();select.append(option);}row.append(select);content.append(row);
const box=document.createElement('div');box.id='files';content.append(box);list();
}else if(config.type==='frame'){
$('#title').textContent='Einzelbild speichern';const box=document.createElement('div');box.className='preview';const video=document.createElement('video');video.controls=true;video.src=items[0].url;box.append(video);content.append(box,field('Zeitpunkt (Sekunden)','time','number',0));$('#time').step='.01';$('#time').max='1000000';video.ontimeupdate=()=>$('#time').value=video.currentTime.toFixed(2);$('#time').onchange=()=>video.currentTime=Number($('#time').value);video.onerror=()=>{box.replaceChildren(text('Keine Videovorschau verfügbar. Den Zeitpunkt kannst du unten angeben.'));};
}else if(config.type==='edit'){
$('#title').textContent={crop:'Zuschneiden',resize:'Größe ändern',rotate:'Drehen / Spiegeln'}[config.mode];
$('#save').disabled=true;content.append(text('Vorschau wird geladen …','muted'));
try{preview=await api.preview();content.replaceChildren();aspect=preview.width/preview.height;
if(preview.dataUrl){const box=document.createElement('div');box.className='preview';const canvas=document.createElement('canvas');const image=new Image();image.src=preview.dataUrl;await image.decode();canvas.width=image.width;canvas.height=image.height;box.append(canvas);content.append(box);const ctx=canvas.getContext('2d');const draw=()=>{ctx.clearRect(0,0,canvas.width,canvas.height);ctx.drawImage(image,0,0);if(crop){const sx=canvas.width/preview.width,sy=canvas.height/preview.height;ctx.fillStyle='#ffffff25';ctx.fillRect(crop.x*sx,crop.y*sy,crop.width*sx,crop.height*sy);ctx.strokeStyle='#ffad76';ctx.lineWidth=2;ctx.strokeRect(crop.x*sx,crop.y*sy,crop.width*sx,crop.height*sy);}};draw();
if(config.mode==='crop'){content.append(text('Zum Zuschneiden einen Bereich im Bild aufziehen.'));let start;const point=e=>{const r=canvas.getBoundingClientRect();return{x:Math.round(Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*preview.width),y:Math.round(Math.max(0,Math.min(1,(e.clientY-r.top)/r.height))*preview.height)};};canvas.onpointerdown=e=>{start=point(e);canvas.setPointerCapture(e.pointerId);};canvas.onpointermove=e=>{if(!start)return;const p=point(e);crop={x:Math.min(start.x,p.x),y:Math.min(start.y,p.y),width:Math.max(1,Math.abs(p.x-start.x)),height:Math.max(1,Math.abs(p.y-start.y))};draw();};canvas.onpointerup=()=>start=null;}
}
if(config.mode==='resize'){const fields=document.createElement('div');fields.className='fields';fields.append(field('Breite (px)','width','number',preview.width),field('Höhe (px)','height','number',preview.height));content.append(fields,check('Seitenverhältnis beibehalten','aspect'));$('#aspect').checked=true;$('#width').oninput=()=>{if($('#aspect').checked)$('#height').value=Math.max(1,Math.round(Number($('#width').value)/aspect));};$('#height').oninput=()=>{if($('#aspect').checked)$('#width').value=Math.max(1,Math.round(Number($('#height').value)*aspect));};}
if(config.mode==='rotate'){const label=document.createElement('label');label.className='field';label.append(document.createTextNode('Drehung im Uhrzeigersinn'));const select=document.createElement('select');select.id='rotate';for(const angle of [0,90,180,270]){const option=document.createElement('option');option.value=angle;option.textContent=`${angle}°`;select.append(option);}label.append(select);content.append(label,check('Horizontal spiegeln','flipH'),check('Vertikal spiegeln','flipV'));}
$('#save').disabled=false;
}catch(e){error(e.message);}
}
if(config.type!=='combine'&&config.type!=='password')content.append(field('Dateiname (optional, ohne Endung)','outputName','text'));
}
$('#cancel').onclick=()=>api.submit(null);
$('#save').onclick=()=>{
$('#error').hidden=true;
const invalid=[...document.querySelectorAll('input')].find(input=>!input.checkValidity());if(invalid){invalid.reportValidity();return;}
if(config.type==='password'){const password=$('#password').value;if(!password)return error('Bitte ein Passwort eingeben.');if(config.mode==='add'&&password!==$('#confirm').value)return error('Die Passwörter stimmen nicht überein.');return api.submit(password);}
if(config.type==='combine')return api.submit({files:items.map(x=>x.path),format:$('#format').value});
const result={};for(const id of ['quality','maxSizeMB','width','height','rotate','time']){if($('#'+id)&&$('#'+id).value!=='')result[id]=Number($('#'+id).value);}
for(const id of ['flipH','flipV'])if($('#'+id))result[id]=$('#'+id).checked;
if(config.type==='edit'&&config.mode==='crop'){if(!crop||crop.width<2||crop.height<2)return error('Bitte einen Bildbereich auswählen.');result.crop=crop;}
if($('#outputName')?.value.trim())result.outputName=$('#outputName').value.trim();api.submit(result);
};
document.addEventListener('keydown',e=>{if(e.key==='Escape')api.submit(null);});init().catch(e=>error(e.message));
+1
View File
@@ -0,0 +1 @@
body{display:flex;flex-direction:column;height:100vh;overflow:hidden}header{padding:26px 32px 18px;border-bottom:1px solid var(--line)}h1{font-size:24px;margin:8px 0}header p{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}main{padding:24px 32px;overflow:auto;flex:1}footer{display:flex;gap:10px;align-items:center;padding:18px 32px;border-top:1px solid var(--line)}footer p{margin-right:auto;font-size:12px}.fields{display:grid;grid-template-columns:1fr 1fr;gap:18px}.field{display:flex;flex-direction:column;gap:8px;margin-bottom:18px}.field small{color:var(--muted)}.preview{position:relative;max-width:100%;height:270px;display:flex;align-items:center;justify-content:center;background:var(--panel);border:1px solid var(--line);border-radius:12px;margin-bottom:20px;overflow:hidden}.preview canvas{max-width:100%;max-height:100%;touch-action:none}.preview video{max-height:100%;max-width:100%}input[type=range]{width:100%;accent-color:var(--accent)}.file-row{display:flex;align-items:center;gap:8px;padding:10px 0;border-bottom:1px solid var(--line)}.file-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.file-row button{padding:5px 11px}.check{display:flex;align-items:center;gap:8px;margin:12px 0}input[type=checkbox]{accent-color:var(--accent);width:17px;height:17px}.info{padding:12px 15px;border-radius:8px;background:var(--panel);color:var(--muted);font-size:13px;margin-bottom:18px}
+25
View File
@@ -0,0 +1,25 @@
<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:;">
<title>FileBow</title><link rel="stylesheet" href="../shared.css"><link rel="stylesheet" href="style.css"></head>
<body><aside><div class="brand"><img src="../../../assets/icon.png" alt=""><strong>FileBow</strong></div>
<nav aria-label="Navigation"><button class="nav active" data-page="files"><span>▤</span>Dateien</button><button class="nav" data-page="history"><span>◷</span>Verlauf</button><button class="nav" data-page="settings"><span>⚙</span>Einstellungen</button><button class="nav" data-page="about"><span>ⓘ</span>Über FileBow</button></nav>
<div class="sidebar-bottom"><span class="status-dot"></span>Lokale Verarbeitung<p id="version"></p></div></aside>
<main><section id="page-files"><header><div><div class="eyebrow">DATEIWERKZEUGE</div><h1>Dateien bearbeiten</h1></div><button id="pick" class="primary">Dateien auswählen</button></header>
<div class="dropzone" id="dropzone"><div class="drop-icon">↓</div><h2>Dateien hier ablegen</h2><p>Bilder, Videos, Audio und Dokumente</p><button id="drop-pick">Dateien auswählen</button><div class="drop-hint">Oder im Explorer auswählen und <kbd>Strg + Leertaste</kbd> drücken.</div></div>
<div id="selection" hidden><div class="section-label"><h2>Auswahl <span id="count"></span></h2><button id="clear" class="text-button">Auswahl leeren</button></div><div id="file-list"></div>
<div class="toolbar"><div class="tabs" role="tablist"><button id="tab-quick" role="tab" aria-selected="true">Konvertieren</button><button id="tab-tools" role="tab" aria-selected="false">Werkzeuge</button></div><button id="wheel-open">Radialmenü öffnen ↗</button></div>
<div id="actions" class="actions"></div><p class="output-note">Neue Dateien werden neben den Originalen gespeichert. Bestehende Dateien werden nicht überschrieben.</p></div>
<div class="shortcuts"><div><kbd>Strg + Leertaste</kbd><span>Konvertieren</span></div><div><kbd>Alt + Leertaste</kbd><span>Werkzeuge</span></div><div><kbd>Esc</kbd><span>Radialmenü schließen</span></div></div>
<div id="recent"><div class="section-label"><h2>Letzte Ergebnisse</h2><button id="all-history" class="text-button">Verlauf öffnen →</button></div><div id="recent-list"></div></div></section>
<section id="page-history" hidden><header><div><div class="eyebrow">AUFTRÄGE</div><h1>Verlauf</h1></div><button id="clear-history">Verlauf löschen</button></header><p class="muted">Die letzten 50 Aufträge. Ergebnisdateien bleiben beim Löschen des Verlaufs erhalten.</p><div id="history-list"></div></section>
<section id="page-settings" hidden><header><div><div class="eyebrow">FILEBOW</div><h1>Einstellungen</h1></div></header><div class="settings-list">
<label class="setting"><span><strong>Darstellung</strong><small>Farbschema der App</small></span><select id="theme"><option value="dark">Dunkel</option><option value="light">Hell</option><option value="system">System</option></select></label>
<label class="setting"><span><strong>Mit Windows starten</strong><small>FileBow im Infobereich starten</small></span><input type="checkbox" data-setting="autoStart"></label>
<label class="setting"><span><strong>Tastenkürzel</strong><small>Strg + Leertaste und Alt + Leertaste</small></span><input type="checkbox" data-setting="shortcuts"></label>
<label class="setting"><span><strong>Radialmenü beim Ziehen</strong><small>Bei Dateiauswahl im Explorer öffnen; Alt für Werkzeuge</small></span><input type="checkbox" data-setting="dragWheel"></label>
<label class="setting"><span><strong>Im Hintergrund weiterlaufen</strong><small>Beim Schließen im Infobereich verfügbar bleiben</small></span><input type="checkbox" data-setting="closeToTray"></label>
<label class="setting"><span><strong>Verlauf speichern</strong><small>Dateinamen und Ergebnispfade lokal speichern</small></span><input type="checkbox" data-setting="rememberHistory"></label>
<label class="setting"><span><strong>Hardwarebeschleunigung</strong><small>Für die Oberfläche; Änderung nach Neustart aktiv</small></span><input type="checkbox" data-setting="hardwareAcceleration"></label>
</div><p id="integration-status" class="muted"></p></section>
<section id="page-about" hidden><header><div><div class="eyebrow">DATEIWERKZEUGE FÜR WINDOWS</div><h1>FileBow</h1></div><img class="about-icon" src="../../../assets/icon.png" alt="FileBow"></header><p>Konvertieren, komprimieren und bearbeiten. Direkt über das Radialmenü oder die Dateiauswahl.</p><div class="about-block"><h2>Datenschutz</h2><p>FileBow verarbeitet Dateien auf diesem Gerät. Die App benötigt kein Konto und überträgt keine Dateien oder Nutzungsdaten. Der Verlauf lässt sich in den Einstellungen abschalten.</p></div><div class="about-block"><h2>Unterstützte Formate</h2><p>Bilder: JPEG, PNG, WebP, AVIF, TIFF, BMP, GIF, HEIC/HEIF und ICO.<br>Video: MP4, MOV, MKV, AVI, WebM und weitere FFmpeg-Formate.<br>Audio: MP3, WAV, FLAC, AAC/M4A, OGG und Opus.<br>Dokumente: PDF, TXT, Markdown, DOCX, XLS/XLSX, PPTX, RTF und EPUB.</p><p class="muted">Dokumentkonvertierungen übernehmen den Textinhalt. Gescannte PDFs benötigen eine vorhandene Textebene. Alte DOC- und PPT-Dateien bitte zuerst als DOCX bzw. PPTX speichern.</p></div><div class="about-block"><h2>Open-Source-Komponenten</h2><p>FileBow verwendet Electron, .NET, Python, Pillow, pypdf und FFmpeg sowie weitere Bibliotheken.</p><button id="licenses">Lizenzhinweise öffnen</button></div><p><button id="support" class="text-button">Auf Ko-fi unterstützen ↗</button></p></section>
</main><div id="job" hidden role="status"><div><strong id="job-label"></strong><p id="job-detail"></p></div><progress id="job-progress" max="100"></progress><button id="cancel-job">Abbrechen</button></div><div id="toast" role="status" hidden></div><script src="index.js"></script></body></html>
+30
View File
@@ -0,0 +1,30 @@
const $=selector=>document.querySelector(selector),api=window.orbit;
let state,mode='quick',page='files',toastTimer;
const sizes=bytes=>bytes<1024?`${bytes} B`:bytes<1048576?`${(bytes/1024).toFixed(0)} KB`:`${(bytes/1048576).toFixed(1)} MB`;
function toast(message,error=false){$('#toast').textContent=message;$('#toast').classList.toggle('error-toast',error);$('#toast').hidden=false;clearTimeout(toastTimer);toastTimer=setTimeout(()=>$('#toast').hidden=true,error?12000:6500);}
async function invoke(fn){try{return await fn();}catch(error){toast(error.message.replace(/^Error invoking remote method '[^']+': Error: /,''),true);}}
function navigate(value){page=value;for(const section of document.querySelectorAll('main>section'))section.hidden=section.id!==`page-${page}`;for(const button of document.querySelectorAll('[data-page]')){button.classList.toggle('active',button.dataset.page===page);button.setAttribute('aria-current',button.dataset.page===page?'page':'false');}}
function renderHistory(selector,entries){const parent=$(selector);parent.replaceChildren();if(!entries.length){const empty=document.createElement('div');empty.className='empty';empty.textContent='Noch keine Aufträge.';parent.append(empty);return;}
for(const entry of entries){const row=document.createElement('article');row.className='history-row';const symbol=document.createElement('div');symbol.className='history-symbol';symbol.textContent=entry.status==='success'?'✓':entry.status==='partial'?'!':'×';const body=document.createElement('div');body.className='history-body';const title=document.createElement('strong');title.textContent=entry.label;const info=document.createElement('p');info.textContent=`${entry.count} Ergebnisdatei(en)${entry.status==='error'?' · Fehlgeschlagen':entry.status==='partial'?' · Teilweise abgeschlossen':''}`;body.append(title,info);
if(entry.errors?.length){const error=document.createElement('p');error.textContent=entry.errors.map(x=>`${x.file?x.file+': ':''}${x.message}`).join('\n');body.append(error);}
const outputs=document.createElement('div');outputs.className='outputs';for(const file of entry.outputs||[]){const button=document.createElement('button');button.textContent=file.split(/[\\/]/).pop()+' ↗';button.title=file;button.onclick=()=>invoke(()=>api.reveal(file));outputs.append(button);}body.append(outputs);const date=document.createElement('time');date.dateTime=entry.date;date.textContent=new Date(entry.date).toLocaleString('de-DE',{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit'});row.append(symbol,body,date);parent.append(row);}
}
function render(next){state=next;document.documentElement.dataset.theme=state.theme;$('#version').textContent=`Version ${state.version}`;$('#selection').hidden=!state.files.length;$('#dropzone').hidden=!!state.files.length;$('#count').textContent=`(${state.files.length})`;const list=$('#file-list');list.replaceChildren();
for(const file of state.files){const row=document.createElement('div');row.className='file-item';const badge=document.createElement('span');badge.className='file-badge';badge.textContent=file.name.split('.').pop().toUpperCase().slice(0,5);const name=document.createElement('span');name.className='filename';name.textContent=file.name;name.title=file.path;const size=document.createElement('span');size.className='file-size';size.textContent=sizes(file.size);const remove=document.createElement('button');remove.className='icon';remove.textContent='×';remove.setAttribute('aria-label',`${file.name} aus Auswahl entfernen`);remove.onclick=()=>invoke(()=>api.selectFiles(state.files.filter(x=>x.path!==file.path).map(x=>x.path)));row.append(badge,name,size,remove);list.append(row);}
const actions=$('#actions');actions.replaceChildren();for(const option of state[mode]){const button=document.createElement('button');button.textContent=option.label;button.dataset.action=option.id;button.disabled=!!state.activeJob;button.onclick=()=>invoke(()=>api.choose(option.id));actions.append(button);}
$('#tab-quick').setAttribute('aria-selected',mode==='quick');$('#tab-tools').setAttribute('aria-selected',mode==='tools');
$('#theme').value=state.settings.theme;for(const input of document.querySelectorAll('[data-setting]'))input.checked=state.settings[input.dataset.setting];
const failures=Object.entries(state.shortcuts).filter(([,active])=>!active).map(([key])=>key==='quick'?'Strg + Leertaste':'Alt + Leertaste');
$('#integration-status').textContent=!state.native.available?`Explorer-Anbindung nicht verfügbar: ${state.native.error}`:failures.length?`Tastenkürzel bereits belegt: ${failures.join(', ')}.`:state.packageIdentity.packaged?'Als MSIX installiert.':'Explorer-Anbindung verfügbar.';
renderHistory('#recent-list',state.history.slice(0,2));renderHistory('#history-list',state.history);
$('#clear-history').disabled=!state.history.length;$('#job').hidden=!state.activeJob;
if(state.activeJob){$('#job-label').textContent=state.activeJob.label;$('#job-detail').textContent=state.activeJob.phase==='preparing'?'Einstellungen wählen':`${state.activeJob.done} von ${state.activeJob.total} Dateien`;$('#cancel-job').disabled=state.activeJob.phase!=='running';if(state.activeJob.phase==='running')$('#job-progress').value=state.activeJob.done/state.activeJob.total*100;else $('#job-progress').removeAttribute('value');}
}
for(const button of document.querySelectorAll('[data-page]'))button.onclick=()=>navigate(button.dataset.page);
$('#pick').onclick=$('#drop-pick').onclick=()=>invoke(()=>api.pickFiles());$('#clear').onclick=()=>invoke(()=>api.selectFiles([]));
$('#tab-quick').onclick=()=>{mode='quick';render(state);};$('#tab-tools').onclick=()=>{mode='tools';render(state);};$('#wheel-open').onclick=()=>invoke(()=>api.wheel(mode));$('#all-history').onclick=()=>navigate('history');$('#clear-history').onclick=()=>invoke(()=>api.clearHistory());$('#cancel-job').onclick=()=>invoke(()=>api.cancel());
$('#theme').onchange=e=>invoke(()=>api.settings({theme:e.target.value}));for(const input of document.querySelectorAll('[data-setting]'))input.onchange=()=>invoke(()=>api.settings({[input.dataset.setting]:input.checked}));
$('#support').onclick=()=>invoke(()=>api.support());
$('#licenses').onclick=()=>invoke(()=>api.licenses());
document.addEventListener('dragover',event=>{event.preventDefault();$('#dropzone').classList.add('dragover');});document.addEventListener('dragleave',()=>$('#dropzone').classList.remove('dragover'));document.addEventListener('drop',event=>{event.preventDefault();$('#dropzone').classList.remove('dragover');const paths=api.pathsForFiles(event.dataTransfer.files);if(paths.length){navigate('files');invoke(()=>api.selectFiles(paths));}});
api.onState(render);api.onNotice(({message,error})=>toast(message,error));invoke(async()=>render(await api.state()));
+1
View File
@@ -0,0 +1 @@
body{display:grid;grid-template-columns:204px 1fr;min-height:100vh}aside{position:fixed;top:0;bottom:0;left:0;width:204px;border-right:1px solid var(--line);padding:28px 18px;display:flex;flex-direction:column;background:var(--panel)}.brand{display:flex;align-items:center;gap:11px;padding:0 8px 35px;font-size:21px;letter-spacing:-.5px}.brand img{width:34px;height:34px}nav{display:flex;flex-direction:column;gap:6px}.nav{display:flex;align-items:center;gap:11px;text-align:left;border:0;background:transparent;color:var(--muted);padding:12px}.nav span{width:19px;font-size:18px}.nav:hover{background:var(--raised)}.nav.active{background:var(--raised);color:var(--text)}.nav.active:before{content:'';width:3px;height:18px;background:var(--accent);position:absolute;left:18px;border-radius:2px}.sidebar-bottom{margin-top:auto;padding:20px 8px 0;font-size:11px;color:var(--muted)}.sidebar-bottom p{margin:10px 0 0 12px}.status-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:#a1b994;margin-right:7px}main{grid-column:2;padding:38px 44px 110px;max-width:1250px;width:100%;margin:0 auto}header{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:28px}header h1{font-size:28px;margin:8px 0 0}header .eyebrow{font-size:10px}.dropzone{border:1px dashed #57545c;border-radius:14px;min-height:270px;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center;background:linear-gradient(135deg,color-mix(in srgb,var(--accent) 5%,var(--bg)),var(--bg));padding:25px}.dropzone.dragover{border:2px solid var(--accent);background:var(--raised)}.drop-icon{font-size:27px;color:var(--accent);height:42px;width:42px;border:1px solid var(--line);border-radius:10px;line-height:36px}.dropzone h2{margin:16px 0 0;font-size:18px}.dropzone p{margin:6px 0 17px;color:var(--muted);font-size:13px}.drop-hint{color:var(--muted);font-size:11px;margin-top:23px}.drop-hint kbd{font-size:11px}.shortcuts{display:flex;gap:26px;justify-content:space-between;border-bottom:1px solid var(--line);padding:24px 0;margin-bottom:24px}.shortcuts div{display:flex;flex-direction:column;gap:8px;align-items:flex-start}.shortcuts span{font-size:11px;color:var(--muted)}.section-label{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.section-label h2{font-size:15px;margin:0}.text-button{border:0;background:transparent;color:var(--muted);padding:6px 0;font-size:12px}.text-button:hover{color:var(--accent)}.empty{padding:23px 0;color:var(--muted);font-size:13px}.history-row{display:flex;gap:14px;align-items:flex-start;border-bottom:1px solid var(--line);padding:16px 0}.history-symbol{width:32px;height:32px;line-height:30px;text-align:center;background:var(--raised);border-radius:9px;color:var(--accent);flex-shrink:0}.history-body{flex:1;min-width:0}.history-body strong{font-size:13px;font-weight:550}.history-body p{font-size:11px;color:var(--muted);margin:5px 0 0;white-space:pre-wrap}.history-row time{color:var(--muted);font-size:11px;white-space:nowrap}.outputs{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}.outputs button{font-size:11px;padding:5px 9px;max-width:290px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-item{display:flex;align-items:center;gap:13px;padding:12px 15px;background:var(--panel);border:1px solid var(--line);border-radius:8px;margin:6px 0}.file-badge{font-size:10px;letter-spacing:.5px;color:var(--accent);width:34px}.file-item .filename{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}.file-size{color:var(--muted);font-size:11px}.toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:24px 0 16px}.toolbar>button{font-size:12px;padding:8px 10px}.tabs{display:flex;gap:3px;background:var(--panel);padding:4px;border-radius:8px;border:1px solid var(--line)}.tabs button{border:0;background:transparent;color:var(--muted);font-size:12px;padding:8px 12px}.tabs button[aria-selected=true]{background:var(--raised);color:var(--text)}.actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:9px}.actions button{min-height:60px;background:var(--panel);text-align:left;font-size:12px;padding:12px 14px}.actions button:hover{border-color:var(--accent);color:var(--accent)}.output-note{font-size:11px;color:var(--muted);margin:16px 0}.settings-list{border-top:1px solid var(--line)}.setting{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:21px 0;border-bottom:1px solid var(--line)}.setting span{display:flex;flex-direction:column;gap:6px}.setting strong{font-size:13px;font-weight:550}.setting small{font-size:12px;color:var(--muted)}.setting input[type=checkbox]{width:19px;height:19px}.about-icon{width:78px;height:78px}.about-block{padding:18px 0;border-top:1px solid var(--line)}.about-block p{font-size:13px;color:var(--muted)}#integration-status{font-size:12px}#job{position:fixed;left:228px;right:24px;bottom:20px;backgroundLine truncated
+1
View File
@@ -0,0 +1 @@
:root{color-scheme:dark;--bg:#14161b;--panel:#1b1e24;--raised:#23262e;--line:#30333d;--text:#eeeff3;--muted:#9b9fae;--accent:#efa878;--accentText:#26190f;--danger:#ff9696;font-family:'Segoe UI Variable','Segoe UI',sans-serif;font-size:14px}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text)}html[data-theme=light]{color-scheme:light;--bg:#f7f7f9;--panel:#fff;--raised:#eeeff3;--line:#d9dce3;--text:#22252c;--muted:#686d7a;--accent:#bd561d;--accentText:#fff;--danger:#b61b2c}button,input,select{font:inherit}button{border:1px solid var(--line);color:var(--text);background:var(--raised);border-radius:7px;padding:10px 16px;cursor:pointer;transition:background .12s,border-color .12s}button:hover{border-color:var(--muted)}button:disabled{opacity:.4;cursor:default}button.primary{background:var(--accent);border-color:var(--accent);color:var(--accentText);font-weight:600}button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--accent);outline-offset:3px}input,select{color:var(--text);background:var(--panel);border:1px solid var(--line);border-radius:7px;padding:10px;min-width:0}input[type=checkbox]{accent-color:var(--accent)}.muted{color:var(--muted)}.eyebrow{font-size:11px;font-weight:650;letter-spacing:1.6px;color:var(--accent)}h1,h2,h3,p{overflow-wrap:anywhere}h1{font-weight:600;letter-spacing:-.7px}h2{font-size:18px;font-weight:600}h3{font-size:14px;font-weight:600}p{line-height:1.6}.error{color:var(--danger);background:color-mix(in srgb,var(--danger) 9%,transparent);padding:12px;border-radius:7px;margin-bottom:14px}kbd{font:12px 'Segoe UI',sans-serif;padding:3px 7px;border:1px solid var(--line);border-radius:5px;background:var(--panel);white-space:nowrap}[hidden]{display:none!important}button.icon{padding:5px 9px;background:transparent}a{color:var(--accent)}
+1
View File
@@ -0,0 +1 @@
<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self';"><title>FileBow Radialmenü</title><link rel="stylesheet" href="style.css"></head><body><div id="wheel" role="menu" aria-label="Dateiaktionen"><svg id="segments" viewBox="0 0 500 500" aria-hidden="true"></svg><div id="buttons"></div><div class="center"><span id="mode"></span><strong id="filename"></strong><small id="hint"></small><button id="close" aria-label="Radialmenü schließen">×</button></div></div><script src="index.js"></script></body></html>
+6
View File
@@ -0,0 +1,6 @@
const api=window.filebowWheel,$=s=>document.querySelector(s);let current;
const position=(r,angle)=>{const radians=(angle-90)*Math.PI/180;return[250+r*Math.cos(radians),250+r*Math.sin(radians)];};
function render(data){current=data;document.body.classList.add('visible');$('#wheel').style.left=`${data.center.x-250}px`;$('#wheel').style.top=`${data.center.y-250}px`;$('#filename').textContent=data.title;$('#mode').textContent=data.mode==='tools'?'WERKZEUGE':'KONVERTIEREN';$('#hint').textContent='Aktion wählen oder Datei ablegen';$('#segments').replaceChildren();$('#buttons').replaceChildren();const n=data.options.length,step=360/n;
data.options.forEach((option,index)=>{const start=index*step-step/2+1,end=index*step+step/2-1;const a=position(245,start),b=position(245,end),c=position(109,end),d=position(109,start);const sector=document.createElementNS('http://www.w3.org/2000/svg','path');sector.classList.add('sector');sector.setAttribute('d',`M ${a} A 245 245 0 ${step>180?1:0} 1 ${b} L ${c} A 109 109 0 ${step>180?1:0} 0 ${d} Z`);$('#segments').append(sector);const button=document.createElement('button');button.className='action';button.setAttribute('role','menuitem');button.dataset.id=option.id;const p=position(177,index*step);button.style.left=`${p[0]}px`;button.style.top=`${p[1]}px`;const number=document.createElement('small');number.textContent=String(index+1).padStart(2,'0');button.append(number,document.createTextNode(option.label));button.onclick=()=>api.choose(option.id);button.onmouseenter=button.onfocus=()=>sector.classList.add('active');button.onmouseleave=button.onblur=()=>sector.classList.remove('active');button.ondragover=e=>{e.preventDefault();sector.classList.add('active');};button.ondragleave=()=>sector.classList.remove('active');button.ondrop=e=>{e.preventDefault();e.stopPropagation();api.drop(e.dataTransfer.files,option.id);};$('#buttons').append(button);});
}
api.onState(render);$('#close').onclick=()=>api.cancel();document.addEventListener('keydown',e=>{if(e.key==='Escape')api.cancel();const index=Number(e.key)-1;if(index>=0&&index<current.options.length)api.choose(current.options[index].id);});document.addEventListener('mousedown',e=>{if(e.target===document.body)api.cancel();});document.addEventListener('dragover',e=>e.preventDefault());document.addEventListener('drop',e=>e.preventDefault());
+7
View File
@@ -0,0 +1,7 @@
const { contextBridge, ipcRenderer, webUtils } = require('electron');
contextBridge.exposeInMainWorld('filebowWheel', {
onState: callback => ipcRenderer.on('filebow-wheel:state', (_event,data) => callback(data)),
choose: id => ipcRenderer.send('filebow-wheel:choose',id),
cancel: () => ipcRenderer.send('filebow-wheel:cancel'),
drop: (files,optionId) => ipcRenderer.send('filebow-wheel:drop',{files:Array.from(files).map(file=>webUtils.getPathForFile(file)).filter(Boolean),optionId}),
});
+1
View File
@@ -0,0 +1 @@
:root{color-scheme:dark;font-family:'Segoe UI',sans-serif}*{box-sizing:border-box}body{margin:0;background:transparent;overflow:hidden}#wheel{position:absolute;width:500px;height:500px;filter:drop-shadow(0 8px 18px #0005)}svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.sector{fill:#20232df8;stroke:#44434b;stroke-width:1;transition:fill .1s}.sector.active{fill:#513f35;stroke:#efa878}.action{position:absolute;transform:translate(-50%,-50%);width:118px;height:90px;border:0;background:transparent;color:#f2efec;font-size:12px;line-height:1.4;padding:8px;cursor:pointer;text-align:center;overflow-wrap:anywhere}.action small{display:block;color:#dfaa86;font-size:10px;margin-bottom:7px}.action:focus-visible{outline:2px solid #efa878;outline-offset:0;border-radius:8px}.center{position:absolute;left:150px;top:150px;width:200px;height:200px;border-radius:50%;background:#15171ff8;border:1px solid #4a4242;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:23px;color:#fff}.center>span{font-size:10px;letter-spacing:1.3px;color:#efa878;margin-bottom:10px}.center strong{font-size:12px;font-weight:500;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.center small{color:#a5a4ad;font-size:10px;line-height:1.6;margin-top:8px}.center button{background:none;border:0;color:#aaa;cursor:pointer;font-size:19px;margin-top:6px}body:not(.visible) #wheel{display:none}@media(prefers-reduced-motion:reduce){*{transition:none}}