mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-11 00:49:26 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bc9944a3e | ||
|
|
9e4c2b13d5 | ||
|
|
cd7143047f | ||
|
|
d608ac4d94 | ||
|
|
9fedf9d10d | ||
|
|
9936191da2 | ||
|
|
538eba3acf | ||
|
|
e39ee9a6f7 | ||
|
|
e1820ad5b3 | ||
|
|
22133f1a6c | ||
|
|
0041cbdff3 | ||
|
|
889da3c769 | ||
|
|
d086eb9c61 | ||
|
|
832fa9cd1a | ||
|
|
8c19fb9629 | ||
|
|
a2e4dd6753 | ||
|
|
22ba7dda55 | ||
|
|
2ffa36eecb | ||
|
|
fe5843b35d | ||
|
|
e95acbe947 | ||
|
|
aed8319dd3 | ||
|
|
babe1b885e | ||
|
|
0612f52402 | ||
|
|
db67cea737 | ||
|
|
52cf675843 | ||
|
|
3421bf6ab5 | ||
|
|
2f39bd600b | ||
|
|
acd5ec69e8 | ||
|
|
09878728af | ||
|
|
af82e9f129 | ||
|
|
c74630e738 | ||
|
|
e4e0697b4b | ||
|
|
11b5ac658b | ||
|
|
1306731164 | ||
|
|
bb6c933aee | ||
|
|
d6a93ef1e6 | ||
|
|
6610da402a | ||
|
|
3ace9cf51e | ||
|
|
49c7ec6073 | ||
|
|
8cf526667e | ||
|
|
6c42876411 | ||
|
|
79471e3806 | ||
|
|
cad06425fc | ||
|
|
6f1e11e474 | ||
|
|
59d13e50ce | ||
|
|
5da0746240 | ||
|
|
192ea8b029 | ||
|
|
bfc20b3e42 | ||
|
|
56bee5c752 | ||
|
|
312df5de1f | ||
|
|
4d3640286c | ||
|
|
20930806b6 | ||
|
|
71360b61da | ||
|
|
411645c9e2 | ||
|
|
3de4e1bfff | ||
|
|
34285f6051 | ||
|
|
84f0cda89b | ||
|
|
04012085ce | ||
|
|
9ad00f3ce7 | ||
|
|
609a4ed351 | ||
|
|
5ca74fd312 | ||
|
|
3b1bb06c68 | ||
|
|
b6b7de42d6 | ||
|
|
3aa3b532ac | ||
|
|
290c740ab1 | ||
|
|
23fd4ca1de | ||
|
|
c128a799b2 | ||
|
|
401c103b76 | ||
|
|
6fb88eb428 | ||
|
|
956f20d295 | ||
|
|
03f8578a37 |
@@ -99,30 +99,29 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.13.3
|
||||
### 版本更新 0.13.6
|
||||
|
||||
* tgbot插件[增加扩展功能]。
|
||||
* ssl功能优化。
|
||||
* 网站统计-计划任务归档优化。
|
||||
* 修复初始化安装,缺少解压命令。
|
||||
* 加入aes加密/解密方法。
|
||||
|
||||
### JSDelivr安装地址
|
||||
|
||||
- 初始安装
|
||||
|
||||
```
|
||||
curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh | bash
|
||||
curl --insecure -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh | bash
|
||||
```
|
||||
|
||||
- 直接更新
|
||||
|
||||
```
|
||||
curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/update.sh | bash
|
||||
curl --insecure -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/update.sh | bash
|
||||
```
|
||||
|
||||
- 卸载脚本
|
||||
|
||||
```
|
||||
wget -O uninstall.sh https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/uninstall.sh && bash uninstall.sh
|
||||
wget --no-check-certificate -O uninstall.sh https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/uninstall.sh && bash uninstall.sh
|
||||
```
|
||||
|
||||
### 备用地址
|
||||
@@ -130,20 +129,20 @@ wget -O uninstall.sh https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scri
|
||||
- 初始安装
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh | bash
|
||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install.sh | bash
|
||||
curl --insecure -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install.sh | bash
|
||||
```
|
||||
|
||||
- 直接更新
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash
|
||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash
|
||||
```
|
||||
|
||||
- 卸载脚本
|
||||
|
||||
```
|
||||
wget -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/uninstall.sh && bash uninstall.sh
|
||||
wget --no-check-certificate -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/uninstall.sh && bash uninstall.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -152,22 +151,22 @@ wget -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/maste
|
||||
- 需已经安装mdserver-web
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/app.sh | bash
|
||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/app.sh | bash
|
||||
```
|
||||
|
||||
|
||||
### DEV使用
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh | bash
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
|
||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh | bash
|
||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
|
||||
|
||||
wget -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/uninstall.sh && bash uninstall.sh
|
||||
wget --no-check-certificate -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/uninstall.sh && bash uninstall.sh
|
||||
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/debug.sh | bash
|
||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/debug.sh | bash
|
||||
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/install_dev.sh | bash
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/update_dev.sh | bash
|
||||
curl --insecure -fsSL https://code.midoks.me/midoks/mdserver-web/raw/branch/dev/scripts/install_dev.sh | bash
|
||||
curl --insecure -fsSL https://code.midoks.me/midoks/mdserver-web/raw/branch/dev/scripts/update_dev.sh | bash
|
||||
```
|
||||
|
||||
### 捐赠地址 USDT(TRC20)
|
||||
|
||||
@@ -27,7 +27,7 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
__version = '0.13.3'
|
||||
__version = '0.13.6'
|
||||
__api_addr = 'data/api.json'
|
||||
|
||||
def __init__(self):
|
||||
@@ -788,6 +788,13 @@ class config_api:
|
||||
return mw.returnData(True, '验证成功')
|
||||
return mw.returnData(False, '验证失败')
|
||||
|
||||
if tag == 'email':
|
||||
t = json.loads(tag_data)
|
||||
test_bool = mw.emailNotifyTest(t)
|
||||
if test_bool:
|
||||
return mw.returnData(True, '验证成功')
|
||||
return mw.returnData(False, '验证失败')
|
||||
|
||||
return mw.returnData(False, '暂时未支持该验证')
|
||||
|
||||
def setNotifyEnableApi(self):
|
||||
|
||||
+167
-3
@@ -23,11 +23,13 @@ import shlex
|
||||
import datetime
|
||||
import subprocess
|
||||
import glob
|
||||
|
||||
import base64
|
||||
import re
|
||||
import db
|
||||
|
||||
from random import Random
|
||||
|
||||
import db
|
||||
|
||||
|
||||
def execShell(cmdstring, cwd=None, timeout=None, shell=True):
|
||||
|
||||
@@ -776,6 +778,133 @@ def deDoubleCrypt(key, strings):
|
||||
return strings
|
||||
|
||||
|
||||
def aesEncrypt(data, key='ABCDEFGHIJKLMNOP', vi='0102030405060708'):
|
||||
# aes加密
|
||||
# @param data 被加密的数据
|
||||
# @param key 加解密密匙 16位
|
||||
# @param vi 16位
|
||||
|
||||
from cryptography.hazmat.primitives import padding
|
||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
|
||||
if not isinstance(data, bytes):
|
||||
data = data.encode()
|
||||
|
||||
# AES_CBC_KEY = os.urandom(32)
|
||||
# AES_CBC_IV = os.urandom(16)
|
||||
|
||||
AES_CBC_KEY = key.encode()
|
||||
AES_CBC_IV = vi.encode()
|
||||
|
||||
# print("AES_CBC_KEY:", AES_CBC_KEY)
|
||||
# print("AES_CBC_IV:", AES_CBC_IV)
|
||||
|
||||
padder = padding.PKCS7(algorithms.AES.block_size).padder()
|
||||
padded_data = padder.update(data) + padder.finalize()
|
||||
|
||||
cipher = Cipher(algorithms.AES(AES_CBC_KEY),
|
||||
modes.CBC(AES_CBC_IV),
|
||||
backend=default_backend())
|
||||
encryptor = cipher.encryptor()
|
||||
|
||||
edata = encryptor.update(padded_data)
|
||||
|
||||
# print(edata)
|
||||
# print(str(edata))
|
||||
# print(edata.decode())
|
||||
return edata
|
||||
|
||||
|
||||
def aesDecrypt(data, key='ABCDEFGHIJKLMNOP', vi='0102030405060708'):
|
||||
# aes加密
|
||||
# @param data 被解密的数据
|
||||
# @param key 加解密密匙 16位
|
||||
# @param vi 16位
|
||||
|
||||
from cryptography.hazmat.primitives import padding
|
||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
|
||||
from cryptography.hazmat.primitives import padding
|
||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
|
||||
if not isinstance(data, bytes):
|
||||
data = data.encode()
|
||||
|
||||
AES_CBC_KEY = key.encode()
|
||||
AES_CBC_IV = vi.encode()
|
||||
|
||||
cipher = Cipher(algorithms.AES(AES_CBC_KEY),
|
||||
modes.CBC(AES_CBC_IV),
|
||||
backend=default_backend())
|
||||
decryptor = cipher.decryptor()
|
||||
|
||||
ddata = decryptor.update(data)
|
||||
|
||||
unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder()
|
||||
data = unpadder.update(ddata)
|
||||
|
||||
try:
|
||||
uppadded_data = data + unpadder.finalize()
|
||||
except ValueError:
|
||||
raise Exception('无效的加密信息!')
|
||||
|
||||
return uppadded_data
|
||||
|
||||
|
||||
def aesEncrypt_Crypto(data, key, vi):
|
||||
# 该方法保留,暂时不使用
|
||||
# aes加密
|
||||
# @param data 被加密的数据
|
||||
# @param key 加解密密匙 16位
|
||||
# @param vi 16位
|
||||
|
||||
from Crypto.Cipher import AES
|
||||
cryptor = AES.new(key.encode('utf8'), AES.MODE_CBC, vi.encode('utf8'))
|
||||
# 判断是否含有中文
|
||||
zhmodel = re.compile(u'[\u4e00-\u9fff]')
|
||||
match = zhmodel.search(data)
|
||||
if match == None:
|
||||
# 无中文时
|
||||
add = 16 - len(data) % 16
|
||||
pad = lambda s: s + add * chr(add)
|
||||
data = pad(data)
|
||||
enctext = cryptor.encrypt(data.encode('utf8'))
|
||||
else:
|
||||
# 含有中文时
|
||||
data = data.encode()
|
||||
add = 16 - len(data) % 16
|
||||
data = data + add * (chr(add)).encode()
|
||||
enctext = cryptor.encrypt(data)
|
||||
encodestrs = base64.b64encode(enctext).decode('utf8')
|
||||
return encodestrs
|
||||
|
||||
|
||||
def aesDecrypt_Crypto(data, key, vi):
|
||||
# 该方法保留,暂时不使用
|
||||
# aes加密
|
||||
# @param data 被加密的数据
|
||||
# @param key 加解密密匙 16位
|
||||
# @param vi 16位
|
||||
|
||||
from crypto.Cipher import AES
|
||||
data = data.encode('utf8')
|
||||
encodebytes = base64.urlsafe_b64decode(data)
|
||||
cipher = AES.new(key.encode('utf8'), AES.MODE_CBC, vi.encode('utf8'))
|
||||
text_decrypted = cipher.decrypt(encodebytes)
|
||||
# 判断是否含有中文
|
||||
zhmodel = re.compile(u'[\u4e00-\u9fff]')
|
||||
match = zhmodel.search(text_decrypted)
|
||||
if match == False:
|
||||
# 无中文时补位
|
||||
unpad = lambda s: s[0:-s[-1]]
|
||||
text_decrypted = unpad(text_decrypted)
|
||||
text_decrypted = text_decrypted.decode('utf8').rstrip() # 去掉补位的右侧空格
|
||||
return text_decrypted
|
||||
|
||||
|
||||
def buildSoftLink(src, dst, force=False):
|
||||
'''
|
||||
建立软连接
|
||||
@@ -1697,7 +1826,7 @@ def getNotifyData(is_parse=False):
|
||||
data = json.loads(notify_data)
|
||||
|
||||
if is_parse:
|
||||
tag_list = ['tgbot']
|
||||
tag_list = ['tgbot', 'email']
|
||||
for t in tag_list:
|
||||
if t in data and 'cfg' in data[t]:
|
||||
data[t]['data'] = json.loads(deDoubleCrypt(t, data[t]['cfg']))
|
||||
@@ -1759,6 +1888,34 @@ def tgbotNotifyTest(app_token, chat_id):
|
||||
return tgbotNotifyHttpPost(app_token, chat_id, msg)
|
||||
|
||||
|
||||
def emailNotifyMessage(data):
|
||||
'''
|
||||
邮件通知
|
||||
'''
|
||||
sys.path.append(os.getcwd() + "/class/plugin")
|
||||
import memail
|
||||
try:
|
||||
if data['smtp_ssl'] == 'ssl':
|
||||
memail.sendSSL(data['smtp_host'], data['smtp_port'],
|
||||
data['username'], data['password'],
|
||||
data['to_mail_addr'], data['subject'], data['content'])
|
||||
else:
|
||||
memail.send(data['smtp_host'], data['smtp_port'],
|
||||
data['username'], data['password'],
|
||||
data['to_mail_addr'], data['subject'], data['content'])
|
||||
return True
|
||||
except Exception as e:
|
||||
print(getTracebackInfo())
|
||||
return False
|
||||
|
||||
|
||||
def emailNotifyTest(data):
|
||||
print(data)
|
||||
data['subject'] = 'MW通知测试'
|
||||
data['content'] = data['mail_test']
|
||||
return emailNotifyMessage(data)
|
||||
|
||||
|
||||
def notifyMessageTry(msg, stype='common', trigger_time=300, is_write_log=True):
|
||||
|
||||
lock_file = getPanelTmp() + '/notify_lock.json'
|
||||
@@ -1796,6 +1953,13 @@ def notifyMessageTry(msg, stype='common', trigger_time=300, is_write_log=True):
|
||||
else:
|
||||
do_notify = tgbotNotifyMessage(
|
||||
t['app_token'], t['chat_id'], msg)
|
||||
|
||||
if 'email' in data and 'enable' in data['email']:
|
||||
if data['email']['enable']:
|
||||
t = data['email']['data']
|
||||
t['subject'] = 'MW通知'
|
||||
t['content'] = msg
|
||||
do_notify = emailNotifyMessage(t)
|
||||
return do_notify
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# coding:utf-8
|
||||
|
||||
# ---------------------------------------------------------------------------------
|
||||
# MW-Linux面板
|
||||
# ---------------------------------------------------------------------------------
|
||||
# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved.
|
||||
# ---------------------------------------------------------------------------------
|
||||
# Author: midoks <midoks@163.com>
|
||||
# ---------------------------------------------------------------------------------
|
||||
|
||||
# ---------------------------------------------------------------------------------
|
||||
# VIP用户管理
|
||||
# ---------------------------------------------------------------------------------
|
||||
|
||||
import mw
|
||||
|
||||
from flask import request
|
||||
|
||||
|
||||
class vip_api:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def loginApi(self):
|
||||
username = request.form.get('username', '')
|
||||
password = request.form.get('password', '')
|
||||
|
||||
print(username, password)
|
||||
|
||||
password = mw.aesEncrypt(
|
||||
password, 'ABCDEFGHIJKLMNOP', '0102030405060708')
|
||||
|
||||
print(password)
|
||||
|
||||
p = mw.aesDecrypt(password, 'ABCDEFGHIJKLMNOP', '0102030405060708')
|
||||
print(p)
|
||||
|
||||
return mw.returnJson(False, "测试中!")
|
||||
@@ -0,0 +1,43 @@
|
||||
# coding: utf-8
|
||||
|
||||
import smtplib
|
||||
|
||||
from email import encoders
|
||||
from email.header import Header
|
||||
from email.mime.text import MIMEText
|
||||
from email.utils import parseaddr, formataddr
|
||||
|
||||
|
||||
def _format_addr(s):
|
||||
name, addr = parseaddr(s)
|
||||
return formataddr((Header(name, 'utf-8').encode(), addr))
|
||||
|
||||
|
||||
def send(smtp_host, smtp_port, username, password, to_mail, subject, content):
|
||||
|
||||
smtp = smtplib.SMTP()
|
||||
smtp.connect(smtp_host, port=smtp_port)
|
||||
smtp.login(user=username, password=password)
|
||||
|
||||
msg = MIMEText(content, 'plain', 'utf-8')
|
||||
msg['From'] = _format_addr(username)
|
||||
msg['To'] = _format_addr(to_mail)
|
||||
msg['Subject'] = Header(subject, 'utf-8').encode()
|
||||
|
||||
smtp.sendmail(from_addr=username, to_addrs=to_mail, msg=msg.as_string())
|
||||
return True
|
||||
|
||||
|
||||
def sendSSL(smtp_host, smtp_port, username, password, to_mail, subject, content):
|
||||
|
||||
smtp = smtplib.SMTP_SSL(smtp_host, port=smtp_port)
|
||||
smtp.login(user=username, password=password)
|
||||
|
||||
msg = MIMEText(content, 'plain', 'utf-8')
|
||||
msg['From'] = _format_addr(username)
|
||||
msg['To'] = _format_addr(to_mail)
|
||||
msg['Subject'] = Header(subject, 'utf-8').encode()
|
||||
|
||||
smtp.sendmail(from_addr=username, to_addrs=to_mail, msg=msg.as_string())
|
||||
smtp.quit()
|
||||
return True
|
||||
@@ -0,0 +1 @@
|
||||
存放VIP关键数据
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"ps": "Gitea 是一个开源社区驱动的轻量级代码托管解决方案。",
|
||||
"ps": "Gitea是一个开源社区驱动的轻量级代码托管解决方案。",
|
||||
"name": "gitea",
|
||||
"title": "Gitea",
|
||||
"versions": ["1.17.2"],
|
||||
"versions": ["1.17.2","1.18.5"],
|
||||
"tip": "soft",
|
||||
"install_pre_inspection":false,
|
||||
"uninstall_pre_inspection":true,
|
||||
|
||||
@@ -14,7 +14,7 @@ if [ -f ${rootPath}/bin/activate ];then
|
||||
fi
|
||||
|
||||
|
||||
URL_DOWNLOAD=https://dl.gitea.io/
|
||||
URL_DOWNLOAD=https://dl.gitea.com
|
||||
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
|
||||
@@ -61,7 +61,18 @@ Install_openresty()
|
||||
|
||||
# wget -O openresty-1.21.4.1.tar.gz https://openresty.org/download/openresty-1.21.4.1.tar.gz
|
||||
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
|
||||
wget -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz
|
||||
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz -T 3
|
||||
fi
|
||||
|
||||
DOWNLOAD_SIZE=`wc -c ${openrestyDir}/openresty-${VERSION}.tar.gz | awk '{print $1}'`
|
||||
if [ "$DOWNLOAD_SIZE" == "0" ];then
|
||||
echo 'download failed, download again'
|
||||
rm -rf ${openrestyDir}/openresty-${VERSION}.tar.gz
|
||||
fi
|
||||
|
||||
# Last Download Method
|
||||
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
|
||||
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://dl.midoks.me/soft/openresty/openresty-${VERSION}.tar.gz -T 3
|
||||
fi
|
||||
|
||||
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
import json
|
||||
import base64
|
||||
import threading
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
import telebot
|
||||
from telebot import types
|
||||
from telebot.util import quick_markup
|
||||
|
||||
|
||||
def init(bot):
|
||||
bot.delete_my_commands(scope=None, language_code=None)
|
||||
bot.set_my_commands(
|
||||
commands=[
|
||||
telebot.types.BotCommand("start", "查看帮助信息"),
|
||||
telebot.types.BotCommand("faq", "查看bbs帖子主题【不要忘记:冒号】"),
|
||||
],
|
||||
)
|
||||
@@ -44,13 +44,31 @@ def send_msg(bot, tag='ad', trigger_time=300):
|
||||
keyboard = [
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="赞助联系ME", url='tg://user?id=5568699210')
|
||||
text="CK资源采集", url='https://ckzy1.com/')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="♻️CMS导航网♻️", url='https://t.me/maccms_jccms')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="💰流量变现💰", url='https://t.me/taohaozhan')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="🙎♂️代实名🙍♀️过人脸🅾️国际阿里云腾讯云(赞助商)", url='https://t.me/gjgzs2022')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="💎DigitalVirt(赞助商)", url='https://digitalvirt.com/aff.php?aff=154')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="论坛", url='https://bbs.midoks.me'),
|
||||
types.InlineKeyboardButton(
|
||||
text="搜索", url='https://bbs.midoks.me/search.php')
|
||||
text="搜索", url='https://bbs.midoks.me/search.php'),
|
||||
types.InlineKeyboardButton(
|
||||
text="@ME", url='tg://user?id=5568699210')
|
||||
]
|
||||
]
|
||||
markup = types.InlineKeyboardMarkup(keyboard)
|
||||
@@ -66,4 +84,4 @@ def send_msg(bot, tag='ad', trigger_time=300):
|
||||
|
||||
|
||||
def run(bot):
|
||||
send_msg(bot, 'ad', 6 * 60 * 60)
|
||||
send_msg(bot, 'ad', 1 * 60 * 60)
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
import json
|
||||
import base64
|
||||
import threading
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
import telebot
|
||||
from telebot import types
|
||||
from telebot.util import quick_markup
|
||||
|
||||
# 推送最新的帖子
|
||||
|
||||
chat_id = -1001578009023
|
||||
# chat_id = 5568699210
|
||||
|
||||
|
||||
def get_newest_tid():
|
||||
|
||||
api_new = 'https://bbs.midoks.me/plugin.php?id=external_api&f=bbs_newest'
|
||||
api_next = 'https://bbs.midoks.me/plugin.php?id=external_api&f=bbs_next_tid&tid='
|
||||
|
||||
tid_push = mw.getServerDir() + '/tgbot/bbs_newest_push.json'
|
||||
|
||||
if not os.path.exists(tid_push):
|
||||
data = mw.httpGet(api_new)
|
||||
data = json.loads(data)
|
||||
if data['code'] == 0:
|
||||
tid = data['data'][0]['tid']
|
||||
mw.writeFile(tid_push, tid)
|
||||
return True, data['data'][0]
|
||||
|
||||
tid = mw.readFile(tid_push)
|
||||
data = mw.httpGet(api_next + tid)
|
||||
data = json.loads(data)
|
||||
if data['code'] == 0 and len(data['data']) > 0:
|
||||
# print(data)
|
||||
tid = data['data'][0]['tid']
|
||||
mw.writeFile(tid_push, tid)
|
||||
return True, data['data'][0]
|
||||
return False, None
|
||||
|
||||
|
||||
def send_msg(bot, tag='ad', trigger_time=300):
|
||||
# 信号只在一个周期内执行一次|start
|
||||
lock_file = mw.getServerDir() + '/tgbot/lock.json'
|
||||
if not os.path.exists(lock_file):
|
||||
mw.writeFile(lock_file, '{}')
|
||||
|
||||
lock_data = json.loads(mw.readFile(lock_file))
|
||||
if tag in lock_data:
|
||||
diff_time = time.time() - lock_data[tag]['do_time']
|
||||
if diff_time >= trigger_time:
|
||||
lock_data[tag]['do_time'] = time.time()
|
||||
else:
|
||||
return False, 0, 0
|
||||
else:
|
||||
lock_data[tag] = {'do_time': time.time()}
|
||||
mw.writeFile(lock_file, json.dumps(lock_data))
|
||||
# 信号只在一个周期内执行一次|end
|
||||
|
||||
yes, info = get_newest_tid()
|
||||
if yes:
|
||||
url = 'https://bbs.midoks.me/thread-' + info['tid'] + '-1-1.html'
|
||||
keyboard = [
|
||||
[
|
||||
types.InlineKeyboardButton(text=info['subject'], url=url)
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="论坛", url='https://bbs.midoks.me'),
|
||||
types.InlineKeyboardButton(
|
||||
text="搜索", url='https://bbs.midoks.me/search.php')
|
||||
]
|
||||
]
|
||||
markup = types.InlineKeyboardMarkup(keyboard)
|
||||
bot.send_message(
|
||||
chat_id, "由【" + info['author'] + "】发帖!", reply_markup=markup)
|
||||
|
||||
|
||||
def run(bot):
|
||||
send_msg(bot, 'push_bbs_newest_tid', 300)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(get_newest_tid())
|
||||
@@ -0,0 +1,102 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
import json
|
||||
import base64
|
||||
import threading
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
import telebot
|
||||
from telebot import types
|
||||
from telebot.util import quick_markup
|
||||
|
||||
# 轮播实例
|
||||
|
||||
chat_id = -1001578009023
|
||||
# chat_id = 5568699210
|
||||
|
||||
|
||||
def send_msg(bot, tag='ad', trigger_time=300):
|
||||
# 信号只在一个周期内执行一次|start
|
||||
lock_file = mw.getServerDir() + '/tgbot/lock.json'
|
||||
if not os.path.exists(lock_file):
|
||||
mw.writeFile(lock_file, '{}')
|
||||
|
||||
lock_data = json.loads(mw.readFile(lock_file))
|
||||
if tag in lock_data:
|
||||
diff_time = time.time() - lock_data[tag]['do_time']
|
||||
if diff_time >= trigger_time:
|
||||
lock_data[tag]['do_time'] = time.time()
|
||||
else:
|
||||
return False, 0, 0
|
||||
else:
|
||||
lock_data[tag] = {'do_time': time.time()}
|
||||
mw.writeFile(lock_file, json.dumps(lock_data))
|
||||
# 信号只在一个周期内执行一次|end
|
||||
|
||||
# https://t.me/gjgzs2022 | 19/m
|
||||
# ♻️CMS导航网♻️/💰流量变现💰 | 28/m
|
||||
# CK资源采集 |29/m
|
||||
keyboard = [
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="CK资源采集", url='https://ckzy1.com/')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="♻️CMS导航网♻️", url='https://t.me/maccms_jccms')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="💰流量变现💰", url='https://t.me/taohaozhan')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="🙎♂️代实名🙍♀️过人脸🅾️国际阿里云腾讯云(赞助商)", url='https://t.me/gjgzs2022')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="💎DigitalVirt(赞助商)", url='https://digitalvirt.com/aff.php?aff=154')
|
||||
],
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="论坛", url='https://bbs.midoks.me'),
|
||||
types.InlineKeyboardButton(
|
||||
text="搜索", url='https://bbs.midoks.me/search.php'),
|
||||
types.InlineKeyboardButton(
|
||||
text="@ME", url='tg://user?id=5568699210')
|
||||
]
|
||||
]
|
||||
markup = types.InlineKeyboardMarkup(keyboard)
|
||||
|
||||
msg_notice = "由于在解决的问题的时候,不给信息,无法了解情况。以后不再群里回答技术问题。全部去论坛提问。在解决问题的过程中,可能需要面板信息,和SSH信息,如无法提供请不要提问。为了让群里都知晓。轮播一年!\n"
|
||||
msg_notice += "为了不打扰双方,私聊解决问题先转100U,否则无视!\n"
|
||||
msg_notice += "现阶段3件事:\n"
|
||||
msg_notice += "* 炒币\n"
|
||||
msg_notice += "* 量化交易\n"
|
||||
msg_notice += "* MW-VIP系统开发\n"
|
||||
msg_notice += "至少1年时间都没空。非诚勿扰!"
|
||||
msg = bot.send_message(chat_id, msg_notice, reply_markup=markup)
|
||||
|
||||
# print(msg.message_id)
|
||||
time.sleep(60)
|
||||
try:
|
||||
bot.delete_message(
|
||||
chat_id=chat_id, message_id=msg.message_id)
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
def run(bot):
|
||||
try:
|
||||
send_msg(bot, 'notice_msg', 180)
|
||||
except Exception as e:
|
||||
writeLog('-----push_notice_msg error start -------')
|
||||
print(mw.getTracebackInfo())
|
||||
writeLog('-----push_notice_msg error start -------')
|
||||
@@ -181,6 +181,13 @@ def answer_callback_query(bot, call):
|
||||
|
||||
def run(bot, message):
|
||||
text_body = message.text
|
||||
|
||||
# 过滤URL
|
||||
is_has_url = re.search(
|
||||
'(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]', text_body)
|
||||
if is_has_url:
|
||||
return bot
|
||||
|
||||
# print(text_body)
|
||||
if isThisCmd('/faq:', text_body):
|
||||
cmd_text = getReadCmd('/faq:', text_body)
|
||||
@@ -193,7 +200,15 @@ def run(bot, message):
|
||||
if text_body.find('?') > -1 or text_body.find('?') > -1:
|
||||
return_msg = "你似乎在寻找【" + text_body + "】答案:\n"
|
||||
return_msg += "/faq:开始寻找你的问题\n"
|
||||
bot.reply_to(message, return_msg)
|
||||
keyboard = [
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
text="如未找到,可以在论坛补充你的提问!", url='https://bbs.midoks.me'),
|
||||
]
|
||||
|
||||
]
|
||||
markup = types.InlineKeyboardMarkup(keyboard)
|
||||
bot.reply_to(message, return_msg, reply_markup=markup)
|
||||
|
||||
return bot
|
||||
|
||||
|
||||
@@ -86,14 +86,15 @@ while True:
|
||||
bot = telebot.TeleBot(cfg['bot']['app_token'])
|
||||
|
||||
|
||||
bot.delete_my_commands(scope=None, language_code=None)
|
||||
bot.set_my_commands(
|
||||
commands=[
|
||||
telebot.types.BotCommand("start", "查看帮助信息"),
|
||||
telebot.types.BotCommand("faq", "查看bbs帖子主题【不要忘记:冒号】"),
|
||||
],
|
||||
)
|
||||
|
||||
init_list = getStartExtCfgByTag('init')
|
||||
for p in init_list:
|
||||
try:
|
||||
script = p['name'].split('.')[0]
|
||||
__import__(script).init(bot)
|
||||
except Exception as e:
|
||||
writeLog('-----init error start -------')
|
||||
writeLog(mw.getTracebackInfo())
|
||||
writeLog('-----init error end -------')
|
||||
|
||||
# @bot.message_handler(commands=['start', 'help'])
|
||||
# def hanle_start_help(message):
|
||||
@@ -154,20 +155,46 @@ def botPush():
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def setDaemon(t):
|
||||
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
|
||||
t.daemon = True
|
||||
else:
|
||||
t.setDaemon(True)
|
||||
def runBotPushOtherTask():
|
||||
plist = getStartExtCfgByTag('other')
|
||||
for p in plist:
|
||||
try:
|
||||
script = p['name'].split('.')[0]
|
||||
__import__(script).run(bot)
|
||||
except Exception as e:
|
||||
writeLog('-----runBotPushOtherTask error start -------')
|
||||
writeLog(mw.getTracebackInfo())
|
||||
writeLog('-----runBotPushOtherTask error end -------')
|
||||
|
||||
|
||||
def botPushOther():
|
||||
while True:
|
||||
runBotPushOtherTask()
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def runBot(bot):
|
||||
try:
|
||||
bot.polling()
|
||||
except Exception as e:
|
||||
writeLog('-----runBot error start -------')
|
||||
writeLog(str(e))
|
||||
writeLog('-----runBot error end -------')
|
||||
time.sleep(1)
|
||||
runBot(bot)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# 机器人推送任务
|
||||
botPushTask = threading.Thread(target=botPush)
|
||||
# print(botPushTask)
|
||||
# botPushTask = setDaemon(botPushTask)
|
||||
botPushTask.start()
|
||||
|
||||
# 机器人其他推送任务
|
||||
botPushOtherTask = threading.Thread(target=botPushOther)
|
||||
botPushOtherTask.start()
|
||||
|
||||
writeLog('启动成功')
|
||||
bot.polling()
|
||||
runBot(bot)
|
||||
|
||||
|
||||
# asyncio.run(bot.polling())
|
||||
|
||||
@@ -14,12 +14,26 @@ install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
VERSION=$2
|
||||
sys_os=`uname`
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
# cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
# HTTP_PREFIX="https://"
|
||||
# if [ ! -z "$cn" ];then
|
||||
# HTTP_PREFIX="https://ghproxy.com/"
|
||||
# fi
|
||||
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
LOCAL_ADDR=common
|
||||
ping -c 1 gihub.com > /dev/null 2>&1
|
||||
if [ "$?" != "0" ];then
|
||||
LOCAL_ADDR=cn
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
PIPSRC="https://pypi.python.org/simple"
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
PIPSRC="https://pypi.tuna.tsinghua.edu.cn/simple"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$sys_os" == "Darwin" ];then
|
||||
BAK='_bak'
|
||||
else
|
||||
@@ -96,7 +110,7 @@ Install_App()
|
||||
fi
|
||||
|
||||
# https://github.com/P3TERX/GeoLite.mmdb
|
||||
pip install geoip2
|
||||
pip install geoip2 -i $PIPSRC
|
||||
# if [ ! -f $serverPath/webstats/GeoLite2-City.mmdb ];then
|
||||
# wget --no-check-certificate -O $serverPath/webstats/GeoLite2-City.mmdb https://github.com/P3TERX/GeoLite.mmdb/releases/download/2022.10.16/GeoLite2-City.mmdb
|
||||
# fi
|
||||
|
||||
+1
-1
@@ -548,7 +548,7 @@ def index(reqClass=None, reqAction=None, reqData=None):
|
||||
|
||||
# API请求
|
||||
classFile = ('config_api', 'crontab_api', 'files_api', 'firewall_api',
|
||||
'plugins_api', 'system_api', 'site_api', 'task_api')
|
||||
'plugins_api', 'system_api', 'site_api', 'task_api', 'vip_api')
|
||||
className = reqClass + '_api'
|
||||
if not className in classFile:
|
||||
return "api error request"
|
||||
|
||||
+241
-1
@@ -86,6 +86,55 @@ $('input[name="bind_ssl"]').click(function(){
|
||||
/** op **/
|
||||
|
||||
|
||||
// VIP -- start
|
||||
function setVipInfo(){
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: "400px",
|
||||
title: 'VIP登录',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
btn:["登录","关闭"],
|
||||
shadeClose: false,
|
||||
content: "<div class='bt-form pd20'>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>用户名</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='text' name='username' value='' style='width:85%' autocomplete='off'/></div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>密码</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='password' name='password' value='' style='width:85%' autocomplete='off'/></div>\
|
||||
</div>\
|
||||
</div>",
|
||||
yes:function(index){
|
||||
var pdata = {};
|
||||
|
||||
pdata['username'] = $('input[name="username"]').val();
|
||||
pdata['password'] = $('input[name="password"]').val();
|
||||
|
||||
if (pdata['username'] == ''){
|
||||
layer.msg('用户名不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['password'] == ''){
|
||||
layer.msg('密码不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
$.post('/vip/login',{'username':pdata['username'], 'password':pdata['password']},function(rdata){
|
||||
showMsg(rdata.msg, function(){
|
||||
if (rdata.status){
|
||||
layer.close(index);
|
||||
}
|
||||
},{icon:rdata.status?1:2},2000);
|
||||
},'json');
|
||||
},
|
||||
});
|
||||
}
|
||||
// VIP -- end
|
||||
|
||||
|
||||
//关闭面板
|
||||
function closePanel(){
|
||||
layer.confirm('关闭面板会导致您无法访问面板 ,您真的要关闭Linux面板吗?',{title:'关闭面板',closeBtn:2,icon:13,cancel:function(){
|
||||
@@ -382,7 +431,7 @@ function getTgbot(){
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: "500px",
|
||||
title: '配置TgBot配置',
|
||||
title: 'TgBot配置',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
btn:["确定","关闭","验证"],
|
||||
@@ -401,6 +450,17 @@ function getTgbot(){
|
||||
var pdata = {};
|
||||
pdata['app_token'] = $('input[name="app_token"]').val();
|
||||
pdata['chat_id'] = $('input[name="chat_id"]').val();
|
||||
|
||||
if (pdata['app_token'] == ''){
|
||||
layer.msg('app_token不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['chat_id'] == ''){
|
||||
layer.msg('chat_id不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
$.post('/config/set_notify',{'tag':'tgbot', 'data':JSON.stringify(pdata)},function(rdata){
|
||||
showMsg(rdata.msg, function(){
|
||||
if (rdata.status){
|
||||
@@ -414,6 +474,17 @@ function getTgbot(){
|
||||
var pdata = {};
|
||||
pdata['app_token'] = $('input[name="app_token"]').val();
|
||||
pdata['chat_id'] = $('input[name="chat_id"]').val();
|
||||
|
||||
if (pdata['app_token'] == ''){
|
||||
layer.msg('app_token不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['chat_id'] == ''){
|
||||
layer.msg('chat_id不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
$.post('/config/set_notify_test',{'tag':'tgbot', 'data':JSON.stringify(pdata)},function(rdata){
|
||||
showMsg(rdata.msg, function(){
|
||||
if (rdata.status){
|
||||
@@ -427,6 +498,175 @@ function getTgbot(){
|
||||
});
|
||||
}
|
||||
|
||||
function getEmailCfg(){
|
||||
var loadT = layer.msg('正在获取邮件配置信息...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/config/get_notify',{},function(data){
|
||||
layer.close(loadT);
|
||||
|
||||
var smtp_host = 'smtp.163.com';
|
||||
var smtp_port = '25';
|
||||
var username = 'admin';
|
||||
var password = '';
|
||||
var to_mail_addr = '';
|
||||
|
||||
var smtp_ssl_no = 'checked';
|
||||
var smtp_ssl_yes = '';
|
||||
|
||||
if (data.status){
|
||||
if (typeof(data['data']['email']) !='undefined'){
|
||||
smtp_host = data['data']['email']['data']['smtp_host'];
|
||||
smtp_port = data['data']['email']['data']['smtp_port'];
|
||||
username = data['data']['email']['data']['username'];
|
||||
password = data['data']['email']['data']['password'];
|
||||
to_mail_addr = data['data']['email']['data']['to_mail_addr'];
|
||||
|
||||
|
||||
var smtp_ssl = data['data']['email']['data']['smtp_ssl'];
|
||||
if (smtp_ssl == 'ssl'){
|
||||
smtp_ssl_no = '';
|
||||
smtp_ssl_yes = 'checked';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: "500px",
|
||||
title: '邮件配置',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
btn:["确定","关闭","验证"],
|
||||
shadeClose: false,
|
||||
content: "<div class='bt-form pd20'>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>SMTP服务器</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='text' name='smtp_host' value='"+smtp_host+"' style='width:100%'/></div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>SMTP安全</span>\
|
||||
<div class='info-r checkbox'>\
|
||||
<label><input name='smtp_ssl' type='radio' value='' style='margin-right: 4px;' "+smtp_ssl_no+">None</label>\
|
||||
<label><input name='smtp_ssl' type='radio' value='ssl' style='margin-right: 4px;' "+smtp_ssl_yes+">SSL</label>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>SMTP端口</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='text' name='smtp_port' value='"+smtp_port+"' style='width:100%' /></div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>用户名</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='text' name='username' value='"+username+"' style='width:100%' autocomplete='off'/></div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>授权码</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='password' name='password' value='"+password+"' style='width:100%' autocomplete='off'/></div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>发送地址</span>\
|
||||
<div class='info-r'><input class='bt-input-text' type='text' name='to_mail_addr' value='"+to_mail_addr+"' style='width:100%' autocomplete='off'/></div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>验证测试</span>\
|
||||
<div class='info-r'>\
|
||||
<textarea class='bt-input-text' name='mail_test' style='width:100%; height: 80px; line-height: 20px; padding: 5px 8px;'>验证测试</textarea></div>\
|
||||
</div>\
|
||||
</div>",
|
||||
yes:function(index){
|
||||
var pdata = {};
|
||||
pdata['smtp_host'] = $('input[name="smtp_host"]').val();
|
||||
pdata['smtp_port'] = $('input[name="smtp_port"]').val();
|
||||
pdata['smtp_ssl'] = $('input[name="smtp_ssl"]:checked').val();
|
||||
pdata['username'] = $('input[name="username"]').val();
|
||||
pdata['password'] = $('input[name="password"]').val();
|
||||
pdata['to_mail_addr'] = $('input[name="to_mail_addr"]').val();
|
||||
|
||||
if (pdata['smtp_host'] == ''){
|
||||
layer.msg('SMTP服务器不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['smtp_port'] == ''){
|
||||
layer.msg('SMTP端口不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['username'] == ''){
|
||||
layer.msg('用户名不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['password'] == ''){
|
||||
layer.msg('授权码不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['to_mail_addr'] == ''){
|
||||
layer.msg('发送地址不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
$.post('/config/set_notify',{'tag':'email', 'data':JSON.stringify(pdata)},function(rdata){
|
||||
showMsg(rdata.msg, function(){
|
||||
if (rdata.status){
|
||||
layer.close(index);
|
||||
}
|
||||
},{icon:rdata.status?1:2},2000);
|
||||
});
|
||||
},
|
||||
|
||||
btn3:function(index){
|
||||
var pdata = {};
|
||||
pdata['smtp_host'] = $('input[name="smtp_host"]').val();
|
||||
pdata['smtp_port'] = $('input[name="smtp_port"]').val();
|
||||
pdata['smtp_ssl'] = $('input[name="smtp_ssl"]:checked').val();
|
||||
pdata['username'] = $('input[name="username"]').val();
|
||||
pdata['password'] = $('input[name="password"]').val();
|
||||
pdata['to_mail_addr'] = $('input[name="to_mail_addr"]').val();
|
||||
pdata['mail_test'] = $('textarea[name="mail_test"]').val();
|
||||
|
||||
|
||||
if (pdata['smtp_host'] == ''){
|
||||
layer.msg('SMTP服务器不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['smtp_port'] == ''){
|
||||
layer.msg('SMTP端口不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['username'] == ''){
|
||||
layer.msg('用户名不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['password'] == ''){
|
||||
layer.msg('授权码不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['to_mail_addr'] == ''){
|
||||
layer.msg('发送地址不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pdata['mail_test'] == ''){
|
||||
layer.msg('验证测试不能为空!', {icon:2});
|
||||
return false;
|
||||
}
|
||||
$.post('/config/set_notify_test',{'tag':'email', 'data':JSON.stringify(pdata)},function(rdata){
|
||||
showMsg(rdata.msg, function(){
|
||||
if (rdata.status){
|
||||
layer.close(index);
|
||||
}
|
||||
},{icon:rdata.status?1:2},2000);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getPanelSSL(){
|
||||
var loadT = layer.msg('正在获取证书信息...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/config/get_panel_ssl',{},function(cert){
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 65 KiB |
@@ -161,7 +161,26 @@
|
||||
<span class="set-info c7">Telegram Bot机器人通知【<b style="color:red;">国内可能无法使用</b>】</span>
|
||||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="绑定账号" style="float: left;">邮件通知</span>
|
||||
<input id="cfg_email" name="cfg_email" onclick="setNotifyApi('email',this)" class="btswitch btswitch-ios" type="checkbox" {{data['notify_email_enable']}}>
|
||||
<label class="btswitch-btn ml5" for="cfg_email" style="float: left;margin-top:4px;"></label>
|
||||
<button ype="button" class="btn btn-default btn-xs panel_api_btn" style="vertical-align: middle; margin-left: 10px" onclick="getEmailCfg();">邮件配置</button>
|
||||
<span class="set-info c7">邮件通知</span>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <div class="title c6 plr15"><h3 class="f16">VIP</h3></div>
|
||||
<div class="setting-con pd15">
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="用户登录" style="float: left;">用户登录</span>
|
||||
<input id="cfg_login" name="cfg_login" onclick="" class="btswitch btswitch-ios" type="checkbox" disabled>
|
||||
<label class="btswitch-btn ml5" for="cfg_login" style="float: left;margin-top:4px;"></label>
|
||||
<button ype="button" class="btn btn-default btn-xs" style="vertical-align: middle; margin-left: 10px" onclick="setVipInfo();">绑定</button>
|
||||
<span class="set-info c7">【<b style="color:red;">请勿使用</b>】测试版(开发中)</span>
|
||||
</p>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -204,7 +204,7 @@ mw_update()
|
||||
if [ "$LOCAL_ADDR" == "common" ];then
|
||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash
|
||||
else
|
||||
curl --insecure -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install.sh | bash
|
||||
curl --insecure -fsSL https://code.midoks.me/midoks/mdserver-web/raw/branch/dev/scripts/update.sh | bash
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ mw_update_dev()
|
||||
if [ "$LOCAL_ADDR" == "common" ];then
|
||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
|
||||
else
|
||||
curl --insecure -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/update_dev.sh | bash
|
||||
curl --insecure -fsSL https://code.midoks.me/midoks/mdserver-web/raw/branch/dev/scripts/update_dev.sh | bash
|
||||
fi
|
||||
cd /www/server/mdserver-web
|
||||
}
|
||||
|
||||
+13
-12
@@ -82,16 +82,21 @@ if [ $OSNAME != "macos" ];then
|
||||
|
||||
# https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh
|
||||
if [ ! -d /www/server/mdserver-web ];then
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
curl --insecure -sSLo /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip
|
||||
if [ "$LOCAL_ADDR" == "common" ];then
|
||||
curl --insecure -sSLo /tmp/master.zip ${HTTP_PREFIX}github.com/midoks/mdserver-web/archive/refs/heads/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
|
||||
else
|
||||
curl --insecure -sSLo /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
|
||||
curl --insecure -sSLo /tmp/master.zip https://code.midoks.me/midoks/mdserver-web/archive/master.zip
|
||||
cd /tmp && unzip /tmp/master.zip
|
||||
mv -f /tmp/mdserver-web /www/server/mdserver-web
|
||||
rm -rf /tmp/master.zip
|
||||
rm -rf /tmp/mdserver-web
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
# install acme.sh
|
||||
@@ -112,11 +117,7 @@ fi
|
||||
|
||||
echo "use system version: ${OSNAME}"
|
||||
if [ "${OSNAME}" == "macos" ];then
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
curl --insecure -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/install/macos.sh | bash
|
||||
else
|
||||
curl --insecure -fsSL ${HTTP_PREFIX}https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/macos.sh | bash
|
||||
fi
|
||||
curl --insecure -fsSL https://code.midoks.me/midoks/mdserver-web/raw/branch/master/scripts/install/macos.sh | bash
|
||||
else
|
||||
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
||||
fi
|
||||
|
||||
@@ -125,13 +125,13 @@ if [ $VERSION_ID -ge 8 ];then
|
||||
REPOS='--enablerepo=appstream,baseos,epel,extras,powertools'
|
||||
fi
|
||||
|
||||
for rpms in autoconf bzip2 bzip2-devel c-ares-devel \
|
||||
for rpms in gcc gcc-c++ lsof autoconf bzip2 bzip2-devel c-ares-devel \
|
||||
ca-certificates cairo-devel cmake crontabs curl curl-devel diffutils e2fsprogs e2fsprogs-devel \
|
||||
expat-devel expect file flex gcc gcc-c++ gd gd-devel gettext gettext-devel glib2 glib2-devel glibc.i686 \
|
||||
expat-devel expect file flex gd gd-devel gettext gettext-devel glib2 glib2-devel glibc.i686 \
|
||||
gmp-devel kernel-devel libXpm-devel libaio-devel libcap libcurl libcurl-devel libevent libevent-devel \
|
||||
libicu-devel libidn libidn-devel libmcrypt libmcrypt-devel libmemcached libmemcached-devel \
|
||||
libpng libpng-devel libstdc++.so.6 libtirpc libtirpc-devel libtool libtool-libs libwebp libwebp-devel \
|
||||
libxml2 libxml2-devel libxslt libxslt-devel libarchive lsof make mysql-devel ncurses ncurses-devel net-tools \
|
||||
libxml2 libxml2-devel libxslt libxslt-devel libarchive make mysql-devel ncurses ncurses-devel net-tools \
|
||||
oniguruma oniguruma-devel patch pcre pcre-devel perl perl-Data-Dumper perl-devel procps psmisc python3-devel \
|
||||
readline-devel rpcgen sqlite-devel tar unzip vim-minimal wget zip zlib zlib-devel ;
|
||||
do
|
||||
@@ -142,13 +142,13 @@ if [ $VERSION_ID -ge 8 ];then
|
||||
done
|
||||
else
|
||||
# CentOS 7
|
||||
for rpms in autoconf bison bzip2 bzip2-devel c-ares-devel ca-certificates cairo-devel \
|
||||
for rpms in gcc gcc-c++ lsof autoconf bison bzip2 bzip2-devel c-ares-devel ca-certificates cairo-devel \
|
||||
cmake cmake3 crontabs curl curl-devel diffutils e2fsprogs e2fsprogs-devel expat-devel expect file \
|
||||
flex freetype freetype-devel gcc gcc-c++ gd gd-devel gettext gettext-devel git-core glib2 glib2-devel \
|
||||
flex freetype freetype-devel gd gd-devel gettext gettext-devel git-core glib2 glib2-devel \
|
||||
glibc.i686 gmp-devel graphviz icu kernel-devel libXpm-devel libaio-devel libcap libcurl libcurl-devel \
|
||||
libevent libevent-devel libicu-devel libidn libidn-devel libjpeg-devel libmcrypt libmcrypt-devel \
|
||||
libmemcached libmemcached-devel libpng-devel libstdc++.so.6 libtirpc libtirpc-devel libtool libtool-libs \
|
||||
libwebp libwebp-devel libxml2 libxml2-devel libxslt libxslt-devel libzip libzip-devel libzstd-devel lsof \
|
||||
libwebp libwebp-devel libxml2 libxml2-devel libxslt libxslt-devel libzip libzip-devel libzstd-devel \
|
||||
make mysql-devel ncurses ncurses-devel net-tools oniguruma oniguruma-devel openldap openldap-devel \
|
||||
openssl openssl-devel patch pcre pcre-devel perl perl-Data-Dumper perl-devel psmisc python-devel \
|
||||
python3-devel python3-pip re2c readline-devel rpcgen sqlite-devel tar unzip vim-minimal vixie-cron \
|
||||
|
||||
+11
-12
@@ -85,14 +85,17 @@ if [ $OSNAME != "macos" ];then
|
||||
|
||||
if [ "$LOCAL_ADDR" == "common" ];then
|
||||
curl --insecure -sSLo /tmp/dev.zip ${HTTP_PREFIX}github.com/midoks/mdserver-web/archive/refs/heads/dev.zip
|
||||
cd /tmp && unzip /tmp/dev.zip
|
||||
mv -f /tmp/mdserver-web-dev /www/server/mdserver-web
|
||||
rm -rf /tmp/dev.zip
|
||||
rm -rf /tmp/mdserver-web-dev
|
||||
else
|
||||
curl --insecure -sSLo /tmp/dev.zip https://gitee.com/midoks/mdserver-web/repository/archive/dev.zip
|
||||
fi
|
||||
|
||||
cd /tmp && unzip /tmp/dev.zip
|
||||
mv -f /tmp/mdserver-web-dev /www/server/mdserver-web
|
||||
rm -rf /tmp/dev.zip
|
||||
rm -rf /tmp/mdserver-web-dev
|
||||
curl --insecure -sSLo /tmp/dev.zip https://code.midoks.me/midoks/mdserver-web/archive/dev.zip
|
||||
cd /tmp && unzip /tmp/dev.zip
|
||||
mv -f /tmp/mdserver-web /www/server/mdserver-web
|
||||
rm -rf /tmp/dev.zip
|
||||
rm -rf /tmp/mdserver-web
|
||||
fi
|
||||
fi
|
||||
|
||||
# install acme.sh
|
||||
@@ -115,11 +118,7 @@ fi
|
||||
echo "use system version: ${OSNAME}"
|
||||
|
||||
if [ "${OSNAME}" == "macos" ];then
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
curl --insecure -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/install/macos.sh | bash
|
||||
else
|
||||
curl --insecure -fsSL ${HTTP_PREFIX}https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/macos.sh | bash
|
||||
fi
|
||||
curl --insecure -fsSL https://code.midoks.me/midoks/mdserver-web/raw/branch/master/scripts/install/macos.sh | bash
|
||||
else
|
||||
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
||||
fi
|
||||
|
||||
+9
-5
@@ -47,13 +47,16 @@ else
|
||||
echo "OK"
|
||||
fi
|
||||
|
||||
# cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
|
||||
HTTP_PREFIX="https://"
|
||||
LOCAL_ADDR=common
|
||||
ping -c 1 pypi.python.org > /dev/null 2>&1
|
||||
if [ "$?" != "0" ];then
|
||||
LOCAL_ADDR=cn
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
ping -c 1 ipinfo.io > /dev/null 2>&1
|
||||
if [ "$?" == "0" ];then
|
||||
CN=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$CN" ];then
|
||||
LOCAL_ADDR=cn
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
fi
|
||||
|
||||
PIPSRC="https://pypi.python.org/simple"
|
||||
@@ -69,6 +72,7 @@ fi
|
||||
|
||||
which pip && pip install --upgrade pip -i $PIPSRC
|
||||
pip3 install --upgrade pip setuptools wheel -i $PIPSRC
|
||||
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -i $PIPSRC
|
||||
|
||||
# pip3 install flask-caching==1.10.1
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ fi
|
||||
|
||||
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
curl --insecure -sSLo /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip
|
||||
curl --insecure -sSLo /tmp/master.zip https://code.midoks.me/midoks/mdserver-web/archive/master.zip
|
||||
else
|
||||
curl --insecure -sSLo /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
|
||||
fi
|
||||
|
||||
@@ -64,7 +64,7 @@ if [ "$?" != "0" ];then
|
||||
fi
|
||||
|
||||
if [ "$LOCAL_ADDR" != "common" ];then
|
||||
curl --insecure -sSLo /tmp/dev.zip https://gitee.com/midoks/mdserver-web/repository/archive/dev.zip
|
||||
curl --insecure -sSLo /tmp/dev.zip https://code.midoks.me/midoks/mdserver-web/archive/dev.zip
|
||||
else
|
||||
curl --insecure -sSLo /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user