Add: Auto-Updater fuer Electron App
- Server: /updates Endpoint fuer Squirrel.Windows Update-Feed - Electron: autoUpdater mit 30min Check-Intervall - Preload: IPC-Events fuer Update-Status ans Frontend Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c8799710ac
commit
5eab3c1956
3 changed files with 59 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import express from 'express';
|
||||
import path from 'node:path';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import http from 'node:http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
import { Client } from 'discord.js';
|
||||
|
|
@ -154,6 +155,18 @@ async function boot(): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
// Squirrel.Windows auto-update feed
|
||||
app.get('/updates', async (_req, res) => {
|
||||
try {
|
||||
const releasesPath = path.join(DATA_DIR, 'downloads', 'RELEASES');
|
||||
const data = await readFile(releasesPath, 'utf-8');
|
||||
res.set('Content-Type', 'application/octet-stream');
|
||||
res.send(data);
|
||||
} catch {
|
||||
res.status(204).end();
|
||||
}
|
||||
});
|
||||
|
||||
// Serve download files (Electron installer etc.)
|
||||
const downloadsDir = path.join(DATA_DIR, 'downloads');
|
||||
app.use('/downloads', express.static(downloadsDir));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue