nya-proxy 0.2.1__tar.gz → 0.2.2__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.2.1/nya_proxy.egg-info → nya_proxy-0.2.2}/PKG-INFO +1 -1
- nya_proxy-0.2.2/nya/_version.py +1 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/config/manager.py +20 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/config.yaml +5 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/schema.json +35 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/server/app.py +9 -4
- {nya_proxy-0.2.1 → nya_proxy-0.2.2/nya_proxy.egg-info}/PKG-INFO +1 -1
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/pyproject.toml +1 -1
- nya_proxy-0.2.1/nya/_version.py +0 -1
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/LICENSE +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/README.md +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/__init__.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/common/__init__.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/common/constants.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/common/exceptions.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/common/logger.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/common/models.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/config/__init__.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/core/__init__.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/core/factory.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/core/handler.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/core/proxy.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/core/request.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/core/response.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/core/streaming.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/dashboard/__init__.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/dashboard/api.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/html/favicon.ico +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/html/index.html +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/html/login.html +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/html/static/css/styles.css +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/html/static/js/dashboard.js +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/html/static/logo.svg +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/integrations/__init__.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/integrations/openai.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/server/__init__.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/server/auth.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/services/__init__.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/services/key.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/services/lb.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/services/limit.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/services/metrics.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/services/queue.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/utils/__init__.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/utils/header.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya/utils/helper.py +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya_proxy.egg-info/SOURCES.txt +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya_proxy.egg-info/dependency_links.txt +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya_proxy.egg-info/entry_points.txt +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya_proxy.egg-info/requires.txt +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/nya_proxy.egg-info/top_level.txt +0 -0
- {nya_proxy-0.2.1 → nya_proxy-0.2.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nya-proxy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.2"
|
|
@@ -269,6 +269,26 @@ class ConfigManager:
|
|
|
269
269
|
"""Get the proxy address."""
|
|
270
270
|
return self.config.get_str("server.proxy.address", "")
|
|
271
271
|
|
|
272
|
+
def get_cors_allow_origins(self) -> List[str]:
|
|
273
|
+
"""Get the CORS allow origin for the proxy."""
|
|
274
|
+
return self.config.get_list("server.cors.allow_origins", "*")
|
|
275
|
+
|
|
276
|
+
def get_cors_allow_methods(self) -> List[str]:
|
|
277
|
+
"""Get the CORS allow methods for the proxy."""
|
|
278
|
+
return self.config.get_list(
|
|
279
|
+
"server.cors.allow_methods", "GET, POST, PUT, DELETE, OPTIONS"
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
def get_cors_allow_headers(self) -> List[str]:
|
|
283
|
+
"""Get the CORS allow headers for the proxy."""
|
|
284
|
+
return self.config.get_list(
|
|
285
|
+
"server.cors.allow_headers", "Content-Type, Authorization"
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
def get_cors_allow_credentials(self) -> bool:
|
|
289
|
+
"""Check if CORS allow credentials is enabled for the proxy."""
|
|
290
|
+
return self.config.get_bool("server.cors.allow_credentials", False)
|
|
291
|
+
|
|
272
292
|
def get_default_settings(self) -> Dict[str, Any]:
|
|
273
293
|
"""Get the default settings for endpoints."""
|
|
274
294
|
return self.config.get_dict("default_settings", {})
|
|
@@ -15,6 +15,11 @@ server:
|
|
|
15
15
|
enabled: true
|
|
16
16
|
max_size: 200
|
|
17
17
|
expiry_seconds: 300
|
|
18
|
+
cors:
|
|
19
|
+
allow_origins: ["*"] # Set to "*" to allow all origins, however, when allow_credentials is true, this must be set to a specific origin
|
|
20
|
+
allow_credentials: true
|
|
21
|
+
allow_methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
|
|
22
|
+
allow_headers: ["*"]
|
|
18
23
|
|
|
19
24
|
# Default settings for the all apis if not specified
|
|
20
25
|
default_settings:
|
|
@@ -265,6 +265,41 @@
|
|
|
265
265
|
"minimum": 1,
|
|
266
266
|
"maximum": 65535
|
|
267
267
|
},
|
|
268
|
+
"cors": {
|
|
269
|
+
"type": "object",
|
|
270
|
+
"properties": {
|
|
271
|
+
"allow_origins": {
|
|
272
|
+
"type": "array",
|
|
273
|
+
"items": {
|
|
274
|
+
"type": "string"
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
"allow_credentials": {
|
|
278
|
+
"type": "boolean",
|
|
279
|
+
"description": "CORS allow credentials"
|
|
280
|
+
},
|
|
281
|
+
"allow_methods": {
|
|
282
|
+
"type": "array",
|
|
283
|
+
"items": {
|
|
284
|
+
"type": "string",
|
|
285
|
+
"enum": [
|
|
286
|
+
"GET",
|
|
287
|
+
"POST",
|
|
288
|
+
"PUT",
|
|
289
|
+
"DELETE",
|
|
290
|
+
"PATCH",
|
|
291
|
+
"OPTIONS"
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"allow_headers": {
|
|
296
|
+
"type": "array",
|
|
297
|
+
"items": {
|
|
298
|
+
"type": "string"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
},
|
|
268
303
|
"api_key": {
|
|
269
304
|
"anyOf": [
|
|
270
305
|
{
|
|
@@ -102,13 +102,18 @@ class NyaProxyApp:
|
|
|
102
102
|
version=__version__,
|
|
103
103
|
)
|
|
104
104
|
|
|
105
|
+
allow_origins = self.config.get_cors_allow_origins()
|
|
106
|
+
allow_methods = self.config.get_cors_allow_methods()
|
|
107
|
+
allow_headers = self.config.get_cors_allow_headers()
|
|
108
|
+
allow_credentials = self.config.get_cors_allow_credentials()
|
|
109
|
+
|
|
105
110
|
# Add CORS middleware
|
|
106
111
|
app.add_middleware(
|
|
107
112
|
CORSMiddleware,
|
|
108
|
-
allow_origins=
|
|
109
|
-
allow_credentials=
|
|
110
|
-
allow_methods=
|
|
111
|
-
allow_headers=
|
|
113
|
+
allow_origins=allow_origins,
|
|
114
|
+
allow_credentials=allow_credentials,
|
|
115
|
+
allow_methods=allow_methods,
|
|
116
|
+
allow_headers=allow_headers,
|
|
112
117
|
)
|
|
113
118
|
|
|
114
119
|
if not self.auth:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nya-proxy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
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
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nya-proxy"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
description = "A lightweight, flexible API proxy with dynamic token rotation, load balancing, and rate limiting capabilities."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
nya_proxy-0.2.1/nya/_version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|