mirror of
https://github.com/AlignPixel-Dev/Pixel-Chat-App.git
synced 2025-04-20 12:25:25 +08:00
Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
50575c2b48 | |||
d7edb3e079 | |||
cc78d2d4d0 | |||
4eb721d5ab | |||
49de09f23e | |||
8530f8f95e | |||
|
8a93fdc95a | ||
|
0ed0deb843 | ||
3ad1fbf770 | |||
6061362cdc | |||
93c6eb1c74 | |||
fce27cb97f | |||
4f79018752 | |||
224628e821 | |||
8bbc40cc3c | |||
ebb8460ca3 | |||
63aea9f91c | |||
4cd862183b | |||
c4c7f7257a | |||
a9653d23e2 | |||
95b287a85c | |||
537525cf19 | |||
96cda61dbd | |||
a569a9d3f2 | |||
71634853f8 | |||
19d37e4aea | |||
8d9085683a | |||
a0e1f1d22e | |||
73127e5b15 | |||
7c5894519a | |||
4b2435f5e5 |
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
|
128
CODE_OF_CONDUCT.md
Normal file
128
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,128 @@
|
||||
# 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.
|
11
README.md
11
README.md
@ -1,7 +1,16 @@
|
||||

|
||||
|
||||
<img src="/assets/logo-final-@1x.png" align="right" width="50px" />
|
||||
|
||||
# 💬 Pixel-Chat App
|
||||
|
||||
一个简单、快速、开源的Python即时聊天系统,涵盖了多种聊天操作需求
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
### 🤩 功能亮点
|
||||
|
||||
- 开箱即用,无需部署
|
||||
@ -27,7 +36,7 @@
|
||||
|
||||
###### 需要特殊/定制版本
|
||||
|
||||
请邮件联系[seventeen@ohdragonboi.cn](mailto:seventeen@ohdragonboi.cn)探讨您需要的内容,也许会需要您支付额外费用🤔
|
||||
请访问[此处](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)查看方法,并邮件探讨您需要的内容,也许会需要您支付额外费用🤔
|
||||
|
||||
### 🎈 贡献者列表
|
||||
|
||||
|
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
|
||||
@ -123,8 +123,9 @@ class ChattingHandler:
|
||||
self.__user_name_to_socket.pop(self.__socket_to_user_name[cs])
|
||||
self.__socket_to_user_name.pop(cs)
|
||||
self.__user_name_to_broadcast_state.pop(nickname)
|
||||
nickname += " "
|
||||
self.broadcast_系统消息_msg(nickname + "离开了本聊天室")
|
||||
nickname += " 离开了本聊天室"
|
||||
if nickname != "SOMEONE": # 说明是正常退出,一个防输出卡死机制,来自 boom hack 0x3299f,除非你有更好的替代方案,请勿修改此项
|
||||
self.broadcast_system_msg(nickname)
|
||||
|
||||
def handle_msg(self, msg, cs):
|
||||
js = json.loads(msg)
|
||||
@ -145,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',
|
||||
@ -225,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',
|
||||
@ -237,6 +238,8 @@ class ChattingHandler:
|
||||
|
||||
def broadcast(self, msg, cs):
|
||||
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({
|
||||
'type': 'broadcast',
|
||||
'msg': data
|
||||
@ -269,19 +272,23 @@ 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)
|
||||
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':
|
||||
print("BAN: 封禁某个IP\r\n"\
|
||||
"UNBAN: 解除封禁某个IP\r\n"\
|
||||
@ -289,6 +296,7 @@ class ChattingHandler:
|
||||
"KICK: 踢出某个用户\r\n"\
|
||||
"AN: 以系统身份发布消息\r\n"\
|
||||
"ONELINE: 查看在线用户\r\n"\
|
||||
"SETVISIT: 对用户访问进行操作\r\n"\
|
||||
"HELP: 查看操作帮助")
|
||||
else:
|
||||
print("不存在的命令!")
|
||||
|
Loading…
x
Reference in New Issue
Block a user