Timelapse: Add snapshot imeout & SSL validation settings
Implements #2455 & #2362
This commit is contained in:
1 parent
1f9c9bed42
commit
3fcd5adfbd
9 files changed
+45
-3
No files matched your search
@@ -337,6 +337,7 @@ def utilTestPath():
|
||||
url = data["url"]
|
||||
method = data.get("method", "HEAD")
|
||||
timeout = 3.0
|
||||
valid_ssl = True
|
||||
check_status = [status_ranges["normal"]]
|
||||
|
||||
if "timeout" in data:
|
||||
@@ -345,6 +346,9 @@ def utilTestPath():
|
||||
except:
|
||||
return make_response("{!r} is not a valid value for timeout (must be int or float)".format(data["timeout"]), 400)
|
||||
|
||||
if "validSsl" in data:
|
||||
valid_ssl = data["validSsl"] in valid_boolean_trues
|
||||
|
||||
if "status" in data:
|
||||
request_status = data["status"]
|
||||
if not isinstance(request_status, list):
|
||||
@@ -363,7 +367,7 @@ def utilTestPath():
|
||||
check_status.append([code])
|
||||
|
||||
try:
|
||||
response = requests.request(method=method, url=url, timeout=timeout)
|
||||
response = requests.request(method=method, url=url, timeout=timeout, verify=valid_ssl)
|
||||
status = response.status_code
|
||||
except:
|
||||
status = 0
|
||||
|
||||
@@ -101,6 +101,8 @@ def getSettings():
|
||||
"streamRatio": s.get(["webcam", "streamRatio"]),
|
||||
"streamTimeout": s.getInt(["webcam", "streamTimeout"]),
|
||||
"snapshotUrl": s.get(["webcam", "snapshot"]),
|
||||
"snapshotTimeout": s.getInt(["webcam", "snapshotTimeout"]),
|
||||
"snapshotSslValidation": s.getBoolean(["webcam", "snapshotSslValidation"]),
|
||||
"ffmpegPath": s.get(["webcam", "ffmpeg"]),
|
||||
"bitrate": s.get(["webcam", "bitrate"]),
|
||||
"ffmpegThreads": s.get(["webcam", "ffmpegThreads"]),
|
||||
@@ -332,6 +334,8 @@ def _saveSettings(data):
|
||||
if "streamRatio" in data["webcam"] and data["webcam"]["streamRatio"] in ("16:9", "4:3"): s.set(["webcam", "streamRatio"], data["webcam"]["streamRatio"])
|
||||
if "streamTimeout" in data["webcam"]: s.setInt(["webcam", "streamTimeout"], data["webcam"]["streamTimeout"])
|
||||
if "snapshotUrl" in data["webcam"]: s.set(["webcam", "snapshot"], data["webcam"]["snapshotUrl"])
|
||||
if "snapshotTimeout" in data["webcam"]: s.setInt(["webcam", "snapshotTimeout"], data["webcam"]["snapshotTimeout"])
|
||||
if "snapshotSslValidation" in data["webcam"]: s.setBoolean(["webcam", "snapshotSslValidation"], data["webcam"]["snapshotSslValidation"])
|
||||
if "ffmpegPath" in data["webcam"]: s.set(["webcam", "ffmpeg"], data["webcam"]["ffmpegPath"])
|
||||
if "bitrate" in data["webcam"]: s.set(["webcam", "bitrate"], data["webcam"]["bitrate"])
|
||||
if "ffmpegThreads" in data["webcam"]: s.setInt(["webcam", "ffmpegThreads"], data["webcam"]["ffmpegThreads"])
|
||||
|
||||
Reference in new issue
Block a user