Redis support password

 支持设置 Redis 数据库密码
This commit is contained in:
xtaodada 2022-01-22 20:55:47 +08:00
parent 95729fe10e
commit 46df9c99f3
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
5 changed files with 9 additions and 8 deletions

View File

@ -37,8 +37,6 @@ jobs:
- name: Build
run: |
FULL_VERSION=$(curl https://api.github.com/repos/just-containers/s6-overlay/releases/latest | jq -r '.tag_name')
declare -a IMAGES
echo "Build amd64"
@ -47,7 +45,6 @@ jobs:
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--output "type=image,push=true" \
--platform linux/amd64 \
--build-arg "S6_VERSION=${FULL_VERSION}" \
--build-arg "S6_ARCH=amd64" \
--tag "${DOCKERHUB_REPOSITORY}:latest-amd64" \
-f Dockerfile \
@ -60,7 +57,6 @@ jobs:
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--output "type=image,push=true" \
--platform linux/arm64/v8 \
--build-arg "S6_VERSION=${FULL_VERSION}" \
--build-arg "S6_ARCH=aarch64" \
--tag "${DOCKERHUB_REPOSITORY}:latest-arm64-v8" \
-f Dockerfile \

View File

@ -27,6 +27,7 @@ redis:
host: "localhost"
port: "6379"
db: "14"
password: ""
# Locale settings
application_language: "zh-cn"

View File

@ -9,6 +9,7 @@ a=$(curl --noproxy '*' -sSL https://api.myip.com/)
b="China"
if [[ $a == *$b* ]]
then
echo "错误:本脚本不支持境内服务器使用。" 1>&2
exit 1
fi

View File

@ -28,7 +28,8 @@ from telethon.errors import AuthKeyError
from telethon.errors.rpcerrorlist import MessageNotModifiedError, MessageIdInvalidError, ChannelPrivateError, \
ChatSendMediaForbiddenError, YouBlockedUserError, FloodWaitError, ChatWriteForbiddenError, \
AuthKeyDuplicatedError, ChatSendStickersForbiddenError, SlowModeWaitError, MessageEditTimeExpiredError, \
PeerIdInvalidError, AuthKeyUnregisteredError, UserBannedInChannelError, UserDeactivatedBanError, PeerFloodError
PeerIdInvalidError, AuthKeyUnregisteredError, UserBannedInChannelError, UserDeactivatedBanError, PeerFloodError, \
SessionRevokedError
from telethon.errors.common import AlreadyInConversationError
from requests.exceptions import ChunkedEncodingError
from requests.exceptions import ConnectionError as ConnectedError
@ -173,6 +174,7 @@ mtp_secret = config.get('mtp_secret', '').strip()
redis_host = config.get('redis').get('host', 'localhost')
redis_port = config.get('redis').get('port', 6379)
redis_db = config.get('redis').get('db', 14)
redis_password = config.get('redis').get('password', '')
if strtobool(config.get('ipv6', 'False')):
use_ipv6 = True
else:
@ -234,7 +236,7 @@ else:
bot = TelegramClient(session_string, api_key, api_hash, auto_reconnect=True, use_ipv6=use_ipv6)
user_id = 0
user_bot = False
redis = StrictRedis(host=redis_host, port=redis_port, db=redis_db)
redis = StrictRedis(host=redis_host, port=redis_port, db=redis_db, password=redis_password)
async def save_id():
@ -283,8 +285,8 @@ def before_send(event, hint):
AuthKeyUnregisteredError, UserBannedInChannelError, AuthKeyError,
CancelError, AsyncTimeoutError)):
return
elif exc_info and isinstance(exc_info[1], UserDeactivatedBanError):
# The user has been deleted/deactivated
elif exc_info and isinstance(exc_info[1], (UserDeactivatedBanError, SessionRevokedError)):
# The user has been deleted/deactivated or session revoked
try:
remove('pagermaid.session')
except Exception as exc:

View File

@ -27,6 +27,7 @@ redis:
host: "localhost"
port: "6379"
db: "14"
password: ""
# Locale settings
application_language: "zh-cn"