Skip to content

Commit 1566207

Browse files
author
M1Screw
authored
Merge pull request #2413 from SSPanel-UIM/dev
Dev 20240410
2 parents 4dc80dc + 2d74597 commit 1566207

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1075
-10442
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@
2121

2222
## TL;DR
2323

24-
SSPanel UIM is a multi-purpose proxy service sales management system designed for Shadowsocks / V2Ray / Trojan / TUIC protocol.
24+
SSPanel UIM is a multi-purpose proxy service management system designed for Shadowsocks / V2Ray / Trojan / TUIC protocol.
2525

2626
## Features
2727

2828
- Integrate multiple payment systems such as Alipay F2F, PayPal, Stripe, etc.
2929
- Support multiple mail services, built-in mail queue function, no third-party components are required to use
3030
- Built-in tabler theme based on Bootstrap 5, template engine support
31-
- Support Shadowsocks 2022, TUIC and other latest proxy protocols
31+
- Support Shadowsocks 2022, TUIC, and other latest proxy protocols
3232
- Universal subscription interface, one-click json/clash/sip008/sing-box format subscription distribution
3333
- Custom node configuration, modular subscription system, support multiple client-specific subscription formats
3434
- Refactored store system, support billing modes including but not limited to annual/monthly, pay-as-you-go, access type billing, etc.
3535
- Refactored scheduled task system, one command can automatically complete all scheduled tasks
36-
- Deep integration of large language models, support intelligent reply to ticket, document generation and other functions
37-
- One-click access to OpenAI, Google AI, Vertex AI, Hugging Face Hosted API, Cloudflare Workers AI and Anthropic and other large language model services
36+
- Deep integration of large language models, support intelligent replies to tickets, document generation, and other functions
37+
- One-click access to OpenAI, Google AI, Vertex AI, Hugging Face Hosted API, Cloudflare Workers AI, Anthropic, and other large language model services
3838

3939
## Installation
4040

app/predefine.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
declare(strict_types=1);
44

5-
/**
6-
* To define global variable
7-
*/
8-
5+
// Global constants
96
const BASE_PATH = __DIR__ . '/..';
107
const VERSION = '2024.1';

composer.lock

+137-130
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/.config.example.php

+88-81
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,144 @@
11
<?php
22

3-
//基本设置--------------------------------------------------------------------------------------------
4-
$_ENV['key'] = 'ChangeMe'; // Cookie加密密钥,请务必修改此key为随机字符串
5-
$_ENV['pwdMethod'] = 'bcrypt'; // 密码加密 可选 bcrypt, argon2i, argon2id
6-
$_ENV['salt'] = ''; // bcrypt/argon2i/argon2id 会忽略此项
3+
//基本设置---------------------------------------------------------------------------------------------------------------
4+
$_ENV['key'] = 'ChangeMe'; // Cookie加密密钥,请务必修改此key为随机字符串
5+
$_ENV['pwdMethod'] = 'bcrypt'; // 密码加密 可选 bcrypt, argon2i, argon2id
6+
$_ENV['salt'] = ''; // bcrypt/argon2i/argon2id 会忽略此项
77

8-
$_ENV['debug'] = false; // debug模式开关,生产环境请保持为false
8+
$_ENV['debug'] = false; // debug模式开关,生产环境请保持为false
99
$_ENV['appName'] = 'SSPanel-UIM'; // 站点名称
1010
$_ENV['baseUrl'] = 'https://example.com'; // 站点地址,必须以https://开头,不要以/结尾
1111

1212
// WebAPI
13-
$_ENV['webAPI'] = true; // 是否开启WebAPI功能
14-
$_ENV['webAPIUrl'] = $_ENV['baseUrl']; // WebAPI地址,如需和站点地址相同,请不要修改
15-
$_ENV['muKey'] = 'ChangeMe'; // WebAPI密钥,用于节点服务端与面板通信,请务必修改此key为随机字符串
16-
$_ENV['checkNodeIp'] = true; // 是否webapi验证节点ip
13+
$_ENV['webAPI'] = true; // 是否开启WebAPI功能
14+
$_ENV['webAPIUrl'] = $_ENV['baseUrl']; // WebAPI地址,如需和站点地址相同,请不要修改
15+
$_ENV['muKey'] = 'ChangeMe'; // WebAPI密钥,用于节点服务端与面板通信,请务必修改此key为随机字符串
16+
$_ENV['checkNodeIp'] = true; // 是否webapi验证节点ip
1717

18-
//数据库设置-------------------------------------------------------------------------------------------
18+
//数据库设置--------------------------------------------------------------------------------------------------------------
1919
// db_host|db_socket 二选一,若设置 db_socket 则 db_host 会被忽略,不用请留空
2020
// db_host 例: localhost(可解析的主机名), 127.0.0.1(IP 地址)
2121
// db_socket 例:/var/run/mysqld/mysqld.sock(需使用绝对地址)
2222
$_ENV['db_host'] = '';
2323
$_ENV['db_socket'] = '';
24-
$_ENV['db_database'] = 'sspanel'; // 数据库名
25-
$_ENV['db_username'] = 'root'; // 数据库用户名
26-
$_ENV['db_password'] = 'sspanel'; // 用户密码
27-
$_ENV['db_port'] = '3306'; // 端口
24+
$_ENV['db_database'] = 'sspanel'; // 数据库名
25+
$_ENV['db_username'] = 'root'; // 数据库用户名
26+
$_ENV['db_password'] = 'sspanel'; // 用户密码
27+
$_ENV['db_port'] = '3306'; // 端口
2828
#读写分离相关配置
29-
$_ENV['enable_db_rw_split'] = false; // 是否开启读写分离
30-
$_ENV['read_db_hosts'] = ['']; // 从库地址,可配置多个
31-
$_ENV['write_db_host'] = ''; // 主库地址
29+
$_ENV['enable_db_rw_split'] = false; // 是否开启读写分离
30+
$_ENV['read_db_hosts'] = ['']; // 从库地址,可配置多个
31+
$_ENV['write_db_host'] = ''; // 主库地址
3232
#高级
3333
$_ENV['db_charset'] = 'utf8mb4';
3434
$_ENV['db_collation'] = 'utf8mb4_unicode_ci';
3535
$_ENV['db_prefix'] = '';
3636

37-
//Redis设置-------------------------------------------------------------------------------------------
38-
$_ENV['redis_host'] = '127.0.0.1'; // Redis地址,使用unix domain socket时填写文件路径
39-
$_ENV['redis_port'] = 6379; // Redis端口,使用unix domain socket时填写-1
40-
$_ENV['redis_connect_timeout'] = 2.0; // Redis连接超时时间,单位秒
41-
$_ENV['redis_read_timeout'] = 8.0; // Redis读取超时时间,单位秒
42-
$_ENV['redis_username'] = ''; // Redis用户名,留空则不使用用户名连接
43-
$_ENV['redis_password'] = ''; // Redis密码,留空则无密码
44-
$_ENV['redis_ssl'] = false; // 是否使用SSL连接Redis,如果使用了SSL,那么Redis端口应为Redis实例的TLS端口
45-
$_ENV['redis_ssl_context'] = []; // 使用SSL时的上下文选项,参考 https://www.php.net/manual/zh/context.ssl.php
46-
47-
//Rate Limit设置--------------------------------------------------------------------------------------------
48-
$_ENV['enable_rate_limit'] = true; // 是否开启请求限制
49-
$_ENV['rate_limit_ip'] = 120; // 每分钟每个IP的全局请求限制
50-
$_ENV['rate_limit_sub'] = 30; // 每分钟每个用户的订阅链接请求限制
51-
$_ENV['rate_limit_webapi'] = 600; // 每分钟每个节点WebAPI密钥请求限制
52-
$_ENV['rate_limit_user_api'] = 60; // 每分钟每个用户的API请求限制
53-
$_ENV['rate_limit_admin_api'] = 60; // 每分钟每个管理员的API请求限制
54-
55-
//邮件设置--------------------------------------------------------------------------------------------
56-
$_ENV['mail_filter'] = 0; // 0: 关闭; 1: 白名单模式; 2; 黑名单模式;
37+
//Redis设置--------------------------------------------------------------------------------------------------------------
38+
$_ENV['redis_host'] = '127.0.0.1'; // Redis地址,使用unix domain socket时填写文件路径
39+
$_ENV['redis_port'] = 6379; // Redis端口,使用unix domain socket时填写-1
40+
$_ENV['redis_connect_timeout'] = 2.0; // Redis连接超时时间,单位秒
41+
$_ENV['redis_read_timeout'] = 8.0; // Redis读取超时时间,单位秒
42+
$_ENV['redis_username'] = ''; // Redis用户名,留空则不使用用户名连接
43+
$_ENV['redis_password'] = ''; // Redis密码,留空则无密码
44+
$_ENV['redis_ssl'] = false; // 是否使用SSL连接Redis,如果使用了SSL,那么Redis端口应为Redis实例的TLS端口
45+
$_ENV['redis_ssl_context'] = []; // 使用SSL时的上下文选项,参考 https://www.php.net/manual/zh/context.ssl.php
46+
47+
//Rate Limit 设置--------------------------------------------------------------------------------------------------------
48+
$_ENV['enable_rate_limit'] = true; // 是否开启请求限制
49+
$_ENV['rate_limit_sub_ip'] = 10; // 每分钟每个IP的订阅链接请求限制
50+
$_ENV['rate_limit_sub'] = 10; // 每分钟每个用户的订阅链接请求限制
51+
$_ENV['rate_limit_webapi_ip'] = 120; // 每分钟每个IP的WebAPI请求限制
52+
$_ENV['rate_limit_webapi'] = 1200; // 每分钟WebAPI全局请求限制
53+
$_ENV['rate_limit_user_api_ip'] = 60; // 每分钟每个IP的用户API请求限制
54+
$_ENV['rate_limit_user_api'] = 60; // 每分钟每个用户的API请求限制
55+
$_ENV['rate_limit_admin_api_ip'] = 60; // 每分钟每个管理员的API请求限制
56+
$_ENV['rate_limit_admin_api'] = 60; // 每分钟每个管理员的API请求限制
57+
$_ENV['rate_limit_node_api_ip'] = 60; // 每分钟每个IP的节点API请求限制
58+
$_ENV['rate_limit_node_api'] = 60; // 每分钟每个节点的API请求限制
59+
60+
//邮件设置----------------------------------------------------------------------------------------------------------------
61+
$_ENV['mail_filter'] = 0; // 0: 关闭; 1: 白名单模式; 2; 黑名单模式;
5762
$_ENV['mail_filter_list'] = [];
5863

59-
//已注册用户设置---------------------------------------------------------------------------------------
64+
//已注册用户设置-----------------------------------------------------------------------------------------------------------
65+
//TODO: move these settings to DB
6066
#高级
61-
$_ENV['class_expire_reset_traffic'] = 0; // 等级到期时重置为的流量值,单位GB,小于0时不重置
62-
$_ENV['enable_kill'] = true; // 是否允许用户注销账户
63-
$_ENV['enable_change_email'] = true; // 是否允许用户更改賬戶郵箱
67+
$_ENV['class_expire_reset_traffic'] = 0; // 等级到期时重置为的流量值,单位GB,小于0时不重置
68+
$_ENV['enable_kill'] = false; // 是否允许用户注销账户
69+
$_ENV['enable_change_email'] = true; // 是否允许用户更改賬戶郵箱
6470

6571
#用户流量余量不足邮件提醒
66-
$_ENV['notify_limit_mode'] = false; // false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
67-
$_ENV['notify_limit_value'] = 500; // 当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
68-
69-
//订阅设置---------------------------------------------------------------------------------------
70-
$_ENV['Subscribe'] = true; // 本站是否提供订阅功能
71-
$_ENV['subUrl'] = $_ENV['baseUrl']; // 订阅地址,如需和站点名称相同,请不要修改
72-
$_ENV['sub_token_len'] = 16; // 订阅token长度
73-
74-
//审计自动封禁设置--------------------------------------------------------------------------------------------
75-
$_ENV['auto_detect_ban_allow_admin'] = true; // 管理员不受审计限制
76-
$_ENV['auto_detect_ban_allow_users'] = []; // 审计封禁的例外用户 ID
77-
$_ENV['auto_detect_ban_number'] = 30; // 每次执行封禁所需的触发次数
72+
$_ENV['notify_limit_mode'] = false; // false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
73+
$_ENV['notify_limit_value'] = 500; // 当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
74+
75+
//订阅设置----------------------------------------------------------------------------------------------------------------
76+
$_ENV['Subscribe'] = true; // 本站是否提供订阅功能
77+
$_ENV['subUrl'] = $_ENV['baseUrl']; // 订阅地址,如需和站点名称相同,请不要修改
78+
$_ENV['sub_token_len'] = 16; // 订阅token长度
79+
80+
//审计自动封禁设置---------------------------------------------------------------------------------------------------------
81+
//TODO: move these settings to DB
82+
$_ENV['auto_detect_ban_allow_admin'] = true; // 管理员不受审计限制
83+
$_ENV['auto_detect_ban_allow_users'] = []; // 审计封禁的例外用户 ID
84+
$_ENV['auto_detect_ban_number'] = 30; // 每次执行封禁所需的触发次数
7885
$_ENV['auto_detect_ban_time'] = 60; // 每次封禁的时长 (分钟)
7986

80-
//节点检测-----------------------------------------------------------------------------------------------
87+
//节点检测---------------------------------------------------------------------------------------------------------------
88+
//TODO: move these settings to DB
8189
#GFW检测
82-
$_ENV['detect_gfw_port'] = 443; //所有节点服务器都打开的TCP端口
90+
$_ENV['detect_gfw_port'] = 443; //所有节点服务器都打开的TCP端口
8391
$_ENV['detect_gfw_url'] = 'http://example.com:8080/v1/tcping?ip={ip}&port={port}'; //检测节点是否被gfw墙了的API的URL
8492

8593
#离线检测
8694
$_ENV['enable_detect_offline'] = true;
8795

88-
//高级设置-----------------------------------------------------------------------------------------------
89-
$_ENV['enable_login_bind_ip'] = true; //是否将登陆线程和IP绑定
90-
$_ENV['enable_login_bind_device'] = true; //是否将登陆线程和设备绑定
91-
$_ENV['rememberMeDuration'] = 7; //登录时记住账号时长天数
92-
$_ENV['timeZone'] = 'Asia/Taipei'; //需使用 PHP 兼容的时区格式
93-
$_ENV['theme'] = 'tabler'; //默认主题
94-
$_ENV['locale'] = 'zh-TW'; //默认语言
95-
$_ENV['jump_delay'] = 1200; //跳转延时,单位ms
96+
//高级设置---------------------------------------------------------------------------------------------------------------
97+
$_ENV['enable_login_bind_ip'] = true; //是否将登陆线程和IP绑定
98+
$_ENV['enable_login_bind_device'] = true; //是否将登陆线程和设备绑定
99+
$_ENV['rememberMeDuration'] = 7; //登录时记住账号时长天数
100+
$_ENV['timeZone'] = 'Asia/Taipei'; //需使用 PHP 兼容的时区格式
101+
$_ENV['theme'] = 'tabler'; //默认主题
102+
$_ENV['locale'] = 'zh-TW'; //默认语言
103+
$_ENV['jump_delay'] = 1200; //跳转延时,单位ms
96104
$_ENV['keep_connect'] = false; // 流量耗尽用户限速至 1Mbps
97105

98-
// cdn.jsdelivr.net / fastly.jsdelivr.net / testingcf.jsdelivr.net
99-
$_ENV['jsdelivr_url'] = 'fastly.jsdelivr.net';
100-
101-
// https://sentry.io for production debugging
102-
$_ENV['sentry_dsn'] = '';
103-
104-
// Maxmind GeoIP2 database
105-
$_ENV['maxmind_license_key'] = '';
106-
$_ENV['geoip_locale'] = 'en';
107-
108-
// Large language model powered ticket reply and more
106+
//Generative AI---------------------------------------------------------------------------------------------------------
107+
//Large language model powered ticket reply and more
108+
//TODO: move these settings to DB
109109
$_ENV['llm_backend'] = 'openai'; // openai/google-ai/huggingface/cf-workers-ai/anthropic
110-
// OpenAI ChatGPT
110+
#OpenAI ChatGPT
111111
$_ENV['openai_api_key'] = '';
112112
$_ENV['openai_model'] = 'gpt-4-turbo-preview';
113-
// Google AI API
113+
#Google AI API
114114
$_ENV['google_ai_api_key'] = '';
115115
$_ENV['google_ai_model_id'] = 'gemini-1.5-pro-latest';
116-
// Vertex AI API
116+
#Vertex AI API
117117
$_ENV['vertex_ai_access_token'] = '';
118118
$_ENV['vertex_ai_location'] = 'us-central1';
119119
$_ENV['vertex_ai_model_id'] = 'gemini-1.0-pro';
120120
$_ENV['vertex_ai_project_id'] = '';
121-
// Hugging Face Inference API
121+
#Hugging Face Inference API
122122
$_ENV['huggingface_api_key'] = '';
123123
$_ENV['huggingface_endpoint_url'] = '';
124-
// Cloudflare Workers AI
124+
#Cloudflare Workers AI
125125
$_ENV['cf_workers_ai_account_id'] = '';
126126
$_ENV['cf_workers_ai_api_token'] = '';
127127
$_ENV['cf_workers_ai_model_id'] = '@cf/meta/llama-2-7b-chat-int8';
128-
// Anthropic
128+
#Anthropic
129129
$_ENV['anthropic_api_key'] = '';
130130
$_ENV['anthropic_model_id'] = 'claude-3-opus-20240229';
131131

132+
//Other-----------------------------------------------------------------------------------------------------------------
133+
// cdn.jsdelivr.net / fastly.jsdelivr.net / testingcf.jsdelivr.net
134+
$_ENV['jsdelivr_url'] = 'fastly.jsdelivr.net';
135+
// https://sentry.io for production debugging
136+
$_ENV['sentry_dsn'] = '';
137+
// Maxmind GeoIP2 database
138+
$_ENV['maxmind_license_key'] = '';
139+
$_ENV['geoip_locale'] = 'en';
132140
// ClientDownload 命令解决 API 访问频率高而被限制使用的 Github access token
133141
$_ENV['github_access_token'] = '';
134-
135142
// use Cloudflare R2 for clients download
136143
$_ENV['enable_r2_client_download'] = false;
137144
$_ENV['r2_bucket_name'] = '';

0 commit comments

Comments
 (0)