Skip to content

Add emoji packs and encrypted log management#7

Open
dxy0218 wants to merge 2 commits intomainfrom
codex/fix-code-errors-8cf5a7
Open

Add emoji packs and encrypted log management#7
dxy0218 wants to merge 2 commits intomainfrom
codex/fix-code-errors-8cf5a7

Conversation

@dxy0218
Copy link
Copy Markdown
Owner

@dxy0218 dxy0218 commented Sep 5, 2025

Summary

  • manage and send emojis with /emoji commands
  • support timed self-destructing messages and hiding/unhiding contacts
  • archive or favorite messages and export/import encrypted chat histories
  • centralize message ID handling and fix timestamp logging during media sends
  • track nicknames with join/leave notifications and allow changing them via /nick
  • add PyInstaller build script to produce a standalone Windows executable
  • rename startup banner, CLI, and build output to 隧道聊天
  • enable direct peer-to-peer chats by listening for incoming connections and performing a bidirectional Diffie-Hellman handshake
  • ensure full socket transfers and clean up temporary file handles after large-file receives
  • display a startup splash screen before authentication and when launching the server
  • introduce Matrix-inspired dark mode and light theme with automatic or manual switching
  • remove unused requests import from proxy client to resolve linter warning
  • join named groups with /group and restrict server broadcasts to members of the same group

Testing

  • python -m py_compile encrypted_chat/*.py build_exe.py
  • pyflakes encrypted_chat/*.py

https://chatgpt.com/codex/tasks/task_e_68ba7a272ecc832b95275853cb750de6

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +226 to +244
def send_large_file(sock, path, tag, session_cipher, local_cipher, chunk_size=32768):
"""Send large files (videos or generic files) in chunks."""
filename = os.path.basename(path)
size = os.path.getsize(path)
send_encrypted(sock, f"{tag}START|{filename}|{size}", session_cipher, local_cipher)
with open(path, "rb") as f:
while chunk := f.read(chunk_size):
b64 = base64.b64encode(chunk).decode()
send_encrypted(sock, f"{tag}CHUNK|{filename}|{b64}", session_cipher, local_cipher)
send_encrypted(sock, f"{tag}END|{filename}", session_cipher, local_cipher)


def receive_messages(sock, session_cipher, local_cipher, history, state, expire_cb):
"""Continuously receive and process messages from the peer."""
ongoing = {}
try:
while True:
encrypted = sock.recv(65536)
if not encrypted:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Prevent partial reads for encrypted file chunks

Large media transfers encrypt a 32 KB chunk, base64 it, then encrypt twice with Fernet before sending. The resulting token is ~78 KB, which exceeds the 65 536 bytes read here. sock.recv(65536) may return only part of the token, causing session_cipher.decrypt to raise InvalidToken and the receiver thread to terminate, so video/file sends above ~25 KB will fail. Frame messages with a length prefix or loop until the full ciphertext is received (the same limit exists on the server side).

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant