Skip to content

Commit 6b9e1fe

Browse files
committed
v1.0.0 (4)
1 parent 0523f60 commit 6b9e1fe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,9 @@ def enabled_handler(enabled: bool, request: Request):
186186
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED)
187187
print(f"enabled={enabled}")
188188
try:
189+
r = ""
189190
if enabled:
190-
ocs_call(
191+
result = ocs_call(
191192
"POST",
192193
"/ocs/v1.php/apps/app_api/api/v1/files/actions/menu",
193194
json_data={
@@ -200,15 +201,19 @@ def enabled_handler(enabled: bool, request: Request):
200201
}
201202
},
202203
)
204+
response_data = json.loads(result.text)
205+
ocs_meta = response_data["ocs"]["meta"]
206+
if ocs_meta["status"] != "ok":
207+
r = f"error: {ocs_meta['message']}"
203208
else:
204209
ocs_call(
205210
"DELETE",
206211
"/ocs/v1.php/apps/app_api/api/v1/files/actions/menu",
207212
json_data={"fileActionMenuName": "upscale"},
208213
)
209-
r = ""
210214
except Exception as e:
211215
r = str(e)
216+
print(f"enabled={enabled} -> {r}")
212217
return responses.JSONResponse(content={"error": r}, status_code=200)
213218

214219

0 commit comments

Comments
 (0)