diff --git a/plugins/mysql/conf/my9.7.cnf b/plugins/mysql/conf/my9.7.cnf
new file mode 100644
index 000000000..87cb53435
--- /dev/null
+++ b/plugins/mysql/conf/my9.7.cnf
@@ -0,0 +1,116 @@
+[client]
+user = root
+#password = your_password
+port = 3306
+socket = {$SERVER_APP_PATH}/mysql.sock
+default-character-set = UTF8MB4
+
+[mysqld]
+!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
+
+authentication_policy=caching_sha2_password
+pid-file = {$SERVER_APP_PATH}/data/mysql.pid
+user = mysql
+port = 3306
+socket = {$SERVER_APP_PATH}/mysql.sock
+basedir = {$SERVER_APP_PATH}
+datadir = {$SERVER_APP_PATH}/data
+log-error = {$SERVER_APP_PATH}/data/error.log
+server-id = {$SERVER_ID}
+#sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
+
+default_storage_engine = InnoDB
+
+key_buffer_size = 8M
+table_open_cache = 32
+sort_buffer_size = 256K
+net_buffer_length = 4K
+read_buffer_size = 128K
+read_rnd_buffer_size = 256K
+myisam_sort_buffer_size = 4M
+thread_cache_size = 4
+lower_case_table_names=0
+tmp_table_size = 8M
+character-set-server = UTF8MB4
+
+max_connections = 500
+max_connect_errors = 100
+open_files_limit = 2560
+max_allowed_packet = 128M
+
+skip_name_resolve=1
+#skip-networking
+#skip-external-locking
+#loose-skip-innodb
+#skip-grant-tables
+
+#skip-log-bin
+#disable-log-bin
+#skip-slave-start
+log-bin=mysql-bin
+slow_query_log=1
+slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
+long_query_time=10
+#log_queries_not_using_indexes=1
+#log_slow_admin_statements=1
+#log_slow_replica_statements=1
+binlog_expire_logs_seconds=604800
+
+relay-log=mdserver
+relay-log-index=mdserver
+
+#多主设置
+#auto_increment_offset=2
+#auto_increment_increment=2
+
+#master
+#sync_binlog=1
+
+#binlog-do-db
+binlog-ignore-db = test
+binlog-ignore-db = mysql
+binlog-ignore-db = information_schema
+binlog-ignore-db = performance_schema
+
+#slave
+log_replica_updates = 1
+# Prevent replication from starting automatically with MySQL
+#skip_replica_start = 1
+#replicate-do-db
+replica_skip_errors=1062,1396
+replicate-ignore-db = information_schema
+replicate-ignore-db = performance_schema
+replicate-ignore-db = mysql
+replicate-ignore-db = test
+
+
+innodb_data_home_dir = {$SERVER_APP_PATH}/data
+innodb_data_file_path = ibdata1:10M:autoextend
+innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
+innodb_buffer_pool_size = 16M
+#innodb_log_file_size = 5M
+innodb_redo_log_capacity = 4G
+innodb_log_buffer_size = 8M
+innodb_flush_log_at_trx_commit = 1
+innodb_lock_wait_timeout = 120
+innodb_max_dirty_pages_pct = 90
+innodb_read_io_threads = 1
+innodb_write_io_threads = 1
+innodb_file_per_table=1
+
+secure-file-priv={$SERVER_APP_PATH}/tmp
+
+[mysqldump]
+quick
+
+[mysql]
+no-auto-rehash
+
+[myisamchk]
+key_buffer_size = 20M
+sort_buffer_size = 20M
+read_buffer = 2M
+write_buffer = 2M
+
+[mysqlhotcopy]
+interactive-timeout
\ No newline at end of file
diff --git a/plugins/mysql/info.json b/plugins/mysql/info.json
index aa65aeedf..daba2aedf 100755
--- a/plugins/mysql/info.json
+++ b/plugins/mysql/info.json
@@ -11,8 +11,8 @@
"checks": "server/mysql/VERSION/bin/mysql",
"path": "server/mysql/VERSION",
"todo_versions":["5.6","5.7","8.0","8.2"],
- "versions":["5.5", "5.6", "5.7","8.0","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4"],
- "updates":["5.5.62","5.6.50", "5.7.32","8.0.34","8.2.0","8.3.0","9.0.1","9.1.0","9.2.0","9.3.0","9.4.0"],
+ "versions":["5.5", "5.6", "5.7","8.0","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.7"],
+ "updates":["5.5.62","5.6.50", "5.7.32","8.0.34","8.2.0","8.3.0","9.0.1","9.1.0","9.2.0","9.3.0","9.4.0","9.7.0"],
"shell":"install.sh",
"checks":"server/mysql",
"path":"server/mysql",
diff --git a/plugins/mysql/versions/9.7/install.sh b/plugins/mysql/versions/9.7/install.sh
new file mode 100755
index 000000000..23c70d1e0
--- /dev/null
+++ b/plugins/mysql/versions/9.7/install.sh
@@ -0,0 +1,230 @@
+# -*- coding: utf-8 -*-
+#!/bin/bash
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
+export PATH
+
+# https://dev.mysql.com/downloads/mysql/
+
+curPath=`pwd`
+rootPath=$(dirname "$curPath")
+rootPath=$(dirname "$rootPath")
+serverPath=$(dirname "$rootPath")
+sysName=`uname`
+
+
+mysqlDir=${serverPath}/source/mysql
+
+_os=`uname`
+echo "use system: ${_os}"
+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'
+ pkg install -y wget unzip
+elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
+ OSNAME='arch'
+ echo y | pacman -Sy unzip
+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
+
+VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
+
+
+VERSION=9.7.0
+# https://dev.mysql.com/get/Downloads/MySQL-9.4/mysql-${VERSION}.tar.gz
+# https://cdn.mysql.com/archives/mysql-9.4/mysql-9.4.0.tar.gz
+Install_mysql()
+{
+ mkdir -p ${mysqlDir}
+ echo '正在安装脚本文件...'
+
+
+ # ----- cpu start ------
+ if [ -z "${cpuCore}" ]; then
+ cpuCore="1"
+ fi
+
+ if [ -f /proc/cpuinfo ];then
+ cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l`
+ fi
+
+ MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}')
+ if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then
+ if [ "${cpuCore}" -gt "${MEM_INFO}" ];then
+ cpuCore="${MEM_INFO}"
+ fi
+ else
+ cpuCore="1"
+ fi
+
+ if [ "$cpuCore" -gt "2" ];then
+ cpuCore=`echo "$cpuCore" | awk '{printf("%.f",($1)*0.8)}'`
+ else
+ cpuCore="1"
+ fi
+ # ----- cpu end ------
+
+ cd ${rootPath}/plugins/mysql/lib && /bin/bash rpcgen.sh
+
+ INSTALL_CMD=cmake
+ # check cmake version
+ CMAKE_VERSION=`cmake -version | grep version | awk '{print $3}' | awk -F '.' '{print $1}'`
+ if [ "$CMAKE_VERSION" -eq "2" ];then
+ mkdir -p /var/log/mariadb
+ touch /var/log/mariadb/mariadb.log
+ INSTALL_CMD=cmake3
+ fi
+
+ if [ ! -f ${mysqlDir}/mysql-${VERSION}.tar.gz ];then
+ wget --no-check-certificate -O ${mysqlDir}/mysql-${VERSION}.tar.gz --tries=3 https://dev.mysql.com/get/Downloads/MySQL-9.4/mysql-${VERSION}.tar.gz
+ fi
+
+ #检测文件是否损坏.
+ md5_mysql_ok=c770f276fb84019be6fbe0a57b32efbc
+ if [ -f ${mysqlDir}/mysql-${VERSION}.tar.gz ];then
+ md5_mysql=`md5sum ${mysqlDir}/mysql-${VERSION}.tar.gz | awk '{print $1}'`
+ if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
+ echo "mysql9.4 file check ok"
+ else
+ # 重新下载
+ rm -rf ${mysqlDir}/mysql-${VERSION}
+ wget --no-check-certificate -O ${mysqlDir}/mysql-${VERSION}.tar.gz --tries=3 https://cdn.mysql.com/archives/mysql-9.4/mysql-${VERSION}.tar.gz
+ fi
+ fi
+
+ if [ ! -d ${mysqlDir}/mysql-${VERSION} ];then
+ cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-${VERSION}.tar.gz
+ fi
+
+ OPTIONS=''
+ ##check openssl version
+ OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
+ if [ "${OPENSSL_VERSION}" -ge "3" ];then
+ #openssl version to high
+ cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh
+ export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
+ OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
+ fi
+
+ WHERE_DIR_GCC=/usr/bin/gcc
+ WHERE_DIR_GPP=/usr/bin/g++
+ if [ "$OSNAME" == "centos" ] && [ "$VERSION_ID" == "7" ];then
+ yum install -y libudev-devel
+ yum install -y centos-release-scl
+ yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils
+
+ gcc --version
+ WHERE_DIR_GCC=/opt/rh/devtoolset-11/root/usr/bin/gcc
+ WHERE_DIR_GPP=/opt/rh/devtoolset-11/root/usr/bin/g++
+ echo $WHERE_DIR_GCC
+ echo $WHERE_DIR_GPP
+ fi
+
+ if [ "$OSNAME" == "ubuntu" ];then
+ apt install -y libudev-dev
+ apt install -y libtirpc-dev
+ apt install -y libssl-dev
+ apt install -y libgssglue-dev
+ apt install -y software-properties-common
+ add-apt-repository -y ppa:ubuntu-toolchain-r/test
+
+ LIBTIRPC_VER=`pkg-config libtirpc --modversion`
+ if [ ! -f ${mysqlDir}/libtirpc_1.3.3.orig.tar.bz2 ];then
+ wget --no-check-certificate -O ${mysqlDir}/libtirpc_1.3.3.orig.tar.bz2 https://downloads.sourceforge.net/libtirpc/libtirpc-1.3.3.tar.bz2
+ cd ${mysqlDir} && tar -jxvf libtirpc_1.3.3.orig.tar.bz2
+ cd libtirpc-1.3.3 && ./configure
+ fi
+
+ export PKG_CONFIG_PATH=/usr/lib/pkgconfig
+ apt install -y gcc-11 g++-11
+ WHERE_DIR_GCC=/usr/bin/gcc-11
+ WHERE_DIR_GPP=/usr/bin/g++-11
+
+
+ OPTIONS="${OPTIONS} -DFORCE_INSOURCE_BUILD=1"
+ OPTIONS="${OPTIONS} -D_FORTIFY_SOURCE=2"
+ fi
+
+
+ if [ "$OSNAME" == "opensuse" ];then
+ zypper install -y gcc11
+ zypper install -y gcc11-c++
+
+
+ WHERE_DIR_GCC=/usr/bin/gcc-11
+ WHERE_DIR_GPP=/usr/bin/g++-11
+ fi
+
+ if [ ! -d $serverPath/mysql ];then
+ # -DCMAKE_CXX_STANDARD=17 \
+ cd ${mysqlDir}/mysql-${VERSION} && ${INSTALL_CMD} \
+ -DCMAKE_INSTALL_PREFIX=$serverPath/mysql \
+ -DMYSQL_USER=mysql \
+ -DMYSQL_TCP_PORT=3306 \
+ -DMYSQL_UNIX_ADDR=/var/tmp/mysql.sock \
+ -DWITH_MYISAM_STORAGE_ENGINE=1 \
+ -DWITH_INNOBASE_STORAGE_ENGINE=1 \
+ -DWITH_MEMORY_STORAGE_ENGINE=1 \
+ -DENABLED_LOCAL_INFILE=1 \
+ -DWITH_PARTITION_STORAGE_ENGINE=1 \
+ -DWITH_READLINE=1 \
+ -DEXTRA_CHARSETS=all \
+ -DDEFAULT_CHARSET=utf8mb4 \
+ -DDEFAULT_COLLATION=utf8mb4_general_ci \
+ -DDOWNLOAD_BOOST=1 \
+ -DFORCE_INSOURCE_BUILD=1 \
+ $OPTIONS \
+ -DCMAKE_C_COMPILER=$WHERE_DIR_GCC \
+ -DCMAKE_CXX_COMPILER=$WHERE_DIR_GPP \
+ -DDOWNLOAD_BOOST=0 \
+ -DWITH_BOOST=${mysqlDir}/mysql-${VERSION}/boost/
+ make -j${cpuCore} && make install && make clean
+
+ if [ -d $serverPath/mysql ];then
+ rm -rf ${mysqlDir}/mysql-${VERSION}
+ echo '9.4' > $serverPath/mysql/version.pl
+ echo "${VERSION}安装完成"
+ else
+ # rm -rf ${mysqlDir}/mysql-${VERSION}
+ echo "${VERSION}安装失败"
+ exit 1
+ fi
+ fi
+}
+
+Uninstall_mysql()
+{
+ rm -rf $serverPath/mysql
+ echo '卸载完成'
+}
+
+action=$1
+if [ "${1}" == "install" ];then
+ Install_mysql
+else
+ Uninstall_mysql
+fi
diff --git a/plugins/php/versions/83/install.sh b/plugins/php/versions/83/install.sh
index 413511675..4c097fb87 100755
--- a/plugins/php/versions/83/install.sh
+++ b/plugins/php/versions/83/install.sh
@@ -9,9 +9,9 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
-version=8.3.30
+version=8.3.31
PHP_VER=83
-md5_file_ok=67f084d36852daab6809561a7c8023d130ca07fc6af8fb040684dd1414934d48
+md5_file_ok=95eae411d594fe6f6e5678b76645dc13ae47d3c0a5325c1d969b58dea56ee45a
Install_php()
{
#------------------------ install start ------------------------------------#
diff --git a/plugins/php/versions/84/install.sh b/plugins/php/versions/84/install.sh
index 096469c8d..9bb2b84ac 100755
--- a/plugins/php/versions/84/install.sh
+++ b/plugins/php/versions/84/install.sh
@@ -9,9 +9,9 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
-version=8.4.20
+version=8.4.21
PHP_VER=84
-md5_file_ok=e454c6f7c89a42f41ebb06dc5c3578e8c8b5f1a3f0da6675665affab04e221f7
+md5_file_ok=7cf5d8ab12c3b2016875bcfaec71bef1ef0b07bed6148f2c447577074431f984
Install_php()
{
#------------------------ install start ------------------------------------#
diff --git a/plugins/php/versions/85/install.sh b/plugins/php/versions/85/install.sh
index 19d83ff04..2118aa593 100755
--- a/plugins/php/versions/85/install.sh
+++ b/plugins/php/versions/85/install.sh
@@ -9,9 +9,9 @@ serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
sysName=`uname`
-version=8.5.5
+version=8.5.6
PHP_VER=85
-md5_file_ok=95bec382f4bd00570a8ef52a58ec04d8d9b9a90494781f1c106d1b274a3902f2
+md5_file_ok=826c600b7c6f956bd335558ca3bdbcab23b22126c1cc8d9348be2280a2204bb7
Install_php()
{
#------------------------ install start ------------------------------------#
diff --git a/plugins/php/versions/common/opcache.sh b/plugins/php/versions/common/opcache.sh
index f7ef20908..9e7e26ad9 100755
--- a/plugins/php/versions/common/opcache.sh
+++ b/plugins/php/versions/common/opcache.sh
@@ -51,7 +51,7 @@ Install_lib()
echo "[opcache]" >> $serverPath/php/$version/etc/php.ini
if [ "$version" == "85" ];then
- echo "no zend_extension"
+ echo "Force enable opcache in PHP 8.5+"
else
echo "zend_extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
fi
diff --git a/plugins/redis/info.json b/plugins/redis/info.json
index c1945312f..d7e6fec75 100755
--- a/plugins/redis/info.json
+++ b/plugins/redis/info.json
@@ -4,7 +4,7 @@
"name": "redis",
"title": "Redis",
"shell": "install.sh",
- "versions":["4.0.14","5.0.14","6.0.20","6.2.21","7.0.15","7.2.13", "7.4.8", "8.0.6", "8.2.5", "8.4.2","8.6.1"],
+ "versions":["4.0.14","5.0.14","6.0.20","6.2.22","7.0.15","7.2.14", "7.4.9", "8.0.6", "8.2.6", "8.4.3","8.6.3"],
"tip": "soft",
"checks": "server/redis",
"path": "server/redis",
diff --git a/plugins/tgclient/ico.png b/plugins/tgclient/ico.png
deleted file mode 100644
index 9416145b2..000000000
Binary files a/plugins/tgclient/ico.png and /dev/null differ
diff --git a/plugins/tgclient/index.html b/plugins/tgclient/index.html
deleted file mode 100755
index 77da84f68..000000000
--- a/plugins/tgclient/index.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/plugins/tgclient/index.py b/plugins/tgclient/index.py
deleted file mode 100755
index ec2eb7238..000000000
--- a/plugins/tgclient/index.py
+++ /dev/null
@@ -1,375 +0,0 @@
-# coding:utf-8
-
-import sys
-import io
-import os
-import time
-import re
-import json
-import base64
-
-web_dir = os.getcwd() + "/web"
-if os.path.exists(web_dir):
- sys.path.append(web_dir)
- os.chdir(web_dir)
-
-import core.mw as mw
-
-app_debug = False
-if mw.isAppleSystem():
- app_debug = True
-
-
-def getPluginName():
- return 'tgclient'
-
-
-def getPluginDir():
- return mw.getPluginDir() + '/' + getPluginName()
-
-
-def getServerDir():
- return mw.getServerDir() + '/' + getPluginName()
-
-
-def getInitDFile():
- if app_debug:
- return '/tmp/' + getPluginName()
- return '/etc/init.d/' + getPluginName()
-
-
-def getConfigData():
- cfg_path = getServerDir() + "/data.cfg"
- if not os.path.exists(cfg_path):
- mw.writeFile(cfg_path, '{}')
- t = mw.readFile(cfg_path)
- return json.loads(t)
-
-
-def writeConf(data):
- cfg_path = getServerDir() + "/data.cfg"
- mw.writeFile(cfg_path, json.dumps(data))
- return True
-
-
-def getExtCfg():
- cfg_path = getServerDir() + "/extend.cfg"
- if not os.path.exists(cfg_path):
- mw.writeFile(cfg_path, '{}')
- t = mw.readFile(cfg_path)
- return json.loads(t)
-
-
-def writeExtCfg(data):
- cfg_path = getServerDir() + "/extend.cfg"
- return mw.writeFile(cfg_path, json.dumps(data))
-
-
-def getInitDTpl():
- path = getPluginDir() + "/init.d/" + getPluginName() + ".tpl"
- return path
-
-
-def getArgs():
- args = sys.argv[2:]
- tmp = {}
- args_len = len(args)
- if args_len == 1:
- t = args[0].strip('{').strip('}')
- if t.strip() == '':
- tmp = []
- else:
- t = t.split(':')
- tmp[t[0]] = t[1]
- tmp[t[0]] = t[1]
- elif args_len > 1:
- for i in range(len(args)):
- t = args[i].split(':')
- tmp[t[0]] = t[1]
- return tmp
-
-
-def checkArgs(data, ck=[]):
- for i in range(len(ck)):
- if not ck[i] in data:
- return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
- return (True, mw.returnJson(True, 'ok'))
-
-
-def status():
- data = mw.execShell(
- "ps -ef|grep tgclient |grep -v grep | grep -v mdserver-web | awk '{print $2}'")
- if data[0] == '':
- return 'stop'
- return 'start'
-
-
-def initDreplace():
-
- file_tpl = getInitDTpl()
- service_path = mw.getServerDir()
- app_path = service_path + '/' + getPluginName()
-
- initD_path = getServerDir() + '/init.d'
- if not os.path.exists(initD_path):
- os.mkdir(initD_path)
- file_bin = initD_path + '/' + getPluginName()
-
- # initd replace
- # if not os.path.exists(file_bin):
- content = mw.readFile(file_tpl)
- content = content.replace('{$SERVER_PATH}', service_path + '/mdserver-web')
- content = content.replace('{$APP_PATH}', app_path)
-
- mw.writeFile(file_bin, content)
- mw.execShell('chmod +x ' + file_bin)
-
- pyMainTplContent = mw.readFile(getPluginDir() + '/startup/tgclient.py')
- toPyMainPath = mw.getServerDir() + '/tgclient.py'
- mw.writeFile(toPyMainPath, pyMainTplContent)
-
- # systemd
- systemDir = mw.systemdCfgDir()
- systemService = systemDir + '/tgclient.service'
- systemServiceTpl = getPluginDir() + '/init.d/tgclient.service.tpl'
- if os.path.exists(systemDir) and not os.path.exists(systemService):
- service_path = mw.getServerDir()
- se_content = mw.readFile(systemServiceTpl)
- se_content = se_content.replace('{$APP_PATH}', app_path)
- mw.writeFile(systemService, se_content)
- mw.execShell('systemctl daemon-reload')
-
- return file_bin
-
-
-def tbOp(method):
- file = initDreplace()
-
- if not mw.isAppleSystem():
- data = mw.execShell('systemctl ' + method + ' ' + getPluginName())
- if data[1] == '':
- return 'ok'
- return data[1]
-
- data = mw.execShell(file + ' ' + method)
- # print(data)
- if data[1] == '':
- return 'ok'
- return 'ok'
-
-
-def start():
- return tbOp('start')
-
-
-def stop():
- return tbOp('stop')
-
-
-def restart():
- status = tbOp('restart')
- return status
-
-
-def reload():
-
- tgbot_tpl = getPluginDir() + '/startup/tgclient.py'
- tgbot_dst = getServerDir() + '/tgclient.py'
-
- content = mw.readFile(tgbot_tpl)
- mw.writeFile(tgbot_dst, content)
-
- ext_src = getPluginDir() + '/startup/extend'
- ext_dst = getServerDir()
-
- mw.execShell('cp -rf ' + ext_src + ' ' + ext_dst)
-
- return tbOp('restart')
-
-
-def initdStatus():
- if mw.isAppleSystem():
- return "Apple Computer does not support"
-
- shell_cmd = 'systemctl status ' + \
- getPluginName() + ' | grep loaded | grep "enabled;"'
- data = mw.execShell(shell_cmd)
- if data[0] == '':
- return 'fail'
- return 'ok'
-
-
-def initdInstall():
- if mw.isAppleSystem():
- return "Apple Computer does not support"
-
- mw.execShell('systemctl enable ' + getPluginName())
- return 'ok'
-
-
-def initdUinstall():
- if mw.isAppleSystem():
- return "Apple Computer does not support"
-
- mw.execShell('systemctl disable ' + getPluginName())
- return 'ok'
-
-
-def getClientConf():
- data = getConfigData()
- if 'bot' in data:
- return mw.returnJson(True, 'ok', data['bot'])
- return mw.returnJson(False, 'ok', {})
-
-
-def setClientConf():
- args = getArgs()
- data_args = checkArgs(args, ['api_id', 'api_hash'])
- if not data_args[0]:
- return data_args[1]
-
- data = getConfigData()
- args['api_id'] = base64.b64decode(args['api_id']).decode('ascii')
- args['api_hash'] = base64.b64decode(args['api_hash']).decode('ascii')
- data['bot'] = args
- writeConf(data)
-
- return mw.returnJson(True, '保存成功!', [])
-
-
-def installPreInspection():
- i = sys.version_info
- if i[0] < 3 or i[1] < 7:
- return "telebot在python小于3.7无法正常使用"
- return 'ok'
-
-
-def uninstallPreInspection():
- stop()
- return "请手动删除
rm -rf {}".format(getServerDir())
-
-
-def getExtCfgByName(name):
- elist = getExtCfg()
- for x in elist:
- if x['name'] == name:
- return x
- return None
-
-
-def clientExtList():
-
- args = getArgs()
- data_args = checkArgs(args, ['p'])
- if not data_args[0]:
- return data_args[1]
-
- ext_path = getServerDir() + '/extend'
- if not os.path.exists(ext_path):
- return mw.returnJson(False, 'ok', [])
- elist_source = os.listdir(ext_path)
-
- elist = []
- for e in elist_source:
- if e.endswith('py'):
- elist.append(e)
-
- page = int(args['p'])
- page_size = 5
-
- make_ext_list = []
- for ex in elist:
- tmp = {}
- tmp['name'] = ex
- edata = getExtCfgByName(ex)
- if edata:
- tmp['status'] = edata['status']
- else:
- tmp['status'] = 'stop'
-
- tmp['tag'] = ex.split('_')[0]
- make_ext_list.append(tmp)
-
- writeExtCfg(make_ext_list)
- dlist_sum = len(make_ext_list)
-
- page_start = int((page - 1) * page_size)
- page_end = page_start + page_size
-
- if page_end >= dlist_sum:
- ret_data = make_ext_list[page_start:]
- else:
- ret_data = make_ext_list[page_start:page_end]
-
- data = {}
- data['data'] = ret_data
- data['args'] = args
- data['list'] = mw.getPage(
- {'count': dlist_sum, 'p': page, 'row': page_size, 'tojs': 'botExtListP'})
-
- return mw.returnJson(True, 'ok', data)
-
-
-def setExtStatus():
- args = getArgs()
- data_args = checkArgs(args, ['name', 'status'])
- if not data_args[0]:
- return data_args[1]
-
- elist = getExtCfg()
- name = args['name']
- status = args['status']
- for x in range(len(elist)):
- if elist[x]['name'] == name:
- elist[x]['status'] = status
- break
-
- writeExtCfg(elist)
-
- action = '开启'
- if status == 'stop':
- action = '关闭'
-
- return mw.returnJson(True, action + '[' + name + ']扩展成功')
-
-
-def runLog():
- p = getServerDir() + '/task.log'
- return p
-
-
-if __name__ == "__main__":
- func = sys.argv[1]
- if func == 'status':
- print(status())
- elif func == 'start':
- print(start())
- elif func == 'stop':
- print(stop())
- elif func == 'restart':
- print(restart())
- elif func == 'reload':
- print(reload())
- elif func == 'initd_status':
- print(initdStatus())
- elif func == 'initd_install':
- print(initdInstall())
- elif func == 'initd_uninstall':
- print(initdUinstall())
- elif func == 'install_pre_inspection':
- print(installPreInspection())
- elif func == 'uninstall_pre_inspection':
- print(uninstallPreInspection())
- elif func == 'get_client_conf':
- print(getClientConf())
- elif func == 'set_client_conf':
- print(setClientConf())
- elif func == 'client_ext_list':
- print(clientExtList())
- elif func == 'set_ext_status':
- print(setExtStatus())
- elif func == 'run_log':
- print(runLog())
-
- else:
- print('error')
diff --git a/plugins/tgclient/info.json b/plugins/tgclient/info.json
deleted file mode 100755
index 76bd12c43..000000000
--- a/plugins/tgclient/info.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "sort": 7,
- "ps": "简单Telegram客服端管理",
- "name": "tgclient",
- "title": "tgclient",
- "shell": "install.sh",
- "versions":["1.1"],
- "tip": "soft",
- "checks": "server/tgclient",
- "path": "server/tgclient",
- "install_pre_inspection":true,
- "uninstall_pre_inspection":true,
- "display": 1,
- "author": "midoks",
- "date": "2023-03-06",
- "home": "https://my.telegram.org/apps",
- "depend_doc1":"https://docs.telethon.dev/en/stable/basic/installation.html",
- "type": 0,
- "pid": "5"
-}
\ No newline at end of file
diff --git a/plugins/tgclient/init.d/tgclient.service.tpl b/plugins/tgclient/init.d/tgclient.service.tpl
deleted file mode 100644
index 4edee4e7e..000000000
--- a/plugins/tgclient/init.d/tgclient.service.tpl
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Tgbot Service
-After=network.target
-
-[Service]
-Type=forking
-ExecStart={$APP_PATH}/init.d/tgclient start
-ExecStop={$APP_PATH}/init.d/tgclient stop
-ExecReload={$APP_PATH}/init.d/tgclient reload
-KillMode=process
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target
\ No newline at end of file
diff --git a/plugins/tgclient/init.d/tgclient.tpl b/plugins/tgclient/init.d/tgclient.tpl
deleted file mode 100644
index 01d4da046..000000000
--- a/plugins/tgclient/init.d/tgclient.tpl
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/sh
-# chkconfig: 2345 55 25
-# description: Tgbot Service
-
-### BEGIN INIT INFO
-# Provides: Tgbot
-# Required-Start: $all
-# Required-Stop: $all
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: starts Tgbot
-# Description: starts the MDW-Web
-### END INIT INFO
-
-# Simple Tgbot init.d script conceived to work on Linux systems
-# as it does use of the /proc filesystem.
-
-PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
-export LANG=en_US.UTF-8
-
-
-mw_path={$SERVER_PATH}
-PATH=$PATH:$mw_path/bin
-
-if [ -f $mw_path/bin/activate ];then
- source $mw_path/bin/activate
-fi
-
-tg_start(){
-
- isStart=`ps -ef|grep 'tgclient.py' |grep -v grep | awk '{print $2}'`
- if [ "$isStart" == '' ];then
- echo -e "starting tgclient... \c"
- cd $mw_path
- echo "python3 {$APP_PATH}/tgclient.py"
- python3 {$APP_PATH}/tgclient.py >> {$APP_PATH}/task.log &
- isStart=""
- while [[ "$isStart" == "" ]];
- do
- echo -e ".\c"
- sleep 0.5
- isStart=`ps -ef|grep 'tgclient.py' |grep -v grep | awk '{print $2}'`
- let n+=1
- if [ $n -gt 20 ];then
- break;
- fi
- done
- if [ "$isStart" == '' ];then
- echo -e "\033[31mfailed\033[0m"
- echo -e "\033[31mError: tgclient service startup failed.\033[0m"
- return;
- fi
- echo -e "\033[32mdone\033[0m"
- else
- echo "starting tgclient...(pid $(echo $isStart)) already running"
- fi
-}
-
-
-tg_stop(){
- echo -e "stopping tgclient ... \c";
- arr=`ps -ef|grep 'tgclient.py'|grep -v grep|awk '{print $2}'`
- for p in ${arr[@]}
- do
- kill -9 $p > /dev/null 2>&1
- done
- echo -e "\033[32mdone\033[0m"
-}
-
-case "$1" in
- start)
- tg_start
- ;;
- stop)
- tg_stop
- ;;
- restart|reload)
- tg_stop
- sleep 0.3
- tg_start
- ;;
- *)
- echo "Please use start or stop as first argument"
- ;;
-esac
-
diff --git a/plugins/tgclient/install.sh b/plugins/tgclient/install.sh
deleted file mode 100755
index 6757ba902..000000000
--- a/plugins/tgclient/install.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
-export PATH
-
-curPath=`pwd`
-rootPath=$(dirname "$curPath")
-rootPath=$(dirname "$rootPath")
-serverPath=$(dirname "$rootPath")
-
-VERSION=$2
-
-# pip3 install ccxt
-if [ -f ${rootPath}/bin/activate ];then
- source ${rootPath}/bin/activate
-fi
-
-pip3 install telethon
-
-Install_App()
-{
- echo '正在安装脚本文件...'
- mkdir -p $serverPath/source
- mkdir -p $serverPath/tgclient
- echo "${VERSION}" > $serverPath/tgclient/version.pl
-
- cp -rf ${rootPath}/plugins/tgclient/startup/* $serverPath/tgclient
-
- cd ${rootPath} && python3 ${rootPath}/plugins/tgclient/index.py start
- cd ${rootPath} && python3 ${rootPath}/plugins/tgclient/index.py initd_install
- echo '安装完成'
-}
-
-Uninstall_App()
-{
- if [ -f /usr/lib/systemd/system/tgclient.service ];then
- systemctl stop tgclient
- systemctl disable tgclient
- rm -rf /usr/lib/systemd/system/tgclient.service
- systemctl daemon-reload
- fi
-
- if [ -f $serverPath/tgclient/initd/tgclient ];then
- $serverPath/tgclient/initd/tgclient stop
- fi
-
- rm -rf $serverPath/tgclient
- echo "Uninstall_redis"
-}
-
-action=$1
-if [ "${1}" == 'install' ];then
- Install_App
-else
- Uninstall_App
-fi
diff --git a/plugins/tgclient/js/tgclient.js b/plugins/tgclient/js/tgclient.js
deleted file mode 100755
index 39b11fac1..000000000
--- a/plugins/tgclient/js/tgclient.js
+++ /dev/null
@@ -1,163 +0,0 @@
-function readme(){
- var readme = '';
- readme += '- 在填写好配置信息好后,还要执行下面命令。进行手机号和短信码验证。再重启,即可正常使用
';
- readme += '- cd /www/server/mdserver-web && source bin/activate && python3 /www/server/tgclient/tgclient.py
';
- readme += '- https://my.telegram.org/auth
';
- readme += '
';
- $('.soft-man-con').html(readme);
-}
-
-function appPost(method, args,callback){
- var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
-
- var req_data = {};
- req_data['name'] = 'tgclient';
- req_data['func'] = method;
-
- if (typeof(args) == 'string'){
- req_data['args'] = JSON.stringify(toArrayObject(args));
- } else {
- req_data['args'] = JSON.stringify(args);
- }
-
- $.post('/plugins/run', req_data, function(data) {
- layer.close(loadT);
- if(typeof(callback) == 'function'){
- callback(data);
- }
- },'json');
-}
-
-function appPostCallbak(method, args,callback){
- var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
-
- var req_data = {};
- req_data['name'] = 'tgclient';
- req_data['func'] = method;
-
- if (typeof(args) == 'string'){
- req_data['args'] = JSON.stringify(toArrayObject(args));
- } else {
- req_data['args'] = JSON.stringify(args);
- }
-
- $.post('/plugins/callback', req_data, function(data) {
- layer.close(loadT);
- if (!data.status){
- layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
- return;
- }
-
- if(typeof(callback) == 'function'){
- callback(data);
- }
- },'json');
-}
-
-function clientConf(){
- appPost('get_client_conf','',function(data){
- var rdata = $.parseJSON(data.data);
- var api_id = 'api_id';
- var api_hash = 'api_hash';
- if(rdata['status']){
- db_data = rdata['data'];
-
- // api_id, api_hash
- api_id = db_data['api_id'];
- api_hash = db_data['api_hash'];
-
- }
-
- var mlist = '';
- mlist += 'api_id必填写
';
- mlist += 'api_hash必填写
';
- var option = '\
- \
- ' + mlist + '\
-
\
- \
-
\
-
';
- $(".soft-man-con").html(option);
- });
-}
-
-function submitBotConf(){
- var pull_data = {};
- pull_data['api_id'] = base64_encode($('input[name="api_id"]').val());
- pull_data['api_hash'] = base64_encode($('input[name="api_hash"]').val());
- appPost('set_client_conf',pull_data,function(data){
- var rdata = $.parseJSON(data.data);
- layer.msg(rdata['msg'],{icon:rdata['status']?1:2,time:2000,shade: [0.3, '#000']});
- });
-}
-
-
-function botExtList(){
- var body = '\
-
\
- \
- \
- | 脚本 | \
- 类型 | \
- 状态 | \
-
\
- \
- \
-
\
- \
-
';
- $('.soft-man-con').html(body);
- botExtListP(1);
-}
-
-function setBotExtStatus(name,status){
- appPost('set_ext_status',{'name':name,'status':status}, function(rdata){
- var rdata = $.parseJSON(rdata.data);
- layer.msg(rdata['msg'],);
- showMsg(rdata['msg'], function(){
- botExtListP(1);
- },{icon:rdata['status']?1:2,shade: [0.3, '#000']},2000);
- });
-}
-
-function botExtListP(p=1){
- appPost('client_ext_list',{'p':p}, function(rdata){
- // console.log(rdata);
- var rdata = $.parseJSON(rdata.data);
- // console.log(rdata);
- var tBody = '';
-
- if (!rdata.status && rdata.data.length == 0 ){
- var tBody = '无数据 |
';
- } else{
- var ldata = rdata.data.data;
- for (var i = 0; i < ldata.length; i++) {
- tBody += ''
- tBody += '| '+ldata[i]['name']+' | ';
- tBody += ''+ldata[i]['tag']+' | ';
-
- if (ldata[i]['status'] == 'start'){
- tBody += ' | ';
- } else{
- tBody += ' | ';
- }
- tBody +='
';
- }
- }
-
- $('#ext_list').html(tBody);
- $('#ext_list_page').html(rdata.data.list);
-
- $('#ext_list .ext_status').click(function(){
- var name = $(this).parent().parent().data('name');
- var status = 'stop';
- if ($(this).hasClass('glyphicon-pause')){
- status = 'start';
- }
- setBotExtStatus(name,status);
- });
- });
-}
diff --git a/plugins/tgclient/startup/extend/client_ad.py b/plugins/tgclient/startup/extend/client_ad.py
deleted file mode 100644
index 52a18e486..000000000
--- a/plugins/tgclient/startup/extend/client_ad.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# coding:utf-8
-
-# func: 在其他发送推送AD
-# url: https://docs.telethon.dev/en/stable/modules/client.html
-import sys
-import io
-import os
-import time
-import re
-import json
-import base64
-import threading
-import asyncio
-
-sys.path.append(os.getcwd() + "/class/core")
-import mw
-
-from telethon import utils
-from telethon import functions, types
-from telethon.tl.functions.messages import AddChatUserRequest
-from telethon.tl.functions.channels import InviteToChannelRequest
-# 指定群ID
-chat_id_list = [-1001578009023]
-filter_g_id = [-1001771526434]
-
-
-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"
-# msg_ad += "加入群聊,一起进步! \n"
-# msg_ad += "https://t.me/mdserver_web \n"
-# msg_ad += "不收费,无毒。源码为证。全靠TG乞讨!😭\n\n"
-# msg_ad += "捐赠地址 USDT(TRC20)\n"
-# msg_ad += "TVbNgrpeGBGZVm5gTLa21ADP7RpnPFhjya\n"
-# msg_ad += "日行一善,以后必定大富大贵\n"
-
-
-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 send_msg(client, chat_id, tag='ad', trigger_time=600):
- # 信号只在一个周期内执行一次|start
- lock_file = mw.getServerDir() + '/tgclient/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
-
- msg = await client.send_message(chat_id, msg_ad)
- await asyncio.sleep(10)
- await client.delete_messages(chat_id, msg)
- await asyncio.sleep(3)
-
-async def run(client):
- client.parse_mode = 'html'
- # for chat_id in chat_id_list:
- # await send_msg(client, chat_id)
- # await asyncio.sleep(30)
-
- 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
diff --git a/plugins/tgclient/startup/extend/client_check_member.py b/plugins/tgclient/startup/extend/client_check_member.py
deleted file mode 100644
index 3593c5396..000000000
--- a/plugins/tgclient/startup/extend/client_check_member.py
+++ /dev/null
@@ -1,69 +0,0 @@
-# coding:utf-8
-
-# func: 自动检测已经注销群成员
-
-import sys
-import io
-import os
-import time
-import re
-import json
-import base64
-import threading
-import asyncio
-
-sys.path.append(os.getcwd() + "/class/core")
-import mw
-
-import telebot
-from telebot import types
-from telebot.util import quick_markup
-
-
-# 指定群ID
-chat_id_list = [-1001979545570]
-# 别人群ID[有API调用限制]
-chat_id_list_other = [-1001578009023, -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:
- 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)
-
-
-if __name__ == "__main__":
- pass
diff --git a/plugins/tgclient/startup/extend/client_holding.py b/plugins/tgclient/startup/extend/client_holding.py
deleted file mode 100644
index 6950efeb9..000000000
--- a/plugins/tgclient/startup/extend/client_holding.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# coding:utf-8
-
-# func: 自动邀请群成员
-
-import sys
-import io
-import os
-import time
-import re
-import json
-import base64
-import threading
-import asyncio
-
-sys.path.append(os.getcwd() + "/class/core")
-import mw
-
-from telethon import utils
-from telethon import functions, types
-from telethon.tl.functions.messages import AddChatUserRequest
-from telethon.tl.functions.channels import InviteToChannelRequest
-# 指定群ID
-chat_id = -1001979545570
-filter_user_id = 5568699210
-filter_g_id = [-1001771526434]
-
-
-async def run(client):
- info = await client.get_dialogs()
- for chat in info:
- is_sleep = True
- print('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))
- if chat.is_group and chat.id != chat_id:
- list_user = []
- async for user in client.iter_participants(chat.id):
- if chat.id in filter_g_id:
- is_sleep = False
- continue
-
- if filter_user_id != user.id and user.username != None and user.bot == False:
- list_user.append(user.username)
- print(list_user)
- try:
- await client(InviteToChannelRequest(
- channel=chat_id, # chat_id
- users=list_user, # 被邀请人id
- ))
- except Exception as e:
- print(str(e))
- if is_sleep:
- await asyncio.sleep(90000)
-
-if __name__ == "__main__":
- pass
diff --git a/plugins/tgclient/startup/extend/client_temp.py b/plugins/tgclient/startup/extend/client_temp.py
deleted file mode 100644
index 4071e77f0..000000000
--- a/plugins/tgclient/startup/extend/client_temp.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# coding:utf-8
-
-# func: 临时测试
-
-import sys
-import io
-import os
-import time
-import re
-import json
-import base64
-import threading
-import asyncio
-
-sys.path.append(os.getcwd() + "/class/core")
-import mw
-
-from telethon import utils
-from telethon import functions, types
-from telethon.tl.functions.messages import AddChatUserRequest
-from telethon.tl.functions.channels import InviteToChannelRequest
-# 指定群ID
-chat_id = -1001979545570
-filter_user_id = 5568699210
-filter_g_id = [-1001771526434]
-
-
-async def run(client):
-
- my_channel = await client.get_entity(PeerChannel(-1001173826177))
- print(my_channel)
-
- for i in range(9999999999):
- try:
- v = -1001000000000 - i
- my_channel = await client.get_entity(PeerChannel(v))
- print(my_channel)
- except Exception as e:
- pass
-
- # -1001809140739
- # -1001800000000
- # -1000000000001
-
- info = await client.get_dialogs()
- for chat in info:
- if not chat.is_group and chat.is_channel:
- print('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))
- await asyncio.sleep(10)
-
-
-if __name__ == "__main__":
- pass
diff --git a/plugins/tgclient/startup/extend/readme.md b/plugins/tgclient/startup/extend/readme.md
deleted file mode 100755
index d52224d88..000000000
--- a/plugins/tgclient/startup/extend/readme.md
+++ /dev/null
@@ -1 +0,0 @@
-push_*.py 识别为推送插件
diff --git a/plugins/tgclient/startup/tgclient.py b/plugins/tgclient/startup/tgclient.py
deleted file mode 100644
index 933ba7170..000000000
--- a/plugins/tgclient/startup/tgclient.py
+++ /dev/null
@@ -1,132 +0,0 @@
-# coding:utf-8
-
-import sys
-import io
-import os
-import time
-import re
-import json
-import base64
-import threading
-import asyncio
-import logging
-
-# python /Users/midoks/Desktop/mwdev/server/tgclient/tgclient.py
-
-'''
-cd /www/server/mdserver-web && source bin/activate && python3 /www/server/tgclient/tgclient.py
-'''
-
-from telethon import TelegramClient
-
-
-sys.path.append(os.getcwd() + "/class/core")
-import mw
-
-logging.basicConfig(level=logging.INFO,
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-logger = logging.getLogger(__name__)
-
-
-def getPluginName():
- return 'tgclient'
-
-
-def getPluginDir():
- return mw.getPluginDir() + '/' + getPluginName()
-
-
-def getServerDir():
- return mw.getServerDir() + '/' + getPluginName()
-
-
-sys.path.append(getServerDir() + "/extend")
-
-
-def getConfigData():
- cfg_path = getServerDir() + "/data.cfg"
- if not os.path.exists(cfg_path):
- mw.writeFile(cfg_path, '{}')
- t = mw.readFile(cfg_path)
- return json.loads(t)
-
-
-def writeConf(data):
- cfg_path = getServerDir() + "/data.cfg"
- mw.writeFile(cfg_path, json.dumps(data))
- return True
-
-
-def getExtCfg():
- cfg_path = getServerDir() + "/extend.cfg"
- if not os.path.exists(cfg_path):
- mw.writeFile(cfg_path, '{}')
- t = mw.readFile(cfg_path)
- return json.loads(t)
-
-
-def getStartExtCfgByTag(tag='push'):
- # 获取开启的扩展
- elist = getExtCfg()
- rlist = []
- for x in elist:
- if x['tag'] == tag and x['status'] == 'start':
- rlist.append(x)
- return rlist
-
-
-def writeLog(log_str):
- if __name__ == "__main__":
- print(log_str)
-
- now = mw.getDateFromNow()
- log_file = getServerDir() + '/task.log'
- mw.writeFileLog(now + ':' + log_str, log_file, limit_size=5 * 1024)
- return True
-
-
-# start tgbot
-cfg = getConfigData()
-while True:
- cfg = getConfigData()
- if 'bot' in cfg and 'api_id' in cfg['bot']:
- if cfg['bot']['api_id'] != '' and cfg['bot']['api_id'] != 'api_id':
- break
- if cfg['bot']['api_hash'] != '' and cfg['bot']['api_hash'] != 'api_hash':
- break
- writeLog('等待输入配置,api_id')
- time.sleep(3)
-
-client = TelegramClient('mdioks', cfg['bot']['api_id'], cfg['bot']['api_hash'])
-
-async def plugins_run_task():
- plist = getStartExtCfgByTag('client')
- for p in plist:
- try:
- script = p['name'].split('.')[0]
- await __import__(script).run(client)
- except Exception as e:
- writeLog('----- client error start -------')
- writeLog(mw.getTracebackInfo())
- writeLog('----- client error end -------')
-
-async def plugins_run():
- while True:
- await plugins_run_task()
- time.sleep(1)
-
-async def main(loop):
- await client.start()
-
- # create new task
- writeLog('creating plugins_run task.')
- task = loop.create_task(plugins_run())
- await task
-
- writeLog('It works.')
- await client.run_until_disconnected()
- task.cancel()
-
-if __name__ == '__main__':
- loop = asyncio.get_event_loop()
- loop.run_until_complete(main(loop))