[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
4b35bb22e1
commit
ca88603c4b
|
@ -1,7 +1,7 @@
|
||||||
# List of allowed schemes and hosts for external requests
|
# List of allowed schemes and hosts for external requests
|
||||||
ALLOWED_SCHEMES = {'http', 'https'}
|
ALLOWED_SCHEMES = {"http", "https"}
|
||||||
ALLOWED_HOSTS = {
|
ALLOWED_HOSTS = {
|
||||||
'localhost',
|
"localhost",
|
||||||
'127.0.0.1',
|
"127.0.0.1",
|
||||||
# Add other trusted hosts here as needed
|
# Add other trusted hosts here as needed
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,29 +15,25 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import base64
|
import base64
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional, Tuple, Union
|
from typing import Dict, List, Tuple, Union
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import flask
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import requests
|
import requests
|
||||||
from flask import Flask, Response, jsonify, request
|
from allowed_hosts import ALLOWED_HOSTS, ALLOWED_SCHEMES
|
||||||
|
from flask import Flask, jsonify, request
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
from lerobot.data.dataset import Dataset
|
from lerobot.data.dataset import Dataset
|
||||||
from lerobot.data.episode import Episode
|
from lerobot.data.episode import Episode
|
||||||
from lerobot.data.frame import Frame
|
from lerobot.data.frame import Frame
|
||||||
from lerobot.data.utils import get_dataset_path
|
from lerobot.data.utils import get_dataset_path
|
||||||
|
|
||||||
from allowed_hosts import ALLOWED_SCHEMES, ALLOWED_HOSTS
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
CORS(app)
|
CORS(app)
|
||||||
|
|
||||||
|
@ -374,11 +370,13 @@ def proxy():
|
||||||
|
|
||||||
# Don't return the actual response to the user, just a success message
|
# Don't return the actual response to the user, just a success message
|
||||||
# This prevents SSRF attacks where the response might contain sensitive information
|
# This prevents SSRF attacks where the response might contain sensitive information
|
||||||
return jsonify({
|
return jsonify(
|
||||||
|
{
|
||||||
"status": "success",
|
"status": "success",
|
||||||
"message": "Request completed successfully",
|
"message": "Request completed successfully",
|
||||||
"status_code": response.status_code
|
"status_code": response.status_code,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return jsonify({"error": str(e)}), 500
|
return jsonify({"error": str(e)}), 500
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue