Commit graph

12 commits

Author SHA1 Message Date
54acab7c28
Bump version to 0.1.0 for initial release
Prepare for the initial public release of the project by incrementing the project version from 0.0.1 to 0.1.0, indicating significant progress in development and readiness for wider distribution.
2024-02-04 08:57:40 +01:00
e76d05caf9
Enhance FicheServer robustness and add form UI
Refactored FicheServer to streamline setter methods, improving type annotations for clarity. Adjusted code formatting and string quoting for consistency across the board, promoting adherence to PEP 8 guidelines. Enhanced `generate_slug` method to recursively resolve file naming conflicts and extended its functionality to use custom inputs. Introduced a form interface to the PyFiche Lines HTML template, allowing easy uploading of pastes through the web UI. This commit improves code maintainability and provides a more user-friendly way for submitting content to the server.

Resolves issue with slug regeneration and implements feature request for web-based content submission.
2024-02-04 08:56:35 +01:00
dbb4aff4e7
Configure server args from env vars and update .gitignore
Server initialization in `fiche_server.py`, `lines_server.py`, and `recup_server.py` has been modified to configure runtime arguments using environment variables, providing flexibility for different deployment environments. This enhances the portability of the code by allowing server configuration without code changes.

Additionally, the `.gitignore` file has been updated to exclude `*.log` files, ensuring that log files do not get committed to version control, thus keeping the repository clean.
2024-01-23 10:20:41 +01:00
23071d36f2
Added Docker setup for pyfiche services
Introduced a Dockerfile to containerize pyfiche alongside its dependencies. The setup includes the latest Python, installs pyfiche from a Git repository, and utilizes Supervisord for process management. Supervisord is configured to manage three pyfiche services: server, recup, and lines, ensuring they start on boot and restart on failure. Exposed ports allow external access, and a persistent data volume ensures data continuity. This encapsulates the pyfiche environment, providing a robust and consistent deployment method.
2024-01-22 09:18:32 +01:00
debe84737d
Add max paste size option to PyFiche README
Enhanced PyFiche with the `-M` switch, enabling users to set a maximum paste size, with a default limit of 5 MiB. This addition offers better control over resource usage and helps prevent abuse. Instructions for usage are updated in the README.
2024-01-22 08:46:13 +01:00
626633a7a9
Add file transfer instructions to README
Enhanced the README with clear examples for uploading and downloading files, and for interaction with pastes via curl or browser. This update should assist users in performing common tasks without needing to refer to external documentation, improving ease of use.
2024-01-22 08:44:37 +01:00
80d5aad05d
Add index page for PyFiche Lines server
Implemented a welcoming index page for the PyFiche Lines HTTP server. Now, when users access the root URL, they are greeted with an informative page that includes a brief introduction to the service, its purpose, and a link to the project's repository for additional information. This enhancement improves user experience by providing context and guidance for new visitors to the server.
2024-01-22 08:39:37 +01:00
b99ea03635
Implement 5 MB file size limit enforcement
Enhanced both FicheServer and LinesServer to reject data transfers exceeding a 5MB limit by introducing a max_size parameter across server classes, request handlers, and CLI arguments. This change improves system stability and security by preventing excessive resource use. Additionally, customized HTTP responses are provided for missing or invalid Content-Length headers and oversized files, creating a clearer client-server communication and ensuring better request validation logic.
2024-01-22 08:36:34 +01:00
9338b9163e
Enable file uploads via POST in Fiche-compatible server
Enhanced the Fiche-compatible HTTP server in PyFiche to accept file uploads using POST requests, providing a more standard method for sending files to the server. This update complements the existing TCP server, Recup, which facilitates downloading pastes via netcat.
2024-01-21 21:48:13 +01:00
bf60f75769
Implement POST file upload and enhance security checks
Introduced the ability to handle file uploads via POST requests with necessary validations and directory management. Added security checks on both POST and GET methods which now verify client IP against allowlist and banlist. Implemented redirection after successful file upload, with a generated slug as the file identifier.

Refactored the 'do_POST' method, incorporating checks on request path and 'Content-Length' header, rejecting inappropriate requests swiftly. Created the upload functionality that reads the content and writes it to the designated data directory, using a new, unique slug for each file. Also added logging for requests, aiding in monitoring and debugging.

These enhancements create a more functional and secure system, laying the groundwork for future improvements and feature integrations.
2024-01-21 21:46:53 +01:00
b23e97e3b8
Enhance README and stub POST method in Lines
Updated README to highlight PyFiche's lack of external dependencies, improving project clarity for potential users. Added a stub for the POST method in the Lines server signaling planned upload functionality with an informative 501 Not Implemented response to client requests. This sets the groundwork for future implementations of the file upload feature.
2024-01-21 21:42:29 +01:00
9c485c7875
Add PyFiche pastebin service with servers and configs
Introducing PyFiche, a pastebin service optimized for command-line usage, including a full suite of servers – a TCP-based 'Fiche' server, an HTTP 'Lines' server, and a 'Recup' server for file retrieval via netcat. The initial release features configuration via pyproject.toml, a comprehensive README, and the MIT license.

This robust solution allows for easy code snippet sharing, file uploads, and downloads without dependencies outside the Python standard library. Setup involves environment configuration and pip installation with the project's handle to git. The 'Fiche' server accepts specific command-line options for customizability, and banlists/allowlists manage server access control, with detailed logging available per user request. Users should note that HTTPS support requires a reverse proxy setup, as PyFiche itself does not handle SSL/TLS.

The '.gitignore' file ensures that local development directories, bytecode and sensitive files are excluded from the repository to maintain a clean working environment. This addition represents a significant milestone for the Private.coffee team in providing a self-contained pastebin service.
2024-01-21 21:38:17 +01:00