RDM-Import, App-Designs, Auto-Update über Gitea, Logo; SFTP-Namensspalte repariert
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// Erzeugt App-Icons aus assets/logo-full.png: npx electron scripts/make-icons.js
|
||||
const { app, nativeImage } = require('electron');
|
||||
const fs = require('fs');
|
||||
app.whenReady().then(() => {
|
||||
const src = nativeImage.createFromPath('assets/logo-full.png');
|
||||
const { width } = src.getSize();
|
||||
const k = width / 1254;
|
||||
// Ausschnitt: Kopf mit Hut, ohne Schriftzug
|
||||
const head = src.crop({ x: Math.round(282 * k), y: Math.round(172 * k), width: Math.round(706 * k), height: Math.round(706 * k) });
|
||||
fs.writeFileSync('build/icon.png', head.resize({ width: 512, height: 512, quality: 'best' }).toPNG());
|
||||
fs.writeFileSync('src/renderer/logo.png', head.resize({ width: 96, height: 96, quality: 'best' }).toPNG());
|
||||
fs.writeFileSync('assets/icon.png', head.resize({ width: 256, height: 256, quality: 'best' }).toPNG());
|
||||
app.quit();
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
// Lädt die gebauten Pakete aus dist/ als Release in das Gitea-Repository hoch.
|
||||
// Nutzung: GITEA_TOKEN=xxx node scripts/release.js [--notes "Text"] [--prerelease]
|
||||
// Mehrere Plattformen: auf Windows und Linux jeweils bauen und ausführen – Assets werden zum selben Release (Tag v<version>) hinzugefügt.
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const REPO = process.env.MRTERM_REPO || 'https://git.mrblake.cc/MrBlake/MrTerm';
|
||||
const token = process.env.GITEA_TOKEN;
|
||||
if (!token) { console.error('GITEA_TOKEN fehlt'); process.exit(1); }
|
||||
const { version } = require('../package.json');
|
||||
const tag = 'v' + version;
|
||||
const u = new URL(REPO);
|
||||
const [owner, repo] = u.pathname.split('/').filter(Boolean);
|
||||
const api = `${u.origin}/api/v1/repos/${owner}/${repo}`;
|
||||
const headers = { Authorization: `token ${token}` };
|
||||
const arg = (n) => { const i = process.argv.indexOf(n); return i > 0 ? process.argv[i + 1] : undefined; };
|
||||
|
||||
(async () => {
|
||||
let res = await fetch(`${api}/releases/tags/${tag}`, { headers });
|
||||
let rel;
|
||||
if (res.ok) rel = await res.json();
|
||||
else {
|
||||
res = await fetch(`${api}/releases`, {
|
||||
method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ tag_name: tag, name: `MrTerm ${version}`, body: arg('--notes') || '', prerelease: process.argv.includes('--prerelease') }),
|
||||
});
|
||||
if (!res.ok) throw new Error(`Release anlegen fehlgeschlagen: ${res.status} ${await res.text()}`);
|
||||
rel = await res.json();
|
||||
console.log('Release angelegt:', rel.html_url);
|
||||
}
|
||||
const files = fs.readdirSync('dist').filter((f) => f.includes(version) && /\.(exe|AppImage|pacman)$/.test(f));
|
||||
if (!files.length) throw new Error('Keine Pakete für ' + version + ' in dist/ gefunden.');
|
||||
for (const f of files) {
|
||||
const old = (rel.assets || []).find((a) => a.name === f);
|
||||
if (old) await fetch(`${api}/releases/${rel.id}/assets/${old.id}`, { method: 'DELETE', headers });
|
||||
const form = new FormData();
|
||||
form.append('attachment', new Blob([fs.readFileSync(path.join('dist', f))]), f);
|
||||
const r = await fetch(`${api}/releases/${rel.id}/assets?name=${encodeURIComponent(f)}`, { method: 'POST', headers, body: form });
|
||||
console.log(r.ok ? '✓' : '✗', f, r.ok ? '' : await r.text());
|
||||
}
|
||||
})().catch((e) => { console.error(e.message); process.exit(1); });
|
||||
Reference in New Issue
Block a user