From 151c26b0041e2bf04074b559b8deb3e15fb6e8e3 Mon Sep 17 00:00:00 2001 From: midoks Date: Fri, 29 Jan 2021 17:03:34 +0800 Subject: [PATCH] up --- plugins/socket5/index.py | 6 +- plugins/socket5/init.d/ss5 | 83 +++ plugins/socket5/js/socket5.js | 101 ---- plugins/socket5/scripts/socket5.sh | 820 ----------------------------- 4 files changed, 88 insertions(+), 922 deletions(-) create mode 100644 plugins/socket5/init.d/ss5 delete mode 100644 plugins/socket5/scripts/socket5.sh diff --git a/plugins/socket5/index.py b/plugins/socket5/index.py index 13ebf7ec1..4c2010c35 100755 --- a/plugins/socket5/index.py +++ b/plugins/socket5/index.py @@ -32,6 +32,10 @@ def getInitDFile(): return '/etc/init.d/ss5' +def initDreplace(): + return getPluginDir() + '/init.d/ss5' + + def getArgs(): args = sys.argv[2:] tmp = {} @@ -74,7 +78,7 @@ def initConf(): ss5_pwd = getServerDir() + '/ss5.passwd' if not os.path.exists(ss5_pwd): - tmp = getPluginDir() + '/tmp/ss5.conf' + tmp = getPluginDir() + '/tmp/ss5.passwd' if not os.path.exists(tmp): mw.execShell('cp -rf ' + tmp + ' /etc/opt/ss5') diff --git a/plugins/socket5/init.d/ss5 b/plugins/socket5/init.d/ss5 new file mode 100644 index 000000000..ee7790b75 --- /dev/null +++ b/plugins/socket5/init.d/ss5 @@ -0,0 +1,83 @@ +#!/bin/sh +# +# chkconfig: 345 20 80 +# description: This script takes care of starting \ +# and stopping ss5 +# + +OS=`uname -s` +if [ $OS = "Linux" ] || [ $OS = "SunOS" ]; then + +# Source function library. + . /etc/rc.d/init.d/functions + +# Source networking configuration. + . /etc/sysconfig/network + +# Check that networking is up. + [ ${NETWORKING} = "no" ] && exit 0 + + [ -f /usr/sbin/ss5 ] || exit 0 +fi + +# Test custom variables +test -f /etc/sysconfig/ss5 && . /etc/sysconfig/ss5 + +# See how we were called. +case "$1" in + start) + # Start daemon. + echo -n "Starting ss5... " + if [ $OS = "Linux" ]; then + daemon /usr/sbin/ss5 -t $SS5_OPTS + touch /var/lock/subsys/ss5 + else + if [ $OS = "SunOS" ]; then + /usr/sbin/ss5 -t + touch /var/lock/subsys/ss5 + else + /usr/local/sbin/ss5 -t + fi + fi + echo "done" + ;; + stop) + # Stop daemon. + echo "Shutting down ss5... " + if [ $OS = "Linux" ] || [ $OS = "SunOS" ]; then + killproc ss5 + rm -f /var/lock/subsys/ss5 + else + killall ss5 + fi + rm -f /var/run/ss5/ss5.pid + echo "done" + ;; + reload) + # Reload configuration + if [ $OS = "Linux" ] || [ $OS = "SunOS" ]; then + echo -n "Reloading ss5... " + killproc ss5 -1 + else + pkill -HUP ss5 + fi + echo "done reload" + ;; + restart) + # Restart daemon + echo -n "Restarting ss5... " + $0 stop + $0 start + ;; + status) + if [ $OS = "Linux" ] || [ $OS = "SunOS" ]; then + status ss5 + fi + ;; + *) + echo "Usage: ss5 {start|stop|status|restart|reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/plugins/socket5/js/socket5.js b/plugins/socket5/js/socket5.js index 3b5da6cda..fef7ffde3 100755 --- a/plugins/socket5/js/socket5.js +++ b/plugins/socket5/js/socket5.js @@ -48,107 +48,6 @@ function lpAsyncPost(method,args){ return syncPost('/plugins/run', {name:'l2tp', func:method, args:_args}); } -function userList(){ - lpPost('user_list', '' ,function(data){ - var rdata = $.parseJSON(data['data']); - - if (!rdata['status']){ - layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']}); - return; - } - var list = rdata['data']; - - var con = ''; - con += '
'; - con += ''; - con += ''; - con += ''; - con += ''; - con += ''; - - con += ''; - - for (var i = 0; i < list.length; i++) { - con += ''+ - '' + - '' + - ''; - } - - con += ''; - con += '
用户密码操作(添加)
' + list[i]['user']+'' + list[i]['pwd']+'改密|删除
'; - - $(".soft-man-con").html(con); - }); -} - - -function addUser(){ - var loadOpen = layer.open({ - type: 1, - title: '添加用户', - area: '240px', - content:"
\ -
\ -
\ -
\ -
\ - \ -
\ -
" - }); - - $('#add_ok').click(function(){ - _data = {}; - _data['username'] = $('#username').val(); - var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); - lpPost('add_user', _data, function(data){ - var rdata = $.parseJSON(data.data); - layer.close(loadOpen); - layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']}); - setTimeout(function(){userList();},2000); - }); - }); -} - -function delUser(username){ - lpPost('del_user', {username:username}, function(data){ - var rdata = $.parseJSON(data.data); - layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']}); - setTimeout(function(){userList();},2000); - }); -} - -function modUser(username){ - var loadOpen = layer.open({ - type: 1, - title: '修改密码', - area: '240px', - content:"
\ -
\ -
\ -
\ -
\ - \ -
\ -
" - }); - - $('#mod_ok').click(function(){ - _data = {}; - _data['username'] = username; - _data['password'] = $('#password').val(); - var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); - lpPost('mod_user', _data, function(data){ - var rdata = $.parseJSON(data.data); - layer.close(loadOpen); - layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']}); - setTimeout(function(){userList();},2000); - }); - }); -} - - function readme(){ var readme = '