Compare commits

..

No commits in common. "master" and "1.0.0" have entirely different histories.

8 changed files with 16 additions and 246 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -1,39 +0,0 @@
# 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

View File

@ -1,30 +0,0 @@
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

View File

@ -1,128 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
seventeen@ohdragonboi.cn.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@ -1,16 +1,7 @@
![Pixel-Chat-App](https://repository-images.githubusercontent.com/832191338/b1042f2c-3c1a-4756-b061-732923b776cd)
<img src="/assets/logo-final-@1x.png" align="right" width="50px" />
# 💬Pixel-Chat App # 💬Pixel-Chat App
一个简单、快速、开源的Python即时聊天系统涵盖了多种聊天操作需求 一个简单、快速、开源的Python即时聊天系统涵盖了多种聊天操作需求
![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/AlignPixel/Pixel-Chat-App/total?style=for-the-badge&logo=github)
![GitHub License](https://img.shields.io/github/license/AlignPixel/Pixel-Chat-App?style=for-the-badge)
![GitHub Discussions](https://img.shields.io/github/discussions/AlignPixel/Pixel-Chat-App?style=for-the-badge&logo=github)
![Static Badge](https://img.shields.io/badge/Python-3.x-blue?style=for-the-badge&logo=Python&logoColor=white)
### 🤩功能亮点 ### 🤩功能亮点
- 开箱即用,无需部署 - 开箱即用,无需部署
@ -25,18 +16,18 @@
###### 在服务器上运行服务端 ###### 在服务器上运行服务端
1. 在用作服务端的服务器或计算机上安装[Python环境](https://python.org) 1. 在用作服务端的服务器或计算机上安装[Python环境](https://python.org)
2. 在[Release](https://github.com/AlignPixel/Pixel-Chat-App/releases)页面下载 `Pixel-Chat Server`,下载完成后运行 2. 在Release页面下载 `Pixel-Chat Server`,下载完成后运行
3. VOILA! 现在邀请你的用户通过 `Pixel-Chat Client``Pixel-Chat Desktop` 访问服务器/计算机IP地址即可聊天 3. VOILA! 现在邀请你的用户通过 `Pixel-Chat Client``Pixel-Chat Desktop` 访问服务器/计算机IP地址即可聊天
###### 访问您喜欢的聊天服务器 ###### 访问您喜欢的聊天服务器
1. 在[Release](https://github.com/AlignPixel/Pixel-Chat-App/releases)页面下载 `Pixel-Chat-Desktop`,下载完成后运行 1. 在Release页面下载 `Pixel-Chat-Desktop`,下载完成后运行
2. 输入您喜欢的聊天服务器IP 2. 输入您喜欢的聊天服务器IP
3. VOILA! 现在是聊天时间 3. VOILA! 现在是聊天时间
###### 需要特殊/定制版本 ###### 需要特殊/定制版本
访问[此处](https://github.com/AlignPixel/Pixel-Chat-App/wiki/%E5%AE%9A%E5%88%B6%E6%82%A8%E7%9A%84%E7%89%88%E6%9C%AC)查看方法,并邮件探讨您需要的内容,也许会需要您支付额外费用🤔 邮件联系[seventeen@ohdragonboi.cn](mailto:seventeen@ohdragonboi.cn)探讨您需要的内容,也许会需要您支付额外费用🤔
### 🎈贡献者列表 ### 🎈贡献者列表
@ -46,8 +37,8 @@
| AVATAR | NAME | WORK | | AVATAR | NAME | WORK |
| ------------------------------------------------------------ | ------------------------------------------------------- | --------------- | | ------------------------------------------------------------ | ------------------------------------------------------- | --------------- |
| <img src="https://avatars.githubusercontent.com/u/120368045?s=400&u=ac60326a41a0d41faaf82ad25bcd143d85224791&v=4" alt="BunDragon's Github AVATAR" width="50px" /> | [磅豆龙(FrederickBun)](https://github.com/FrederickBun) | Author(Creator) | | <img src="https://avatars.githubusercontent.com/u/120368045?s=400&u=ac60326a41a0d41faaf82ad25bcd143d85224791&v=4" alt="BunDragon's Github AVATAR" width="50px" /> | [磅豆龙(FrederickBun)](https://github.com/FrederickBun) | AUTHOR(Creator) |
| <img src="https://avatars.githubusercontent.com/u/98998872" alt="Rayminn's Github AVATAR" width="50px"/> | [Yiming Lei(Rayminn)](https://github.com/Rayminn) | Author(Editor) | | <img src="https://avatars.githubusercontent.com/u/98998872" alt="Rayminn's Github AVATAR" width="50px"/> | [Yiming Lei(Rayminn)](https://github.com/Rayminn) | AUTHOR(Editor) |
### 📦特供版本与特殊版本使用者 ### 📦特供版本与特殊版本使用者

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

View File

@ -14,7 +14,7 @@ class PyChattingServer:
self.__msg_handler = ChattingHandler() self.__msg_handler = ChattingHandler()
def start_session(self): def start_session(self):
print('已经上线,用户可通过客户端输入IP进入,输入.help可以调出命令列表\r\n') print('已经上线,用户可通过IP进入\r\n')
input_thread_handler = threading.Thread(target=self.input_thread) input_thread_handler = threading.Thread(target=self.input_thread)
input_thread_handler.daemon = True input_thread_handler.daemon = True
input_thread_handler.start() input_thread_handler.start()
@ -44,7 +44,7 @@ class ChattingThread(threading.Thread):
def run(self): def run(self):
try: try:
print('-> 连接来自于:', self.__caddr) print('连接来自于:', self.__caddr)
if self.__msg_handler.is_blacklisted(self.__caddr[0]): if self.__msg_handler.is_blacklisted(self.__caddr[0]):
self.__handle_blacklisted() self.__handle_blacklisted()
return return
@ -123,9 +123,8 @@ class ChattingHandler:
self.__user_name_to_socket.pop(self.__socket_to_user_name[cs]) self.__user_name_to_socket.pop(self.__socket_to_user_name[cs])
self.__socket_to_user_name.pop(cs) self.__socket_to_user_name.pop(cs)
self.__user_name_to_broadcast_state.pop(nickname) self.__user_name_to_broadcast_state.pop(nickname)
nickname += " 离开了本聊天室" nickname += " "
if nickname != "SOMEONE": # 说明是正常退出,一个防输出卡死机制,来自 boom hack 0x3299f除非你有更好的替代方案请勿修改此项 self.broadcast_系统消息_msg(nickname + "离开了本聊天室")
self.broadcast_system_msg(nickname)
def handle_msg(self, msg, cs): def handle_msg(self, msg, cs):
js = json.loads(msg) js = json.loads(msg)
@ -146,7 +145,7 @@ class ChattingHandler:
'success': True, 'success': True,
'msg': '昵称建立成功,输入/checkol可查看所有在线的人,输入/help可以查看帮助(所有首字符为/的消息都不会发送)' 'msg': '昵称建立成功,输入/checkol可查看所有在线的人,输入/help可以查看帮助(所有首字符为/的消息都不会发送)'
}), cs) }), cs)
self.broadcast_system_msg(js['msg'] + "加入了聊天") self.broadcast_系统消息_msg(js['msg'] + "加入了聊天")
else: else:
self.send_to(json.dumps({ self.send_to(json.dumps({
'type': 'login', 'type': 'login',
@ -226,7 +225,7 @@ class ChattingHandler:
self.__socket_list.append(cs) self.__socket_list.append(cs)
cs.sendall(bytes(msg, 'utf-8')) cs.sendall(bytes(msg, 'utf-8'))
def broadcast_system_msg(self, msg): def broadcast_系统消息_msg(self, msg):
data = '[ %s ]\r\n[ 系统消息 ] : %s' % (ctime(), msg) data = '[ %s ]\r\n[ 系统消息 ] : %s' % (ctime(), msg)
js = json.dumps({ js = json.dumps({
'type': '系统消息_msg', 'type': '系统消息_msg',
@ -238,8 +237,6 @@ class ChattingHandler:
def broadcast(self, msg, cs): def broadcast(self, msg, cs):
data = '[ %s ]\r\n[%s] : %s\r\n' % (ctime(), self.__socket_to_user_name[cs], msg) data = '[ %s ]\r\n[%s] : %s\r\n' % (ctime(), self.__socket_to_user_name[cs], msg)
if '' in data: # 屏蔽卡死服务器的字符,所有 Contributors 请不要更改这条判断,否则 PR 将直接拒绝合并,本安全措施来自 boom hack 0x3657f
data = '[ %s ]\r\n[ 系统警告 - %s ] : %s\r\n' % (ctime(), self.__socket_to_user_name[cs], '{用户发送的内容可能包含卡死服务器的内容,已经被屏蔽显示}')
js = json.dumps({ js = json.dumps({
'type': 'broadcast', 'type': 'broadcast',
'msg': data 'msg': data
@ -272,31 +269,10 @@ class ChattingHandler:
print(f"IP {ip} 已经被手动移除") print(f"IP {ip} 已经被手动移除")
elif ip == '.banlist': elif ip == '.banlist':
print(self.__blacklist) print(self.__blacklist)
elif ip == '.an':
user = input("请输入要发布的内容:")
self.broadcast_system_msg(user)
print("发布成功")
elif ip == '.online':
login_list = "[ 输出 ] 在线用户 : "
for key in self.__socket_to_user_name:
login_list += self.__socket_to_user_name[key] + ' | '
print(login_list)
elif ip == '.setvisit': # 一个防输出卡死的屏蔽功能,目前仅支持手动添加,来自 boom hack 0x3299f
ip = input("请输入限制访问信息的ip地址")
if not self.is_alisted(ip):
self.__alist.add(ip)
print(f"IP {ip} 已经被手动更改访问")
else:
self.__alist.remove(ip)
print(f"IP {ip} 已经被手动更改访问")
elif ip == '.help': elif ip == '.help':
print("BAN: 封禁某个IP\r\n"\ print("BAN: 封禁某个IP\r\n"\
"UNBAN: 解除封禁某个IP\r\n"\ "UNBAN: 解除封禁某个IP\r\n"\
"BANLIST: 查看封禁IP列表\r\n"\ "BANLIST: 查看封禁IP列表\r\n"\
"KICK: 踢出某个用户\r\n"\
"AN: 以系统身份发布消息\r\n"\
"ONELINE: 查看在线用户\r\n"\
"SETVISIT: 对用户访问进行操作\r\n"\
"HELP: 查看操作帮助") "HELP: 查看操作帮助")
else: else:
print("不存在的命令!") print("不存在的命令!")