Bug fixes and additional checks
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import sqlite3, subprocess, sys, threading, bcrypt, secrets, time
|
||||
import sqlite3, subprocess, sys, threading, bcrypt, secrets, time, re
|
||||
from flask import Flask, jsonify, request, abort, session
|
||||
from functools import wraps
|
||||
from flask_cors import CORS
|
||||
@@ -278,7 +278,9 @@ def post_regexes_add():
|
||||
"is_blacklist" : {"type" : "boolean"},
|
||||
"mode" : {"type" : "string"},
|
||||
},
|
||||
})
|
||||
})
|
||||
if not re.match("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$",req["regex"]):
|
||||
return abort(400)
|
||||
except Exception:
|
||||
return abort(400)
|
||||
db.query("INSERT INTO regexes (service_id, regex, is_blacklist, mode) VALUES (?, ?, ?, ?);",
|
||||
|
||||
@@ -76,13 +76,14 @@ class ProxyManager:
|
||||
self.lock = threading.Lock()
|
||||
|
||||
def __clear_proxy_table(self):
|
||||
for key in self.proxy_table.keys():
|
||||
if not self.proxy_table[key]["thread"].is_alive():
|
||||
del self.proxy_table[key]
|
||||
with self.lock:
|
||||
for key in list(self.proxy_table.keys()):
|
||||
if not self.proxy_table[key]["thread"].is_alive():
|
||||
del self.proxy_table[key]
|
||||
|
||||
def reload(self):
|
||||
with self.lock:
|
||||
self.__clear_proxy_table()
|
||||
self.__clear_proxy_table()
|
||||
with self.lock:
|
||||
for srv_id in self.db.query('SELECT service_id, status FROM services;'):
|
||||
srv_id, n_status = srv_id
|
||||
if srv_id in self.proxy_table:
|
||||
|
||||
Reference in New Issue
Block a user