add: filtering table of firewall + InterfaceSelector frontend fixes and improves
This commit is contained in:
@@ -12,8 +12,8 @@ socketio:SocketManager = None
|
||||
|
||||
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
||||
ROUTERS_DIR = os.path.join(ROOT_DIR,"routers")
|
||||
ON_DOCKER = len(sys.argv) > 1 and sys.argv[1] == "DOCKER"
|
||||
DEBUG = len(sys.argv) > 1 and sys.argv[1] == "DEBUG"
|
||||
ON_DOCKER = "DOCKER" in sys.argv
|
||||
DEBUG = "DEBUG" in sys.argv
|
||||
FIREGEX_PORT = int(os.getenv("PORT","4444"))
|
||||
JWT_ALGORITHM: str = "HS256"
|
||||
API_VERSION = "2.2.0"
|
||||
@@ -44,10 +44,11 @@ class SysctlManager:
|
||||
for name in ctl_table.keys():
|
||||
self.old_table[name] = read_sysctl(name)
|
||||
|
||||
def write_table(self, table):
|
||||
def write_table(self, table) -> bool:
|
||||
for name, value in table.items():
|
||||
write_sysctl(name, value)
|
||||
|
||||
if read_sysctl(name) != value:
|
||||
write_sysctl(name, value)
|
||||
|
||||
def set(self):
|
||||
self.write_table(self.new_table)
|
||||
|
||||
@@ -124,7 +125,6 @@ class NFTableManager(Singleton):
|
||||
|
||||
def cmd(self, *cmds):
|
||||
code, out, err = self.raw_cmd(*cmds)
|
||||
|
||||
if code == 0: return out
|
||||
else: raise Exception(err)
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
|
||||
import os, httpx
|
||||
from typing import Callable
|
||||
from fastapi import APIRouter, WebSocket
|
||||
import asyncio
|
||||
from fastapi import APIRouter
|
||||
from starlette.responses import StreamingResponse
|
||||
from fastapi.responses import FileResponse
|
||||
from utils import DEBUG, ON_DOCKER, ROUTERS_DIR, list_files, run_func
|
||||
from utils.models import ResetRequest
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
REACT_BUILD_DIR: str = "../frontend/build/" if not ON_DOCKER else "frontend/"
|
||||
REACT_HTML_PATH: str = os.path.join(REACT_BUILD_DIR,"index.html")
|
||||
@@ -26,15 +24,6 @@ async def react_deploy(path):
|
||||
return FileResponse(file_request)
|
||||
|
||||
def frontend_deploy(app):
|
||||
if DEBUG:
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
@app.get("/{full_path:path}", include_in_schema=False)
|
||||
async def catch_all(full_path:str):
|
||||
if DEBUG:
|
||||
|
||||
Reference in New Issue
Block a user