nya-proxy 0.4.2__tar.gz → 0.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/PKG-INFO +9 -4
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/README.md +6 -0
- nya_proxy-0.4.4/nya/_version.py +1 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/config/manager.py +17 -9
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/core/control.py +0 -4
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/dashboard/api.py +18 -13
- nya_proxy-0.4.4/nya/html/index.html +386 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/server/app.py +13 -11
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya_proxy.egg-info/PKG-INFO +9 -4
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya_proxy.egg-info/requires.txt +2 -3
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/pyproject.toml +3 -4
- nya_proxy-0.4.2/nya/_version.py +0 -1
- nya_proxy-0.4.2/nya/html/index.html +0 -664
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/LICENSE +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/__init__.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/common/__init__.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/common/constants.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/common/exceptions.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/common/models.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/config/__init__.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/config.yaml +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/core/__init__.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/core/handler.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/core/proxy.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/core/queue.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/core/request.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/core/streaming.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/dashboard/__init__.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/html/favicon.ico +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/html/login.html +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/html/static/css/styles.css +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/html/static/js/dashboard.js +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/html/static/logo.svg +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/schema.json +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/server/__init__.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/server/auth.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/services/__init__.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/services/lb.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/services/limit.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/services/metrics.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/utils/__init__.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/utils/header.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya/utils/helper.py +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya_proxy.egg-info/SOURCES.txt +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya_proxy.egg-info/dependency_links.txt +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya_proxy.egg-info/entry_points.txt +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/nya_proxy.egg-info/top_level.txt +0 -0
- {nya_proxy-0.4.2 → nya_proxy-0.4.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nya-proxy
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.4
|
|
4
4
|
Summary: A lightweight, flexible API proxy with dynamic token rotation, load balancing, and rate limiting capabilities.
|
|
5
5
|
Author-email: "Nya Foundation Team (k3scat)" <k3scat@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -16,17 +16,16 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
16
16
|
Requires-Python: >=3.10
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: fastapi>=0.
|
|
19
|
+
Requires-Dist: fastapi>=0.100.0
|
|
20
20
|
Requires-Dist: uvicorn>=0.22.0
|
|
21
21
|
Requires-Dist: httpx>=0.24.0
|
|
22
22
|
Requires-Dist: httpx-socks>=0.10.0
|
|
23
|
-
Requires-Dist: jinja2>=3.1.2
|
|
24
23
|
Requires-Dist: setuptools>=42.0.0
|
|
25
24
|
Requires-Dist: watchfiles>=0.18.0
|
|
26
25
|
Requires-Dist: jmespath>=1.0.1
|
|
27
26
|
Requires-Dist: orjson<4,>=3.10
|
|
28
27
|
Requires-Dist: loguru>=0.7.0
|
|
29
|
-
Requires-Dist: nekoconf[remote,schema,server]==1.1
|
|
28
|
+
Requires-Dist: nekoconf[remote,schema,server]==1.2.1
|
|
30
29
|
Provides-Extra: dev
|
|
31
30
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
32
31
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
@@ -41,6 +40,11 @@ Dynamic: license-file
|
|
|
41
40
|
|
|
42
41
|
# 🐾 NyaProxy - Universal API Proxy
|
|
43
42
|
|
|
43
|
+
**📖 多言語ドキュメント / Multi-language Documentation:**
|
|
44
|
+
- [English](README.md)
|
|
45
|
+
- [简体中文](README_zh.md)
|
|
46
|
+
- [日本語](README_ja.md)
|
|
47
|
+
|
|
44
48
|
<div align="center">
|
|
45
49
|
<img src="https://raw.githubusercontent.com/Nya-Foundation/NyaProxy/main/assets/banner.png" alt="NyaProxy Banner" width="800" />
|
|
46
50
|
|
|
@@ -60,6 +64,7 @@ Dynamic: license-file
|
|
|
60
64
|
<a href="https://github.com/nya-foundation/nyaproxy/actions/workflows/scan.yml"><img src="https://github.com/nya-foundation/nyaproxy/actions/workflows/scan.yml/badge.svg" alt="CodeQL & Dependencies Scan"/></a>
|
|
61
65
|
<a href="https://github.com/Nya-Foundation/nyaproxy/actions/workflows/publish.yml"><img src="https://github.com/Nya-Foundation/nyaproxy/actions/workflows/publish.yml/badge.svg" alt="CI/CD Builds"/></a>
|
|
62
66
|
</div>
|
|
67
|
+
|
|
63
68
|
</div>
|
|
64
69
|
|
|
65
70
|
## 🌈 Introduction
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# 🐾 NyaProxy - Universal API Proxy
|
|
2
2
|
|
|
3
|
+
**📖 多言語ドキュメント / Multi-language Documentation:**
|
|
4
|
+
- [English](README.md)
|
|
5
|
+
- [简体中文](README_zh.md)
|
|
6
|
+
- [日本語](README_ja.md)
|
|
7
|
+
|
|
3
8
|
<div align="center">
|
|
4
9
|
<img src="https://raw.githubusercontent.com/Nya-Foundation/NyaProxy/main/assets/banner.png" alt="NyaProxy Banner" width="800" />
|
|
5
10
|
|
|
@@ -19,6 +24,7 @@
|
|
|
19
24
|
<a href="https://github.com/nya-foundation/nyaproxy/actions/workflows/scan.yml"><img src="https://github.com/nya-foundation/nyaproxy/actions/workflows/scan.yml/badge.svg" alt="CodeQL & Dependencies Scan"/></a>
|
|
20
25
|
<a href="https://github.com/Nya-Foundation/nyaproxy/actions/workflows/publish.yml"><img src="https://github.com/Nya-Foundation/nyaproxy/actions/workflows/publish.yml/badge.svg" alt="CI/CD Builds"/></a>
|
|
21
26
|
</div>
|
|
27
|
+
|
|
22
28
|
</div>
|
|
23
29
|
|
|
24
30
|
## 🌈 Introduction
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.4"
|
|
@@ -6,7 +6,7 @@ import os
|
|
|
6
6
|
from typing import Any, Callable, Dict, List, Optional, TypeVar, Union
|
|
7
7
|
|
|
8
8
|
from loguru import logger
|
|
9
|
-
from nekoconf import NekoConf, NekoConfOrchestrator
|
|
9
|
+
from nekoconf import EventType, NekoConf, NekoConfOrchestrator
|
|
10
10
|
from nekoconf.storage import FileStorageBackend, RemoteStorageBackend
|
|
11
11
|
|
|
12
12
|
from nya.common.exceptions import ConfigurationError
|
|
@@ -48,7 +48,6 @@ class ConfigManager:
|
|
|
48
48
|
self.remote_url = remote_url
|
|
49
49
|
self.remote_api_key = remote_api_key
|
|
50
50
|
self.remote_app_name = remote_app_name
|
|
51
|
-
|
|
52
51
|
self.callback = callback
|
|
53
52
|
|
|
54
53
|
if config_path and not os.path.exists(config_path):
|
|
@@ -65,7 +64,9 @@ class ConfigManager:
|
|
|
65
64
|
storage: Union[FileStorageBackend, RemoteStorageBackend, None] = None
|
|
66
65
|
|
|
67
66
|
if self.remote_url:
|
|
68
|
-
logger.info(
|
|
67
|
+
logger.info(
|
|
68
|
+
f"[NyaProxy] Using remote configuration server: {self.remote_url}"
|
|
69
|
+
)
|
|
69
70
|
storage = RemoteStorageBackend(
|
|
70
71
|
remote_url=self.remote_url,
|
|
71
72
|
api_key=self.remote_api_key,
|
|
@@ -73,12 +74,11 @@ class ConfigManager:
|
|
|
73
74
|
logger=logger,
|
|
74
75
|
)
|
|
75
76
|
else:
|
|
76
|
-
logger.info(
|
|
77
|
+
logger.info(
|
|
78
|
+
f"[NyaProxy] Using local configuration file: {self.config_path}"
|
|
79
|
+
)
|
|
77
80
|
storage = FileStorageBackend(config_path=self.config_path, logger=logger)
|
|
78
81
|
|
|
79
|
-
if self.callback:
|
|
80
|
-
storage.set_change_callback(self.callback)
|
|
81
|
-
|
|
82
82
|
if not storage:
|
|
83
83
|
raise ConfigurationError(
|
|
84
84
|
"No storage backend configured. Please set a config path or remote URL."
|
|
@@ -93,12 +93,20 @@ class ConfigManager:
|
|
|
93
93
|
env_prefix="NYA",
|
|
94
94
|
)
|
|
95
95
|
|
|
96
|
+
if self.callback:
|
|
97
|
+
client.event_pipeline.register_handler(
|
|
98
|
+
self.callback,
|
|
99
|
+
EventType.CHANGE,
|
|
100
|
+
path_pattern="@global",
|
|
101
|
+
priority=10,
|
|
102
|
+
)
|
|
103
|
+
|
|
96
104
|
# Validate against the schema
|
|
97
105
|
results = client.validate()
|
|
98
106
|
if results:
|
|
99
107
|
raise ConfigurationError(f"Configuration validation failed: {results}")
|
|
100
108
|
|
|
101
|
-
logger.info("
|
|
109
|
+
logger.info("[NyaProxy] NekoConf client configuration validated successfully")
|
|
102
110
|
return client
|
|
103
111
|
|
|
104
112
|
def init_config_server(self) -> NekoConfOrchestrator:
|
|
@@ -509,7 +517,7 @@ class ConfigManager:
|
|
|
509
517
|
nya_app = [{"NyaProxy": self.config}]
|
|
510
518
|
self.server = NekoConfOrchestrator(apps=nya_app, logger=logger)
|
|
511
519
|
|
|
512
|
-
logger.info("Configuration reloaded successfully")
|
|
520
|
+
logger.info("[NyaProxy] Configuration reloaded successfully")
|
|
513
521
|
except Exception as e:
|
|
514
522
|
logger.error(f"Failed to reload configuration: {str(e)}")
|
|
515
523
|
raise ConfigurationError(f"Failed to reload configuration: {str(e)}")
|
|
@@ -242,10 +242,6 @@ class TrafficManager:
|
|
|
242
242
|
key_limiter.release()
|
|
243
243
|
key_limiter.unlock()
|
|
244
244
|
|
|
245
|
-
# additional metrics update to support the key selection (least_requests)
|
|
246
|
-
key_lb = self.get_load_balancer(api_name)
|
|
247
|
-
key_lb.update_request_count(key, -1)
|
|
248
|
-
|
|
249
245
|
def release_ip(self, api_name: str, ip: str) -> None:
|
|
250
246
|
"""
|
|
251
247
|
Release the most recent request for a specific IP address.
|
|
@@ -8,10 +8,9 @@ from pathlib import Path
|
|
|
8
8
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional
|
|
9
9
|
|
|
10
10
|
import uvicorn
|
|
11
|
-
from fastapi import FastAPI, Query, Request
|
|
12
|
-
from fastapi.responses import FileResponse, JSONResponse
|
|
11
|
+
from fastapi import FastAPI, HTTPException, Query, Request, status
|
|
12
|
+
from fastapi.responses import FileResponse, HTMLResponse, JSONResponse
|
|
13
13
|
from fastapi.staticfiles import StaticFiles
|
|
14
|
-
from fastapi.templating import Jinja2Templates
|
|
15
14
|
from loguru import logger
|
|
16
15
|
|
|
17
16
|
from .._version import __version__
|
|
@@ -70,9 +69,6 @@ class DashboardAPI:
|
|
|
70
69
|
version=__version__,
|
|
71
70
|
)
|
|
72
71
|
|
|
73
|
-
# Set up templates for HTML views
|
|
74
|
-
self.templates = Jinja2Templates(directory=str(self.www_dir))
|
|
75
|
-
|
|
76
72
|
# Serve static files
|
|
77
73
|
if static_dir.exists():
|
|
78
74
|
self.app.mount(
|
|
@@ -130,13 +126,22 @@ class DashboardAPI:
|
|
|
130
126
|
"""
|
|
131
127
|
Render the dashboard HTML.
|
|
132
128
|
"""
|
|
133
|
-
|
|
134
|
-
"index.html"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
129
|
+
try:
|
|
130
|
+
with importlib.resources.open_text("nya.html", "index.html") as f:
|
|
131
|
+
html_content = f.read()
|
|
132
|
+
html_content = html_content.replace(
|
|
133
|
+
"{{ root_path }}",
|
|
134
|
+
request.scope.get("root_path", ""),
|
|
135
|
+
).replace(
|
|
136
|
+
"{{ enable_control }}",
|
|
137
|
+
"flex" if self.enable_control else "none",
|
|
138
|
+
)
|
|
139
|
+
return HTMLResponse(html_content)
|
|
140
|
+
except Exception as e:
|
|
141
|
+
raise HTTPException(
|
|
142
|
+
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
|
143
|
+
detail=f"Failed to load index.html",
|
|
144
|
+
)
|
|
140
145
|
|
|
141
146
|
@self.app.get("/favicon.ico")
|
|
142
147
|
async def favicon():
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>NyaProxy Dashboard</title>
|
|
7
|
+
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
|
8
|
+
<link rel="stylesheet" href="{{ root_path }}/static/css/styles.css" />
|
|
9
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
10
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
11
|
+
<link rel="icon" href="{{ root_path }}/favicon.ico" />
|
|
12
|
+
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
14
|
+
</head>
|
|
15
|
+
<body class="bg-slate-50 dark:bg-slate-900 text-slate-900 dark:text-white transition-colors duration-200">
|
|
16
|
+
<div class="min-h-screen flex flex-col">
|
|
17
|
+
<!-- Header -->
|
|
18
|
+
<header class="bg-white/80 dark:bg-slate-800/80 header-blur fixed top-0 left-0 right-0 z-10 transition-all duration-200">
|
|
19
|
+
<div class="container mx-auto px-4 py-3.5 flex justify-between items-center">
|
|
20
|
+
<div class="flex items-center space-x-3">
|
|
21
|
+
<img class="app-logo" src="{{ root_path }}/static/logo.svg" width="40" height="40" />
|
|
22
|
+
<h1 class="text-xl font-bold">
|
|
23
|
+
NyaProxy
|
|
24
|
+
<span class="bg-clip-text text-transparent bg-gradient-to-r from-pink-500 to-purple-500">Dashboard</span>
|
|
25
|
+
</h1>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="flex items-center space-x-4">
|
|
28
|
+
<button id="theme-toggle" class="p-2 rounded-full hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors duration-200 transition-transform">
|
|
29
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 dark:hidden" viewBox="0 0 20 20" fill="currentColor">
|
|
30
|
+
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z" />
|
|
31
|
+
</svg>
|
|
32
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 hidden dark:block" viewBox="0 0 20 20" fill="currentColor">
|
|
33
|
+
<path
|
|
34
|
+
fill-rule="evenodd"
|
|
35
|
+
d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"
|
|
36
|
+
clip-rule="evenodd"
|
|
37
|
+
/>
|
|
38
|
+
</svg>
|
|
39
|
+
</button>
|
|
40
|
+
<div class="relative" id="refresh-container">
|
|
41
|
+
<button id="refresh-button" class="p-2 rounded-full hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors duration-200 interactive-hover">
|
|
42
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
43
|
+
<path
|
|
44
|
+
fill-rule="evenodd"
|
|
45
|
+
d="M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z"
|
|
46
|
+
clip-rule="evenodd"
|
|
47
|
+
/>
|
|
48
|
+
</svg>
|
|
49
|
+
</button>
|
|
50
|
+
<span id="last-updated" class="text-xs text-slate-500 dark:text-slate-400 absolute -bottom-6 right-0 whitespace-nowrap"></span>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</header>
|
|
55
|
+
|
|
56
|
+
<!-- Main Content -->
|
|
57
|
+
<main class="flex-grow container mx-auto px-4 pt-20 pb-6 page-transition">
|
|
58
|
+
<!-- Global Stats -->
|
|
59
|
+
<section class="mb-8">
|
|
60
|
+
<h2 class="text-lg font-semibold mb-4 flex items-center">
|
|
61
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-pink-500" viewBox="0 0 20 20" fill="currentColor">
|
|
62
|
+
<path d="M2 11a1 1 0 011-1h2a1 1 0 011 1v5a1 1 0 01-1 1H3a1 1 0 01-1-1v-5zM8 7a1 1 0 011-1h2a1 1 0 011 1v9a1 1 0 01-1 1H9a1 1 0 01-1-1V7zM14 4a1 1 0 011-1h2a1 1 0 011 1v12a1 1 0 01-1 1h-2a1 1 0 01-1-1V4z" />
|
|
63
|
+
</svg>
|
|
64
|
+
Global Statistics
|
|
65
|
+
</h2>
|
|
66
|
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
|
67
|
+
<div class="modern-card gradient-card-blue p-5">
|
|
68
|
+
<div class="flex items-center justify-between">
|
|
69
|
+
<h3 class="text-sm font-medium text-slate-500 dark:text-slate-400">Total Requests</h3>
|
|
70
|
+
<span class="badge bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 text-xs">All Time</span>
|
|
71
|
+
</div>
|
|
72
|
+
<p id="total-requests" class="text-2xl font-bold mt-3 mb-2">0</p>
|
|
73
|
+
<div class="mt-2 h-1 w-full bg-slate-200 dark:bg-slate-700 rounded-full overflow-hidden">
|
|
74
|
+
<div id="total-requests-bar" class="h-1 bg-gradient-to-r from-blue-500 to-blue-600" style="width: 0%"></div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="modern-card gradient-card-red p-5">
|
|
78
|
+
<div class="flex items-center justify-between">
|
|
79
|
+
<h3 class="text-sm font-medium text-slate-500 dark:text-slate-400">Total Errors</h3>
|
|
80
|
+
<span class="badge bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-300 text-xs">All Time</span>
|
|
81
|
+
</div>
|
|
82
|
+
<p id="total-errors" class="text-2xl font-bold mt-3 mb-2">0</p>
|
|
83
|
+
<div class="mt-2 h-1 w-full bg-slate-200 dark:bg-slate-700 rounded-full overflow-hidden">
|
|
84
|
+
<div id="total-errors-bar" class="h-1 bg-gradient-to-r from-red-500 to-red-600" style="width: 0%"></div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="modern-card gradient-card-yellow p-5">
|
|
88
|
+
<div class="flex items-center justify-between">
|
|
89
|
+
<h3 class="text-sm font-medium text-slate-500 dark:text-slate-400">Rate Limit Hits</h3>
|
|
90
|
+
<span class="badge bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-300 text-xs">All Time</span>
|
|
91
|
+
</div>
|
|
92
|
+
<p id="total-rate-limits" class="text-2xl font-bold mt-3 mb-2">0</p>
|
|
93
|
+
<div class="mt-2 h-1 w-full bg-slate-200 dark:bg-slate-700 rounded-full overflow-hidden">
|
|
94
|
+
<div id="total-rate-limits-bar" class="h-1 bg-gradient-to-r from-yellow-500 to-yellow-600" style="width: 0%"></div>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="modern-card gradient-card-green p-5">
|
|
98
|
+
<div class="flex items-center justify-between">
|
|
99
|
+
<h3 class="text-sm font-medium text-slate-500 dark:text-slate-400">Uptime</h3>
|
|
100
|
+
<span class="badge bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300 text-xs">Current</span>
|
|
101
|
+
</div>
|
|
102
|
+
<p id="uptime" class="text-2xl font-bold mt-3 mb-2">0s</p>
|
|
103
|
+
<div class="mt-2 flex items-center">
|
|
104
|
+
<span class="inline-block h-2.5 w-2.5 rounded-full bg-green-500 mr-2 pulse-animation"></span>
|
|
105
|
+
<span class="text-xs text-slate-500 dark:text-slate-400">System Online</span>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</section>
|
|
110
|
+
|
|
111
|
+
<!-- API Traffic Overview -->
|
|
112
|
+
<section class="mb-8">
|
|
113
|
+
<h2 class="text-lg font-semibold mb-4 flex items-center">
|
|
114
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-pink-500" viewBox="0 0 20 20" fill="currentColor">
|
|
115
|
+
<path
|
|
116
|
+
fill-rule="evenodd"
|
|
117
|
+
d="M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 0l-2 2a1 1 0 101.414 1.414L8 10.414l1.293 1.293a1 1 0 001.414 0l4-4z"
|
|
118
|
+
clip-rule="evenodd"
|
|
119
|
+
/>
|
|
120
|
+
</svg>
|
|
121
|
+
API Traffic Overview
|
|
122
|
+
</h2>
|
|
123
|
+
<div class="modern-card p-5">
|
|
124
|
+
<div class="flex flex-col md:flex-row gap-4 mb-4">
|
|
125
|
+
<div class="flex-1">
|
|
126
|
+
<label for="api-filter" class="block text-sm font-medium text-slate-500 dark:text-slate-400 mb-1">Filter by API</label>
|
|
127
|
+
<select id="api-filter" class="w-full rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-pink-500 transition-shadow duration-200">
|
|
128
|
+
<option value="all">All APIs</option>
|
|
129
|
+
<!-- API options will be added dynamically -->
|
|
130
|
+
</select>
|
|
131
|
+
</div>
|
|
132
|
+
<div class="flex-1">
|
|
133
|
+
<label for="key-filter" class="block text-sm font-medium text-slate-500 dark:text-slate-400 mb-1">Filter by API Key</label>
|
|
134
|
+
<select id="key-filter" class="w-full rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-pink-500 transition-shadow duration-200">
|
|
135
|
+
<option value="all">All Keys</option>
|
|
136
|
+
<!-- Key options will be added dynamically -->
|
|
137
|
+
</select>
|
|
138
|
+
</div>
|
|
139
|
+
<div class="flex-1">
|
|
140
|
+
<label for="time-range" class="block text-sm font-medium text-slate-500 dark:text-slate-400 mb-1">Time Range</label>
|
|
141
|
+
<select id="time-range" class="w-full rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-pink-500 transition-shadow duration-200">
|
|
142
|
+
<option value="1h">Last Hour</option>
|
|
143
|
+
<option value="24h" selected>Last 24 Hours</option>
|
|
144
|
+
<option value="7d">Last 7 Days</option>
|
|
145
|
+
<option value="30d">Last 30 Days</option>
|
|
146
|
+
<option value="all">All Time</option>
|
|
147
|
+
</select>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
<div id="filter-summary" class="text-sm text-slate-500 dark:text-slate-400 mt-1 mb-3 italic">Showing data for all APIs over the last 24h</div>
|
|
151
|
+
<div class="h-72 md:h-64 mt-2">
|
|
152
|
+
<canvas id="traffic-chart"></canvas>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
</section>
|
|
156
|
+
|
|
157
|
+
<!-- Advanced Analytics Section (New) -->
|
|
158
|
+
<section class="mb-8">
|
|
159
|
+
<h2 class="text-lg font-semibold mb-4 flex items-center">
|
|
160
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-pink-500" viewBox="0 0 20 20" fill="currentColor">
|
|
161
|
+
<path fill-rule="evenodd" d="M3 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" />
|
|
162
|
+
</svg>
|
|
163
|
+
Advanced Analytics
|
|
164
|
+
</h2>
|
|
165
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
|
166
|
+
<div class="modern-card p-5">
|
|
167
|
+
<h3 class="text-md font-semibold mb-3">Response Time Analysis</h3>
|
|
168
|
+
<div class="h-60">
|
|
169
|
+
<canvas id="response-time-chart"></canvas>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
<div class="modern-card p-5">
|
|
173
|
+
<h3 class="text-md font-semibold mb-3">Status Code Distribution</h3>
|
|
174
|
+
<div class="h-60">
|
|
175
|
+
<canvas id="status-code-chart"></canvas>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
<div class="modern-card p-5">
|
|
179
|
+
<h3 class="text-md font-semibold mb-3">API Usage Distribution</h3>
|
|
180
|
+
<div class="h-60">
|
|
181
|
+
<canvas id="api-distribution-chart"></canvas>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
<div class="modern-card p-5">
|
|
185
|
+
<h3 class="text-md font-semibold mb-3">API Key Usage</h3>
|
|
186
|
+
<div class="h-60">
|
|
187
|
+
<canvas id="key-usage-chart"></canvas>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</section>
|
|
192
|
+
|
|
193
|
+
<!-- API Details -->
|
|
194
|
+
<section class="mb-8">
|
|
195
|
+
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4 gap-3 sm:gap-0">
|
|
196
|
+
<h2 class="text-lg font-semibold flex items-center">
|
|
197
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-pink-500" viewBox="0 0 20 20" fill="currentColor">
|
|
198
|
+
<path
|
|
199
|
+
fill-rule="evenodd"
|
|
200
|
+
d="M2 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm3.293 1.293a1 1 0 011.414 0l3 3a1 1 0 010 1.414l-3 3a1 1 0 01-1.414-1.414L7.586 10 5.293 7.707a1 1 0 010-1.414zM11 12a1 1 0 100 2h3a1 1 0 100-2h-3z"
|
|
201
|
+
clip-rule="evenodd"
|
|
202
|
+
/>
|
|
203
|
+
</svg>
|
|
204
|
+
API Details
|
|
205
|
+
</h2>
|
|
206
|
+
<div class="flex items-center w-full sm:w-auto">
|
|
207
|
+
<div class="relative flex-grow sm:flex-grow-0 mr-2">
|
|
208
|
+
<input
|
|
209
|
+
type="text"
|
|
210
|
+
id="api-search"
|
|
211
|
+
placeholder="Search APIs..."
|
|
212
|
+
class="w-full sm:w-auto rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 pl-8 pr-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-pink-500 transition-shadow duration-200"
|
|
213
|
+
/>
|
|
214
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-slate-400 absolute left-2.5 top-1/2 transform -translate-y-1/2" viewBox="0 0 20 20" fill="currentColor">
|
|
215
|
+
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
|
|
216
|
+
</svg>
|
|
217
|
+
</div>
|
|
218
|
+
<button id="reset-metrics-btn" class="btn-modern bg-red-500 hover:bg-red-600 text-white text-xs py-1.5 px-3 rounded-lg transition-all duration-200 flex items-center" style="display: {{ enable_control }}">
|
|
219
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3 mr-1.5" viewBox="0 0 20 20" fill="currentColor">
|
|
220
|
+
<path
|
|
221
|
+
fill-rule="evenodd"
|
|
222
|
+
d="M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z"
|
|
223
|
+
clip-rule="evenodd"
|
|
224
|
+
/>
|
|
225
|
+
</svg>
|
|
226
|
+
Reset Metrics
|
|
227
|
+
</button>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
<div class="overflow-x-auto responsive-table">
|
|
231
|
+
<table class="min-w-full modern-card">
|
|
232
|
+
<thead>
|
|
233
|
+
<tr class="bg-slate-50 dark:bg-slate-700/50 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider">
|
|
234
|
+
<th class="px-6 py-3 rounded-tl-lg">API Name</th>
|
|
235
|
+
<th class="px-6 py-3">Requests</th>
|
|
236
|
+
<th class="px-6 py-3">Errors</th>
|
|
237
|
+
<th class="px-6 py-3">Avg Response Time</th>
|
|
238
|
+
<th class="px-6 py-3">Last Request</th>
|
|
239
|
+
<th class="px-6 py-3 rounded-tr-lg">Actions</th>
|
|
240
|
+
</tr>
|
|
241
|
+
</thead>
|
|
242
|
+
<tbody id="api-table-body" class="divide-y divide-slate-200 dark:divide-slate-700">
|
|
243
|
+
<!-- API rows will be added dynamically -->
|
|
244
|
+
<tr class="skeleton-pulse">
|
|
245
|
+
<td colspan="6" class="px-6 py-4 text-center text-sm text-slate-500 dark:text-slate-400">Loading API data...</td>
|
|
246
|
+
</tr>
|
|
247
|
+
</tbody>
|
|
248
|
+
</table>
|
|
249
|
+
</div>
|
|
250
|
+
<!-- Mobile view for API table -->
|
|
251
|
+
<div id="api-cards-container" class="md:hidden mt-4 space-y-4">
|
|
252
|
+
<!-- Will be populated via JS -->
|
|
253
|
+
</div>
|
|
254
|
+
</section>
|
|
255
|
+
|
|
256
|
+
<!-- Queue Status -->
|
|
257
|
+
<section class="mb-8">
|
|
258
|
+
<h2 class="text-lg font-semibold mb-4 flex items-center">
|
|
259
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-pink-500" viewBox="0 0 20 20" fill="currentColor">
|
|
260
|
+
<path d="M3 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" />
|
|
261
|
+
</svg>
|
|
262
|
+
Queue Status
|
|
263
|
+
</h2>
|
|
264
|
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" id="queue-container">
|
|
265
|
+
<!-- Queue cards will be added dynamically -->
|
|
266
|
+
<div class="modern-card p-5 skeleton-pulse">
|
|
267
|
+
<div class="h-6 bg-slate-200 dark:bg-slate-700 rounded w-1/2 mb-4"></div>
|
|
268
|
+
<div class="h-10 bg-slate-200 dark:bg-slate-700 rounded mb-4"></div>
|
|
269
|
+
<div class="h-4 bg-slate-200 dark:bg-slate-700 rounded w-3/4"></div>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
</section>
|
|
273
|
+
|
|
274
|
+
<!-- Recent Requests -->
|
|
275
|
+
<section>
|
|
276
|
+
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4 gap-3 sm:gap-0">
|
|
277
|
+
<h2 class="text-lg font-semibold flex items-center">
|
|
278
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-pink-500" viewBox="0 0 20 20" fill="currentColor">
|
|
279
|
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" clip-rule="evenodd" />
|
|
280
|
+
</svg>
|
|
281
|
+
Recent Requests
|
|
282
|
+
</h2>
|
|
283
|
+
<div class="flex items-center gap-2">
|
|
284
|
+
<div class="relative flex-grow sm:flex-grow-0">
|
|
285
|
+
<input
|
|
286
|
+
type="text"
|
|
287
|
+
id="history-search"
|
|
288
|
+
placeholder="Filter history..."
|
|
289
|
+
class="w-full sm:w-auto rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 pl-8 pr-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-pink-500 transition-shadow duration-200"
|
|
290
|
+
/>
|
|
291
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-slate-400 absolute left-2.5 top-1/2 transform -translate-y-1/2" viewBox="0 0 20 20" fill="currentColor">
|
|
292
|
+
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
|
|
293
|
+
</svg>
|
|
294
|
+
</div>
|
|
295
|
+
<button id="clear-all-queues-btn" class="btn-modern bg-yellow-500 hover:bg-yellow-600 text-white text-xs py-1.5 px-3 rounded-lg transition-all duration-200 flex items-center" style="display: {{ enable_control }}">
|
|
296
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3 mr-1.5" viewBox="0 0 20 20" fill="currentColor">
|
|
297
|
+
<path
|
|
298
|
+
fill-rule="evenodd"
|
|
299
|
+
d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z"
|
|
300
|
+
clip-rule="evenodd"
|
|
301
|
+
/>
|
|
302
|
+
</svg>
|
|
303
|
+
Clear All Queues
|
|
304
|
+
</button>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
<div class="modern-card overflow-hidden">
|
|
308
|
+
<div class="overflow-x-auto responsive-table">
|
|
309
|
+
<table class="min-w-full">
|
|
310
|
+
<thead>
|
|
311
|
+
<tr class="bg-slate-50 dark:bg-slate-700/50 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider">
|
|
312
|
+
<th class="px-6 py-3">Time</th>
|
|
313
|
+
<th class="px-6 py-3">API</th>
|
|
314
|
+
<th class="px-6 py-3">Status</th>
|
|
315
|
+
<th class="px-6 py-3">Response Time</th>
|
|
316
|
+
<th class="px-6 py-3">Key</th>
|
|
317
|
+
</tr>
|
|
318
|
+
</thead>
|
|
319
|
+
<tbody id="history-table-body" class="divide-y divide-slate-200 dark:divide-slate-700">
|
|
320
|
+
<!-- History rows will be added dynamically -->
|
|
321
|
+
<tr class="skeleton-pulse">
|
|
322
|
+
<td colspan="5" class="px-6 py-4 text-center text-sm text-slate-500 dark:text-slate-400">Loading request history...</td>
|
|
323
|
+
</tr>
|
|
324
|
+
</tbody>
|
|
325
|
+
</table>
|
|
326
|
+
</div>
|
|
327
|
+
<!-- Mobile view for history -->
|
|
328
|
+
<div id="history-cards-container" class="md:hidden p-4 space-y-4">
|
|
329
|
+
<!-- Will be populated via JS -->
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
</section>
|
|
333
|
+
</main>
|
|
334
|
+
|
|
335
|
+
<!-- Footer -->
|
|
336
|
+
<footer class="bg-white/80 dark:bg-slate-800/80 backdrop-blur border-t border-slate-200 dark:border-slate-700 py-4 mt-auto">
|
|
337
|
+
<div class="container mx-auto px-4 flex flex-col md:flex-row justify-between items-center">
|
|
338
|
+
<p class="text-sm text-slate-500 dark:text-slate-400">© 2023 NyaProxy Dashboard</p>
|
|
339
|
+
<div class="flex items-center space-x-6 mt-2 md:mt-0">
|
|
340
|
+
<a href="#" class="text-sm text-slate-500 dark:text-slate-400 hover:text-pink-500 dark:hover:text-pink-400 transition-colors duration-200">Documentation</a>
|
|
341
|
+
<a href="#" class="text-sm text-slate-500 dark:text-slate-400 hover:text-pink-500 dark:hover:text-pink-400 transition-colors duration-200">GitHub</a>
|
|
342
|
+
<a href="#" class="text-sm text-slate-500 dark:text-slate-400 hover:text-pink-500 dark:hover:text-pink-400 transition-colors duration-200">Support</a>
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
</footer>
|
|
346
|
+
|
|
347
|
+
<!-- API Details Modal -->
|
|
348
|
+
<div id="api-details-modal" class="fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 hidden transition-opacity duration-300">
|
|
349
|
+
<div class="bg-white dark:bg-slate-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto modern-card m-4">
|
|
350
|
+
<div class="p-4 border-b border-slate-200 dark:border-slate-700 flex justify-between items-center">
|
|
351
|
+
<h3 class="text-lg font-semibold" id="modal-title">API Details</h3>
|
|
352
|
+
<button id="close-modal" class="text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200 p-1 rounded-full hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors duration-200">
|
|
353
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
354
|
+
<path
|
|
355
|
+
fill-rule="evenodd"
|
|
356
|
+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
357
|
+
clip-rule="evenodd"
|
|
358
|
+
/>
|
|
359
|
+
</svg>
|
|
360
|
+
</button>
|
|
361
|
+
</div>
|
|
362
|
+
<div class="p-4" id="modal-content">
|
|
363
|
+
<!-- Modal content will be added dynamically -->
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
<!-- Toast Notification -->
|
|
370
|
+
<div
|
|
371
|
+
id="toast"
|
|
372
|
+
class="fixed bottom-4 right-4 toast-modern bg-white/90 dark:bg-slate-800/90 border border-slate-200 dark:border-slate-700 rounded-lg shadow-lg p-4 transform translate-y-full opacity-0 transition-all duration-300 flex items-center max-w-sm z-50"
|
|
373
|
+
>
|
|
374
|
+
<div id="toast-icon" class="mr-3 text-green-500">
|
|
375
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
376
|
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
|
377
|
+
</svg>
|
|
378
|
+
</div>
|
|
379
|
+
<div>
|
|
380
|
+
<p id="toast-message" class="text-sm font-medium">Success message</p>
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
<script src="{{ root_path }}/static/js/dashboard.js"></script>
|
|
385
|
+
</body>
|
|
386
|
+
</html>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
NyaProxy - A simple low-level API proxy with dynamic token rotation.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
import argparse
|
|
8
7
|
import contextlib
|
|
9
8
|
import os
|
|
@@ -77,16 +76,19 @@ class NyaProxyApp:
|
|
|
77
76
|
remote_api_key = os.environ.get("REMOTE_CONFIG_API_KEY")
|
|
78
77
|
remote_app_name = os.environ.get("REMOTE_CONFIG_APP_NAME")
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
try:
|
|
80
|
+
config = ConfigManager(
|
|
81
|
+
config_path=config_path,
|
|
82
|
+
schema_path=schema_path,
|
|
83
|
+
remote_url=remote_url or None,
|
|
84
|
+
remote_api_key=remote_api_key or None,
|
|
85
|
+
remote_app_name=remote_app_name or None,
|
|
86
|
+
callback=trigger_reload,
|
|
87
|
+
)
|
|
88
|
+
except Exception as e:
|
|
89
|
+
logger.error(f"Failed to initialize config manager: {e}")
|
|
90
|
+
raise
|
|
91
|
+
|
|
90
92
|
self.config = config
|
|
91
93
|
|
|
92
94
|
def _init_auth(self):
|