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:
@@ -7,6 +7,7 @@ const { utils: sshUtils } = require('ssh2');
|
||||
const { Store } = require('./store');
|
||||
const { SshManager } = require('./ssh');
|
||||
const rdp = require('./rdp');
|
||||
const { Updater } = require('./updater');
|
||||
|
||||
let win;
|
||||
const store = new Store();
|
||||
@@ -42,6 +43,7 @@ function askSecret(sessionId, req) {
|
||||
}
|
||||
|
||||
const ssh = new SshManager(store, confirmHostKey, askSecret);
|
||||
const updater = new Updater(store, send);
|
||||
|
||||
function createWindow() {
|
||||
win = new BrowserWindow({
|
||||
@@ -50,6 +52,7 @@ function createWindow() {
|
||||
minWidth: 900,
|
||||
minHeight: 560,
|
||||
backgroundColor: '#14161d',
|
||||
icon: path.join(__dirname, '..', '..', 'assets', 'icon.png'),
|
||||
frame: false,
|
||||
titleBarStyle: process.platform === 'darwin' ? 'hiddenInset' : 'hidden',
|
||||
webPreferences: {
|
||||
@@ -241,6 +244,46 @@ handle('rdp:launch', (hostId) => {
|
||||
return r.client;
|
||||
});
|
||||
|
||||
// ---------- Import aus anderen Programmen (z. B. Devolutions RDM) ----------
|
||||
handle('import:pickFile', async (title, extensions) => {
|
||||
const r = await dialog.showOpenDialog(win, { title, filters: [{ name: title, extensions }, { name: 'Alle Dateien', extensions: ['*'] }], properties: ['openFile'] });
|
||||
if (r.canceled) return null;
|
||||
const buf = fs.readFileSync(r.filePaths[0]);
|
||||
// UTF-16-Exporte (BOM) erkennen
|
||||
const text = buf[0] === 0xff && buf[1] === 0xfe ? buf.toString('utf16le') : buf.toString('utf8');
|
||||
return { name: path.basename(r.filePaths[0]), content: text.replace(/^/, '') };
|
||||
});
|
||||
// entries: [{ folder: ['A','B'], host?: {...} }] – Ordner werden per Pfad angelegt bzw. wiederverwendet
|
||||
handle('vault:bulkImport', (entries) => {
|
||||
const groups = store.get().groups;
|
||||
const ensure = (parts) => {
|
||||
let parent = null;
|
||||
for (const label of parts) {
|
||||
let g = groups.find((x) => (x.parentId || null) === parent && x.label.toLowerCase() === label.toLowerCase());
|
||||
if (!g) { g = { id: crypto.randomUUID(), label, parentId: parent, createdAt: Date.now() }; groups.push(g); }
|
||||
parent = g.id;
|
||||
}
|
||||
return parent;
|
||||
};
|
||||
let hosts = 0, skipped = 0;
|
||||
for (const e of entries) {
|
||||
const groupId = ensure(e.folder || []);
|
||||
if (!e.host) continue;
|
||||
const dup = store.get().hosts.find((h) => h.address === e.host.address && (h.groupId || null) === groupId && (h.label || '') === (e.host.label || '') && (h.protocol || 'ssh') === e.host.protocol);
|
||||
if (dup) { skipped++; continue; }
|
||||
store.get().hosts.push({ ...e.host, id: crypto.randomUUID(), groupId, createdAt: Date.now(), updatedAt: Date.now() });
|
||||
hosts++;
|
||||
}
|
||||
store.save();
|
||||
return { hosts, skipped, groups: groups.length };
|
||||
});
|
||||
|
||||
// ---------- Updates ----------
|
||||
handle('update:check', () => updater.check());
|
||||
handle('update:download', () => updater.download());
|
||||
handle('update:install', () => updater.install());
|
||||
handle('app:version', () => app.getVersion());
|
||||
|
||||
handle('clipboard:write', (t) => clipboard.writeText(t));
|
||||
handle('clipboard:read', () => clipboard.readText());
|
||||
handle('shell:open', (url) => shell.openExternal(url));
|
||||
@@ -248,6 +291,9 @@ handle('shell:open', (url) => shell.openExternal(url));
|
||||
app.whenReady().then(() => {
|
||||
store.load();
|
||||
createWindow();
|
||||
if (store.get().settings.updateAutoCheck && app.isPackaged) {
|
||||
setTimeout(() => updater.check().then((r) => { if (r.available) send('update:available', r); }).catch(() => {}), 6000);
|
||||
}
|
||||
});
|
||||
app.on('window-all-closed', () => { ssh.closeAll(); app.quit(); });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user