mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
secure api access
This commit is contained in:
Regular → Executable
+1
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
|
||||
@@ -599,7 +599,6 @@ def add_args():
|
||||
group.add_argument('--debug', default = False, action='store_true', help = "Run installer with debug logging, default: %(default)s")
|
||||
group.add_argument('--reset', default = False, action='store_true', help = "Reset main repository to latest version, default: %(default)s")
|
||||
group.add_argument('--upgrade', default = False, action='store_true', help = "Upgrade main repository to latest version, default: %(default)s")
|
||||
group.add_argument('--api-only', default = False, action='store_true', help = "Run in API only mode without starting UI")
|
||||
group.add_argument("--use-ipex", default = False, action='store_true', help="Use Intel OneAPI XPU backend, default: %(default)s")
|
||||
group.add_argument('--use-directml', default = False, action='store_true', help = "Use DirectML if no compatible GPU is detected, default: %(default)s")
|
||||
group.add_argument("--use-cuda", default=False, action='store_true', help="Force use nVidia CUDA backend, default: %(default)s")
|
||||
|
||||
@@ -93,6 +93,15 @@ class Api:
|
||||
for auth in shared.cmd_opts.api_auth.split(","):
|
||||
user, password = auth.split(":")
|
||||
self.credentials[user] = password
|
||||
else:
|
||||
if shared.cmd_opts.auth:
|
||||
user, password = [x.strip() for x in shared.cmd_opts.auth.strip('"').replace('\n', '').split(',') if x.strip()]
|
||||
self.credentials[user] = password
|
||||
if shared.cmd_opts.authfile:
|
||||
with open(shared.cmd_opts.authfile, 'r', encoding="utf8") as file:
|
||||
for line in file.readlines():
|
||||
user, password = [x.strip() for x in line.split(',') if x.strip()]
|
||||
self.credentials[user] = password
|
||||
self.router = APIRouter()
|
||||
self.app = app
|
||||
self.queue_lock = queue_lock
|
||||
|
||||
@@ -25,6 +25,7 @@ group.add_argument("--freeze", action='store_true', help="Disable editing settin
|
||||
group.add_argument("--auth", type=str, help='Set access authentication like "user:pwd,user:pwd""', default=None)
|
||||
group.add_argument("--authfile", type=str, help='Set access authentication using file, default: %(default)s', default=None)
|
||||
group.add_argument("--autolaunch", action='store_true', help="Open the UI URL in the system's default browser upon launch", default=False)
|
||||
group.add_argument('--api-only', default = False, action='store_true', help = "Run in API only mode without starting UI")
|
||||
group.add_argument("--api-auth", type=str, help='Set API authentication, default: %(default)s', default=None)
|
||||
group.add_argument("--api-log", default=False, action='store_true', help="Enable logging of all API requests, default: %(default)s")
|
||||
group.add_argument("--device-id", type=str, help="Select the default CUDA device to use, default: %(default)s", default=None)
|
||||
|
||||
Reference in New Issue
Block a user