Compare commits

..
38 Commits
Author SHA1 Message Date
Mr Chen 60c0c0a34b Merge pull request #156 from midoks/dev
0.9.1
2022-08-11 22:35:24 +08:00
midoks 2323de4fc6 0.9.1 2022-08-11 22:33:33 +08:00
midoks f15134aa9e 右键菜单修复 2022-08-11 22:16:40 +08:00
midoks a71936cabc Update files.js 2022-08-11 20:14:31 +08:00
midoks 58af7bb152 up 2022-08-11 20:06:26 +08:00
midoks f8b04deb03 expect 加入安装脚本 2022-08-11 19:38:43 +08:00
midoks 4b798b14b0 Update files.html 2022-08-11 18:51:49 +08:00
midoks 9cc667ac4a pgxx9 2022-08-11 18:19:08 +08:00
midoks 6775934a0d up 2022-08-11 16:52:21 +08:00
midoks cec9c3a23d up 2022-08-11 15:15:02 +08:00
midoks e904ad4406 up 2022-08-11 11:53:49 +08:00
midoks a68c8605b7 up 2022-08-11 02:08:20 +08:00
midoks a65a484bf1 up 2022-08-11 00:13:15 +08:00
midoks 24ca8cfde3 Update index.py 2022-08-11 00:03:07 +08:00
midoks 57b83e654b Update index.py 2022-08-11 00:02:31 +08:00
midoks aa13a9163a Update index.py 2022-08-10 23:44:12 +08:00
midoks f83e00d565 Update index.py 2022-08-10 22:41:36 +08:00
midoks 63cd240b5c Update index.py 2022-08-10 22:08:28 +08:00
midoks 7ef311d972 Update install.sh 2022-08-10 22:08:03 +08:00
midoks 1a8e643c10 Update index.py 2022-08-10 22:01:46 +08:00
midoks da4c8750fc Update index.py 2022-08-10 19:03:35 +08:00
midoks 1e366c6263 Update index.py 2022-08-10 18:30:50 +08:00
midoks 364a8ba5db Update postgresql.conf 2022-08-10 18:01:15 +08:00
midoks 5867c5d2cc pgxx8 2022-08-10 16:14:39 +08:00
midoks 52d5fe4470 Update my.cnf 2022-08-10 15:47:37 +08:00
midoks c2f1dba9dc 远程下载-稳定显示 2022-08-10 12:20:57 +08:00
midoks 1bf2dc2738 up 2022-08-10 11:22:01 +08:00
midoks 0d09cf6ad4 Update index.py 2022-08-10 11:13:20 +08:00
midoks b6543b54e6 pgxx7 2022-08-10 11:10:24 +08:00
midoks bb8f970604 Update db.py 2022-08-10 10:16:08 +08:00
midoks c7b2fd182c up 2022-08-10 10:15:59 +08:00
midoks afd255c767 pgxx6 2022-08-10 00:22:41 +08:00
midoks 8daa136bc8 pgxx6 2022-08-09 23:05:48 +08:00
midoks 5c3840ee63 Update index.py 2022-08-09 03:02:27 +08:00
midoks 3e0ab6176c pgxx5 2022-08-09 02:51:20 +08:00
midoks 9a4336935b pgxx4 2022-08-09 01:48:09 +08:00
midoks 7ca8d687d7 pg up xx3 2022-08-08 23:07:22 +08:00
midoks b2a2ce52a7 up 2022-08-08 18:38:38 +08:00
32 changed files with 1626 additions and 1379 deletions
+1
View File
@@ -130,6 +130,7 @@ pyvenv.cfg
include
pip-selfcheck.json
scripts/mdserver-web
data/api_login.txt
data/sessions
data/ssl.pl
+4 -15
View File
@@ -1,4 +1,4 @@
### mdserver-web 0.9.0
### mdserver-web 0.9.1
简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
复制了后台管理界面,按照自己想要的方式写了一版。
@@ -70,21 +70,10 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```
### 版本更新 0.9.0
* 主流系统支持。
* 插件支持更多参数。
* MySQL主从支持GTID和经典模式。
* MariaDB主从支持GTID和经典模式。
* Rsyncd更新。
* 添加网站统计的插件。
* 添加varnish插件。
* 添加PHP的APT安装方式[辅助插件]。
* 添加PHP的YUM安装方式[辅助插件]。
* 添加MYSQL的YUM安装方式[辅助插件]。
* 各种bug修复。
### 版本更新 0.9.1
* 菜单修复.
* 更新修复.
### JSDelivr安装地址
+1 -1
View File
@@ -16,7 +16,7 @@ from flask import request
class config_api:
# mariadb 优化
__version = '0.9.0'
__version = '0.9.1'
def __init__(self):
pass
+1 -1
View File
@@ -171,7 +171,7 @@ class Sql():
def getField(self, keyName):
# 取回指定字段
result = self.field(keyName).select()
if len(result) == 1:
if len(result) >= 1:
return result[0][keyName]
return result
+23 -20
View File
@@ -53,8 +53,8 @@ class task_api:
return v
def getTaskSpeedApi(self):
tempFile = os.getcwd() + '/tmp/panelExec.log'
freshFile = os.getcwd() + '/tmp/panelFresh'
tempFile = mw.getRunDir() + '/tmp/panelExec.log'
freshFile = mw.getRunDir() + '/tmp/panelFresh'
find = mw.M('tasks').where('status=? OR status=?',
('-1', '0')).field('id,type,name,execstr').find()
@@ -63,25 +63,28 @@ class task_api:
mw.triggerTask()
echoMsg = {}
echoMsg['name'] = find['name']
echoMsg['execstr'] = find['execstr']
data = {}
data['name'] = find['name']
data['execstr'] = find['execstr']
if find['type'] == 'download':
import json
try:
tmp = mw.readFile(tempFile)
if len(tmp) < 10:
return mw.returnJson(False, '当前没有任务队列在执行-3!')
echoMsg['msg'] = json.loads(tmp)
echoMsg['isDownload'] = True
except:
mw.M('tasks').where(
"id=?", (find['id'],)).save('status', ('0',))
return mw.returnJson(False, '当前没有任务队列在执行-4!')
readLine = ""
for i in range(3):
try:
readLine = mw.readFile(tempFile)
if len(readLine) > 10:
data['msg'] = json.loads(readLine)
data['isDownload'] = True
break
except Exception as e:
if i == 2:
mw.M('tasks').where("id=?", (find['id'],)).save(
'status', ('0',))
return mw.returnJson(False, '当前没有任务队列在执行-4:' + str(e))
time.sleep(0.5)
else:
echoMsg['msg'] = mw.getLastLine(tempFile, 10)
echoMsg['isDownload'] = False
data['msg'] = mw.getLastLine(tempFile, 10)
data['isDownload'] = False
echoMsg['task'] = mw.M('tasks').where("status!=?", ('1',)).field(
data['task'] = mw.M('tasks').where("status!=?", ('1',)).field(
'id,status,name,type').order("id asc").select()
return mw.getJson(echoMsg)
return mw.getJson(data)
+2 -2
View File
@@ -7,8 +7,8 @@ socket = {$SERVER_APP_PATH}/mysql.sock
[mysqld]
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
sha256_password_private_key_path=mysql.pem
sha256_password_public_key_path=mysql.pub
;sha256_password_private_key_path=mysql.pem
;sha256_password_public_key_path=mysql.pub
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
user = mysql
+1 -1
View File
@@ -2421,7 +2421,7 @@ if __name__ == "__main__":
print(getDbAccess())
elif func == 'set_db_access':
print(setDbAccess())
elif func == 'get_db_rw':
elif func == 'set_db_rw':
print(setDbRw(version))
elif func == 'set_db_ps':
print(setDbPs())
+1 -1
View File
@@ -527,7 +527,7 @@ function checkSelect(){
}
function setDbRw(id,username,val){
myPost('get_db_rw',{id:id,username:username,rw:val}, function(data){
myPost('set_db_rw',{id:id,username:username,rw:val}, function(data){
var rdata = $.parseJSON(data.data);
// layer.msg(rdata.msg,{icon:rdata.status ? 1 : 5,shade: [0.3, '#000']});
showMsg(rdata.msg, function(){
+89 -2
View File
@@ -9,16 +9,24 @@ import psycopg2
class ORM:
__DB_PASS = None
__DB_USER = 'root'
__DB_USER = 'postgres'
__DB_PORT = 5432
__DB_HOST = 'localhost'
__DB_CONN = None
__DB_CUR = None
__DB_ERR = None
__DB_CNF = '/etc/my.cnf'
__DB_CNF = '/etc/postgresql.cnf'
__DB_SOCKET = '/www/server/postgresql/mysql.sock'
__DB_CHARSET = "utf8"
__DB_TABLE = "" # 被操作的表名称
__OPT_WHERE = "" # where条件
__OPT_LIMIT = "" # limit条件
__OPT_GROUP = "" # group条件
__OPT_ORDER = "" # order条件
__OPT_FIELD = "*" # field条件
__OPT_PARAM = () # where值
def __Conn(self):
'''连接数据库'''
try:
@@ -31,7 +39,9 @@ class ORM:
self.__DB_CONN = psycopg2.connect(database='postgres', user=self.__DB_USER, password=self.__DB_PASS,
host=self.__DB_HOST, port=int(self.__DB_PORT))
self.__DB_CONN.autocommit = True
self.__DB_CUR = self.__DB_CONN.cursor()
return True
except Exception as e:
self.__DB_ERR = e
@@ -55,6 +65,83 @@ class ORM:
def getPwd(self):
return self.__DB_PASS
def table(self, table):
# 设置表名
self.__DB_TABLE = table
return self
def where(self, where, param=()):
# WHERE条件
if where:
self.__OPT_WHERE = " WHERE " + where
self.__OPT_PARAM = param
return self
def andWhere(self, where, param):
# WHERE条件
if where:
self.__OPT_WHERE = self.__OPT_WHERE + " and " + where
# print(param)
# print(self.__OPT_PARAM)
self.__OPT_PARAM = self.__OPT_PARAM + param
return self
def order(self, order):
# ORDER条件
if len(order):
self.__OPT_ORDER = " ORDER BY " + order
else:
self.__OPT_ORDER = ""
return self
def group(self, group):
if len(group):
self.__OPT_GROUP = " GROUP BY " + group
else:
self.__OPT_GROUP = ""
return self
def limit(self, limit):
# LIMIT条件
if len(limit):
self.__OPT_LIMIT = " LIMIT " + limit
else:
self.__OPT_LIMIT = ""
return self
def field(self, field):
# FIELD条件
if len(field):
self.__OPT_FIELD = field
return self
def select(self):
# 查询数据集
if not self.__Conn():
return self.__DB_ERR
try:
sql = "SELECT " + self.__OPT_FIELD + " FROM " + self.__DB_TABLE + \
self.__OPT_WHERE + self.__OPT_GROUP + self.__OPT_ORDER + self.__OPT_LIMIT
# print(sql)
result = self.__DB_CUR.execute(sql, self.__OPT_PARAM)
data = self.__DB_CUR.fetchall()
ret = []
if self.__OPT_FIELD != "*":
field = self.__OPT_FIELD.split(',')
for row in data:
i = 0
field_k = {}
for key in field:
field_k[key] = row[i]
i += 1
ret.append(field_k)
else:
ret = map(list, data)
self.__Close()
return ret
except Exception as ex:
return "error: " + str(ex)
def execute(self, sql):
# 执行SQL语句返回受影响行
if not self.__Conn():
+10
View File
@@ -0,0 +1,10 @@
# PostgreSQL Client Authentication Configuration File
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
host all all 0.0.0.0/0 md5
host all all ::1/128 md5
local replication all trust
host replication all 0.0.0.0/0 md5
host replication all ::1/128 md5
+39 -1
View File
@@ -1,11 +1,49 @@
port = 5432
listen_addresses='*'
unix_socket_directories='{$APP_PATH}/tmp'
unix_socket_directories='/tmp'
max_connections=200
max_wal_size = 1GB
min_wal_size = 80MB
shared_buffers = 128MB
work_mem = 4MB
effective_cache_size = 4GB
temp_buffers = 8MB
max_prepared_transactions = 0
max_stack_depth = 2MB
bgwriter_lru_maxpages = 100
max_worker_processes = 8
dynamic_shared_memory_type = posix
log_timezone = 'Asia/Shanghai'
datestyle = 'iso, ymd'
timezone = 'Asia/Shanghai'
default_text_search_config = 'pg_catalog.simple'
# 主配置
#archive_mode = on
#archive_command = 'test ! -f {$APP_PATH}/archivelog/%f && cp %p {$APP_PATH}/archivelog/%f'
#wal_level = replica
#max_wal_senders = 10
#wal_sender_timeout = 60s
# 从配置
#hot_standby = on
#primary_conninfo = 'host=192.168.0.100 port=5432 user=replica password=123456'
#max_standby_streaming_delay = 30s
#wal_receiver_status_interval = 10s
#hot_standby_feedback = on
#recovery_target_timeline= 'latest'
logging_collector = on
log_destination = 'stderr'
log_directory = '{$APP_PATH}/logs'
log_filename = 'postgresql-%Y-%m-%d.log'
log_statement = all
log_rotation_age = 7d
log_rotation_size = 100MB
log_min_duration_statement = 5000
+6 -7
View File
@@ -2,18 +2,17 @@
<div class='plugin_version'></div>
<div class="bt-w-main">
<div class="bt-w-menu">
<!-- <script type="text/javascript">console.log($('.plugin_version').attr('version'));</script> -->
<p class="bgw" onclick="pluginService('postgresql', $('.plugin_version').attr('version'));">服务</p>
<p onclick="pluginInitD('postgresql', $('.plugin_version').attr('version'));">自启动</p>
<p onclick="pluginConfigTpl('postgresql');">配置文件</p>
<!--<p onclick="myDbPos();">存储位置</p> -->
<p onclick="pluginConfigTpl('postgresql');">配置文件</p>
<p onclick="pluginConfig('postgresql','','pg_hba_conf');">客服端认证</p>
<p onclick="pgPort();">端口</p>
<!-- <p onclick="runInfo();">当前状态</p>
<p onclick="myPerfOpt();">性能优化</p> -->
<p onclick="runInfo();">当前状态</p>
<p onclick="pgPerfOpt();">性能优化</p>
<p onclick="pluginLogs('postgresql',$('.plugin_version').attr('version'),'run_log');">日志</p>
<!--<p onclick="pluginLogs('postgresql',$('.plugin_version').attr('version'),'show_log');">慢日志</p>-->
<p onclick="pluginLogs('postgresql',$('.plugin_version').attr('version'),'slow_log');">慢日志</p>
<p onclick="dbList()">管理列表</p>
<!--<p onclick="masterOrSlaveConf($('.plugin_version').attr('version'))">主从配置</p> -->
<p onclick="masterOrSlaveConf($('.plugin_version').attr('version'))">主从配置</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con" style="height: 530px; overflow: auto;"></div>
+1030 -207
View File
File diff suppressed because it is too large Load Diff
@@ -4,8 +4,8 @@ After=network.target
[Service]
Type=forking
User=postgresql
Group=postgresql
User=postgres
Group=postgres
WorkingDirectory={$APP_PATH}
ExecStart={$APP_PATH}/bin/pg_ctl start -D {$APP_PATH}/data
ExecReload={$APP_PATH}/bin/pg_ctl restart -D {$APP_PATH}/data
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -20,12 +20,12 @@ Install_App()
mkdir -p ${postgreDir}
echo '正在安装脚本文件...' > $install_tmp
if id postgresql &> /dev/null ;then
echo "postgresql UID is `id -u postgresql`"
echo "postgresql Shell is `grep "^postgresql:" /etc/passwd |cut -d':' -f7 `"
if id postgres &> /dev/null ;then
echo "postgres UID is `id -u postgres`"
echo "postgres Shell is `grep "^postgres:" /etc/passwd |cut -d':' -f7 `"
else
groupadd postgresql
useradd -g postgresql postgresql
groupadd postgres
useradd -g postgres postgres
fi
if [ "$sysName" != "Darwin" ];then
@@ -68,13 +68,13 @@ Install_App()
if [ ! -d $serverPath/postgresql ];then
cd ${postgreDir}/postgresql-${VERSION} && ./configure \
--prefix=$serverPath/postgresql
# --with-openssl \
--prefix=$serverPath/postgresql \
--with-openssl
# --with-pgport=33206
echo "cd ${postgreDir}/postgresql-${VERSION} && ./configure \
--prefix=$serverPath/postgresql"
# --with-openssl \
--prefix=$serverPath/postgresql \
--with-openssl"
# --with-pgport=33206
make -j${cpuCore} && make install && make clean
fi
+186 -119
View File
@@ -1,4 +1,4 @@
console.log(lan);
// console.log(lan);
//判断磁盘数量超出宽度
function isDiskWidth(){
@@ -305,7 +305,7 @@ function getFiles(Path) {
if(!showRow) {
showRow = '100';
}
var Body = '';
var body = '';
var data = 'path=' + Path;
var loadT = layer.load();
var totalSize = 0;
@@ -340,9 +340,10 @@ function getFiles(Path) {
if(getCookie('rank') == 'a'){
$("#set_list").addClass("active");
$("#set_icon").removeClass("active");
Body += "<tr class='folderBoxTr' data-path='" + rdata.PATH + "/" + fmp[0] + "' filetype='dir'>\
body += "<tr class='folderBoxTr' data-path='" + rdata.PATH + "/" + fmp[0] + "' filetype='dir'>\
<td><input type='checkbox' name='id' value='"+fmp[0]+"'></td>\
<td class='column-name'><span class='cursor' onclick=\"getFiles('" + rdata.PATH + "/" + fmp[0] + "')\"><span class='ico ico-folder'></span><a class='text' title='" + fmp[0] + fmp[5] + "'>" + cnametext + "</a></span></td>\
<td class='column-name'><span class='cursor' onclick=\"getFiles('" + rdata.PATH + "/" + fmp[0] + "')\">\
<span class='ico ico-folder'></span><a class='text' title='" + fmp[0] + fmp[5] + "'>" + cnametext + "</a></span></td>\
<td>"+toSize(fmp[1])+"</td>\
<td>"+getLocalTime(fmp[2])+"</td>\
<td>"+fmp[3]+"</td>\
@@ -358,7 +359,8 @@ function getFiles(Path) {
} else {
$("#set_icon").addClass("active");
$("#set_list").removeClass("active");
Body += "<div class='file folderBox menufolder' data-path='" + rdata.PATH + "/" + fmp[0] + "' filetype='dir' title='"+lan.files.file_name+":" + fmp[0]+"&#13;"+lan.files.file_size+":" + toSize(fmp[1])+"&#13;"+lan.files.file_etime+":"+getLocalTime(fmp[2])+"&#13;"+lan.files.file_auth+":"+fmp[3]+"&#13;"+lan.files.file_own+":"+fmp[4]+"'>\
body += "<div class='file folderBox menufolder' data-path='" + rdata.PATH + "/" + fmp[0] + "' filetype='dir' title='"+lan.files.file_name+":" + fmp[0]+"&#13;"+lan.files.file_size+":"
+ toSize(fmp[1])+"&#13;"+lan.files.file_etime+":"+getLocalTime(fmp[2])+"&#13;"+lan.files.file_auth+":"+fmp[3]+"&#13;"+lan.files.file_own+":"+fmp[4]+"'>\
<input type='checkbox' name='id' value='"+fmp[0]+"'>\
<div class='ico ico-folder' ondblclick=\"getFiles('" + rdata.PATH + "/" + fmp[0] + "')\"></div>\
<div class='titleBox' onclick=\"getFiles('" + rdata.PATH + "/" + fmp[0] + "')\"><span class='tname'>" + fmp[0] + "</span></div>\
@@ -397,7 +399,7 @@ function getFiles(Path) {
totalSize += parseInt(fmp[1]);
if(getCookie("rank")=="a"){
Body += "<tr class='folderBoxTr' data-path='" + rdata.PATH +"/"+ fmp[0] + "' filetype='" + fmp[0] + "'><td><input type='checkbox' name='id' value='"+fmp[0]+"'></td>\
body += "<tr class='folderBoxTr' data-path='" + rdata.PATH +"/"+ fmp[0] + "' filetype='" + fmp[0] + "'><td><input type='checkbox' name='id' value='"+fmp[0]+"'></td>\
<td class='column-name'><span class='ico ico-"+(getExtName(fmp[0]))+"'></span><a class='text' title='" + fmp[0] + fmp[5] + "'>" + cnametext + "</a></td>\
<td>" + (toSize(fmp[1])) + "</td>\
<td>" + ((fmp[2].length > 11)?fmp[2]:getLocalTime(fmp[2])) + "</td>\
@@ -414,14 +416,16 @@ function getFiles(Path) {
</span></td></tr>";
}
else{
Body += "<div class='file folderBox menufile' data-path='" + rdata.PATH +"/"+ fmp[0] + "' filetype='"+fmp[0]+"' title='文件名:" + fmp[0]+"&#13;大小:" + toSize(fmp[1])+"&#13;修改时间:"+getLocalTime(fmp[2])+"&#13;权限:"+fmp[3]+"&#13;所有者:"+fmp[4]+"'>\
body += "<div class='file folderBox menufile' data-path='" + rdata.PATH +"/"+ fmp[0] + "' filetype='"+fmp[0]+"' title='文件名:" + fmp[0]+"&#13;大小:"
+ toSize(fmp[1])+"&#13;修改时间:"+getLocalTime(fmp[2])+"&#13;权限:"+fmp[3]+"&#13;所有者:"+fmp[4]+"'>\
<input type='checkbox' name='id' value='"+fmp[0]+"'>\
<div class='ico ico-"+(getExtName(fmp[0]))+"'></div>\
<div class='titleBox'><span class='tname'>" + fmp[0] + "</span></div>\
</div>";
}
}
var dirInfo = '(共{1}个目录与{2}个文件,大小:'.replace('{1}',rdata.DIR.length+'').replace('{2}',rdata.DIR.length+'')+'<font id="pathSize">'+(toSize(totalSize))+'<a class="btlink ml5" onClick="getPathSize()">获取</a></font>)';
var dirInfo = '(共{1}个目录与{2}个文件,大小:'.replace('{1}',rdata.DIR.length+'').replace('{2}',rdata.DIR.length+'')+'<font id="pathSize">'
+ (toSize(totalSize))+'<a class="btlink ml5" onClick="getPathSize()">获取</a></font>)';
$("#DirInfo").html(dirInfo);
if(getCookie('rank')=='a'){
var tablehtml = '<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table table-hover">\
@@ -436,13 +440,13 @@ function getFiles(Path) {
<th style="text-align: right;" width="330">操作</th>\
</tr>\
</thead>\
<tbody id="filesBody" class="list-list">'+Body+'</tbody>\
<tbody id="filesBody" class="list-list">'+body+'</tbody>\
</table>';
$("#fileCon").removeClass("fileList").html(tablehtml);
$("#tipTools").width($("#fileCon").width());
}
else{
$("#fileCon").addClass("fileList").html(Body);
$("#fileCon").addClass("fileList").html(body);
$("#tipTools").width($("#fileCon").width());
}
$("#DirPathPlace input").val(rdata.PATH);
@@ -464,19 +468,20 @@ function getFiles(Path) {
var copyName = getCookie('copyFileName');
var cutName = getCookie('cutFileName');
var isPaste = (copyName == 'null') ? cutName : copyName;
console.log('isPaste:',isPaste);
// console.log('isPaste:',isPaste);
//---
if (isPaste != 'null' && isPaste != undefined) {
BarTools += ' <button onclick="javascript:pasteFile(\'' + (getFileName(isPaste)) + '\');" class="btn btn-Warning btn-sm">粘贴</button>';
}
$("#Batch").html('');
var BatchTools = '';
var batchTools = '';
var isBatch = getCookie('BatchSelected');
if (isBatch == 1 || isBatch == '1') {
BatchTools += ' <button onclick="javascript:batchPaste();" class="btn btn-default btn-sm">粘贴所有</button>';
batchTools += ' <button onclick="javascript:batchPaste();" class="btn btn-default btn-sm">粘贴所有</button>';
}
$("#Batch").html(BatchTools);
$("#Batch").html(batchTools);
$("#setBox").prop("checked", false);
$("#BarTools").html(BarTools);
@@ -511,32 +516,38 @@ function getFiles(Path) {
$("input[name=id]").dblclick(function(e){
e.stopPropagation();
});
//禁用右键
$("#fileCon").bind("contextmenu",function(e){
return false;
});
bindselect();
//绑定右键
$("#fileCon").mousedown(function(e){
var count = totalFile();
if(e.which == 3) {
if(count>1){
RClickAll(e);
}
else{
return
}
}
});
// //禁用右键
// $("#fileCon").bind("contextmenu",function(e){
// return false;
// });
// bindselect();
// //绑定右键
// $("#fileCon").mousedown(function(e){
// var count = totalFile();
// if(e.which == 3) {
// if(count>1){
// RClickAll(e);
// }
// else{
// return
// }
// }
// });
$(".folderBox,.folderBoxTr").mousedown(function(e){
// console.log(e);
var count = totalFile();
if(e.which == 3) {
if(count <= 1){
var a = $(this);
a.contextify(RClick(a.attr("filetype"),a.attr("data-path"),a.find("input").val()));
}
else{
RClickAll(e);
var option = rightMenuClick(a.attr("filetype"),a.attr("data-path"),a.find("input").val());
a.contextify(option);
} else{
rightMenuClickAll(e);
}
}
});
@@ -600,18 +611,17 @@ function bindselect(){
//选择操作
function showSeclect(){
var count = totalFile();
var BatchTools = '';
var batchTools = '';
if(count > 1){
BatchTools = '<button onclick="javascript:batch(1);" class="btn btn-default btn-sm">复制</button>\
batchTools = '<button onclick="javascript:batch(1);" class="btn btn-default btn-sm">复制</button>\
<button onclick="javascript:batch(2);" class="btn btn-default btn-sm">剪切</button>\
<button onclick="javascript:batch(3);" class="btn btn-default btn-sm">权限</button>\
<button onclick="javascript:batch(5);" class="btn btn-default btn-sm">压缩</button>\
<button onclick="javascript:batch(4);" class="btn btn-default btn-sm">删除</button>'
$("#Batch").html(BatchTools);
<button onclick="javascript:batch(4);" class="btn btn-default btn-sm">删除</button>';
}else{
$("#Batch").html(BatchTools);
//setCookie('BatchSelected', null);
}
$("#Batch").html(batchTools);
}
//滚动条事件
@@ -739,7 +749,18 @@ function batchPasteTo(data,path){
//取扩展名
function getExtName(fileName){
var extArr = fileName.split(".");
var exts = ['folder','folder-unempty','sql','c','cpp','cs','flv','css','js','htm','html','java','log','mht','php','url','xml','ai','bmp','cdr','gif','ico','jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4','mpeg','mpg','rm','rmvb','swf','wav','webm','wma','wmv','rtf','docx','fdf','potm','pptx','txt','xlsb','xlsx','7z','cab','iso','rar','zip','gz','bt','file','apk','bookfolder','folder','folder-empty','folder-unempty','fromchromefolder','documentfolder','fromphonefolder','mix','musicfolder','picturefolder','videofolder','sefolder','access','mdb','accdb','sql','c','cpp','cs','js','fla','flv','htm','html','java','log','mht','php','url','xml','ai','bmp','cdr','gif','ico','jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4','mpeg','mpg','rm','rmvb','swf','wav','webm','wma','wmv','doc','docm','dotx','dotm','dot','rtf','docx','pdf','fdf','ppt','pptm','pot','potm','pptx','txt','xls','csv','xlsm','xlsb','xlsx','7z','gz','cab','iso','rar','zip','bt','file','apk','css'];
var exts = ['folder','folder-unempty','sql','c','cpp','cs','flv','css','js',
'htm','html','java','log','mht','php','url','xml','ai','bmp','cdr','gif','ico',
'jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4',
'mpeg','mpg','rm','rmvb','swf','wav','webm','wma','wmv','rtf','docx','fdf','potm',
'pptx','txt','xlsb','xlsx','7z','cab','iso','rar','zip','gz','bt','file','apk','bookfolder',
'folder','folder-empty','folder-unempty','fromchromefolder','documentfolder','fromphonefolder',
'mix','musicfolder','picturefolder','videofolder','sefolder','access','mdb','accdb','sql','c',
'cpp','cs','js','fla','flv','htm','html','java','log','mht','php','url','xml','ai','bmp','cdr',
'gif','ico','jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4','mpeg',
'mpg','rm','rmvb','swf','wav','webm','wma','wmv','doc','docm','dotx','dotm','dot','rtf','docx','pdf',
'fdf','ppt','pptm','pot','potm','pptx','txt','xls','csv','xlsm','xlsb','xlsx','7z','gz','cab','iso',
'rar','zip','bt','file','apk','css'];
var extLastName = extArr[extArr.length - 1];
for(var i=0; i<exts.length; i++){
if(exts[i]==extLastName){
@@ -759,20 +780,16 @@ function ShowEditMenu(){
})
}
// //取文件名
// function GetFileName(fileNameFull) {
// var pName = fileNameFull.split('/');
// return pName[pName.length - 1];
// }
//取磁盘
function getDisk() {
var LBody = '';
$.get('/system/disk_info', function(rdata) {
for (var i = 0; i < rdata.length; i++) {
LBody += "<span onclick=\"getFiles('" + rdata[i].path + "')\"><span class='glyphicon glyphicon-hdd'></span>&nbsp;" + (rdata[i].path=='/'?lan.files.path_root:rdata[i].path) + "(" + rdata[i].size[2] + ")</span>";
LBody += "<span onclick=\"getFiles('" + rdata[i].path + "')\">\
<span class='glyphicon glyphicon-hdd'></span>&nbsp;" + (rdata[i].path=='/'?lan.files.path_root:rdata[i].path) + "(" + rdata[i].size[2] + ")</span>";
}
var trash = '<span id="recycle_bin" onclick="recycleBin(\'open\')" title="回收站" style="position: absolute; border-color: #ccc; right: 77px;"><span class="glyphicon glyphicon-trash"></span>&nbsp;回收站</span>';
var trash = '<span id="recycle_bin" onclick="recycleBin(\'open\')" title="回收站" style="position: absolute; border-color: #ccc; right: 77px;">\
<span class="glyphicon glyphicon-trash"></span>&nbsp;回收站</span>';
$("#comlist").html(LBody+trash);
isDiskWidth();
},'json');
@@ -835,11 +852,14 @@ function createFile(type, path) {
<button type="button" class="btn btn-danger btn-sm" onclick="layer.closeAll()">关闭</button>\
<button id="createFileBtn" type="button" class="btn btn-success btn-sm" onclick="createFile(1,\'' + path + '\')">新建</button>\
</div>\
</div>'
});
$("#newFileName").focus().keyup(function(e){
if(e.keyCode == 13) $("#createFileBtn").click();
</div>',
success:function(){
$("#newFileName").focus().keyup(function(e){
if(e.keyCode == 13) $("#createFileBtn").click();
});
}
});
}
//新建目录
function createDir(type, path) {
@@ -872,11 +892,14 @@ function createDir(type, path) {
<button type="button" class="btn btn-danger btn-sm btn-title" onclick="layer.closeAll()">关闭</button>\
<button type="button" id="createDirBtn" class="btn btn-success btn-sm btn-title" onclick="createDir(1,\'' + path + '\')">新建</button>\
</div>\
</div>'
});
$("#newDirName").focus().keyup(function(e){
if(e.keyCode == 13) $("#createDirBtn").click();
</div>',
success:function(){
$("#newDirName").focus().keyup(function(e){
if(e.keyCode == 13) $("#createDirBtn").click();
});
}
});
}
//删除文件
@@ -886,7 +909,7 @@ function deleteFile(fileName){
$.post('/files/delete', 'path=' + encodeURIComponent(fileName), function(rdata) {
layer.closeAll();
layer.msg(rdata.msg, {
icon: rdata.status ? 1 : 2
icon: rdata.status ? 1 : 2,
});
getFiles($("#DirPathPlace input").val());
},'json');
@@ -933,10 +956,18 @@ function downloadFile(action){
if(action == 1){
var fUrl = $("#mUrl").val();
fUrl = encodeURIComponent(fUrl);
fpath = $("#dpath").val();
var fpath = $("#dpath").val();
fname = encodeURIComponent($("#dfilename").val());
if (fUrl == "" ){
layer.msg("URL地址不能为空!",{icon:2});
return;
}
layer.closeAll();
layer.msg(lan.files.down_task,{time:0,icon:16,shade: [0.3, '#000']});
$.post('/files/download_file','path='+fpath+'&url='+fUrl+'&filename='+fname,function(rdata){
layer.closeAll();
getFiles(fpath);
@@ -945,38 +976,42 @@ function downloadFile(action){
},'json');
return;
}
var path = $("#DirPathPlace input").val();
layer.open({
type: 1,
shift: 5,
closeBtn: 2,
area: '500px',
btn:["确定","关闭"],
title: lan.files.down_title,
content: '<form class="bt-form pd20 pb70">\
content: '<form class="bt-form pd20">\
<div class="line">\
<span class="tname">URL地址:</span><input type="text" class="bt-input-text" name="url" id="mUrl" placeholder="URL地址" style="width:330px" />\
<span class="tname">URL地址:</span>\
<input type="text" class="bt-input-text" name="url" id="mUrl" placeholder="URL地址" style="width:330px" />\
</div>\
<div class="line">\
<span class="tname ">下载到:</span><input type="text" class="bt-input-text" name="path" id="dpath" value="'+path+'" placeholder="下载到" style="width:330px" />\
<span class="tname ">下载到:</span>\
<input type="text" class="bt-input-text" name="path" id="dpath" value="'+path+'" placeholder="下载到" style="width:330px" />\
</div>\
<div class="line">\
<span class="tname">文件名:</span><input type="text" class="bt-input-text" name="filename" id="dfilename" value="" placeholder="文件名" style="width:330px" />\
<span class="tname">文件名:</span>\
<input type="text" class="bt-input-text" name="filename" id="dfilename" value="" placeholder="文件名" style="width:330px" />\
</div>\
<div class="bt-form-submit-btn">\
<button type="button" class="btn btn-danger btn-sm" onclick="layer.closeAll()">关闭</button>\
<button type="button" id="dlok" class="btn btn-success btn-sm dlok" onclick="downloadFile(1)">确定</button>\
</div>\
</form>'
});
$("#mUrl").keyup(function(){
durl = $(this).val();
tmp = durl.split('/');
$("#dfilename").val(tmp[tmp.length-1]);
</form>',
success:function(){
$("#mUrl").keyup(function(){
durl = $(this).val();
tmp = durl.split('/');
$("#dfilename").val(tmp[tmp.length-1]);
});
},
yes:function(){
downloadFile(1);
}
});
}
//重命名
function reName(type, fileName) {
if (type == 1) {
@@ -1002,19 +1037,22 @@ function reName(type, fileName) {
closeBtn: 2,
area: '320px',
title: '重命名',
content: '<div class="bt-form pd20 pb70">\
btn:["确定","保存"],
content: '<div class="bt-form pd20">\
<div class="line">\
<input type="text" class="bt-input-text" name="Name" id="newFileName" value="' + fileName + '" placeholder="文件名" style="width:100%" />\
</div>\
<div class="bt-form-submit-btn">\
<button type="button" class="btn btn-danger btn-sm btn-title" onclick="layer.closeAll()">关闭</button>\
<button type="button" id="ReNameBtn" class="btn btn-success btn-sm btn-title" onclick="reName(1,\'' + fileName.replace(/'/,"\\'") + '\')">保存</button>\
</div>\
</div>'
});
$("#newFileName").focus().keyup(function(e){
if(e.keyCode == 13) $("#ReNameBtn").click();
</div>',
success:function(){
$("#newFileName").focus().keyup(function(e){
if(e.keyCode == 13) $("#ReNameBtn").click();
});
},
yes:function(){
reName(1,fileName.replace(/'/,"\\'"));
}
});
}
//剪切
function cutFile(fileName) {
@@ -1023,7 +1061,7 @@ function cutFile(fileName) {
setCookie('copyFileName', null);
layer.msg('已剪切', {
icon: 1,
time: 1000
time: 1000,
});
setTimeout(function(){
getFiles(path);
@@ -1036,7 +1074,7 @@ function copyFile(fileName) {
setCookie('cutFileName', null);
layer.msg('已复制', {
icon: 1,
time: 1000
time: 1000,
});
setTimeout(function(){
@@ -1140,8 +1178,8 @@ function zip(dirName,submits) {
param = dirName;
if(dirName.indexOf(',') != -1){
tmp = path.split('/')
dirName = path + '/' + tmp[tmp.length-1]
tmp = path.split('/');
dirName = path + '/' + tmp[tmp.length-1];
}
layer.open({
@@ -1153,28 +1191,29 @@ function zip(dirName,submits) {
content: '<div class="bt-form pd20 pb70">'
+'<div class="line noborder">'
+'<input type="text" class="form-control" id="sfile" value="' +param + '" placeholder="" style="display:none" />'
+'<span>'+lan.files.zip_to+'</span><input type="text" class="bt-input-text" id="dfile" value="'+dirName + '.tar.gz" placeholder="'+lan.files.zip_to+'" style="width: 75%; display: inline-block; margin: 0px 10px 0px 20px;" /><span class="glyphicon glyphicon-folder-open cursor" onclick="ChangePath(\'dfile\')"></span>'
+'<span>'+lan.files.zip_to+'</span>\
<input type="text" class="bt-input-text" id="dfile" value="'+dirName + '.tar.gz" placeholder="'+lan.files.zip_to+'" style="width: 75%; display: inline-block; margin: 0px 10px 0px 20px;" />\
<span class="glyphicon glyphicon-folder-open cursor" onclick="changePath(\'dfile\')"></span>'
+'</div>'
+'<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" id="ReNameBtn" class="btn btn-success btn-sm btn-title" onclick="zip(\'' + param + '\',1)">'+lan.files.file_menu_zip+'</button>'
+'</div>'
+'</div>'
+'</div>',
success:function(){
$("#dfile").change(function(){
var dfile = $(this).val()
tmp = dfile.split('.');
if(tmp[tmp.length-1] != 'gz'){
var path = $("#DirPathPlace input").val();
tmp = path.split('/');
dfile += '/' + tmp[tmp.length-1] + '.tar.gz'
$(this).val(dfile.replace(/\/\//g,'/'))
}
});
}
});
setTimeout(function(){
$("#dfile").change(function(){
var dfile = $(this).val()
tmp = dfile.split('.');
if(tmp[tmp.length-1] != 'gz'){
var path = $("#DirPathPlace input").val();
tmp = path.split('/');
dfile += '/' + tmp[tmp.length-1] + '.tar.gz'
$(this).val(dfile.replace(/\/\//g,'/'))
}
});
},100);
}
//解压目录
@@ -1208,8 +1247,8 @@ function unZip(fileName,type) {
content: '<div class="bt-form pd20 pb70">'
+'<div class="line unzipdiv">'
+'<span class="tname">'+lan.files.unzip_name+'</span><input type="text" class="bt-input-text" id="sfile" value="' +fileName + '" placeholder="'+lan.files.unzip_name_title+'" style="width:330px" /></div>'
+'<div class="line"><span class="tname">'+lan.files.unzip_to+'</span><input type="text" class="bt-input-text" id="dfile" value="'+path + '" placeholder="'+lan.files.unzip_to+'" style="width:330px" /></div>' + umpass
+'<div class="line"><span class="tname">'+lan.files.unzip_coding+'</span><select class="bt-input-text" name="coding">'
+'<div class="line"><span class="tname">'+lan.files.unzip_to+'</span><input type="text" class="bt-input-text" id="dfile" value="'+path + '" placeholder="'+lan.files.unzip_to+'" style="width:330px" /></div>'
+ umpass +'<div class="line"><span class="tname">'+lan.files.unzip_coding+'</span><select class="bt-input-text" name="coding">'
+'<option value="UTF-8">UTF-8</option>'
+'<option value="gb18030">GBK</option>'
+'</select>'
@@ -1233,7 +1272,8 @@ function isZip(fileName){
//是否文本文件
function isText(fileName){
var exts = ['rar','zip','tar.gz','gz','iso','xsl','doc','xdoc','jpeg','jpg','png','gif','bmp','tiff','exe','so','7z','bz'];
var exts = ['rar','zip','tar.gz','gz','iso','xsl','doc','xdoc','jpeg',
'jpg','png','gif','bmp','tiff','exe','so','7z','bz'];
return isExts(fileName,exts)?false:true;
}
@@ -1424,36 +1464,63 @@ function onAccess(){
}
}
}
//右键菜单
function RClick(type,path,name){
function rightMenuClick(type,path,name){
console.log(type,path,name);
var displayZip = isZip(type);
var options = {items:[
{text: lan.files.file_menu_copy, onclick: function() {copyFile(path)}},
{text: lan.files.file_menu_mv, onclick: function() {cutFile(path)}},
{text: lan.files.file_menu_rename, onclick: function() {reName(0,name)}},
{text: lan.files.file_menu_auth, onclick: function() {setChmod(0,path)}},
{text: lan.files.file_menu_zip, onclick: function() {zip(path)}}
{text: "复制", onclick: function() {copyFile(path)}},
{text: "剪切", onclick: function() {cutFile(path)}},
{text: "重命名", onclick: function() {reName(0,name)}},
{text: lan.files.file_menu_auth, onclick: function() {setChmod(0,path)}},
{text: lan.files.file_menu_zip, onclick: function() {zip(path)}},
]};
if(type == "dir"){
options.items.push({text: lan.files.file_menu_del, onclick: function() {DeleteDir(path)}});
options.items.push({text: lan.files.file_menu_del, onclick: function() {
deleteDir(path)}
});
}
else if(isText(type)){
options.items.push({text: lan.files.file_menu_edit, onclick: function() {onlineEditFile(0,path)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {deleteFile(path)}});
options.items.push({text: lan.files.file_menu_edit, onclick: function() {
onlineEditFile(0,path);
}},{text: lan.files.file_menu_down, onclick: function() {
getFileBytes(path);
}},{ text: lan.files.file_menu_del, onclick: function() {
deleteFile(path);
}});
}
else if(displayZip != -1){
options.items.push({text: lan.files.file_menu_unzip, onclick: function() {unZip(path,displayZip)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {deleteFile(path)}});
options.items.push({text: lan.files.file_menu_unzip, onclick: function() {
unZip(path,displayZip);
}},{text: lan.files.file_menu_down, onclick: function() {
getFileBytes(path);
}},{text: lan.files.file_menu_del, onclick: function() {
deleteFile(path);
}});
}
else if(isImage(type)){
options.items.push({text: lan.files.file_menu_img, onclick: function() {GetImage(path)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {deleteFile(path)}});
options.items.push({text: lan.files.file_menu_img, onclick: function() {
getImage(path);
}},{text: lan.files.file_menu_down, onclick: function() {
getFileBytes(path);
}},{text: lan.files.file_menu_del, onclick: function() {
deleteFile(path);
}});
}
else{
options.items.push({text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {deleteFile(path)}});
options.items.push({text: lan.files.file_menu_down, onclick: function() {
getFileBytes(path);
}},{text: lan.files.file_menu_del, onclick: function() {
deleteFile(path);
}});
}
return options;
}
//右键批量操作
function RClickAll(e){
function rightMenuClickAll(e){
var menu = $("#rmenu");
var windowWidth = $(window).width(),
windowHeight = $(window).height(),
+2 -5
View File
@@ -1,9 +1,6 @@
/*!
* jQuery Contextify v1.0.8 (http://contextify.js.org)
* jQuery Contextify v1.0.7 (http://contextify.js.org)
* Copyright (c) 2016 Adam Bouqdib
* Licensed under GPL-2.0 (http://abemedia.co.uk/license)
*/
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery,window)}(function(a,b){function c(b,c){this.element=b,this.options=a.extend({},e,c),this._defaults=e,this._name=d,this.init()}var d="contextify",e={items:[],action:"contextmenu",menuId:"contextify-menu",menuClass:"dropdown-menu",headerClass:"dropdown-header",dividerClass:"divider",before:!1},f=0,g=a(b);c.prototype.init=function(){var b=a.extend({},this.options,a(this.element).data());b.id=f,a(this.element).attr("data-contextify-id",b.id).on("contextmenu",function(c){c.preventDefault(),"function"==typeof b.before&&b.before(this,b);var d=a('<ul class="'+b.menuClass+'" role="menu" id="'+b.menuId+'" data-contextify-id="'+b.id+'"/>');d.data(b);var e,f=b.items.length;for(e=0;e<f;e++){var h=b.items[e],i=a("<li/>");if(h.divider)i.addClass(b.dividerClass);else if(h.header)i.addClass(b.headerClass),i.html(h.header);else{i.append("<a/>");var j=i.find("a");if(h.href&&j.attr("href",h.href),h.onclick&&(j.on("click",b,h.onclick),j.css("cursor","pointer")),h.data){for(var k in h.data)d.attr("data-"+k,h.data[k]);j.data(h.data)}j.html(h.text)}d.append(i)}var l=a("#"+b.menuId);l.length>0?l!==d&&l.replaceWith(d):a("body").append(d);var m=g.width(),n=g.height(),o=d.outerWidth(),p=d.outerHeight(),q=o+c.clientX<m?c.clientX:m-o,r=p+c.clientY<n?c.clientY:n-p;d.css("top",r).css("left",q).css("position","fixed").show();if($("#rmenu").is(":visible")) d.hide()}).parents().on("mouseup",function(){a("#"+b.menuId).hide()}),g.on("scroll",function(){a("#"+b.menuId).hide()}),f++},c.prototype.destroy=function(){var b=a(this.element),c=a.extend({},this.options,b.data());b.removeAttr("data-contextify-id").off("contextmenu").parents().off("mouseup",function(){a("#"+c.menuId).hide()}),g.off("scroll",function(){a("#"+c.menuId).hide()}),a("#"+c.menuId).remove()},a.fn[d]=function(b){return this.each(function(){a.data(this,"plugin_"+d)&&"[object String]"===Object.prototype.toString.call(b)?a.data(this,"plugin_"+d)[b]():a.data(this,"plugin_"+d)||a.data(this,"plugin_"+d,new c(this,b))})}});
//# sourceMappingURL=jquery.contextify.min.js.map
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery,window)}}(function($,window){var pluginName="contextify",defaults={items:[],action:"contextmenu",menuId:"contextify-menu",menuClass:"dropdown-menu",headerClass:"dropdown-header",dividerClass:"divider",before:false},contextifyId=0;function Plugin(element,options){this.element=element;this.options=$.extend({},defaults,options);this._defaults=defaults;this._name=pluginName;this.init()}Plugin.prototype.init=function(){var options=$.extend({},this.options,$(this.element).data()),that=$(this);options.id=contextifyId;$(this.element).attr("data-contextify-id",options.id).on("contextmenu",function(e){e.preventDefault();if(typeof(options.before)==="function"){options.before(this,options)}var menu=$('<ul class="'+options.menuClass+'" role="menu" id="'+options.menuId+'" data-contextify-id="'+options.id+'"/>');menu.data(options);var l=options.items.length;var i;for(i=0;i<l;i++){var item=options.items[i];var el=$("<li/>");if(item.divider){el.addClass(options.dividerClass)}else{if(item.header){el.addClass(options.headerClass);el.html(item.header)}else{el.append("<a/>");var a=el.find("a");if(item.href){a.attr("href",item.href)}if(item.onclick){a.on("click",options,item.onclick);a.css("cursor","pointer")}if(item.data){for(var data in item.data){menu.attr("data-"+data,item.data[data])}a.data(item.data)}a.html(item.text)}}menu.append(el)}var currentMenu=$("#"+options.menuId);if(currentMenu.length>0){if(currentMenu!==menu){currentMenu.replaceWith(menu)}}else{$("body").append(menu)}var clientTop=$(window).scrollTop()+e.clientY,x=(menu.width()+e.clientX<$(window).width())?e.clientX:e.clientX-menu.width(),y=(menu.height()+e.clientY<$(window).height())?clientTop:clientTop-menu.height();menu.css("top",y).css("left",x).css("position","fixed").show();$(document).one("click",function(e){$("#"+options.menuId).hide();e.preventDefault()})}).one("click",function(e){$("#"+options.menuId).hide();e.preventDefault()});contextifyId++};Plugin.prototype.destroy=function(){var el=$(this.element),options=$.extend({},this.options,el.data()),menu=$("#"+options.menuId);el.removeAttr("data-contextify-id").off("contextmenu").parents().off("mouseup",function(){menu.hide()});menu.remove()};$.fn[pluginName]=function(options){return this.each(function(){if($.data(this,"plugin_"+pluginName)&&Object.prototype.toString.call(options)==="[object String]"){$.data(this,"plugin_"+pluginName)[options]()}else{if(!$.data(this,"plugin_"+pluginName)){$.data(this,"plugin_"+pluginName,new Plugin(this,options))}}})}}));
+8 -1
View File
@@ -25,7 +25,7 @@
</div>
<div class="clearfix ptb10">
<button class="btn btn-default btn-sm pull-left" onclick="uploadFiles()">上传</button>
<button class="btn btn-default btn-sm pull-left" onclick="downloadFile()" title="$tData['lan']['TI1']" style="margin:0 5px">远程下载</button>
<button class="btn btn-default btn-sm pull-left" onclick="downloadFile()" title="远程下载" style="margin:0 5px">远程下载</button>
<span id='BarTools'></span>
<span id='Batch' style="background-color:#fff;position:absolute;right:190px;z-index:10"></span>
<span id='comlist' class="comlist"></span>
@@ -54,14 +54,18 @@
<li onclick="javascript:batch(3);"><a style="cursor: pointer;">压缩</a></li>
<li onclick="javascript:batch(4);"><a style="cursor: pointer;">删除</a></li>
</ul>
<script src="/static/js/jquery-ui.min.js?v={{config.version}}"></script>
<script src="/static/js/jquery.contextify.min.js?v={{config.version}}"></script>
<script src="/static/app/files.js?v={{config.version}}"></script>
<script src="/static/app/upload.js?v={{config.version}}"></script>
<script type="text/javascript">
setTimeout(function() {
getDisk();
}, 500);
var xPath = getCookie('open_dir_path');
setTimeout(function() {
getFiles((xPath != undefined ? xPath : '/www/wwwroot'));
@@ -72,18 +76,21 @@ setCookie('uploadSize', 1024 * 1024 * 1024);
if (getCookie('rank') == undefined || getCookie('rank') == null) {
setCookie('rank', 'a');
}
$("#set_icon").click(function() {
setCookie('rank', 'b');
$(this).addClass("active");
$("#set_list").removeClass("active");
getFiles(getCookie('open_dir_path'));
});
$("#set_list").click(function() {
setCookie('rank', 'a');
$(this).addClass("active");
$("#set_icon").removeClass("active");
getFiles(getCookie('open_dir_path'));
})
$(".refreshBtn").click(function() {
getFiles(getCookie('open_dir_path'));
})
+1
View File
@@ -92,6 +92,7 @@ yum install -y openldap openldap-devel
yum install -y bison re2c cmake
yum install -y cmake3
yum install -y autoconf
yum install -y expect
yum install -y curl curl-devel
yum install -y zlib zlib-devel
+1
View File
@@ -37,6 +37,7 @@ echo y | pacman -Sy mariadb-clients
echo y | pacman -Sy rpcsvc-proto
echo y | pacman -Sy lemon
echo y | pacman -Sy which
echo y | pacman -Sy expect
## gd start
echo y | pacman -Sy gd
+1
View File
@@ -20,6 +20,7 @@ yum install -y python-devel
yum install -y vixie-cron
yum install -y curl-devel libmcrypt libmcrypt-devel
yum install -y mysql-devel
yum install -y expect
+1
View File
@@ -24,6 +24,7 @@ apt install -y python3-pip
apt install -y python3-dev
apt install -y python3-venv
apt install -y cron
apt install -y expect
apt install -y locate
locale-gen en_US.UTF-8
+1
View File
@@ -14,6 +14,7 @@ setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
yum install -y wget curl lsof unzip
yum install -y expect
dnf install crontabs -y
#https need
+1
View File
@@ -26,6 +26,7 @@ pkg install -y cmake
pkg install -y libxslt
pkg install -y libunwind
pkg install -y influxpkg-config
pkg install -y expect
pkg install -y pcre
pkg install -y webp
+1
View File
@@ -27,6 +27,7 @@ zypper install -y libjpeg-devel libpng-devel
zypper install -y libevent-devel
zypper install -y libtirpc-devel
zypper install -y rpcgen
zypper install -y expect
zypper install -y libzip libzip-devel
zypper install -y libmemcached libmemcached-devel
+1
View File
@@ -17,6 +17,7 @@ yum install -y wget lsof
yum install -y python3-devel
yum install -y python-devel
yum install -y crontabs
yum install -y expect
yum install -y curl curl-devel libcurl libcurl-devel
#https need
+1 -1
View File
@@ -15,7 +15,7 @@ apt install -y wget curl lsof unzip
apt install -y python3-pip
apt install -y python3-venv
apt install -y python3-dev
apt install -y expect
apt install -y cron
-85
View File
@@ -1,85 +0,0 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# LANG=en_US.UTF-8
is64bit=`getconf LONG_BIT`
if [ -f /etc/motd ];then
echo "welcome to mdserver-web panel" > /etc/motd
fi
startTime=`date +%s`
_os=`uname`
echo "use system: ${_os}"
if [ "$EUID" -ne 0 ]
then echo "Please run as root!"
exit
fi
if [ ${_os} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eq "openSUSE" /etc/*-release; then
OSNAME='opensuse'
zypper refresh
elif grep -Eq "FreeBSD" /etc/*-release; then
OSNAME='freebsd'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
yum install -y wget zip unzip
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
yum install -y wget zip unzip
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
yum install -y wget zip unzip
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
yum install -y wget zip unzip
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
apt update -y
apt install -y devscripts
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
apt install -y wget zip unzip
else
OSNAME='unknow'
fi
if [ $OSNAME != "macos" ];then
mkdir -p /www/server
mkdir -p /www/wwwroot
mkdir -p /www/wwwlogs
mkdir -p /www/backup/database
mkdir -p /www/backup/site
if [ ! -d /www/server/mdserver-web ];then
wget -O /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip
cd /tmp && unzip /tmp/master.zip
mv -f /tmp/mdserver-web-master /www/server/mdserver-web
rm -rf /tmp/master.zip
rm -rf /tmp/mdserver-web-master
fi
fi
echo "use system version: ${OSNAME}"
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
chmod +x /www/server/mdserver-web/mw-cli
if [ ! -e /usr/bin/mw-cli ]; then
ln -s /www/server/mdserver-web/mw-cli /usr/bin/mw-cli
fi
endTime=`date +%s`
((outTime=(${endTime}-${startTime})/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
systemctl daemon-reload
+18
View File
@@ -102,6 +102,14 @@ venv.bak/
# mypy
scripts/.git/*
.git/*
.github/*
bin/*
lib/*
include/*
pyvenv.cfg
__pycache__
docker/*
.mypy_cache/
.gitignore
.git
@@ -117,5 +125,15 @@ data/system.db
data/default.pl
data/control.conf
data/iplist.txt
data/osname.pl
data/edate.pl
data/backup.pl
data/default_site.pl
data/port.pl
data/api_login.txt
data/json/index.json
data/sessions/*
script/init.d/mw
-62
View File
@@ -1,62 +0,0 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# LANG=en_US.UTF-8
is64bit=`getconf LONG_BIT`
startTime=`date +%s`
_os=`uname`
echo "use system: ${_os}"
if [ "$EUID" -ne 0 ]
then echo "Please run as root!"
exit
fi
if [ ${_os} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eq "openSUSE" /etc/*-release; then
OSNAME='opensuse'
zypper refresh
elif grep -Eq "FreeBSD" /etc/*-release; then
OSNAME='freebsd'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
yum install -y wget zip unzip
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
yum install -y wget zip unzip
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
yum install -y wget zip unzip
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
yum install -y wget zip unzip
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
apt install -y wget zip unzip
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
OSNAME='raspbian'
else
OSNAME='unknow'
fi
wget -O /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip
cd /tmp && unzip /tmp/master.zip
cp -rf /tmp/mdserver-web-master/* /www/server/mdserver-web
rm -rf /tmp/master.zip
rm -rf /tmp/mdserver-web-master
#pip uninstall public
echo "use system version: ${OSNAME}"
cd /www/server/mdserver-web && bash scripts/update/${OSNAME}.sh
endTime=`date +%s`
((outTime=($endTime-$startTime)/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
+7 -36
View File
@@ -1,42 +1,13 @@
[
{
"version": "0.8.6",
"content": "* mysql主从配置。<br/> * swap插件[虚拟内存]。<br/> * 部分优化。",
"path": "https://github.com/midoks/mdserver-web/releases/download/0.8.6/mdserver-web.zip"
"version": "0.9.1",
"content": "* 菜单修复。<br/> * 更新修复",
"path": "https://github.com/midoks/mdserver-web/releases/download/0.9.1/mdserver-web.zip",
"purge":"https://purge.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/update.sh",
},
{
"version": "0.8.5",
"content": "* 添加PHP80版本-Alpha <br/> * 自动识别IP地址 <br/> * 增加xhprof插件",
"path": "https://github.com/midoks/mdserver-web/releases/download/0.8.5/mdserver-web.zip"
},
{
"version": "0.7.3",
"content": "* 修复自动更新错误 <br/> * 优化文件批量处理 <br/> * 添加PHP守护插件",
"path": "https://github.com/midoks/mdserver-web/releases/download/0.7.3/mdserver-web.zip"
},
{
"version": "0.5.6",
"content": "* openresty,php,mysql,memcached,redis,pureftp,sphinx自启动添加 <br/> * 修复rsync自启动问题",
"path": "https://github.com/midoks/mdserver-web/releases/download/0.5.6/mdserver-web.zip"
},
{
"version": "0.4.2",
"content": "* ssh工具优化<br/>* 面板收藏功能完成<br/>* 网站子目录绑定<br/>* 网站备份<br/>* 自动更新优化",
"path": "https://github.com/midoks/mdserver-web/releases/download/0.4.2/mdserver-web.zip"
},
{
"version": "0.0.6",
"content": "1.修复重复js方法",
"path": "https://github.com//midoks/mdserver-web/archive/0.0.6.zip"
},
{
"version": "0.0.5",
"content": "1.基本功能OK<br/>,2.网站HTTPS功能验证!",
"path": "https://github.com//midoks/mdserver-web/archive/0.0.5.zip"
},
{
"version": "0.0.1.2",
"content": "1.项目初建!<br/>2.面板更新功能!",
"path": "https://github.com/midoks/mdserver-web/releases/download/0.0.1/mdserver-web.zip"
"version": "0.9.0",
"content": "* 主流系统支持。<br/> * 插件支持更多参数。<br/>* MySQL主从支持GTID和经典模式。<br/>* MariaDB主从支持GTID和经典模式。<br/>* Rsyncd更新。<br/>* 添加网站统计的插件。<br/>* 添加varnish插件。",
"path": "https://github.com/midoks/mdserver-web/releases/download/0.9.0/mdserver-web.zip"
}
]