mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-04-29 12:05:47 +08:00
many improve
This commit is contained in:
@@ -68,6 +68,10 @@
|
|||||||
|
|
||||||
rpadmin ALL=(ALL) NOPASSWD: ALL
|
rpadmin ALL=(ALL) NOPASSWD: ALL
|
||||||
|
|
||||||
|
vi /etc/rc.local
|
||||||
|
|
||||||
|
iptables-restore < /etc/iptables.rules
|
||||||
|
|
||||||
reboot
|
reboot
|
||||||
|
|
||||||
su rpadmin
|
su rpadmin
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
* [文件系统](Linux/Filesystem.md)
|
* [文件系统](Linux/Filesystem.md)
|
||||||
* [SSH](Linux/SSH.md)
|
* [SSH](Linux/SSH.md)
|
||||||
|
|
||||||
### Service
|
|
||||||
|
|
||||||
* [ShadowSocks](Service/ShadowSocks.md)
|
|
||||||
|
|
||||||
### Nginx
|
### Nginx
|
||||||
|
|
||||||
* [JSON 配置文件](Nginx/JSON-Configure.md)
|
* [JSON 配置文件](Nginx/JSON-Configure.md)
|
||||||
|
|||||||
@@ -26,11 +26,13 @@ fs.chmodSync path.join(__dirname, 'config.coffee'), 0o750
|
|||||||
bindRouters = ->
|
bindRouters = ->
|
||||||
app.use require 'middleware-injector'
|
app.use require 'middleware-injector'
|
||||||
|
|
||||||
for module_name in ['account', 'admin', 'panel', 'plan', 'ticket', 'wiki', 'bitcoin']
|
for module_name in ['account', 'admin', 'panel', 'plan', 'ticket', 'bitcoin']
|
||||||
app.use "/#{module_name}", require './core/router/' + module_name
|
app.use "/#{module_name}", require './core/router/' + module_name
|
||||||
|
|
||||||
plugin.loadPlugins()
|
plugin.loadPlugins()
|
||||||
|
|
||||||
|
app.use '/wiki', require './core/router/wiki'
|
||||||
|
|
||||||
app.get '/', (req, res) ->
|
app.get '/', (req, res) ->
|
||||||
res.redirect '/panel/'
|
res.redirect '/panel/'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module.exports =
|
module.exports =
|
||||||
web:
|
web:
|
||||||
|
name: 'GreenShadow'
|
||||||
url: 'http://ss.rpvhost.net'
|
url: 'http://ss.rpvhost.net'
|
||||||
listen: '/home/rpadmin/rootpanel.sock'
|
listen: '/home/rpadmin/rootpanel.sock'
|
||||||
google_analytics_id: 'UA-49193300-2'
|
google_analytics_id: 'UA-49193300-2'
|
||||||
@@ -16,6 +17,8 @@ module.exports =
|
|||||||
available_services: ['shadowsocks']
|
available_services: ['shadowsocks']
|
||||||
|
|
||||||
billing:
|
billing:
|
||||||
|
taobao_item_id: '38370649858'
|
||||||
|
|
||||||
force_unsubscribe:
|
force_unsubscribe:
|
||||||
when_balance_below: 0
|
when_balance_below: 0
|
||||||
when_arrears_above: 0
|
when_arrears_above: 0
|
||||||
@@ -31,22 +34,6 @@ module.exports =
|
|||||||
services: ['shadowsocks']
|
services: ['shadowsocks']
|
||||||
resources: {}
|
resources: {}
|
||||||
|
|
||||||
nodes:
|
|
||||||
us1:
|
|
||||||
domain: 'us1.rpvhost.net'
|
|
||||||
location: 'Linode Fremont, CA, USA'
|
|
||||||
readme: ''
|
|
||||||
|
|
||||||
jp1:
|
|
||||||
domain: 'jp1.rpvhost.net'
|
|
||||||
location: 'Linode Tokyo, JP'
|
|
||||||
readme: ''
|
|
||||||
|
|
||||||
ss:
|
|
||||||
domain: 'ss.rpvhost.net'
|
|
||||||
location: 'Linode Fremont, CA, USA'
|
|
||||||
readme: 'ShadowSocks Only'
|
|
||||||
|
|
||||||
mongodb:
|
mongodb:
|
||||||
user: 'rpadmin'
|
user: 'rpadmin'
|
||||||
password: 'password'
|
password: 'password'
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ exports.get '/pay', requireAuthenticate, renderAccount, (req, res) ->
|
|||||||
billing_log: (callback) ->
|
billing_log: (callback) ->
|
||||||
mBalance.find
|
mBalance.find
|
||||||
account_id: req.account._id
|
account_id: req.account._id
|
||||||
type: 'billing'
|
type:
|
||||||
|
$in: ['billing', 'service_billing']
|
||||||
,
|
,
|
||||||
sort:
|
sort:
|
||||||
created_at: -1
|
created_at: -1
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ markdown = require('markdown').markdown
|
|||||||
path = require 'path'
|
path = require 'path'
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
|
|
||||||
app.view_hook.menu_bar.push
|
unless _.find(app.view_hook.menu_bar, (i) -> i.href == '/wiki/')
|
||||||
href: '/wiki/'
|
app.view_hook.menu_bar.push
|
||||||
html: '用户手册'
|
href: '/wiki/'
|
||||||
|
html: '用户手册'
|
||||||
|
|
||||||
{renderAccount} = require './middleware'
|
{renderAccount} = require './middleware'
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ html
|
|||||||
span.icon-bar
|
span.icon-bar
|
||||||
span.icon-bar
|
span.icon-bar
|
||||||
span.icon-bar
|
span.icon-bar
|
||||||
a.navbar-brand(href='/')= t('app.name')
|
a.navbar-brand(href='/')= config.web.name
|
||||||
#navbar-collapse.collapse.navbar-collapse
|
#navbar-collapse.collapse.navbar-collapse
|
||||||
ul.nav.navbar-nav
|
ul.nav.navbar-nav
|
||||||
for item in app.view_hook.menu_bar
|
for item in app.view_hook.menu_bar
|
||||||
|
|||||||
@@ -15,24 +15,8 @@ block main
|
|||||||
|
|
||||||
div
|
div
|
||||||
h2 淘宝
|
h2 淘宝
|
||||||
p 拍下对应宝贝后付款即可,购买时注意选择服务器节点选项,备注填写你在 RP 主机的用户名。
|
p 拍下对应宝贝后付款即可,购买时注意选择服务器节点选项,备注填写你的用户名。
|
||||||
a.btn.btn-success(href='http://item.taobao.com/item.htm?id=38370649858') 淘宝购买
|
a.btn.btn-success(href='http://item.taobao.com/item.htm?id=#{config.billing.taobao_item_id}') 淘宝购买
|
||||||
|
|
||||||
.row
|
|
||||||
header 机房列表
|
|
||||||
table.table.table-hover
|
|
||||||
thead
|
|
||||||
tr
|
|
||||||
th 域名
|
|
||||||
th 位置
|
|
||||||
th 说明
|
|
||||||
tbody
|
|
||||||
for node in nodes
|
|
||||||
tr
|
|
||||||
td
|
|
||||||
a(href='//#{node.domain}')= node.domain
|
|
||||||
td= node.location
|
|
||||||
td= node.readme
|
|
||||||
|
|
||||||
.row
|
.row
|
||||||
header 充值记录
|
header 充值记录
|
||||||
@@ -69,4 +53,7 @@ block main
|
|||||||
tr
|
tr
|
||||||
td= moment(item.created_at).format('YYYY-MM-DD HH:mm:ss')
|
td= moment(item.created_at).format('YYYY-MM-DD HH:mm:ss')
|
||||||
td #{item.amount.toFixed(2)} CNY
|
td #{item.amount.toFixed(2)} CNY
|
||||||
td #{item.attribute.plans.join(', ')} | #{item.attribute.billing_time} hours #{item.attribute.is_force ? '| force' : ''}
|
if item.type == 'billing'
|
||||||
|
td #{item.attribute.plans.join(', ')} | #{item.attribute.billing_time} hours #{item.attribute.is_force ? '| force' : ''}
|
||||||
|
else if item.type == 'service_billing' && item.attribute.service == 'shadowsocks'
|
||||||
|
td ShadowSocks #{item.attribute.traffic_mb} MB #{item.attribute.is_force ? '| force' : ''}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
markdown = require('markdown').markdown
|
||||||
|
fs = require 'fs'
|
||||||
|
path = require 'path'
|
||||||
|
|
||||||
service = require './service'
|
service = require './service'
|
||||||
{requireInService} = require '../../core/router/middleware'
|
{renderAccount, requireInService} = require '../../core/router/middleware'
|
||||||
|
|
||||||
mAccount = require '../../core/model/account'
|
mAccount = require '../../core/model/account'
|
||||||
|
|
||||||
@@ -18,3 +22,32 @@ exports.post '/reset_password', (req, res) ->
|
|||||||
|
|
||||||
service.restart req.account, ->
|
service.restart req.account, ->
|
||||||
res.json {}
|
res.json {}
|
||||||
|
|
||||||
|
wiki_router = express.Router()
|
||||||
|
|
||||||
|
wiki_router.use (req, res) ->
|
||||||
|
req.inject [renderAccount], ->
|
||||||
|
url = req.url.substr 1
|
||||||
|
|
||||||
|
unless url
|
||||||
|
url = 'README.md'
|
||||||
|
|
||||||
|
filename = path.resolve path.join __dirname, 'WIKI', url
|
||||||
|
baseDir = path.resolve path.join __dirname, 'WIKI'
|
||||||
|
|
||||||
|
unless filename[0 .. baseDir.length-1] == baseDir
|
||||||
|
return res.json 404
|
||||||
|
|
||||||
|
fs.readFile filename, (err, data) ->
|
||||||
|
if err
|
||||||
|
return res.status(404).send err.toString()
|
||||||
|
|
||||||
|
res.render 'wiki',
|
||||||
|
title: url
|
||||||
|
content: markdown.toHTML data.toString()
|
||||||
|
|
||||||
|
app.view_hook.menu_bar.push
|
||||||
|
href: '/wiki/'
|
||||||
|
html: '用户手册'
|
||||||
|
|
||||||
|
app.use '/wiki', wiki_router
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ module.exports =
|
|||||||
last_traffic_value: 0
|
last_traffic_value: 0
|
||||||
, new: true, (err, account) ->
|
, new: true, (err, account) ->
|
||||||
child_process.exec "sudo iptables -I OUTPUT -p tcp --sport #{port}", ->
|
child_process.exec "sudo iptables -I OUTPUT -p tcp --sport #{port}", ->
|
||||||
module.exports.restart account, ->
|
child_process.exec 'sudo iptables-save | sudo tee /etc/iptables.rules', ->
|
||||||
callback()
|
module.exports.restart account, ->
|
||||||
|
callback()
|
||||||
|
|
||||||
delete: (account, callback) ->
|
delete: (account, callback) ->
|
||||||
queryIptablesInfo (iptables_info) ->
|
queryIptablesInfo (iptables_info) ->
|
||||||
@@ -86,6 +87,9 @@ module.exports =
|
|||||||
(callback) ->
|
(callback) ->
|
||||||
child_process.exec "sudo iptables -D OUTPUT #{iptables_info[port].num}", callback
|
child_process.exec "sudo iptables -D OUTPUT #{iptables_info[port].num}", callback
|
||||||
|
|
||||||
|
(callback) ->
|
||||||
|
child_process.exec 'sudo iptables-save | sudo tee /etc/iptables.rules', callback
|
||||||
|
|
||||||
(callback) ->
|
(callback) ->
|
||||||
child_process.exec "sudo rm /etc/supervisor/conf.d/#{account.username}.conf", callback
|
child_process.exec "sudo rm /etc/supervisor/conf.d/#{account.username}.conf", callback
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
module.exports =
|
module.exports =
|
||||||
web:
|
web:
|
||||||
url: 'http://ss.rpvhost.net'
|
name: 'GreenShadow'
|
||||||
|
url: 'http://greenshadow.net'
|
||||||
listen: '/home/rpadmin/rootpanel.sock'
|
listen: '/home/rpadmin/rootpanel.sock'
|
||||||
google_analytics_id: 'UA-49193300-2'
|
google_analytics_id: 'UA-49193300-3'
|
||||||
|
|
||||||
account:
|
account:
|
||||||
cookie_time: 30 * 24 * 3600 * 1000
|
cookie_time: 30 * 24 * 3600 * 1000
|
||||||
@@ -16,6 +17,8 @@ module.exports =
|
|||||||
available_services: ['shadowsocks']
|
available_services: ['shadowsocks']
|
||||||
|
|
||||||
billing:
|
billing:
|
||||||
|
taobao_item_id: '38370649858'
|
||||||
|
|
||||||
force_unsubscribe:
|
force_unsubscribe:
|
||||||
when_balance_below: 0
|
when_balance_below: 0
|
||||||
when_arrears_above: 0
|
when_arrears_above: 0
|
||||||
@@ -31,12 +34,6 @@ module.exports =
|
|||||||
services: ['shadowsocks']
|
services: ['shadowsocks']
|
||||||
resources: {}
|
resources: {}
|
||||||
|
|
||||||
nodes:
|
|
||||||
ss:
|
|
||||||
domain: 'ss.rpvhost.net'
|
|
||||||
location: 'Linode Fremont, CA, USA'
|
|
||||||
readme: 'ShadowSocks Only'
|
|
||||||
|
|
||||||
mongodb:
|
mongodb:
|
||||||
user: 'rpadmin'
|
user: 'rpadmin'
|
||||||
password: 'password'
|
password: 'password'
|
||||||
|
|||||||
Reference in New Issue
Block a user