Added Settings router
This commit is contained in:
@ -54,6 +54,7 @@ def create_app() -> FastAPI:
|
|||||||
app.include_router(routers.config.router, prefix='/config', tags=['Config Management[Web]']) # Add config router
|
app.include_router(routers.config.router, prefix='/config', tags=['Config Management[Web]']) # Add config router
|
||||||
app.include_router(routers.user.router, prefix='/users', tags=['User Management[Web]']) # Add user router
|
app.include_router(routers.user.router, prefix='/users', tags=['User Management[Web]']) # Add user router
|
||||||
app.include_router(routers.api.v1.api_v1_router, prefix='/api/v1', tags=['API Version 1']) # Add API version 1 router # type: ignore
|
app.include_router(routers.api.v1.api_v1_router, prefix='/api/v1', tags=['API Version 1']) # Add API version 1 router # type: ignore
|
||||||
|
app.include_router(routers.settings.router, prefix='/settings', tags=['Settings[Web]']) # Add settings router
|
||||||
|
|
||||||
# Document that the API requires an API key
|
# Document that the API requires an API key
|
||||||
setup_openapi_schema(app)
|
setup_openapi_schema(app)
|
||||||
|
|||||||
@ -3,3 +3,4 @@ from . import api
|
|||||||
from . import user
|
from . import user
|
||||||
from . import login
|
from . import login
|
||||||
from . import config
|
from . import config
|
||||||
|
from . import settings
|
||||||
1
core/scripts/webpanel/routers/settings/__init__.py
Normal file
1
core/scripts/webpanel/routers/settings/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from .settings import router
|
||||||
11
core/scripts/webpanel/routers/settings/settings.py
Normal file
11
core/scripts/webpanel/routers/settings/settings.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from fastapi import APIRouter, Depends, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
from dependency import get_templates
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
@router.get('/')
|
||||||
|
async def settings(request: Request, templates: Jinja2Templates = Depends(get_templates)):
|
||||||
|
return templates.TemplateResponse('settings.html', {'request': request})
|
||||||
|
|
||||||
@ -73,6 +73,12 @@
|
|||||||
<p>Config</p>
|
<p>Config</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{ url_for('settings') }}" class="nav-link {% if request.path == url_for('settings') %}active{% endif %}">
|
||||||
|
<i class="nav-icon fas fa-tools"></i>
|
||||||
|
<p>settings</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
150
core/scripts/webpanel/templates/settings.html
Normal file
150
core/scripts/webpanel/templates/settings.html
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Settings{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="content-header">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<h1 class="m-0">Settings</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="card card-primary card-outline card-tabs">
|
||||||
|
<div class="card-header p-0 pt-1 border-bottom-0">
|
||||||
|
<ul class="nav nav-pills" id="custom-tabs-three-tab" role="tablist">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" id="telegram-tab" data-toggle="pill" href="#telegram"
|
||||||
|
role="tab" aria-controls="telegram" aria-selected="true">Telegram Bot</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="subs-tab" data-toggle="pill" href="#subs" role="tab"
|
||||||
|
aria-controls="subs" aria-selected="false">Subscriptions</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="sni-tab" data-toggle="pill" href="#sni" role="tab"
|
||||||
|
aria-controls="sni" aria-selected="false">SNI</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="ip-tab" data-toggle="pill" href="#change_ip" role="tab"
|
||||||
|
aria-controls="change_ip" aria-selected="false">Change IP</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="tab-content" id="custom-tabs-three-tabContent">
|
||||||
|
|
||||||
|
<!-- Telegram Bot Tab -->
|
||||||
|
<div class="tab-pane fade show active" id="telegram" role="tabpanel"
|
||||||
|
aria-labelledby="telegram-tab">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="telegram_api_token">API Token:</label>
|
||||||
|
<input type="text" class="form-control" id="telegram_api_token"
|
||||||
|
placeholder="Enter API Token">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="telegram_admin_id">Admin ID:</label>
|
||||||
|
<input type="text" class="form-control" id="telegram_admin_id"
|
||||||
|
placeholder="Enter Admin ID">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-success">Accept</button>
|
||||||
|
<button type="button" class="btn btn-danger">Remove</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Subscriptions Tab -->
|
||||||
|
<div class="tab-pane fade" id="subs" role="tabpanel" aria-labelledby="subs-tab">
|
||||||
|
<ul class="nav nav-tabs" id="subs-tabs" role="tablist">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" id="singbox-tab" data-toggle="tab" href="#singbox"
|
||||||
|
role="tab" aria-controls="singbox" aria-selected="true">SingBox</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="normal-tab" data-toggle="tab" href="#normal" role="tab"
|
||||||
|
aria-controls="normal" aria-selected="false">Normal</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content" id="subs-tabs-content">
|
||||||
|
|
||||||
|
<!-- SingBox Sub Tab -->
|
||||||
|
<div class="tab-pane fade show active" id="singbox" role="tabpanel"
|
||||||
|
aria-labelledby="singbox-tab">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="singbox_domain">Domain:</label>
|
||||||
|
<input type="text" class="form-control" id="singbox_domain"
|
||||||
|
placeholder="Enter Domain">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="singbox_port">Port:</label>
|
||||||
|
<input type="text" class="form-control" id="singbox_port"
|
||||||
|
placeholder="Enter Port">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-success">Accept</button>
|
||||||
|
<button type="button" class="btn btn-danger">Remove</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Normal Sub Tab -->
|
||||||
|
<div class="tab-pane fade" id="normal" role="tabpanel" aria-labelledby="normal-tab">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="normal_domain">Domain:</label>
|
||||||
|
<input type="text" class="form-control" id="normal_domain"
|
||||||
|
placeholder="Enter Domain">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="normal_port">Port:</label>
|
||||||
|
<input type="text" class="form-control" id="normal_port"
|
||||||
|
placeholder="Enter Port">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-success">Accept</button>
|
||||||
|
<button type="button" class="btn btn-danger">Remove</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SNI Tab -->
|
||||||
|
<div class="tab-pane fade" id="sni" role="tabpanel" aria-labelledby="sni-tab">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="sni_domain">Domain:</label>
|
||||||
|
<input type="text" class="form-control" id="sni_domain"
|
||||||
|
placeholder="Enter Domain">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Change</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Change IP Tab -->
|
||||||
|
<div class="tab-pane fade" id="change_ip" role="tabpanel" aria-labelledby="ip-tab">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="ipv4">IPv4:</label>
|
||||||
|
<input type="text" class="form-control" id="ipv4" placeholder="Enter IPv4">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="ipv6">IPv6:</label>
|
||||||
|
<input type="text" class="form-control" id="ipv6" placeholder="Enter IPv6">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Save</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.card -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user