Add scoped start stop and delete actions for application containers

This commit is contained in:
Mikei386
2026-10-01 10:11:58 +02:00
parent 88c6957dac
commit f66e7fbf71
7 changed files with 82 additions and 4 deletions
+7
View File
@@ -488,6 +488,13 @@ class Handler(BaseHTTPRequestHandler):
with self.server.auth_lock:
self.server.sessions.pop(self.session_token(),None)
return self.respond({'logged_out':True})
if self.path in ('/api/v1/docker/start','/api/v1/docker/stop','/api/v1/docker/delete'):
try:
data=self.read_json();action=self.path.rsplit('/',1)[1]
expected={'id','confirm'} if action=='delete' else {'id'}
if set(data)!=expected or (action=='delete' and data['confirm'] is not True):raise ValueError('Ungültige oder unbestätigte Containeraktion.')
return self.respond(self.server.docker.container_action(action,data['id']))
except (OSError,ValueError) as exc:return self.respond({'error':str(exc) if isinstance(exc,ValueError) else 'Docker-Systemhelfer nicht erreichbar.'},400)
if self.path == '/api/v1/docker/install':
try:
if self.read_json()!={'confirm':True}:raise ValueError('Die Docker-Erstinstallation muss ausdrücklich bestätigt werden.')