Skip to content

Commit

Permalink
Merge pull request #698 from midoks/dev
Browse files Browse the repository at this point in the history
openresty配置优化
  • Loading branch information
midoks authored Jan 24, 2025
2 parents 25fcf93 + 46a525a commit 4cc5194
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 37 deletions.
1 change: 1 addition & 0 deletions plugins/openresty/conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
user {$OS_USER} {$OS_USER_GROUP};
worker_processes auto;
worker_cpu_affinity auto;
error_log {$SERVER_PATH}/openresty/nginx/logs/error.log crit;
pid {$SERVER_PATH}/openresty/nginx/logs/nginx.pid;

Expand Down
25 changes: 25 additions & 0 deletions plugins/openresty/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,23 @@ def getCfg():

return mw.returnJson(True, "ok", rdata)

def replaceChar(value, index, new_char):
return value[:index] + new_char + value[index+1:]

def makeWorkerCpuAffinity(val):
if val == "auto":
return "auto"

if mw.isNumber(val):
core_num = int(val)
default_core_str = "0"*core_num
core_num_arr = []
for x in range(core_num):
t = replaceChar(default_core_str, x , "1")
core_num_arr.append(t)
return " ".join(core_num_arr)

return 'auto'

def setCfg():

Expand Down Expand Up @@ -544,6 +561,14 @@ def setCfg():
if not re.search(r"\d+", v):
return mw.returnJson(False, '参数值错误,请输入数字整数')

if k == "worker_processes" :
k_wca = "worker_cpu_affinity"
rep_wca = r"%s\s+[^\;\n]+" % k_wca
v_wca = makeWorkerCpuAffinity(v)
newconf = "%s %s" % (k_wca, v_wca)
content = re.sub(rep_wca, newconf, content)


if re.search(rep, content):
newconf = "%s %s" % (k, v)
content = re.sub(rep, newconf, content)
Expand Down
21 changes: 3 additions & 18 deletions plugins/tgbot/startup/extend/push_ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,20 @@ def send_msg(bot, tag='ad', trigger_time=300):

# 跨链混币器Cce.Cash💰低手续费💰隔断溯源 | 10/m | next,6/10 | @hu ge
# TTKCDN 无视移动墙/GFW/SNI阻断 TG第一性价比 | 10/m | @ssdpflood
# SJ资源网播放计费| 14/m | next,4/14 |@sjllzyw
# https://t.me/gjgzs2022 | 22/m | @GJ_gzs
# 综合包网/NG接口开户 | 28/m | 6m | next,4/28 | x
# 实名认证/过人脸🕵️‍♀️各种账号处理✅ | 30/m| next,6/30 | @nngzs
# 桃花资源采集| 13/m| next,1/13 | @xiaolizi1122
# 桃花资源采集| 13/m| next,7/13 | @xiaolizi1122
keyboard = [
[
types.InlineKeyboardButton(
text="TTKCDN 性价比最高的商业CDN", url='https://t.me/ssdpflood')
],
[
types.InlineKeyboardButton(
text="TTKCDN 过河南郑州/泉州等地区阻断", url='https://t.me/ssdpflood')
],
[
types.InlineKeyboardButton(
text="TTKCDN 私人定制 属于你自己的独立CDN", url='https://t.me/ssdpflood')
],
[
types.InlineKeyboardButton(
text="TTKCDN 全系主动防御 全球威胁情报网", url='https://t.me/ssdpflood')
text="SJ资源网播放计费", url='https://sjzy.tv?mw')
],
[
types.InlineKeyboardButton(
text="跨链混币器Cce.Cash💰低手续费💰隔断溯源", url='https://cce.cash/#/main/home?MW')
],
[
types.InlineKeyboardButton(
text="TTKCDN 无视移动墙/GFW/SNI阻断 TG第一性价比", url='https://t.me/ssdpflood')
],
[
types.InlineKeyboardButton(
text="桃花资源采集🚀 ", url='https://thzy.me')
Expand Down
23 changes: 4 additions & 19 deletions plugins/tgbot/startup/extend/push_notice_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,20 @@ def send_msg(bot, tag='ad', trigger_time=300):

# 跨链混币器Cce.Cash💰低手续费💰隔断溯源 | 10/m | next,6/10 | @hu ge
# TTKCDN | 10/m | @ssdpflood | 5
# SJ资源网播放计费| 14/m | next,4/14 |@sjllzyw
# https://t.me/gjgzs2022 | 22/m | @GJ_gzs
# 综合包网/NG接口开户 | 28/m | 6m | next,4/28 | x
# 实名认证/过人脸🕵️‍♀️各种账号处理✅ | 30/m| next,6/30 | @nngzs
# 桃花资源采集| 13/m| next,1/13 | @xiaolizi1122
# 桃花资源采集| 13/m| next,7/13 | @xiaolizi1122
keyboard = [
[
types.InlineKeyboardButton(
text="TTKCDN 性价比最高的商业CDN", url='https://t.me/ssdpflood')
],
[
types.InlineKeyboardButton(
text="TTKCDN 过河南郑州/泉州等地区阻断", url='https://t.me/ssdpflood')
],
[
types.InlineKeyboardButton(
text="TTKCDN 私人定制 属于你自己的独立CDN", url='https://t.me/ssdpflood')
],
[
types.InlineKeyboardButton(
text="TTKCDN 全系主动防御 全球威胁情报网", url='https://t.me/ssdpflood')
text="SJ资源网播放计费", url='https://sjzy.tv?mw')
],
[
types.InlineKeyboardButton(
text="跨链混币器Cce.Cash💰低手续费💰隔断溯源", url='https://cce.cash/#/main/home?MW')
],
[
types.InlineKeyboardButton(
text="TTKCDN 无视移动墙/GFW/SNI阻断 TG第一性价比", url='https://t.me/ssdpflood')
],
[
types.InlineKeyboardButton(
text="桃花资源采集🚀 ", url='https://thzy.me')
Expand Down Expand Up @@ -119,7 +104,7 @@ def send_msg(bot, tag='ad', trigger_time=300):
types.InlineKeyboardButton(
text="@ME", url='tg://user?id=5568699210'),
types.InlineKeyboardButton(
text="150RMB/月[已满]", url='tg://user?id=5568699210')
text="150RMB/月", url='tg://user?id=5568699210')
]
]
markup = types.InlineKeyboardMarkup(keyboard)
Expand Down

0 comments on commit 4cc5194

Please sign in to comment.