### Copy Environment Example File Source: https://github.com/dominux/pentaract/blob/main/README.md This command copies the example environment file to a new file named '.env'. This new file can then be edited to configure the application's settings. ```sh cp ./.env.example ./.env ``` -------------------------------- ### Build SolidJS Frontend (bash) Source: https://context7.com/dominux/pentaract/llms.txt Installs frontend dependencies using pnpm, builds the SolidJS frontend for production, and copies the build output to the specified UI directory. ```bash # Build the SolidJS frontend cd ../ui pnpm install pnpm run build cp -r ./dist/* ~/pentaract/ui/ ``` -------------------------------- ### Build and Run Pentaract with Make Source: https://github.com/dominux/pentaract/blob/main/README.md This command builds and starts the Pentaract application using a Makefile. It is a simplified way to run the application from source, often used during development. ```sh make up ``` -------------------------------- ### Start Pentaract with Docker Compose (bash) Source: https://context7.com/dominux/pentaract/llms.txt Commands to start the Pentaract application in detached mode using Docker Compose and to view the application logs for monitoring. ```bash # Start the application docker compose up -d # Check logs for any errors docker logs -f pentaract ``` -------------------------------- ### Start Pentaract with Docker Compose Source: https://github.com/dominux/pentaract/blob/main/README.md This command starts the services defined in the 'docker-compose.yml' file in detached mode. It is used to run the Pentaract application and its dependencies. ```sh docker compose up -d ``` -------------------------------- ### Docker Compose Configuration (YAML) Source: https://context7.com/dominux/pentaract/llms.txt Defines the Docker Compose setup for deploying Pentaract. It specifies the service, image, environment file, ports, restart policy, and dependencies on a PostgreSQL database. ```yaml version: "3.9" volumes: pentaract-db-volume: name: pentaract-db-volume services: pentaract: container_name: pentaract image: thedominux/pentaract env_file: - .env ports: - "${PORT}:8000" restart: unless-stopped depends_on: - db db: container_name: pentaract_db image: postgres:15.0-alpine environment: POSTGRES_USER: ${DATABASE_USER} POSTGRES_PASSWORD: ${DATABASE_PASSWORD} restart: unless-stopped volumes: - pentaract-db-volume:/var/lib/postgresql/data ``` -------------------------------- ### Authenticate and Get JWT Token (Bash) Source: https://context7.com/dominux/pentaract/llms.txt Logs in a user with email and password to obtain a JWT access token. This token is required for authenticating subsequent API requests. Ensure the Content-Type header is set to application/json. ```bash # Login and get access token curl -X POST http://localhost:8000/api/auth/login \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com", "password": "your_password" }' # Response: # { # "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." # } # Use the token in subsequent requests export TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ``` -------------------------------- ### Download File (curl) Source: https://context7.com/dominux/pentaract/llms.txt Downloads a file from a specified path within a storage. This GET request requires a bearer token and uses the --output flag to specify the local filename for the downloaded content. ```bash curl -X GET http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/download/Documents/report.pdf \ -H "Authorization: Bearer $TOKEN" \ --output report.pdf ``` -------------------------------- ### List Directory Contents (curl) Source: https://context7.com/dominux/pentaract/llms.txt Retrieves a tree view of the contents within a storage. This is a GET request that requires a bearer token for authentication. The response is a JSON array detailing files and folders. ```bash curl -X GET http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/tree/ \ -H "Authorization: Bearer $TOKEN" ``` -------------------------------- ### List Specific Subdirectory Contents (curl) Source: https://context7.com/dominux/pentaract/llms.txt Fetches the contents of a specific subdirectory within a storage. This GET request requires a bearer token and the subdirectory name in the URL. The output is a JSON array of items. ```bash curl -X GET http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/tree/Documents \ -H "Authorization: Bearer $TOKEN" ``` -------------------------------- ### List Storage Access (curl) Source: https://context7.com/dominux/pentaract/llms.txt Retrieves a list of all users who have access to a specific storage. This GET request requires a bearer token for authentication. The response is a JSON array of user access details. ```bash curl -X GET http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/access \ -H "Authorization: Bearer $TOKEN" ``` -------------------------------- ### Search for Files/Folders (curl) Source: https://context7.com/dominux/pentaract/llms.txt Searches for files or folders within a storage based on a query string. This GET request requires a bearer token and the search term is provided as a query parameter. The response is a JSON array of matching items. ```bash curl -X GET "http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/search/?search_path=report" \ -H "Authorization: Bearer $TOKEN" ``` -------------------------------- ### Create Directory for Pentaract App Source: https://github.com/dominux/pentaract/blob/main/README.md This command creates a new directory named 'pentaract' to store the application files. This is the first step for setting up the application locally. ```sh mkdir pentaract ``` -------------------------------- ### Build Pentaract UI Application Source: https://github.com/dominux/pentaract/blob/main/README.md This command builds the frontend user interface for the Pentaract application using pnpm. The built static files are typically placed in a 'dist' directory. ```sh pnpm run build ``` -------------------------------- ### Register New User (Bash) Source: https://context7.com/dominux/pentaract/llms.txt Registers a new user account in the system using email and password credentials. The superuser account is automatically created on the first startup via environment variables. The response is a 200 OK status on successful registration. ```bash # Register a new user curl -X POST http://localhost:8000/api/users \ -H "Content-Type: application/json" \ -d '{ "email": "newuser@example.com", "password": "secure_password123" }' # Response: 200 OK on success ``` -------------------------------- ### Copy Built UI Files Source: https://github.com/dominux/pentaract/blob/main/README.md This command copies the built static files from the UI's distribution directory ('dist') into the main application's UI directory. This integrates the frontend assets with the backend. ```sh cp ./dist/* ~/pentaract/ui/ ``` -------------------------------- ### Build Rust Backend (bash) Source: https://context7.com/dominux/pentaract/llms.txt Builds the Rust backend of the Pentaract project in release mode and copies the executable to a specified location. ```bash # Build the Rust backend cd pentaract cargo build --release cp ./target/release/pentaract ~/pentaract/pentaract ``` -------------------------------- ### Build Pentaract Server-Side Application Source: https://github.com/dominux/pentaract/blob/main/README.md This command compiles the Rust-based server-side application for Pentaract in release mode, optimizing it for performance. The output binary is typically found in the 'target/release/' directory. ```sh cargo build --release ``` -------------------------------- ### User Registration API Source: https://context7.com/dominux/pentaract/llms.txt Allows for the registration of new user accounts. The superuser is automatically created on the first startup. ```APIDOC ## POST /api/users ### Description Registers a new user account. ### Method POST ### Endpoint /api/users ### Parameters #### Request Body - **email** (string) - Required - The email address for the new user. - **password** (string) - Required - The password for the new user. ### Request Example ```json { "email": "newuser@example.com", "password": "secure_password123" } ``` ### Response #### Success Response (200) Indicates successful user registration. ``` -------------------------------- ### Copy Pentaract Release Binary Source: https://github.com/dominux/pentaract/blob/main/README.md This command copies the compiled Pentaract server-side binary from the build output directory ('target/release/') to the main application directory. Alternatively, a symbolic link can be created. ```sh cp ./target/release/pentaract ~/pentaract/pentaract ``` -------------------------------- ### Clone Pentaract Repository (bash) Source: https://context7.com/dominux/pentaract/llms.txt Clones the Pentaract project repository from GitHub and navigates into the project directory. ```bash # Clone the repository git clone git@github.com:Dominux/Pentaract.git cd Pentaract ``` -------------------------------- ### Clone Pentaract Repository Source: https://github.com/dominux/pentaract/blob/main/README.md This command clones the Pentaract source code repository from GitHub. It is the first step when building the application from source. ```sh git clone git@github.com:Dominux/Pentaract.git ``` -------------------------------- ### Docker Compose Configuration for Pentaract Source: https://github.com/dominux/pentaract/blob/main/README.md This YAML file defines the services for running Pentaract and its PostgreSQL database using Docker Compose. It specifies image versions, environment variables, volumes, and network dependencies. ```yaml version: "3.9" volumes: pentaract-db-volume: name: pentaract-db-volume services: pentaract: container_name: pentaract image: thedominux/pentaract env_file: - .env ports: - ${PORT}:8000 restart: unless-stopped depends_on: - db db: container_name: pentaract_db image: postgres:15.0-alpine environment: POSTGRES_USER: ${DATABASE_USER} POSTGRES_PASSWORD: ${DATABASE_PASSWORD} restart: unless-stopped volumes: - pentaract-db-volume:/var/lib/postgresql/data ``` -------------------------------- ### Manage Storages (Bash) Source: https://context7.com/dominux/pentaract/llms.txt Handles the creation, listing, retrieval, and deletion of storages, which are core organizational units backed by Telegram channels. Requires an Authorization header with a valid JWT token. The 'chat_id' is essential for creating a new storage. ```bash # Create a new storage (requires Telegram channel chat_id) curl -X POST http://localhost:8000/api/storages \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "name": "My Documents", "chat_id": -1001234567890 }' # Response: # { # "id": "550e8400-e29b-41d4-a716-446655440000", # "name": "My Documents", # "chat_id": -1001234567890 # } # List all storages the user has access to curl -X GET http://localhost:8000/api/storages \ -H "Authorization: Bearer $TOKEN" # Response: # { # "storages": [ # { # "id": "550e8400-e29b-41d4-a716-446655440000", # "name": "My Documents", # "chat_id": -1001234567890, # "files_amount": 42, # "size": 1073741824 # } # ] # } # Get a specific storage by ID curl -X GET http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000 \ -H "Authorization: Bearer $TOKEN" # Delete a storage curl -X DELETE http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000 \ -H "Authorization: Bearer $TOKEN" ``` -------------------------------- ### Environment Variables Configuration (.env) Source: https://context7.com/dominux/pentaract/llms.txt Lists the environment variables required for configuring the Pentaract application when running in Docker. Includes settings for port, worker count, authentication, database connection, and Telegram API. ```bash # .env configuration PORT=8000 WORKERS=4 CHANNEL_CAPACITY=32 SUPERUSER_EMAIL=admin@example.com SUPERUSER_PASS=secure_admin_password ACCESS_TOKEN_EXPIRE_IN_SECS=1800 REFRESH_TOKEN_EXPIRE_IN_DAYS=14 SECRET_KEY=$(openssl rand -hex 32) TELEGRAM_API_BASE_URL=https://api.telegram.org DATABASE_USER=pentaract DATABASE_PASSWORD=pentaract DATABASE_NAME=pentaract DATABASE_HOST=db DATABASE_PORT=5432 ``` -------------------------------- ### View Pentaract Docker Logs Source: https://github.com/dominux/pentaract/blob/main/README.md This command streams the logs from the 'pentaract' Docker container in real-time. It is useful for debugging and monitoring the application's activity. ```sh docker logs -f pentaract ``` -------------------------------- ### Basic Pentaract UI Styling Source: https://github.com/dominux/pentaract/blob/main/ui/index.html This snippet demonstrates the basic CSS reset provided by Pentaract UI. It ensures consistent styling across browsers by setting margin and padding to zero for all HTML elements. ```css html { margin: 0; padding: 0; } ``` -------------------------------- ### Pentaract Environment Variables Configuration Source: https://github.com/dominux/pentaract/blob/main/README.md This file configures the environment variables required for the Pentaract application, including port, worker count, database credentials, and security settings. It is essential for customizing the application's behavior. ```env PORT=8000 WORKERS=4 CHANNEL_CAPACITY=32 SUPERUSER_EMAIL= SUPERUSER_PASS= ACCESS_TOKEN_EXPIRE_IN_SECS=1800 REFRESH_TOKEN_EXPIRE_IN_DAYS=14 SECRET_KEY= TELEGRAM_API_BASEURL=https://api.telegram.org DATABASE_USER=pentaract DATABASE_PASSWORD=pentaract DATABASE_NAME=pentaract DATABASE_HOST=db DATABASE_PORT=5432 ``` -------------------------------- ### Authentication API Source: https://context7.com/dominux/pentaract/llms.txt Handles user authentication using JWT tokens. Users can log in with their email and password to obtain an access token. ```APIDOC ## POST /api/auth/login ### Description Logs in a user and returns an access token. ### Method POST ### Endpoint /api/auth/login ### Parameters #### Request Body - **email** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. ### Request Example ```json { "email": "user@example.com", "password": "your_password" } ``` ### Response #### Success Response (200) - **access_token** (string) - The JWT access token for authenticated requests. #### Response Example ```json { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." } ``` ``` -------------------------------- ### Create Folder (curl) Source: https://context7.com/dominux/pentaract/llms.txt Creates a new folder within a specified storage path. This operation requires a bearer token for authentication and sends the folder name and its parent path as a JSON payload. ```bash curl -X POST http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/create_folder \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "path": "/", "folder_name": "Documents" }' ``` -------------------------------- ### File Operations API Source: https://context7.com/dominux/pentaract/llms.txt Provides comprehensive file system operations within storages, including upload, download, directory listing, folder creation, search, and deletion. ```APIDOC ## POST /api/storages/{storage_id}/files/upload ### Description Uploads a file to a specified storage. ### Method POST ### Endpoint /api/storages/{storage_id}/files/upload ### Parameters #### Path Parameters - **storage_id** (string) - Required - The ID of the storage to upload the file to. #### Form Data - **file** (file) - Required - The file to upload. - **path** (string) - Required - The destination path within the storage for the file. ### Request Example ```bash curl -X POST http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/upload \ -H "Authorization: Bearer $TOKEN" \ -F "file=@/path/to/local/document.pdf" \ -F "path=/" ``` ``` -------------------------------- ### Upload File (Bash) Source: https://context7.com/dominux/pentaract/llms.txt Uploads a file to a specified storage. This operation requires the JWT access token for authorization and uses multipart/form-data to send the file and its intended path within the storage. The file is automatically chunked to handle Telegram's size limits. ```bash # Upload a file to a storage curl -X POST http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/upload \ -H "Authorization: Bearer $TOKEN" \ -F "file=@/path/to/local/document.pdf" \ -F "path=/" ``` -------------------------------- ### File Operations API Source: https://context7.com/dominux/pentaract/llms.txt Endpoints for uploading, creating folders, listing directory contents, downloading, searching, and deleting files and folders within a storage. ```APIDOC ## POST /api/storages/{storage_id}/files/upload_to ### Description Uploads a file to a specific path within a storage. ### Method POST ### Endpoint `/api/storages/{storage_id}/files/upload_to` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. #### Query Parameters None #### Request Body - **file** (file) - Required - The file to upload. - **path** (string) - Required - The destination path for the file within the storage. ### Request Example ```bash curl -X POST http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/upload_to \ -H "Authorization: Bearer $TOKEN" \ -F "file=@/path/to/local/image.png" \ -F "path=/photos/vacation/image.png" ``` ### Response #### Success Response (200) Details of the uploaded file (structure not specified). #### Response Example (No example provided in source) ## POST /api/storages/{storage_id}/files/create_folder ### Description Creates a new folder at a specified path within a storage. ### Method POST ### Endpoint `/api/storages/{storage_id}/files/create_folder` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. #### Query Parameters None #### Request Body - **path** (string) - Required - The path where the folder should be created. - **folder_name** (string) - Required - The name of the folder to create. ### Request Example ```bash curl -X POST http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/create_folder \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "path": "/", "folder_name": "Documents" }' ``` ### Response #### Success Response (200) Details of the created folder (structure not specified). #### Response Example (No example provided in source) ## GET /api/storages/{storage_id}/files/tree/ ### Description Retrieves a tree view of the contents of a storage. ### Method GET ### Endpoint `/api/storages/{storage_id}/files/tree/` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/tree/ \ -H "Authorization: Bearer $TOKEN" ``` ### Response #### Success Response (200) A list of files and folders in a tree structure. - **path** (string) - The full path of the item. - **name** (string) - The name of the item. - **size** (integer) - The size of the item in bytes. - **is_file** (boolean) - True if the item is a file, false if it is a folder. #### Response Example ```json [ { "path": "/Documents", "name": "Documents", "size": 0, "is_file": false }, { "path": "/readme.txt", "name": "readme.txt", "size": 1024, "is_file": true } ] ``` ## GET /api/storages/{storage_id}/files/tree/{folder_path} ### Description Retrieves the contents of a specific subdirectory within a storage. ### Method GET ### Endpoint `/api/storages/{storage_id}/files/tree/{folder_path}` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. - **folder_path** (string) - Required - The path to the subdirectory. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/tree/Documents \ -H "Authorization: Bearer $TOKEN" ``` ### Response #### Success Response (200) A list of files and folders within the specified subdirectory (structure similar to the tree view response). #### Response Example (No example provided in source) ## GET /api/storages/{storage_id}/files/download/{file_path} ### Description Downloads a file from a storage. ### Method GET ### Endpoint `/api/storages/{storage_id}/files/download/{file_path}` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. - **file_path** (string) - Required - The path to the file to download. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/download/Documents/report.pdf \ -H "Authorization: Bearer $TOKEN" \ --output report.pdf ``` ### Response #### Success Response (200) The content of the downloaded file. #### Response Example (Binary file content) ## GET /api/storages/{storage_id}/files/search/ ### Description Searches for files and folders within a storage based on a search query. ### Method GET ### Endpoint `/api/storages/{storage_id}/files/search/` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. #### Query Parameters - **search_path** (string) - Required - The search query string. #### Request Body None ### Request Example ```bash curl -X GET "http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/search/?search_path=report" \ -H "Authorization: Bearer $TOKEN" ``` ### Response #### Success Response (200) A list of files and folders matching the search query. - **path** (string) - The full path of the found item. - **is_file** (boolean) - True if the item is a file, false if it is a folder. #### Response Example ```json [ { "path": "/Documents/report.pdf", "is_file": true }, { "path": "/Archives/old_report.pdf", "is_file": true } ] ``` ## DELETE /api/storages/{storage_id}/files/{item_path} ### Description Deletes a file or folder from a storage. ### Method DELETE ### Endpoint `/api/storages/{storage_id}/files/{item_path}` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. - **item_path** (string) - Required - The path to the file or folder to delete. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X DELETE http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/Documents/old_file.txt \ -H "Authorization: Bearer $TOKEN" ``` ### Response #### Success Response (200) Indicates successful deletion (details not specified). #### Response Example (No example provided in source) ``` -------------------------------- ### Generate Random Secret Key Source: https://github.com/dominux/pentaract/blob/main/README.md This command generates a cryptographically secure random hexadecimal string of 64 characters, suitable for use as a secret key in the Pentaract application's environment configuration. ```sh openssl rand -hex 32 ``` -------------------------------- ### Access Control API Source: https://context7.com/dominux/pentaract/llms.txt Endpoints for managing user access permissions to storages, including granting, listing, and revoking access. ```APIDOC ## POST /api/storages/{storage_id}/access ### Description Grants access to a storage for a specific user. ### Method POST ### Endpoint `/api/storages/{storage_id}/access` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. #### Query Parameters None #### Request Body - **user_email** (string) - Required - The email address of the user to grant access to. - **access_type** (string) - Required - The type of access to grant. Options: "R" (Viewer), "W" (Can Edit), "A" (Admin). ### Request Example ```bash curl -X POST http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/access \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "user_email": "colleague@example.com", "access_type": "W" }' ``` ### Response #### Success Response (200) Indicates successful access grant (details not specified). #### Response Example (No example provided in source) ## GET /api/storages/{storage_id}/access ### Description Lists all users with access to a specific storage and their permission levels. ### Method GET ### Endpoint `/api/storages/{storage_id}/access` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/access \ -H "Authorization: Bearer $TOKEN" ``` ### Response #### Success Response (200) A list of users and their access details. - **id** (string) - The unique identifier of the user. - **email** (string) - The email address of the user. - **access_type** (string) - The type of access the user has (e.g., "A", "W", "R"). #### Response Example ```json [ { "id": "user-uuid-1", "email": "owner@example.com", "access_type": "A" }, { "id": "user-uuid-2", "email": "colleague@example.com", "access_type": "W" } ] ``` ## DELETE /api/storages/{storage_id}/access ### Description Revokes access to a storage for a specific user. ### Method DELETE ### Endpoint `/api/storages/{storage_id}/access` ### Parameters #### Path Parameters - **storage_id** (string) - Required - The unique identifier of the storage. #### Query Parameters None #### Request Body - **user_id** (string) - Required - The unique identifier of the user whose access should be revoked. ### Request Example ```bash curl -X DELETE http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/access \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "user_id": "user-uuid-2" }' ``` ### Response #### Success Response (200) Indicates successful access revocation (details not specified). #### Response Example (No example provided in source) ``` -------------------------------- ### Manage Storage Workers (Bash) Source: https://context7.com/dominux/pentaract/llms.txt Manages Telegram bots (storage workers) responsible for file operations. This includes creating new workers, listing existing ones, and checking if a storage is configured with workers. Requires a JWT token for authorization and a valid Telegram bot token. ```bash # Create a storage worker (Telegram bot) curl -X POST http://localhost:8000/api/storage_workers \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "name": "Upload Bot 1", "token": "6123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw", "storage_id": "550e8400-e29b-41d4-a716-446655440000" }' # Response: # { # "id": "660e8400-e29b-41d4-a716-446655440001", # "name": "Upload Bot 1", # "user_id": "770e8400-e29b-41d4-a716-446655440002", # "token": "6123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw", # "storage_id": "550e8400-e29b-41d4-a716-446655440000" # } # List all storage workers curl -X GET http://localhost:8000/api/storage_workers \ -H "Authorization: Bearer $TOKEN" # Check if a storage has workers configured curl -X GET "http://localhost:8000/api/storage_workers/has_workers?storage_id=550e8400-e29b-41d4-a716-446655440000" \ -H "Authorization: Bearer $TOKEN" # Response: # { "has": true } ``` -------------------------------- ### Set Pentaract Environment Variables Source: https://github.com/dominux/pentaract/blob/main/README.md These commands export environment variables required for running the Pentaract application, such as the port number and worker count. These variables configure the application's runtime behavior. ```sh export PORT=8000 export WORKERS=4 ``` -------------------------------- ### Storage Management API Source: https://context7.com/dominux/pentaract/llms.txt Manages storages, which are the core organizational units backed by Telegram channels. Supports creation, listing, retrieval, and deletion of storages. ```APIDOC ## POST /api/storages ### Description Creates a new storage. ### Method POST ### Endpoint /api/storages ### Parameters #### Request Body - **name** (string) - Required - The name of the storage. - **chat_id** (integer) - Required - The Telegram chat ID backing this storage. ### Request Example ```json { "name": "My Documents", "chat_id": -1001234567890 } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the created storage. - **name** (string) - The name of the storage. - **chat_id** (integer) - The Telegram chat ID. #### Response Example ```json { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "My Documents", "chat_id": -1001234567890 } ``` ``` ```APIDOC ## GET /api/storages ### Description Lists all storages accessible by the authenticated user. ### Method GET ### Endpoint /api/storages ### Response #### Success Response (200) - **storages** (array) - A list of storage objects. - **id** (string) - The unique identifier of the storage. - **name** (string) - The name of the storage. - **chat_id** (integer) - The Telegram chat ID. - **files_amount** (integer) - The number of files in the storage. - **size** (integer) - The total size of files in the storage (in bytes). #### Response Example ```json { "storages": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "My Documents", "chat_id": -1001234567890, "files_amount": 42, "size": 1073741824 } ] } ``` ``` ```APIDOC ## GET /api/storages/{storage_id} ### Description Retrieves details for a specific storage. ### Method GET ### Endpoint /api/storages/{storage_id} ### Parameters #### Path Parameters - **storage_id** (string) - Required - The ID of the storage to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the storage. - **name** (string) - The name of the storage. - **chat_id** (integer) - The Telegram chat ID. - **files_amount** (integer) - The number of files in the storage. - **size** (integer) - The total size of files in the storage (in bytes). ``` ```APIDOC ## DELETE /api/storages/{storage_id} ### Description Deletes a specific storage. ### Method DELETE ### Endpoint /api/storages/{storage_id} ### Parameters #### Path Parameters - **storage_id** (string) - Required - The ID of the storage to delete. ``` -------------------------------- ### Upload File to Specific Path (curl) Source: https://context7.com/dominux/pentaract/llms.txt Uploads a local file to a specified path within a storage. Requires a bearer token for authentication and accepts the file and its destination path as form data. The storage ID is part of the URL. ```bash curl -X POST http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/upload_to \ -H "Authorization: Bearer $TOKEN" \ -F "file=@/path/to/local/image.png" \ -F "path=/photos/vacation/image.png" ``` -------------------------------- ### Grant Storage Access (curl) Source: https://context7.com/dominux/pentaract/llms.txt Grants access to a storage for another user with a specified permission level (R, W, or A). This POST request requires a bearer token and sends the user's email and access type in a JSON payload. ```bash curl -X POST http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/access \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "user_email": "colleague@example.com", "access_type": "W" }' ``` -------------------------------- ### Delete File or Folder (curl) Source: https://context7.com/dominux/pentaract/llms.txt Deletes a file or folder from a specified path within a storage. This DELETE request requires a bearer token for authentication and the path to the item to be deleted is included in the URL. ```bash curl -X DELETE http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/files/Documents/old_file.txt \ -H "Authorization: Bearer $TOKEN" ``` -------------------------------- ### Storage Workers API Source: https://context7.com/dominux/pentaract/llms.txt Manages storage workers, which are Telegram bots responsible for file operations. Allows for creation, listing, and checking worker status for storages. ```APIDOC ## POST /api/storage_workers ### Description Creates a new storage worker (Telegram bot). ### Method POST ### Endpoint /api/storage_workers ### Parameters #### Request Body - **name** (string) - Required - The name of the storage worker. - **token** (string) - Required - The Telegram bot token. - **storage_id** (string) - Required - The ID of the storage this worker is associated with. ### Request Example ```json { "name": "Upload Bot 1", "token": "6123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw", "storage_id": "550e8400-e29b-41d4-a716-446655440000" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the created storage worker. - **name** (string) - The name of the storage worker. - **user_id** (string) - The Telegram user ID of the bot. - **token** (string) - The Telegram bot token. - **storage_id** (string) - The ID of the associated storage. #### Response Example ```json { "id": "660e8400-e29b-41d4-a716-446655440001", "name": "Upload Bot 1", "user_id": "770e8400-e29b-41d4-a716-446655440002", "token": "6123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw", "storage_id": "550e8400-e29b-41d4-a716-446655440000" } ``` ``` ```APIDOC ## GET /api/storage_workers ### Description Lists all storage workers accessible by the authenticated user. ### Method GET ### Endpoint /api/storage_workers ``` ```APIDOC ## GET /api/storage_workers/has_workers ### Description Checks if a storage has any configured workers. ### Method GET ### Endpoint /api/storage_workers/has_workers ### Parameters #### Query Parameters - **storage_id** (string) - Required - The ID of the storage to check. ### Response #### Success Response (200) - **has** (boolean) - True if the storage has workers, false otherwise. #### Response Example ```json { "has": true } ``` ``` -------------------------------- ### Revoke Storage Access (curl) Source: https://context7.com/dominux/pentaract/llms.txt Revokes access for a specific user from a storage. This DELETE request requires a bearer token and the user's ID in a JSON payload to identify the user whose access is being removed. ```bash curl -X DELETE http://localhost:8000/api/storages/550e8400-e29b-41d4-a716-446655440000/access \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "user_id": "user-uuid-2" }' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.