Coming soon...
20 |├── .gitattributes ├── storage ├── ss-panel │ └── .gitignore └── framework │ ├── views │ └── .gitignore │ └── smarty │ ├── cache │ └── .gitignore │ └── compile │ └── .gitignore ├── .gitignore ├── run.sh ├── app ├── Command │ ├── Job.php │ └── XCat.php ├── Services │ ├── Auth │ │ ├── File.php │ │ ├── Base.php │ │ ├── JwtToken.php │ │ ├── Cookie.php │ │ └── Redis.php │ ├── Token │ │ ├── Token.php │ │ ├── Base.php │ │ └── DB.php │ ├── Aws │ │ ├── Factory.php │ │ └── Client.php │ ├── Jwt.php │ ├── Auth.php │ ├── View.php │ ├── Analytics.php │ ├── Analytic.php │ ├── Factory.php │ ├── Mail.php │ ├── Boot.php │ ├── Mail │ │ ├── Mailgun.php │ │ └── Smtp.php │ ├── Slim.php │ ├── Config.php │ ├── RedisClient.php │ └── Password.php ├── Models │ ├── Token.php │ ├── PasswordReset.php │ ├── Node.php │ ├── Role.php │ ├── InviteCode.php │ ├── Model.php │ └── User.php ├── Utils │ ├── Response.php │ ├── Check.php │ ├── Cookie.php │ ├── Helper.php │ ├── Hash.php │ └── Tools.php ├── Middleware │ ├── Guest.php │ ├── Auth.php │ ├── Admin.php │ └── Api.php └── Controllers │ ├── BaseController.php │ ├── HomeController.php │ ├── AdminController.php │ ├── PasswordController.php │ ├── Admin │ ├── UserController.php │ └── NodeController.php │ ├── ApiController.php │ ├── AuthController.php │ └── UserController.php ├── public ├── favicon.ico ├── robots.txt ├── assets │ ├── public │ │ ├── img │ │ │ ├── blue.png │ │ │ └── blue@2x.png │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── css │ │ │ ├── sticky-footer-navbar.css │ │ │ ├── jumbotron-narrow.css │ │ │ └── blue.css │ │ ├── js │ │ │ ├── icheck.min.js │ │ │ └── app.min.js │ │ └── plugins │ │ │ └── slimScroll │ │ │ └── jquery.slimscroll.min.js │ └── materialize │ │ ├── font │ │ ├── Material_Icons.woff2 │ │ ├── roboto │ │ │ ├── Roboto-Bold.ttf │ │ │ ├── Roboto-Thin.ttf │ │ │ ├── Roboto-Bold.woff │ │ │ ├── Roboto-Bold.woff2 │ │ │ ├── Roboto-Light.ttf │ │ │ ├── Roboto-Light.woff │ │ │ ├── Roboto-Light.woff2 │ │ │ ├── Roboto-Medium.ttf │ │ │ ├── Roboto-Medium.woff │ │ │ ├── Roboto-Regular.ttf │ │ │ ├── Roboto-Thin.woff │ │ │ ├── Roboto-Thin.woff2 │ │ │ ├── Roboto-Medium.woff2 │ │ │ ├── Roboto-Regular.woff │ │ │ └── Roboto-Regular.woff2 │ │ └── material-design-icons │ │ │ ├── Material-Design-Icons.eot │ │ │ ├── Material-Design-Icons.ttf │ │ │ ├── Material-Design-Icons.woff │ │ │ ├── Material-Design-Icons.woff2 │ │ │ └── cd-top-arrow.svg │ │ ├── css │ │ └── style.css │ │ └── js │ │ └── init.js ├── .htaccess └── index.php ├── .travis.yml ├── docker ├── shadowsocks.conf ├── config.json ├── 3line.sh ├── supervisor.conf ├── Config.py ├── mysql-init.sh ├── .env ├── default ├── Dockerfile └── Dockerfile_daocloud ├── install.sh ├── xcat ├── bootstrap.php ├── composer.json ├── README.md ├── db-user_token.sql ├── views └── default │ ├── user │ ├── sys.tpl │ ├── footer.tpl │ ├── profile.tpl │ ├── nodeinfo.tpl │ ├── node.tpl │ ├── kill.tpl │ ├── invite.tpl │ ├── index.tpl │ └── main.tpl │ ├── admin │ ├── footer.tpl │ ├── sys.tpl │ ├── index.tpl │ ├── invite.tpl │ ├── node │ │ ├── index.tpl │ │ ├── create.tpl │ │ └── edit.tpl │ ├── user │ │ └── index.tpl │ └── main.tpl │ ├── tos.tpl │ ├── auth │ ├── header.tpl │ ├── login.tpl │ └── register.tpl │ ├── footer.tpl │ ├── code.tpl │ ├── header.tpl │ ├── index.tpl │ └── password │ ├── reset.tpl │ └── token.tpl ├── LICENSE ├── .env.example ├── db-160212.sql └── config └── routes.php /.gitattributes: -------------------------------------------------------------------------------- 1 | *.tpl linguist-language=php -------------------------------------------------------------------------------- /storage/ss-panel/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .env 3 | vendor/ 4 | composer.phar -------------------------------------------------------------------------------- /storage/framework/smarty/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | php -S localhost:8000 -t public -------------------------------------------------------------------------------- /storage/framework/smarty/compile/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /app/Command/Job.php: -------------------------------------------------------------------------------- 1 | boot(); 10 | -------------------------------------------------------------------------------- /app/Models/Node.php: -------------------------------------------------------------------------------- 1 | > \$file; done" 7 | done -------------------------------------------------------------------------------- /app/Models/Model.php: -------------------------------------------------------------------------------- 1 | withStatus(302)->withHeader('Location',$to); 10 | return $newResponse; 11 | } 12 | } -------------------------------------------------------------------------------- /docker/supervisor.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | 4 | [program:nginx] 5 | command=/usr/sbin/nginx 6 | 7 | [program:php5-fpm] 8 | command=/usr/sbin/php5-fpm 9 | 10 | [program:mysql] 11 | command=/usr/bin/mysqld_safe 12 | 13 | [program:redis-server] 14 | command=/usr/bin/redis-server -------------------------------------------------------------------------------- /app/Services/Token/Base.php: -------------------------------------------------------------------------------- 1 | 'us-west-2', 12 | 'version' => 'latest', 13 | 'DynamoDb' => [ 14 | 'region' => 'eu-central-1' 15 | ] 16 | ]); 17 | } 18 | } -------------------------------------------------------------------------------- /app/Utils/Cookie.php: -------------------------------------------------------------------------------- 1 | $value){ 10 | setcookie($key,$value,$time,'/'); 11 | } 12 | } 13 | 14 | public static function get($key){ 15 | if(isset($_COOKIE[$key])){ 16 | return $_COOKIE[$key]; 17 | } 18 | return ""; 19 | } 20 | } -------------------------------------------------------------------------------- /app/Utils/Helper.php: -------------------------------------------------------------------------------- 1 | getQueryParams(); 14 | if(!isset($params['access_token'])){ 15 | return null; 16 | } 17 | $accessToken = $params['access_token']; 18 | return $accessToken; 19 | } 20 | } -------------------------------------------------------------------------------- /app/Services/Jwt.php: -------------------------------------------------------------------------------- 1 | login($uid,$time); 20 | } 21 | 22 | public static function getUser(){ 23 | return self::getDriver()->getUser(); 24 | } 25 | 26 | public static function logout(){ 27 | self::getDriver()->logout(); 28 | } 29 | } -------------------------------------------------------------------------------- /public/assets/materialize/font/material-design-icons/cd-top-arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "slim/slim": "^3.0", 4 | "illuminate/database": "*", 5 | "slim/twig-view": "~2.0", 6 | "slim/csrf": "0.5.*", 7 | "smarty/smarty": "~3.1", 8 | "mailgun/mailgun-php": "~1.7.2", 9 | "predis/predis": "~1.0", 10 | "phpmailer/phpmailer": "~5.2", 11 | "illuminate/pagination": "~5.1", 12 | "vlucas/phpdotenv": "~2.1", 13 | "zeuxisoo/slim-whoops": "0.4.*", 14 | "firebase/php-jwt": "~3.0", 15 | "aws/aws-sdk-php": "3.*" 16 | }, 17 | "autoload": { 18 | "classmap": [ 19 | 20 | ], 21 | "psr-4": { 22 | "App\\": "app/" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ss-panel 2 | 3 | Thanks: 4 | 5 | [LightFish](https://github.com/OzCat/LightFish) 6 | 7 | [shadowsocks manyuser](https://github.com/mengskysama/shadowsocks/tree/manyuser) 8 | 9 | [shadowsocks-go mu](https://github.com/orvice/shadowsocks-go/tree/mu) 10 | 11 | [ss-panel](https://github.com/orvice/ss-panel) 12 | 13 | 14 | 15 | ## About 16 | 17 | [完整版中文安装教程](https://github.com/maxidea-com/ss-panel/wiki/v3-Guide) 18 | 19 | ## Quick Start 20 | 21 | [专为懒人准备的Docker版本](https://github.com/maxidea-com/ss-panel/wiki/Docker) 22 | 23 | 24 | ## Requirements 25 | 26 | * PHP 5.5 or newer 27 | * Web server with URL rewriting 28 | * MySQL 29 | 30 | -------------------------------------------------------------------------------- /app/Middleware/Guest.php: -------------------------------------------------------------------------------- 1 | isLogin){ 15 | $newResponse = $response->withStatus(302)->withHeader('Location', '/user'); 16 | return $newResponse; 17 | } 18 | $response = $next($request, $response); 19 | return $response; 20 | } 21 | } -------------------------------------------------------------------------------- /app/Middleware/Auth.php: -------------------------------------------------------------------------------- 1 | isLogin){ 15 | $newResponse = $response->withStatus(302)->withHeader('Location', '/auth/login'); 16 | return $newResponse; 17 | } 18 | $response = $next($request, $response); 19 | return $response; 20 | } 21 | } -------------------------------------------------------------------------------- /app/Services/View.php: -------------------------------------------------------------------------------- 1 | settemplatedir(BASE_PATH.'/views/'.Config::get('theme').'/'); //设置模板文件存放目录 12 | $smarty->setcompiledir(BASE_PATH.'/storage/framework/smarty/compile/'); //设置生成文件存放目录 13 | $smarty->setcachedir(BASE_PATH.'/storage/framework/smarty/cache/'); //设置缓存文件存放目录 14 | // add config 15 | $smarty->assign('config',Config::getPublicConfig()); 16 | $smarty->assign('user',Auth::getUser()); 17 | return $smarty; 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /app/Services/Analytics.php: -------------------------------------------------------------------------------- 1 | ',0)->count(); 15 | } 16 | 17 | public function getTrafficUsage(){ 18 | $total = User::sum('u') + USer::sum('d'); 19 | return Tools::flowAutoShow($total); 20 | } 21 | 22 | public function getOnlineUser($time){ 23 | $time = time() - $time; 24 | return User::where('t','>',$time)->count(); 25 | } 26 | } -------------------------------------------------------------------------------- /app/Services/Analytic.php: -------------------------------------------------------------------------------- 1 | count(); 13 | } 14 | 15 | public function checkinUserCount(){ 16 | return User::where('last_checkin_time','>', 1)->count(); 17 | } 18 | 19 | public function activedUserCount(){ 20 | return User::where('t','>', 1)->count(); 21 | } 22 | 23 | public function totalTraffic(){ 24 | $u = User::all()->sum('u'); 25 | $d = User::all()->sum('d'); 26 | return Tools::flowAutoShow($u + $d); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /docker/mysql-init.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | sudo service mysql restart 3 | if [ $? -eq 0 ]; then 4 | echo "mysql startup successful!" 5 | else 6 | echo "mysql startup failed!" 7 | exit 1 8 | fi 9 | 10 | echo "create ss-panel database, user, password" 11 | mysql -uroot -p'pw123456' -e "CREATE DATABASE sspanel character SET utf8; CREATE user 'ssuser'@'localhost' IDENTIFIED BY 'sspasswd'; GRANT ALL privileges ON sspanel.* TO 'ssuser'@'localhost'; FLUSH PRIVILEGES;" 12 | 13 | echo "input shadowsocks sql init database" 14 | cd /opt/shadowsocks/shadowsocks; mysql -u ssuser -psspasswd sspanel < ./shadowsocks.sql 15 | 16 | echo "input ss-panel sql into database" 17 | cd /opt/ss-panel; mysql -u ssuser -psspasswd sspanel < db-160212.sql -------------------------------------------------------------------------------- /db-user_token.sql: -------------------------------------------------------------------------------- 1 | -- Adminer 4.1.0 MySQL dump 2 | 3 | SET NAMES utf8; 4 | SET time_zone = '+00:00'; 5 | SET foreign_key_checks = 0; 6 | SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; 7 | 8 | DROP TABLE IF EXISTS `user_token`; 9 | CREATE TABLE `user_token` ( 10 | `id` int(11) NOT NULL AUTO_INCREMENT, 11 | `token` varchar(256) NOT NULL, 12 | `user_id` int(11) NOT NULL, 13 | `create_time` int(11) NOT NULL, 14 | `expire_time` int(11) NOT NULL, 15 | PRIMARY KEY (`id`) 16 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 17 | 18 | INSERT INTO `user_token` (`id`, `token`, `user_id`, `create_time`, `expire_time`) VALUES 19 | (14, 'ar9DfZZhN9eL1PbETj1YnmKsSgPaefMye8J5YPTfriHgrLmIL7hSGoy8O5w2IKQY', 1, 1455114361, 1455719161); 20 | 21 | -- 2016-02-10 15:38:15 22 | -------------------------------------------------------------------------------- /app/Controllers/BaseController.php: -------------------------------------------------------------------------------- 1 | smarty = View::getSmarty(); 27 | return $this->smarty; 28 | } 29 | 30 | public function view(){ 31 | return $this->smarty(); 32 | } 33 | 34 | /** 35 | * @param $response 36 | * @param $res 37 | * @return mixed 38 | */ 39 | public function echoJson($response,$res){ 40 | return $response->getBody()->write(json_encode($res)); 41 | } 42 | } -------------------------------------------------------------------------------- /app/Services/Factory.php: -------------------------------------------------------------------------------- 1 | send($to,$subject,$text); 26 | case "smtp": 27 | $mail = new Smtp(); 28 | return $mail->send($to,$subject,$text); 29 | default: 30 | // @TODO default action 31 | } 32 | return true; 33 | } 34 | } -------------------------------------------------------------------------------- /views/default/user/sys.tpl: -------------------------------------------------------------------------------- 1 | {include file='user/main.tpl'} 2 | 3 |
Coming soon...
20 |