feat(dashboard): consolidate /api/git-commit into /api/eco/git-commit
This commit is contained in:
@@ -126,8 +126,6 @@ class TaskBoardHandler(
|
||||
self.handle_files_post()
|
||||
elif self.path == '/api/refresh-index':
|
||||
self.handle_refresh_index()
|
||||
elif self.path == '/api/git-commit':
|
||||
self.handle_git_commit()
|
||||
elif self.path == '/api/pdf':
|
||||
self.handle_pdf_post()
|
||||
elif self.path == '/api/habits':
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"""Git status / diff / commit handlers for dashboard + workspace projects."""
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from datetime import datetime
|
||||
@@ -25,30 +23,6 @@ class GitHandlers:
|
||||
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) ───────────────────────────────
|
||||
def handle_git_status(self):
|
||||
"""Get git status for the echo-core repo."""
|
||||
|
||||
@@ -1364,7 +1364,7 @@
|
||||
if (!confirm('Fac commit și push la toate modificările?')) return;
|
||||
showToast('Se execută commit...', 'info');
|
||||
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();
|
||||
if (result.success) {
|
||||
showToast('Commit reușit: ' + (result.files || 0) + ' fișiere', 'success');
|
||||
|
||||
Reference in New Issue
Block a user