feat(dashboard): consolidate /api/git-commit into /api/eco/git-commit

This commit is contained in:
2026-04-21 07:17:11 +00:00
parent e0abe5cdfc
commit 0ac0f3b907
3 changed files with 1 additions and 29 deletions

View File

@@ -126,8 +126,6 @@ class TaskBoardHandler(
self.handle_files_post() self.handle_files_post()
elif self.path == '/api/refresh-index': elif self.path == '/api/refresh-index':
self.handle_refresh_index() self.handle_refresh_index()
elif self.path == '/api/git-commit':
self.handle_git_commit()
elif self.path == '/api/pdf': elif self.path == '/api/pdf':
self.handle_pdf_post() self.handle_pdf_post()
elif self.path == '/api/habits': elif self.path == '/api/habits':

View File

@@ -1,8 +1,6 @@
"""Git status / diff / commit handlers for dashboard + workspace projects.""" """Git status / diff / commit handlers for dashboard + workspace projects."""
import json import json
import re
import subprocess import subprocess
import sys
import urllib.error import urllib.error
import urllib.request import urllib.request
from datetime import datetime from datetime import datetime
@@ -25,30 +23,6 @@ class GitHandlers:
timeout=timeout, timeout=timeout,
) )
# ── /api/git-commit (legacy — delegates to tools/git_commit.py) ──
def handle_git_commit(self):
"""Run tools/git_commit.py --push against the echo-core repo."""
try:
script = constants.TOOLS_DIR / 'git_commit.py'
result = subprocess.run(
[sys.executable, str(script), '--push'],
capture_output=True,
text=True,
timeout=60,
cwd=str(constants.BASE_DIR),
)
output = result.stdout + result.stderr
files_match = re.search(r'Files changed: (\d+)', output)
files = int(files_match.group(1)) if files_match else 0
if result.returncode == 0 or 'Pushing...' in output:
self.send_json({'success': True, 'files': files, 'output': output})
else:
self.send_json({'success': False, 'error': output or 'Unknown error'})
except Exception as e:
self.send_json({'success': False, 'error': str(e)}, 500)
# ── /api/git (dashboard repo) ─────────────────────────────── # ── /api/git (dashboard repo) ───────────────────────────────
def handle_git_status(self): def handle_git_status(self):
"""Get git status for the echo-core repo.""" """Get git status for the echo-core repo."""

View File

@@ -1364,7 +1364,7 @@
if (!confirm('Fac commit și push la toate modificările?')) return; if (!confirm('Fac commit și push la toate modificările?')) return;
showToast('Se execută commit...', 'info'); showToast('Se execută commit...', 'info');
try { try {
const response = await fetch('/echo/api/git-commit', { method: 'POST' }); const response = await fetch('/echo/api/eco/git-commit', { method: 'POST' });
const result = await response.json(); const result = await response.json();
if (result.success) { if (result.success) {
showToast('Commit reușit: ' + (result.files || 0) + ' fișiere', 'success'); showToast('Commit reușit: ' + (result.files || 0) + ' fișiere', 'success');