Compare commits
2 Commits
56397d11e2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 34731c4e26 | |||
| 22ea72bccc |
10
renderer.js
10
renderer.js
@@ -122,16 +122,8 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
pushBtn.textContent = 'Pushing…';
|
pushBtn.textContent = 'Pushing…';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const hasUncommittedFiles = await window.electronAPI.hasDiffs(selected);
|
|
||||||
if (hasUncommittedFiles) {
|
|
||||||
const confirmed = confirm(
|
|
||||||
'This repository contains uncommitted or untracked files.\n\n' +
|
|
||||||
'Only committed files will be pushed. Continue anyway?'
|
|
||||||
);
|
|
||||||
if (!confirmed) return;
|
|
||||||
}
|
|
||||||
// send the folder‐path to main via a new IPC channel 'push-to-gitea'
|
// send the folder‐path to main via a new IPC channel 'push-to-gitea'
|
||||||
const result = await window.electronAPI.pushToGitea(selected.path, hasUncommittedFiles);
|
const result = await window.electronAPI.pushToGitea(selected.path);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
alert('✔ Pushed successfully to Gitea: ' + result.repoUrl);
|
alert('✔ Pushed successfully to Gitea: ' + result.repoUrl);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -223,36 +223,44 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// OK: alles final speichern
|
// OK: alles final speichern – eine fehlschlagende Einstellung darf die
|
||||||
|
// anderen nicht blockieren und das Fenster muss sich immer schließen.
|
||||||
ok.addEventListener('click', async () => {
|
ok.addEventListener('click', async () => {
|
||||||
await window.settingsAPI.setSkipPrompt(cbSkip.checked);
|
const errors = [];
|
||||||
await window.settingsAPI.setAutostart(cbAutostart.checked);
|
const safe = async (name, promise) => {
|
||||||
await window.settingsAPI.setCloseToTray(cbCloseToTray.checked);
|
try { await promise; } catch (e) { errors.push(`${name}: ${e}`); }
|
||||||
await window.settingsAPI.setTheme(themeSelect.value || fallbackTheme);
|
};
|
||||||
await window.settingsAPI.setRewordMode(rewordModeSelect.value || 'ask');
|
|
||||||
|
await safe('Skip-Prompt', window.settingsAPI.setSkipPrompt(cbSkip.checked));
|
||||||
|
await safe('Autostart', window.settingsAPI.setAutostart(cbAutostart.checked));
|
||||||
|
await safe('Close-to-Tray', window.settingsAPI.setCloseToTray(cbCloseToTray.checked));
|
||||||
|
await safe('Theme', window.settingsAPI.setTheme(themeSelect.value || fallbackTheme));
|
||||||
|
await safe('Reword-Mode', window.settingsAPI.setRewordMode(rewordModeSelect.value || 'ask'));
|
||||||
|
|
||||||
// Threshold speichern (immer Wert aus Feld nehmen!)
|
// Threshold speichern (immer Wert aus Feld nehmen!)
|
||||||
let threshold = parseInt(thresholdInput.value, 10);
|
let threshold = parseInt(thresholdInput.value, 10);
|
||||||
if (isNaN(threshold)) threshold = 10;
|
if (isNaN(threshold)) threshold = 10;
|
||||||
if (threshold < 1) threshold = 1;
|
if (threshold < 1) threshold = 1;
|
||||||
if (threshold > 1000) threshold = 1000;
|
if (threshold > 1000) threshold = 1000;
|
||||||
await window.settingsAPI.setIntelligentCommitThreshold(threshold);
|
await safe('Commit-Threshold', window.settingsAPI.setIntelligentCommitThreshold(threshold));
|
||||||
|
|
||||||
let minutes = parseInt(minutesInput.value, 10);
|
let minutes = parseInt(minutesInput.value, 10);
|
||||||
if (isNaN(minutes)) minutes = 10;
|
if (isNaN(minutes)) minutes = 10;
|
||||||
if (minutes < 1) minutes = 1;
|
if (minutes < 1) minutes = 1;
|
||||||
if (minutes > 1000) minutes = 60;
|
if (minutes > 1000) minutes = 60;
|
||||||
await window.settingsAPI.setMinutesCommitThreshold(minutes);
|
await safe('Minutes-Threshold', window.settingsAPI.setMinutesCommitThreshold(minutes));
|
||||||
|
|
||||||
// Dropdowns speichern
|
// Dropdowns speichern
|
||||||
const commitSel = document.getElementById('commitModelSelect');
|
const commitSel = document.getElementById('commitModelSelect');
|
||||||
const readmeSel = document.getElementById('readmeModelSelect');
|
const readmeSel = document.getElementById('readmeModelSelect');
|
||||||
if (commitSel) await window.settingsAPI.setCommitModel(commitSel.value);
|
if (commitSel) await safe('Commit-Model', window.settingsAPI.setCommitModel(commitSel.value));
|
||||||
if (readmeSel) await window.settingsAPI.setReadmeModel(readmeSel.value);
|
if (readmeSel) await safe('Readme-Model', window.settingsAPI.setReadmeModel(readmeSel.value));
|
||||||
|
|
||||||
await window.settingsAPI.setGiteaToken(giteaTokenInput.value.trim());
|
|
||||||
|
|
||||||
|
await safe('Gitea-Token', window.settingsAPI.setGiteaToken(giteaTokenInput.value.trim()));
|
||||||
|
|
||||||
|
if (errors.length) {
|
||||||
|
alert('Nicht alle Einstellungen konnten gespeichert werden:\n\n' + errors.join('\n'));
|
||||||
|
}
|
||||||
window.settingsAPI.close();
|
window.settingsAPI.close();
|
||||||
});
|
});
|
||||||
// Cancel / Close: Theme zurücksetzen, dann schließen
|
// Cancel / Close: Theme zurücksetzen, dann schließen
|
||||||
|
|||||||
@@ -3557,6 +3557,7 @@ fn set_autostart(state: tauri::State<'_, AppState>, enabled: bool) -> CommandRes
|
|||||||
let auto = auto_launch::AutoLaunchBuilder::new()
|
let auto = auto_launch::AutoLaunchBuilder::new()
|
||||||
.set_app_name("Auto-Git")
|
.set_app_name("Auto-Git")
|
||||||
.set_app_path(exe.to_string_lossy().as_ref())
|
.set_app_path(exe.to_string_lossy().as_ref())
|
||||||
|
.set_use_launch_agent(true)
|
||||||
.build()
|
.build()
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
if enabled {
|
if enabled {
|
||||||
@@ -4886,7 +4887,6 @@ fn push_to_gitea(
|
|||||||
app: AppHandle,
|
app: AppHandle,
|
||||||
state: tauri::State<'_, AppState>,
|
state: tauri::State<'_, AppState>,
|
||||||
folder_path: String,
|
folder_path: String,
|
||||||
allow_dirty: bool,
|
|
||||||
) -> CommandResult<Value> {
|
) -> CommandResult<Value> {
|
||||||
let token = state
|
let token = state
|
||||||
.store
|
.store
|
||||||
@@ -4899,13 +4899,6 @@ fn push_to_gitea(
|
|||||||
json!({ "success": false, "error": "No Gitea API token configured – open Settings and enter it first" }),
|
json!({ "success": false, "error": "No Gitea API token configured – open Settings and enter it first" }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if has_status_changes(&git_status(&folder_path)?) && !allow_dirty {
|
|
||||||
return Ok(json!({
|
|
||||||
"success": false,
|
|
||||||
"code": "DIRTY_WORKTREE",
|
|
||||||
"error": "The repository contains uncommitted or untracked files. Confirm the warning before pushing."
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
let result = (|| -> CommandResult<Value> {
|
let result = (|| -> CommandResult<Value> {
|
||||||
let folder_name = Path::new(&folder_path)
|
let folder_name = Path::new(&folder_path)
|
||||||
.file_name()
|
.file_name()
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
hasReadme: folderPath => invoke('has_readme', { folderPath }),
|
hasReadme: folderPath => invoke('has_readme', { folderPath }),
|
||||||
generateReadme: folderPath => invoke('generate_readme', { folderPath }),
|
generateReadme: folderPath => invoke('generate_readme', { folderPath }),
|
||||||
squashCommits: folderPath => invoke('squash_commits', { folderPath }),
|
squashCommits: folderPath => invoke('squash_commits', { folderPath }),
|
||||||
pushToGitea: (folderPath, allowDirty = false) => invoke('push_to_gitea', { folderPath, allowDirty }),
|
pushToGitea: folderPath => invoke('push_to_gitea', { folderPath }),
|
||||||
initRepo: folderPath => invoke('init_repo', { folderPath }),
|
initRepo: folderPath => invoke('init_repo', { folderPath }),
|
||||||
triggerRewriteNow: folderPath => invoke('trigger_rewrite_now', { folderPath }),
|
triggerRewriteNow: folderPath => invoke('trigger_rewrite_now', { folderPath }),
|
||||||
rewriteCommit: (folderPath, hash) => invoke('rewrite_commit', { folderPath, hash }),
|
rewriteCommit: (folderPath, hash) => invoke('rewrite_commit', { folderPath, hash }),
|
||||||
|
|||||||
Reference in New Issue
Block a user