forked from Github/frigate
Limit exposed go2rtc api to bare minimum (#8762)
* only permit GET requests to go2rtc * bare minimum go2rtc passthrough * support frigate card * expose go2rtc streams data only
This commit is contained in:
@@ -16,6 +16,7 @@ from urllib.parse import unquote
|
||||
import cv2
|
||||
import numpy as np
|
||||
import pytz
|
||||
import requests
|
||||
from flask import (
|
||||
Blueprint,
|
||||
Flask,
|
||||
@@ -1345,6 +1346,22 @@ def config_schema():
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/go2rtc/streams")
|
||||
def go2rtc_streams():
|
||||
r = requests.get("http://127.0.0.1:1984/api/streams")
|
||||
if not r.ok:
|
||||
logger.error("Failed to fetch streams from go2rtc")
|
||||
return make_response(
|
||||
jsonify({"success": False, "message": "Error fetching stream data"}),
|
||||
500,
|
||||
)
|
||||
stream_data = r.json()
|
||||
for data in stream_data.values():
|
||||
for producer in data["producers"]:
|
||||
producer["url"] = clean_camera_user_pass(producer["url"])
|
||||
return jsonify(stream_data)
|
||||
|
||||
|
||||
@bp.route("/version")
|
||||
def version():
|
||||
return VERSION
|
||||
|
||||
Reference in New Issue
Block a user