ProishCDN Info - thepoopooman652/proishs-webtools GitHub Wiki
CDN (content delivery network)
Overview
This folder contains a lightweight content-serving and upload helper. It provides a simple HTTP API for serving public assets and optionally serving or accepting private uploads when an API token is supplied. The implementation is intended for development and small-scale use; it exposes endpoints for file retrieval and uploads and is designed to be referenced by other tools in this repository.
Top-level files
api.php— Primary HTTP endpoint. Supports file retrieval frompublic/and (when a token is supplied) fromprivate/. Also implements upload handling and simple response JSON for programmatic consumers.index.html— Basic documentation and examples demonstrating how to call theapi.phpendpoints from a browser or curl.public/— Directory for public assets that can be served without authentication.private/— Directory for private assets; access is gated by the API token mechanism implemented inapi.php.
Configuration
Configuration values are read from environment variables or constants set by the running environment. Typical settings include:
MAIN_API_KEY— primary read token used by the API to authorize private access.UPLOAD_API_KEY— token used to authorize web uploads.PRIVATE_API_UPLOAD_KEY— optional upload-scoped key for private uploads.
Example API usage
- Retrieve a public file (GET)
GET /api.php?file=logo.png
GET /api.php?file=images/logo.png
Response: binary stream with appropriate Content-Type (e.g., image/png).
- Retrieve a private file (GET with token)
GET /api.php?file=secret.pdf&auth=REDACTED_TOKEN
GET /api.php?file=documents/secret.pdf&auth=REDACTED_TOKEN
Response: binary stream for authorized requests; JSON error payload for unauthorized or missing files.
- Upload a file (POST multipart/form-data)
Request fields:
auth— upload API keyuploadedFile— file field containing the uploaded file
Successful upload returns a JSON object with success: true and a message string.
API response examples (JSON)
Retrieve file list:
{
"success": true,
"files": ["public/logo.png", "public/styles.css"]
}
Upload success:
{
"success": true,
"message": "File uploaded successfully.",
"path": "private/uploads/example.txt"
}
Developer notes and integration
- When integrating with other tools in this repository, reference
api.phpendpoints by path. Tools that need to upload files should POST toapi.php?action=upload(or the implemented action name) and include the upload token in the request. - Logging and diagnostics are written to the runtime environment (stdout, error logs) or local log files depending on server configuration.
Testing and local run
Start a local PHP server from the repository root for quick iteration:
cd 'C:\Users\Administrator\Documents\GitHub\proish-webtools\cdn'
php -S 127.0.0.1:8000 -t .
Then open http://127.0.0.1:8000/index.html for examples or call api.php endpoints programmatically.
Changelog
- 2025-11-06: Initial detailed README created; documents public/private retrieval and upload flows.
- 2025-11-06: Updated request examples
Notes
This README focuses on interface and integration details for the CDN helper and provides concise examples for programmatic access.