Initial commit: Telegram Management System
Some checks failed
Deploy / deploy (push) Has been cancelled

Full-stack web application for Telegram management
- Frontend: Vue 3 + Vben Admin
- Backend: NestJS
- Features: User management, group broadcast, statistics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
你的用户名
2025-11-04 15:37:50 +08:00
commit 237c7802e5
3674 changed files with 525172 additions and 0 deletions

View File

@@ -0,0 +1,102 @@
server {
listen 80;
server_name localhost;
# API versioning
set $api_version "v1";
# CORS configuration
add_header 'Access-Control-Allow-Origin' '$http_origin' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
# Handle OPTIONS requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
# Health check endpoint
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
# Auth endpoints
location ~ ^/api/($api_version/)?auth {
limit_req zone=auth_limit burst=5 nodelay;
proxy_pass http://orchestrator;
include /etc/nginx/proxy.conf;
}
# Orchestrator service
location ~ ^/api/($api_version/)?orchestrator {
limit_req zone=api_limit burst=20 nodelay;
proxy_pass http://orchestrator;
include /etc/nginx/proxy.conf;
}
# Claude Agent service
location ~ ^/api/($api_version/)?claude {
limit_req zone=api_limit burst=10 nodelay;
proxy_pass http://claude_agent;
include /etc/nginx/proxy.conf;
}
# GramJS Adapter service
location ~ ^/api/($api_version/)?telegram {
limit_req zone=api_limit burst=20 nodelay;
proxy_pass http://gramjs_adapter;
include /etc/nginx/proxy.conf;
}
# Safety Guard service
location ~ ^/api/($api_version/)?safety {
limit_req zone=api_limit burst=30 nodelay;
proxy_pass http://safety_guard;
include /etc/nginx/proxy.conf;
}
# Analytics service
location ~ ^/api/($api_version/)?analytics {
limit_req zone=api_limit burst=50 nodelay;
proxy_pass http://analytics;
include /etc/nginx/proxy.conf;
}
# A/B Testing service
location ~ ^/api/($api_version/)?experiments {
limit_req zone=api_limit burst=20 nodelay;
proxy_pass http://ab_testing;
include /etc/nginx/proxy.conf;
}
# WebSocket endpoints
location ~ ^/ws/($api_version/)? {
proxy_pass http://orchestrator;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
}
# Static files (if any)
location /static {
alias /usr/share/nginx/html/static;
expires 30d;
add_header Cache-Control "public, immutable";
}
# Default location
location / {
return 404;
}
}

View File

@@ -0,0 +1,75 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'rt=$request_time uct="$upstream_connect_time" '
'uht="$upstream_header_time" urt="$upstream_response_time"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# Gzip compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss application/rss+xml application/atom+xml image/svg+xml;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
# Rate limiting
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;
limit_req_zone $binary_remote_addr zone=auth_limit:10m rate=5r/m;
# Upstream services
upstream orchestrator {
server orchestrator:3001 max_fails=3 fail_timeout=30s;
}
upstream claude_agent {
server claude-agent:3002 max_fails=3 fail_timeout=30s;
}
upstream gramjs_adapter {
server gramjs-adapter:3003 max_fails=3 fail_timeout=30s;
}
upstream safety_guard {
server safety-guard:3004 max_fails=3 fail_timeout=30s;
}
upstream analytics {
server analytics:3005 max_fails=3 fail_timeout=30s;
}
upstream ab_testing {
server ab-testing:3006 max_fails=3 fail_timeout=30s;
}
# Include additional configuration files
include /etc/nginx/conf.d/*.conf;
}

View File

@@ -0,0 +1,19 @@
# Proxy headers
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Request-ID $request_id;
# Proxy settings
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "";
# Error handling
proxy_intercept_errors on;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;