mirror of
https://github.com/AlignPixel-Dev/Pixel-Chat-App.git
synced 2025-07-07 08:37:00 +08:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
8a93fdc95a | |||
0ed0deb843 | |||
3ad1fbf770 | |||
6061362cdc | |||
93c6eb1c74 | |||
fce27cb97f | |||
4f79018752 | |||
224628e821 | |||
8bbc40cc3c | |||
ebb8460ca3 |
39
.github/workflows/python-app.yml
vendored
Normal file
39
.github/workflows/python-app.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
||||
|
||||
name: Python application
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8 pytest pyinstaller
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
- name: Pyinstaller
|
||||
run: |
|
||||
pyinstaller -F desktop/se-verson.py
|
||||
pyinstaller -F server-client/simple-verson.py
|
30
.github/workflows/translate.yml
vendored
Normal file
30
.github/workflows/translate.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
name: 'issue and discussion translator'
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
issue_comment:
|
||||
types: [created, edited]
|
||||
discussion:
|
||||
types: [created, edited]
|
||||
discussion_comment:
|
||||
types: [created, edited]
|
||||
pull_request_target:
|
||||
types: [opened, edited]
|
||||
pull_request_review_comment:
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
translate:
|
||||
permissions:
|
||||
issues: write
|
||||
discussions: write
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: lizheming/github-translate-action@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
IS_MODIFY_TITLE: true
|
||||
APPEND_TRANSLATION: true
|
@ -1,5 +1,7 @@
|
||||

|
||||
|
||||
<img src="/assets/logo-final-@1x.png" align="right" width="50px" />
|
||||
|
||||
# 💬 Pixel-Chat App
|
||||
|
||||
一个简单、快速、开源的Python即时聊天系统,涵盖了多种聊天操作需求
|
||||
|
BIN
assets/logo-final-@1x.png
Normal file
BIN
assets/logo-final-@1x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 119 KiB |
@ -14,7 +14,7 @@ class PyChattingServer:
|
||||
self.__msg_handler = ChattingHandler()
|
||||
|
||||
def start_session(self):
|
||||
print('已经上线,用户可通过客户端输入IP进入\r\n')
|
||||
print('已经上线,用户可通过客户端输入IP进入,输入.help可以调出命令列表\r\n')
|
||||
input_thread_handler = threading.Thread(target=self.input_thread)
|
||||
input_thread_handler.daemon = True
|
||||
input_thread_handler.start()
|
||||
@ -44,7 +44,7 @@ class ChattingThread(threading.Thread):
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
print('连接来自于:', self.__caddr)
|
||||
print('-> 连接来自于:', self.__caddr)
|
||||
if self.__msg_handler.is_blacklisted(self.__caddr[0]):
|
||||
self.__handle_blacklisted()
|
||||
return
|
||||
@ -124,7 +124,7 @@ class ChattingHandler:
|
||||
self.__socket_to_user_name.pop(cs)
|
||||
self.__user_name_to_broadcast_state.pop(nickname)
|
||||
nickname += " 离开了本聊天室"
|
||||
if nickname != "SOMEONE": # 说明是正常退出,一个防输出卡死机制,来自 boom hack 0x3299f
|
||||
if nickname != "SOMEONE": # 说明是正常退出,一个防输出卡死机制,来自 boom hack 0x3299f,除非你有更好的替代方案,请勿修改此项
|
||||
self.broadcast_system_msg(nickname)
|
||||
|
||||
def handle_msg(self, msg, cs):
|
||||
@ -146,7 +146,7 @@ class ChattingHandler:
|
||||
'success': True,
|
||||
'msg': '昵称建立成功,输入/checkol可查看所有在线的人,输入/help可以查看帮助(所有首字符为/的消息都不会发送)'
|
||||
}), cs)
|
||||
self.broadcast_系统消息_msg(js['msg'] + "加入了聊天")
|
||||
self.broadcast_system_msg(js['msg'] + "加入了聊天")
|
||||
else:
|
||||
self.send_to(json.dumps({
|
||||
'type': 'login',
|
||||
@ -226,7 +226,7 @@ class ChattingHandler:
|
||||
self.__socket_list.append(cs)
|
||||
cs.sendall(bytes(msg, 'utf-8'))
|
||||
|
||||
def broadcast_系统消息_msg(self, msg):
|
||||
def broadcast_system_msg(self, msg):
|
||||
data = '[ %s ]\r\n[ 系统消息 ] : %s' % (ctime(), msg)
|
||||
js = json.dumps({
|
||||
'type': '系统消息_msg',
|
||||
@ -272,11 +272,6 @@ class ChattingHandler:
|
||||
print(f"IP {ip} 已经被手动移除")
|
||||
elif ip == '.banlist':
|
||||
print(self.__blacklist)
|
||||
elif ip == '.help':
|
||||
print("BAN: 封禁某个IP\r\n"\
|
||||
"UNBAN: 解除封禁某个IP\r\n"\
|
||||
"BANLIST: 查看封禁IP列表\r\n"\
|
||||
"HELP: 查看操作帮助")
|
||||
elif ip == '.an':
|
||||
user = input("请输入要发布的内容:")
|
||||
self.broadcast_system_msg(user)
|
||||
|
Reference in New Issue
Block a user