Skip to content

Commit

Permalink
Merge pull request #409 from midoks/dev
Browse files Browse the repository at this point in the history
0.14.5
  • Loading branch information
midoks authored May 14, 2023
2 parents a12c4dd + bec2a9a commit 3a7882e
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 35 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```


### 版本更新 0.14.4
### 版本更新 0.14.5

* 安装优化,redat系列优化。
* PHP74-82在redat的安装修复(oniguruma)。
* 面板端口修改优化。
* 软件管理-搜索功能。
* 文件-右键功能优化。

### JSDelivr安装地址

Expand Down
2 changes: 1 addition & 1 deletion class/core/config_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class config_api:

__version = '0.14.4'
__version = '0.14.5'
__api_addr = 'data/api.json'

def __init__(self):
Expand Down
28 changes: 21 additions & 7 deletions class/core/plugins_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def listApi(self):
if not mw.isNumber(sType):
sType = 0

# print sPage
data = self.getPluginList(sType, int(sPage))
# print(sPage, sType)
search = request.args.get('search', '').lower()
data = self.getPluginList(sType, search, int(sPage))
return mw.getJson(data)

def menuGetAbsPath(self, tag, path):
Expand Down Expand Up @@ -781,7 +782,18 @@ def getAllList(self, sType='0'):
print(e)
return plugins_info

def getAllListPage(self, sType='0', page=1, pageSize=10):
def searchKey(self, info, kw):
try:
if info['title'].lower().find(kw) > -1:
return True
if info['ps'].lower().find(kw) > -1:
return True
if info['name'].lower().find(kw) > -1:
return True
except Exception as e:
return False

def getAllListPage(self, sType='0', kw='', page=1, pageSize=10):
plugins_info = []
for dirinfo in os.listdir(self.__plugin_dir):
if dirinfo[0:1] == '.':
Expand All @@ -792,11 +804,13 @@ def getAllListPage(self, sType='0', page=1, pageSize=10):
if os.path.exists(json_file):
try:
data = json.loads(mw.readFile(json_file))
# 判断是否搜索
if kw != '' and not self.searchKey(data, kw):
continue
tmp_data = self.makeList(data, sType)
for index in range(len(tmp_data)):
plugins_info.append(tmp_data[index])
except Exception as e:
print(json_file)
print(mw.getTracebackInfo())

start = (page - 1) * pageSize
Expand Down Expand Up @@ -927,14 +941,14 @@ def getAllListProcess(self, sType='0'):

return plugins_info

def getPluginList(self, sType, sPage=1, sPageSize=10):
# print sType, sPage, sPageSize
def getPluginList(self, sType, kw='', sPage=1, sPageSize=10):
# print(sType, kw, sPage, sPageSize)

ret = {}
ret['type'] = json.loads(mw.readFile(self.__type))
# plugins_info = self.getAllListThread(sType)
# plugins_info = self.getAllListProcess(sType)
data = self.getAllListPage(sType, sPage, sPageSize)
data = self.getAllListPage(sType, kw, sPage, sPageSize)
ret['data'] = data[0]

args = {}
Expand Down
9 changes: 7 additions & 2 deletions plugins/tgbot/startup/extend/push_ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ def send_msg(bot, tag='ad', trigger_time=300):
# https://t.me/gjgzs2022 | 19/m
# ♻️CMS导航网♻️/💰流量变现💰 | 28/m
# CK资源采集 |29/m
# https://zhaoziyuan.la/ | 15/m | 2m | next,5/15
# https://zhaoziyuan.la/ | 15/m | 2m | next,7/15
# 香港高防CDN |9/m
keyboard = [
[
types.InlineKeyboardButton(
text="香港高防CDN、免实名、试用30天", url='www.100dun.com')
],
[
types.InlineKeyboardButton(
text="CK资源采集", url='https://ckzy1.com/')
Expand All @@ -60,7 +65,7 @@ def send_msg(bot, tag='ad', trigger_time=300):
],
[
types.InlineKeyboardButton(
text="🙎‍♂️代实名🙍‍♀️过人脸🅾️国际阿里云腾讯云(赞助商)", url='https://t.me/gjgzs2022')
text="🙎‍♂️代实名🙍‍♀️过人脸🅾️国际阿里云腾讯云", url='https://t.me/gjgzs2022')
],
[
types.InlineKeyboardButton(
Expand Down
18 changes: 17 additions & 1 deletion plugins/tgbot/startup/extend/push_bbs_ntid.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
# chat_id = 5568699210


def writeLog(log_str):
if __name__ == "__main__":
print(log_str)

now = mw.getDateFromNow()
log_file = mw.getServerDir() + '/tgbot/task.log'
mw.writeFileLog(now + ':' + log_str, log_file, limit_size=5 * 1024)
return True


def get_newest_tid():

api_new = 'https://bbs.midoks.me/plugin.php?id=external_api&f=bbs_newest'
Expand Down Expand Up @@ -86,7 +96,13 @@ def send_msg(bot, tag='ad', trigger_time=300):


def run(bot):
send_msg(bot, 'push_bbs_newest_tid', 300)

try:
send_msg(bot, 'push_bbs_newest_tid', 300)
except Exception as e:
writeLog('-----push_bbs_newest_tid error start -------')
print(mw.getTracebackInfo())
writeLog('-----push_bbs_newest_tid error start -------')


if __name__ == "__main__":
Expand Down
17 changes: 16 additions & 1 deletion plugins/tgbot/startup/extend/push_notice_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
# chat_id = 5568699210


def writeLog(log_str):
if __name__ == "__main__":
print(log_str)

now = mw.getDateFromNow()
log_file = mw.getServerDir() + '/tgbot/task.log'
mw.writeFileLog(now + ':' + log_str, log_file, limit_size=5 * 1024)
return True


def send_msg(bot, tag='ad', trigger_time=300):
# 信号只在一个周期内执行一次|start
lock_file = mw.getServerDir() + '/tgbot/lock.json'
Expand All @@ -43,7 +53,12 @@ def send_msg(bot, tag='ad', trigger_time=300):
# https://t.me/gjgzs2022 | 19/m
# ♻️CMS导航网♻️/💰流量变现💰 | 28/m
# CK资源采集 |29/m
# 香港高防CDN |9/m
keyboard = [
[
types.InlineKeyboardButton(
text="香港高防CDN、免实名、试用30天", url='www.100dun.com')
],
[
types.InlineKeyboardButton(
text="CK资源采集", url='https://ckzy1.com/')
Expand All @@ -58,7 +73,7 @@ def send_msg(bot, tag='ad', trigger_time=300):
],
[
types.InlineKeyboardButton(
text="🙎‍♂️代实名🙍‍♀️过人脸🅾️国际阿里云腾讯云(赞助商)", url='https://t.me/gjgzs2022')
text="🙎‍♂️代实名🙍‍♀️过人脸🅾️国际阿里云腾讯云", url='https://t.me/gjgzs2022')
],
[
types.InlineKeyboardButton(
Expand Down
13 changes: 10 additions & 3 deletions plugins/tgclient/startup/extend/client_ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
filter_g_id = [-1001771526434]


msg_ad = "本人软件推广(30s)\n\n"
msg_ad += "开源地址(Linux面板) mdserver-web,站长必备,不收费,无毒。源码为证。全靠TG乞讨! \n"
msg_ad = "本人软件推广(10s)\n\n"
msg_ad += "开源Linux面板【mdserver-web】,站长必备,无毒,源码为证。\n"
msg_ad += "不收费,全靠TG乞讨! \n"
msg_ad += "看个人简介,加入群聊,一起进步!\n"
# msg_ad += "https://github.com/midoks/mdserver-web \n"
# msg_ad += "\n"
Expand Down Expand Up @@ -65,7 +66,7 @@ async def send_msg(client, chat_id, tag='ad', trigger_time=600):
# 信号只在一个周期内执行一次|end

msg = await client.send_message(chat_id, msg_ad)
await asyncio.sleep(30)
await asyncio.sleep(10)
await client.delete_messages(chat_id, msg)
await asyncio.sleep(3)

Expand All @@ -78,13 +79,19 @@ async def run(client):
info = await client.get_dialogs()
for chat in info:
if chat.is_group and not chat.id in filter_g_id:
chat_id = str(chat.id)
if chat_id[0:4] != '-100':
continue

# print(chat)
await writeLog('name:{0} id:{1} is_user:{2} is_channel:{3} is_group:{4}'.format(
chat.name, chat.id, chat.is_user, chat.is_channel, chat.is_group))
try:
await send_msg(client, chat.id, 'ad_' + str(chat.id))
except Exception as e:
await writeLog(str(chat))
await writeLog(str(e))


if __name__ == "__main__":
pass
49 changes: 37 additions & 12 deletions plugins/tgclient/startup/extend/client_check_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,46 @@

# 指定群ID
chat_id_list = [-1001578009023, -1001979545570]
# 别人群ID[有API调用限制]
chat_id_list_other = [-1001771526434]

async def writeLog(log_str):
if __name__ == "__main__":
print(log_str)

now = mw.getDateFromNow()
log_file = mw.getServerDir() + '/tgclient/task.log'
mw.writeFileLog(now + ':' + log_str, log_file, limit_size=5 * 1024)
return True

async def run(client):
for chat_id in chat_id_list:
s = await client.send_message(chat_id, '开始自动检测已经注销群成员...')
count = 0
async for user in client.iter_participants(chat_id):
if user.deleted:
count += 1
msg = await client.kick_participant(chat_id, user)

await client.edit_message(chat_id, s.id, '已经检测到有(%d)个账户已失效' % (count))
await asyncio.sleep(3)
await client.edit_message(chat_id, s.id, '自动检测已经注销群成员完毕!!!')
await asyncio.sleep(3)
await client.delete_messages(chat_id, s)
try:
s = await client.send_message(chat_id, '开始自动检测已经注销群成员...')
count = 0
async for user in client.iter_participants(chat_id):
if user.deleted:
count += 1
msg = await client.kick_participant(chat_id, user)

await client.edit_message(chat_id, s.id, '已经检测到有(%d)个账户已失效' % (count))
await asyncio.sleep(3)
await client.edit_message(chat_id, s.id, '自动检测已经注销群成员完毕!!!')
await asyncio.sleep(3)
await client.delete_messages(chat_id, s)
except Exception as e:
print(str(e))
writeLog(str(e))

for chat_id in chat_id_list_other:
try:
async for user in client.iter_participants(chat_id):
if user.deleted:
msg = await client.kick_participant(chat_id, user)
except Exception as e:
print(str(e))
writeLog(str(e))

await asyncio.sleep(300)


Expand Down
4 changes: 2 additions & 2 deletions route/templates/default/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
<ul id="rmenu" class="dropdown-menu" style="display:none">
<li onclick="javascript:batch(1);"><a style="cursor: pointer;">复制</a></li>
<li onclick="javascript:batch(2);"><a style="cursor: pointer;">剪切</a></li>
<li onclick="javascript:batch(5);"><a style="cursor: pointer;">权限</a></li>
<li onclick="javascript:batch(3);"><a style="cursor: pointer;">压缩</a></li>
<li onclick="javascript:batch(3);"><a style="cursor: pointer;">权限</a></li>
<li onclick="javascript:batch(5);"><a style="cursor: pointer;">压缩</a></li>
<li onclick="javascript:batch(4);"><a style="cursor: pointer;">删除</a></li>
</ul>

Expand Down
4 changes: 2 additions & 2 deletions route/templates/default/soft.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<a class="plr10 c4" href="/">首页</a>/<span class="plr10 c4">软件管理</span>
</div>
<div class="search pull-right">
<form target="hid" onsubmit='getSList()'>
<input type="text" id="SearchValue" class="ser-text pull-left" placeholder="搜索" />
<form target="_self" onsubmit='getSList();return false;'>
<input type="text" id="SearchValue" class="ser-text pull-left" placeholder="搜索" autocomplete="false" />
<button type="button" class="ser-sub pull-left" onclick='getSList()'></button>
</form>
</div>
Expand Down

0 comments on commit 3a7882e

Please sign in to comment.