mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -172,6 +172,33 @@ def initdUinstall():
|
|||||||
os.remove(initd_bin)
|
os.remove(initd_bin)
|
||||||
return 'ok'
|
return 'ok'
|
||||||
|
|
||||||
|
|
||||||
|
def getFtpPort():
|
||||||
|
import re
|
||||||
|
try:
|
||||||
|
file = getServerDir() + '/etc/pure-ftpd.conf'
|
||||||
|
conf = public.readFile(file)
|
||||||
|
rep = "\n#?\s*Bind\s+[0-9]+\.[0-9]+\.[0-9]+\.+[0-9]+,([0-9]+)"
|
||||||
|
port = re.search(rep, conf).groups()[0]
|
||||||
|
except:
|
||||||
|
port = '21'
|
||||||
|
return port
|
||||||
|
|
||||||
|
|
||||||
|
def getFtpList():
|
||||||
|
|
||||||
|
data = {}
|
||||||
|
info = {}
|
||||||
|
info['ip'] = public.getLocalIp()
|
||||||
|
info['port'] = getFtpPort()
|
||||||
|
data['info'] = info
|
||||||
|
|
||||||
|
return public.getJson(data)
|
||||||
|
|
||||||
|
|
||||||
|
def addFtp():
|
||||||
|
return 'o'
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
func = sys.argv[1]
|
func = sys.argv[1]
|
||||||
if func == 'status':
|
if func == 'status':
|
||||||
@@ -192,5 +219,9 @@ if __name__ == "__main__":
|
|||||||
print initdUinstall()
|
print initdUinstall()
|
||||||
elif func == 'conf':
|
elif func == 'conf':
|
||||||
print getConf()
|
print getConf()
|
||||||
|
elif func == 'get_ftp_list':
|
||||||
|
print getFtpList()
|
||||||
|
elif func == 'add_ftp':
|
||||||
|
print addFtp()
|
||||||
else:
|
else:
|
||||||
print 'error'
|
print 'error'
|
||||||
|
|||||||
+76
-16
@@ -1,6 +1,67 @@
|
|||||||
|
function ftpPost(method,args,callback){
|
||||||
|
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||||
|
$.post('/plugins/run', {name:'pureftp', func:method, args:JSON.stringify(args)}, function(data) {
|
||||||
|
layer.close(loadT);
|
||||||
|
if (!data.status){
|
||||||
|
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(typeof(callback) == 'function'){
|
||||||
|
callback(data);
|
||||||
|
}
|
||||||
|
},'json');
|
||||||
|
}
|
||||||
|
|
||||||
function ftpList(page, search){
|
function ftpList(page, search){
|
||||||
|
var _data = {};
|
||||||
|
if (typeof(page) =='undefined'){
|
||||||
|
var page = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_data['page'] = page;
|
||||||
|
_data['page_size'] = 10;
|
||||||
|
if(typeof(search) != 'undefined'){
|
||||||
|
_data['search'] = search;
|
||||||
|
}
|
||||||
|
|
||||||
|
ftpPost('get_ftp_list', _data, function(data){
|
||||||
|
|
||||||
|
var rdata = $.parseJSON(data.data);
|
||||||
|
content = '<div class="info-title-tips"><p><span class="glyphicon glyphicon-alert" style="color: #f39c12; margin-right: 10px;"></span>当前FTP地址为:ftp://'+rdata['info']['ip']+':'+rdata['info']['port']+'</p></div>';
|
||||||
|
content += '<div class="finduser"><input class="bt-input-text mr5 outline_no" type="text" placeholder="查找用户名" id="csvn_find_user" style="height: 28px; border-radius: 3px;width: 435px;">';
|
||||||
|
content += '<button class="btn btn-success btn-sm" onclick="csvnUserFind();">查找</button></div>';
|
||||||
|
|
||||||
|
content += '<div class="divtable" style="margin-top:5px;"><table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">';
|
||||||
|
content += '<thead><tr>';
|
||||||
|
content += '<th>用户名</th>';
|
||||||
|
content += '<th>密码</th>';
|
||||||
|
content += '<th>状态</th>';
|
||||||
|
content += '<th>根目录</th>';
|
||||||
|
content += '<th>备注</th>';
|
||||||
|
content += '<th>操作(<a class="btlink" onclick="addFtp(0);">添加</a>|<a class="btlink">修改FTP端口</a>)</th>';
|
||||||
|
content += '</tr></thead>';
|
||||||
|
|
||||||
|
content += '<tbody>';
|
||||||
|
|
||||||
|
ulist = rdata.data;
|
||||||
|
for (i in ulist){
|
||||||
|
content += '<tr><td>'+ulist[i]+'</td><td>'+
|
||||||
|
'<a class="btlink" onclick="csvnDelUser(\''+ulist[i]+'\')">删除</a> | ' +
|
||||||
|
'<a class="btlink" onclick="csvnModPwdUser(\''+ulist[i]+'\')">改密</a></td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
content += '</tbody>';
|
||||||
|
content += '</table></div>';
|
||||||
|
|
||||||
|
page = '<div class="dataTables_paginate paging_bootstrap pagination" style="margin-top:0px;"><ul id="softPage" class="page"><div>';
|
||||||
|
page += rdata.list;
|
||||||
|
page += '</div></ul></div>';
|
||||||
|
|
||||||
|
content += page;
|
||||||
|
|
||||||
|
$(".soft-man-con").html(content);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,13 +127,14 @@ function getFtp(page, search) {
|
|||||||
*添加FTP帐户
|
*添加FTP帐户
|
||||||
* @param {Number} type 添加类型
|
* @param {Number} type 添加类型
|
||||||
*/
|
*/
|
||||||
function ftpAdd(type) {
|
function addFtp(type) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
var loadT = layer.load({
|
var loadT = layer.load({
|
||||||
shade: true,
|
shade: true,
|
||||||
shadeClose: false
|
shadeClose: false
|
||||||
});
|
});
|
||||||
var data = $("#ftpAdd").serialize();
|
var data = $("#ftpAdd").serialize();
|
||||||
|
console.log(data);
|
||||||
$.post('/ftp?action=AddUser', data, function(rdata) {
|
$.post('/ftp?action=AddUser', data, function(rdata) {
|
||||||
if (rdata.status) {
|
if (rdata.status) {
|
||||||
getFtp(1);
|
getFtp(1);
|
||||||
@@ -95,41 +157,39 @@ function ftpAdd(type) {
|
|||||||
type: 1,
|
type: 1,
|
||||||
skin: 'demo-class',
|
skin: 'demo-class',
|
||||||
area: '500px',
|
area: '500px',
|
||||||
title: lan.ftp.add_title,
|
title: '添加FTP帐户',
|
||||||
closeBtn: 2,
|
closeBtn: 2,
|
||||||
shift: 5,
|
shift: 5,
|
||||||
shadeClose: false,
|
shadeClose: false,
|
||||||
content: "<form class='bt-form pd20 pb70' id='ftpAdd'>\
|
content: "<form class='bt-form pd20 pb70' id='ftpAdd'>\
|
||||||
<div class='line'>\
|
<div class='line'>\
|
||||||
<span class='tname'>"+lan.ftp.add_user+"</span>\
|
<span class='tname'>用户名</span>\
|
||||||
<div class='info-r'><input class='bt-input-text' type='text' id='ftpUser' name='ftp_username' style='width:330px' /></div>\
|
<div class='info-r'><input class='bt-input-text' type='text' id='ftpUser' name='ftp_username' style='width:330px' /></div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class='line'>\
|
<div class='line'>\
|
||||||
<span class='tname'>"+lan.ftp.add_pass+"</span>\
|
<span class='tname'>密码</span>\
|
||||||
<div class='info-r'><input class='bt-input-text mr5' type='text' name='ftp_password' id='MyPassword' style='width:330px' value='"+(RandomStrPwd(10))+"' /><span title='"+lan.ftp.add_pass_rep+"' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(10)'></span></div>\
|
<div class='info-r'><input class='bt-input-text mr5' type='text' name='ftp_password' id='MyPassword' style='width:330px' value='"+(randomStrPwd(16))+"' /><span title='随机密码' class='glyphicon glyphicon-repeat cursor' onclick='repeatPwd(16)'></span></div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class='line'>\
|
<div class='line'>\
|
||||||
<span class='tname'>"+lan.ftp.add_path+"</span>\
|
<span class='tname'>根目录</span>\
|
||||||
<div class='info-r'><input id='inputPath' class='bt-input-text mr5' type='text' name='path' value='"+defaultPath+"/' placeholder='"+lan.ftp.add_path_title+"' style='width:330px' /><span class='glyphicon glyphicon-folder-open cursor' onclick='ChangePath(\"inputPath\")'></span><p class='c9 mt10'>"+lan.ftp.add_path_ps+"</p></div>\
|
<div class='info-r'><input id='inputPath' class='bt-input-text mr5' type='text' name='path' value='"+defaultPath+"/' placeholder='"+lan.ftp.add_path_title+"' style='width:330px' /><span class='glyphicon glyphicon-folder-open cursor' onclick='changePath(\"inputPath\")'></span><p class='c9 mt10'>"+lan.ftp.add_path_ps+"</p></div>\
|
||||||
</div>\
|
</div>\
|
||||||
<div class='line' style='display:none'>\
|
<div class='line' style='display:none'>\
|
||||||
<span class='tname'>"+lan.ftp.add_ps+"</span>\
|
<span class='tname'>备注</span>\
|
||||||
<div class='info-r'>\
|
<div class='info-r'>\
|
||||||
<input class='bt-input-text' type='text' name='ps' value='' placeholder='"+lan.ftp.add_ps_title+"' />\
|
<input class='bt-input-text' type='text' name='ps' value='' placeholder='"+lan.ftp.add_ps_title+"' />\
|
||||||
</div></div>\
|
</div></div>\
|
||||||
<div class='bt-form-submit-btn'>\
|
<div class='bt-form-submit-btn'>\
|
||||||
<button type='button' class='btn btn-danger btn-sm btn-title' onclick='layer.closeAll()'>"+lan.public.close+"</button>\
|
<button type='button' class='btn btn-danger btn-sm btn-title' onclick='layer.closeAll()'>关闭</button>\
|
||||||
<button type='button' class='btn btn-success btn-sm btn-title' onclick=\"ftpAdd(1)\" >"+lan.public.submit+"</button>\
|
<button type='button' class='btn btn-success btn-sm btn-title' onclick=\"ftpAdd(1)\" >提交</button>\
|
||||||
</div>\
|
</div>\
|
||||||
</form>"
|
</form>"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#ftpUser").keyup(function(){
|
||||||
$("#ftpUser").keyup(function()
|
console.log('dd');
|
||||||
{
|
|
||||||
var ftpName = $(this).val();
|
var ftpName = $(this).val();
|
||||||
if($("#inputPath").val().substr(0,11) == '/www/wwwroo' )
|
if( $("#inputPath").val().substr(0,11) == '/www/wwwroo' ){
|
||||||
{
|
|
||||||
$("#inputPath").val('/www/wwwroot/'+ftpName);
|
$("#inputPath").val('/www/wwwroot/'+ftpName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ function syncPost(path, args){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function repeatPwd(a) {
|
function repeatPwd(a) {
|
||||||
$("#MyPassword").val(RandomStrPwd(a))
|
$("#MyPassword").val(randomStrPwd(a))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user