Compare commits

...

8 Commits

  1. 7
      panel_tools.py
  2. 2
      plugins/tgbot/startup/extend/push_ad.py
  3. 2
      plugins/tgbot/startup/extend/push_notice_msg.py
  4. 93
      web/utils/site_reflect.py

@ -75,6 +75,7 @@ def mwcli(mw_input=0):
'(26) 关闭二次验证',
'(27) 查看防火墙信息',
'(28) 自动识别防火墙端口到面板',
'(29) 自动识别配置站点信息',
'(100) 开启PHP52显示',
'(101) 关闭PHP52显示',
'(200) 切换Linux系统软件源',
@ -102,7 +103,7 @@ def mwcli(mw_input=0):
nums = [
1, 2, 3, 4, 5, 6, 7,
10, 11, 12, 13, 14, 15,
20, 21, 22, 23, 24, 25, 26, 27, 28,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
100, 101,
200, 201
]
@ -238,6 +239,10 @@ def mwcli(mw_input=0):
elif mw_input == 28:
MwFirewall.instance().aIF()
mw.echoInfo("执行自动识别防火墙端口到面板成功!")
elif mw_input == 29:
from utils.site_reflect import parse as MwParse
MwParse()
mw.echoInfo("自动识别配置站点信息成功!")
elif mw_input == 100:
php_conf = panel_dir + '/plugins/php/info.json'
if os.path.exists(php_conf):

@ -53,7 +53,7 @@ def send_msg(bot, tag='ad', trigger_time=300):
keyboard = [
[
types.InlineKeyboardButton(
text="跨链混币器Cce.Cash💰低手续费💰隔断溯源", url='https://cce.cash/#/main/home?MW')
text="跨链混币器Cce.Cash💰低手续费💰隔断溯源", url='https://cce.cash/exchange?s=_midoks')
],
[
types.InlineKeyboardButton(

@ -62,7 +62,7 @@ def send_msg(bot, tag='ad', trigger_time=300):
keyboard = [
[
types.InlineKeyboardButton(
text="跨链混币器Cce.Cash💰低手续费💰隔断溯源", url='https://cce.cash/#/main/home?MW')
text="跨链混币器Cce.Cash💰低手续费💰隔断溯源", url='https://cce.cash/exchange?s=_midoks')
],
[
types.InlineKeyboardButton(

@ -0,0 +1,93 @@
# coding:utf-8
# ---------------------------------------------------------------------------------
# MW-Linux面板
# ---------------------------------------------------------------------------------
# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved.
# ---------------------------------------------------------------------------------
# Author: midoks <midoks@163.com>
# ---------------------------------------------------------------------------------
import os
import sys
import re
import json
import time
import threading
import multiprocessing
import core.mw as mw
import thisdb
def getVhostDir():
sdir = mw.getServerDir()
nginx_conf = sdir + "/web_conf/nginx"
vhosts = nginx_conf+"/vhost"
return vhosts
def getRootDir(content):
pattern = r'\s*root\s*(.+);'
match = re.search(pattern, content)
if match:
return match.group(1)
return ''
def getServerName(content):
pattern = r'\s*server_name\s*(.+);'
match = re.search(pattern, content)
if match:
content = match.group(1)
clist = content.strip().split(" ");
return clist
return []
def addDomain(site_id, site_name, domain):
# print(site_id, site_name, domain)
d = domain.split(':')
port = '80'
name = d[0]
if len(d) == 2:
port = d[1]
if thisdb.checkSitesDomainIsExist(name, port):
print('您添加的域名[{}:{}],已使用。请仔细检查!'.format(name, port))
return True
thisdb.addDomain(site_id, name, port)
return True
def parse():
vhosts = getVhostDir()
vh_list = os.listdir(vhosts)
vail_list = []
for f in vh_list:
if f.startswith("0."):
continue
if f.endswith("_bak"):
continue
if f.startswith("phpmyadmin"):
continue
if f.startswith("webstats"):
continue
vail_list.append(f)
for vail_domain in vail_list:
parseSite(vail_domain)
def parseSite(d):
vhosts = getVhostDir()
domain = d.replace(".conf","")
dconf = vhosts + '/' + d
content = mw.readFile(dconf)
root_dir = getRootDir(content)
sn_list = getServerName(content)
if thisdb.isSitesExist(domain):
print('您添加的站点[%s]已存在!' % domain)
else:
thisdb.addSites(domain, root_dir)
info = thisdb.getSitesByName(domain)
site_id = info['id']
for sn in sn_list:
addDomain(site_id, d, sn)
Loading…
Cancel
Save