Add IPC handlers for git repository checks and folder relocation
This commit is contained in:
15
main.js
15
main.js
@@ -1087,7 +1087,22 @@ app.whenReady().then(() => {
|
||||
if (settingsWin) settingsWin.close();
|
||||
});
|
||||
|
||||
ipcMain.handle('is-git-repo', async (_e, folderPath) => {
|
||||
const gitFolder = path.join(folderPath, '.git');
|
||||
return fs.existsSync(gitFolder);
|
||||
});
|
||||
|
||||
// Setzt für ein Folder-Objekt den neuen Pfad, needsRelocation => false
|
||||
ipcMain.handle('relocate-folder', async (_e, oldPath, newPath) => {
|
||||
let folders = store.get('folders') || [];
|
||||
folders = folders.map(f =>
|
||||
f.path === oldPath
|
||||
? { ...f, path: newPath, needsRelocation: false }
|
||||
: f
|
||||
);
|
||||
store.set('folders', folders);
|
||||
return folders.find(f => f.path === newPath);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -81,15 +81,13 @@ folders.forEach(folderObj => {
|
||||
const folder = folderObj.path;
|
||||
const isMonitoring = folderObj.monitoring;
|
||||
const li = document.createElement('li');
|
||||
if (folderObj.needsRelocation) {
|
||||
li.classList.add('needs-relocation');
|
||||
}
|
||||
li.setAttribute('data-folder-id', encodeURIComponent(folder));
|
||||
li.className = [
|
||||
'flex items-center justify-between px-3 py-2 rounded cursor-pointer',
|
||||
selected && folder === selected.path ? 'selected' : ''
|
||||
selected && folder === selected.path ? 'selected' : '',
|
||||
folderObj.needsRelocation ? 'needs-relocation' : ''
|
||||
].join(' ');
|
||||
|
||||
|
||||
// beide Buttons schon im Template unter „right“
|
||||
li.innerHTML = `
|
||||
<div class="flex items-center space-x-2 overflow-hidden">
|
||||
|
||||
Reference in New Issue
Block a user