From e7f9056ff4f00a8838afbea92461162b57b0da13 Mon Sep 17 00:00:00 2001 From: jysperm Date: Mon, 13 Oct 2014 16:00:14 +0800 Subject: [PATCH] fixbugs --- core/cache.coffee | 4 +- core/pluggable.coffee | 4 ++ plugin/linux/monitor.coffee | 2 + sample/shadowsocks.config.coffee | 64 -------------------------------- 4 files changed, 8 insertions(+), 66 deletions(-) delete mode 100644 sample/shadowsocks.config.coffee diff --git a/core/cache.coffee b/core/cache.coffee index 0f3cac4..643e89a 100644 --- a/core/cache.coffee +++ b/core/cache.coffee @@ -27,7 +27,7 @@ exports.try = (key, options, setter, callback) -> redis.get key, (err, value) -> if value != undefined if options.is_json - value = JSON.prase value + value = JSON.parse value callback value @@ -39,7 +39,7 @@ exports.try = (key, options, setter, callback) -> options.command key, value, -> callback value -exports.delete (key, param, callback) -> +exports.delete = (key, param, callback) -> unless callback callback = param param = {} diff --git a/core/pluggable.coffee b/core/pluggable.coffee index 30cdd22..9201fa3 100644 --- a/core/pluggable.coffee +++ b/core/pluggable.coffee @@ -89,6 +89,10 @@ exports.selectHook = (account, hook_name) -> return _.filter pointer, (hook) -> if hook.plugin_info.type == 'extension' return true + else if !hook.require_account + return true + else if !account + return false else if account.meta == 'any' return true else if hook.plugin_info.name in account.billing.services diff --git a/plugin/linux/monitor.coffee b/plugin/linux/monitor.coffee index 147fce6..cd72832 100644 --- a/plugin/linux/monitor.coffee +++ b/plugin/linux/monitor.coffee @@ -1,6 +1,8 @@ child_process = require 'child_process' os = require 'os' fs = require 'fs' +async = require 'async' +_ = require 'underscore' {config} = app {mAccount} = app.models diff --git a/sample/shadowsocks.config.coffee b/sample/shadowsocks.config.coffee deleted file mode 100644 index b7444f3..0000000 --- a/sample/shadowsocks.config.coffee +++ /dev/null @@ -1,64 +0,0 @@ -module.exports = - web: - name: 'GreenShadow' - url: 'http://greenshadow.net' - listen: '/home/rpadmin/rootpanel.sock' - google_analytics_id: 'UA-49193300-3' - - account: - cookie_time: 30 * 24 * 3600 * 1000 - - i18n: - defaultLanguage: 'zh_CN' - availableLanguage: ['zh_CN', 'en'] - - plugin: - available_extensions: ['rpvhost'] - available_services: ['shadowsocks'] - - billing: - taobao_item_id: '41040606505' - - force_unsubscribe: - when_balance_below: 0 - when_arrears_above: 0 - - cyclical_billing: 3600 * 1000 - daily_billing_cycle: 24 * 3600 * 1000 - - plans: - shadowsocks: - t_name: 'ShadowSocks' - t_service: '按量付费' - t_resources: '0.6 CNY / G' - services: ['shadowsocks'] - resources: {} - - mongodb: - user: 'rpadmin' - password: 'password' - host: 'localhost' - name: 'RootPanel' - - redis_password: 'password' - - email: - send_from: 'robot@rpvhost.net' - - account: - service: 'Postmark' - auth: - user: 'postmark-api-token' - pass: 'postmark-api-token' - - bitcoin: - coinbase_api_key: 'coinbase-simple-api-key' - - plugins: - rpvhost: - index_page: false - - shadowsocks: - price_bucket: 0.06 - monitor_cycle: 60 * 1000 - billing_bucket: 100 * 1024 * 1024