mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-01-13 07:01:20 +08:00
完成了除了流量统计的部分
This commit is contained in:
13
INSTALL.md
13
INSTALL.md
@@ -110,14 +110,23 @@
|
||||
|
||||
# ShadowSocks
|
||||
|
||||
add-apt-repository 'deb http://shadowsocks.org/debian wheezy main'
|
||||
apt-get install shadowsocks
|
||||
apt-get install python-pip python-m2crypto supervisor
|
||||
pip install shadowsocks
|
||||
|
||||
vi /etc/default/supervisor
|
||||
|
||||
ulimit -n 51200
|
||||
|
||||
service supervisor restart
|
||||
|
||||
### Runtime
|
||||
|
||||
# Golang
|
||||
apt-get install golang golang-go.tools
|
||||
|
||||
# Python
|
||||
apt-get install python python3 python-pip python3-pip python-dev python3-dev
|
||||
pip install django tornado markdown python-memcached web.py mongo uwsgi virtualenv virtualenvwrapper flask gevent jinja2 requests
|
||||
|
||||
# Node.js
|
||||
npm install forever coffee-script gulp mocha harp bower -g
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
img {
|
||||
img.pull-left {
|
||||
width: 58px;
|
||||
height: 58px;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
child_process = require 'child_process'
|
||||
path = require 'path'
|
||||
jade = require 'jade'
|
||||
fs = require 'fs'
|
||||
|
||||
plugin = require '../../core/plugin'
|
||||
|
||||
@@ -20,12 +21,18 @@ generatePort = (callback) ->
|
||||
module.exports =
|
||||
enable: (account, callback) ->
|
||||
generatePort (port) ->
|
||||
password = mAccount.randomSalt()[0...10]
|
||||
|
||||
mAccount.update _id: account._id,
|
||||
$set:
|
||||
'attribute.plugin.shadowsocks':
|
||||
port: port
|
||||
password: mAccount.randomSalt()
|
||||
password: password
|
||||
, ->
|
||||
account.attribute.plugin.shadowsocks =
|
||||
port: port
|
||||
password: password
|
||||
|
||||
module.exports.restart account, ->
|
||||
callback()
|
||||
|
||||
@@ -34,16 +41,24 @@ module.exports =
|
||||
$unset:
|
||||
'attribute.plugin.shadowsocks': true
|
||||
, ->
|
||||
#TODO kill process
|
||||
callback()
|
||||
# TODO delete iptables
|
||||
|
||||
child_process.exec "sudo rm /etc/supervisor/conf.d/#{account.username}.conf", ->
|
||||
child_process.exec 'sudo supervisorctl reload', ->
|
||||
callback()
|
||||
|
||||
restart: (account, callback) ->
|
||||
config_content = _.template (fs.readFileSync path.join(__dirname, 'template/config.conf')).toString(), account.attribute.plugin.shadowsocks
|
||||
|
||||
plugin.writeConfig "/etc/shadowsocks/#{account.username}.conf", config_content, ->
|
||||
# kill process
|
||||
child_process.exec "nohup ss-server -c /etc/shadowsocks/#{account.username}.conf &", ->
|
||||
callback()
|
||||
# TODO iptables
|
||||
|
||||
plugin.writeConfig "/etc/shadowsocks/#{account.username}.json", config_content, ->
|
||||
config_content = _.template (fs.readFileSync path.join(__dirname, 'template/supervisor.conf')).toString(),
|
||||
account: account
|
||||
|
||||
plugin.writeConfig "/etc/supervisor/conf.d/#{account.username}.conf", config_content, ->
|
||||
child_process.exec 'sudo supervisorctl reload', ->
|
||||
callback()
|
||||
|
||||
widget: (account, callback) ->
|
||||
jade.renderFile path.join(__dirname, 'view/widget.jade'),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"server": "0.0.0.0",
|
||||
"server_port": "<%= port %>",
|
||||
"server_port": <%= port %>,
|
||||
"local_port": 1080,
|
||||
"password": "<%= password %>",
|
||||
"timeout": 60,
|
||||
|
||||
4
plugin/shadowsocks/template/supervisor.conf
Normal file
4
plugin/shadowsocks/template/supervisor.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
[program:shadowsocks-<%= account.username %>]
|
||||
command=ssserver -c /etc/shadowsocks/<%= account.username %>.json
|
||||
autorestart=true
|
||||
user=nobody
|
||||
@@ -6,10 +6,10 @@ header ShadowSocks
|
||||
.panel-body
|
||||
.input-group(style='margin-bottom: 20px;')
|
||||
span.input-group-addon 端口
|
||||
input.form-control(type='text', value='14261', disabled)
|
||||
input.form-control(type='text', value=account.attribute.plugin.shadowsocks.port, disabled)
|
||||
.input-group
|
||||
span.input-group-addon 密码
|
||||
input.form-control(type='test', value='zppeLxbSfyNR2YwL', disabled)
|
||||
input.form-control(type='text', value=account.attribute.plugin.shadowsocks.password, disabled)
|
||||
span.input-group-btn
|
||||
button.btn.btn-default(type='button') 重置
|
||||
|
||||
|
||||
Reference in New Issue
Block a user