history: report user in job history
When possible record the name of the user that requested the job. The klippy_api's component now takes an optional user argument in its "start_print" method. This user is broadcast in an event after a print request successfully returns. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
@@ -388,9 +388,10 @@ class OctoPrintCompat:
|
||||
except self.server.error:
|
||||
pstate = "not_avail"
|
||||
started: bool = False
|
||||
user = web_request.get_current_user()
|
||||
if pstate not in ["printing", "paused", "not_avail"]:
|
||||
try:
|
||||
await self.klippy_apis.start_print(filename)
|
||||
await self.klippy_apis.start_print(filename, user=user)
|
||||
except self.server.error:
|
||||
started = False
|
||||
else:
|
||||
@@ -400,7 +401,7 @@ class OctoPrintCompat:
|
||||
if fmgr.upload_queue_enabled():
|
||||
job_queue: JobQueue = self.server.lookup_component(
|
||||
'job_queue')
|
||||
await job_queue.queue_job(filename, check_exists=False)
|
||||
await job_queue.queue_job(filename, check_exists=False, user=user)
|
||||
logging.debug(f"Job '{filename}' queued via OctoPrint API")
|
||||
else:
|
||||
raise self.server.error("Conflict", 409)
|
||||
|
Reference in New Issue
Block a user