mirror of
https://github.com/AlignPixel-Dev/Pixel-Chat-App.git
synced 2025-07-07 16:47:00 +08:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
63aea9f91c | |||
4cd862183b | |||
c4c7f7257a | |||
a9653d23e2 | |||
95b287a85c | |||
537525cf19 | |||
96cda61dbd | |||
a569a9d3f2 | |||
71634853f8 | |||
19d37e4aea | |||
8d9085683a | |||
a0e1f1d22e | |||
73127e5b15 | |||
7c5894519a | |||
4b2435f5e5 |
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.
|
@ -1,7 +1,14 @@
|
|||||||
|

|
||||||
|
|
||||||
# 💬 Pixel-Chat App
|
# 💬 Pixel-Chat App
|
||||||
|
|
||||||
一个简单、快速、开源的Python即时聊天系统,涵盖了多种聊天操作需求
|
一个简单、快速、开源的Python即时聊天系统,涵盖了多种聊天操作需求
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
### 🤩 功能亮点
|
### 🤩 功能亮点
|
||||||
|
|
||||||
- 开箱即用,无需部署
|
- 开箱即用,无需部署
|
||||||
|
@ -14,7 +14,7 @@ class PyChattingServer:
|
|||||||
self.__msg_handler = ChattingHandler()
|
self.__msg_handler = ChattingHandler()
|
||||||
|
|
||||||
def start_session(self):
|
def start_session(self):
|
||||||
print('已经上线,用户可通过IP进入\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()
|
||||||
@ -123,8 +123,9 @@ 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 += " 离开了本聊天室"
|
||||||
self.broadcast_系统消息_msg(nickname + "离开了本聊天室")
|
if nickname != "SOMEONE": # 说明是正常退出,一个防输出卡死机制,来自 boom hack 0x3299f
|
||||||
|
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)
|
||||||
@ -237,6 +238,8 @@ 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
|
||||||
@ -277,11 +280,20 @@ class ChattingHandler:
|
|||||||
elif ip == '.an':
|
elif ip == '.an':
|
||||||
user = input("请输入要发布的内容:")
|
user = input("请输入要发布的内容:")
|
||||||
self.broadcast_system_msg(user)
|
self.broadcast_system_msg(user)
|
||||||
|
print("发布成功")
|
||||||
elif ip == '.online':
|
elif ip == '.online':
|
||||||
login_list = "[ 输出 ] 在线用户 : "
|
login_list = "[ 输出 ] 在线用户 : "
|
||||||
for key in self.__socket_to_user_name:
|
for key in self.__socket_to_user_name:
|
||||||
login_list += self.__socket_to_user_name[key] + ' | '
|
login_list += self.__socket_to_user_name[key] + ' | '
|
||||||
print(login_list)
|
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"\
|
||||||
@ -289,6 +301,7 @@ class ChattingHandler:
|
|||||||
"KICK: 踢出某个用户\r\n"\
|
"KICK: 踢出某个用户\r\n"\
|
||||||
"AN: 以系统身份发布消息\r\n"\
|
"AN: 以系统身份发布消息\r\n"\
|
||||||
"ONELINE: 查看在线用户\r\n"\
|
"ONELINE: 查看在线用户\r\n"\
|
||||||
|
"SETVISIT: 对用户访问进行操作\r\n"\
|
||||||
"HELP: 查看操作帮助")
|
"HELP: 查看操作帮助")
|
||||||
else:
|
else:
|
||||||
print("不存在的命令!")
|
print("不存在的命令!")
|
||||||
|
Reference in New Issue
Block a user