### Get System Settings (GET) Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves the current site-wide system configuration, including branding, registration settings, and custom scripts. This is a public endpoint. ```bash curl -X GET http://localhost:6277/api/settings ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/lin-snow/ech0/blob/main/web/README.md Installs all project dependencies using the pnpm package manager. This is a crucial first step before running any other commands. ```shell pnpm install ``` -------------------------------- ### Get S3 Settings (GET) Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves the current S3 storage configuration. Requires an Authorization header with a JWT token. ```bash curl -X GET http://localhost:6277/api/s3/settings \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Get OAuth2/OIDC Settings (GET) Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves the configuration for OAuth2 or OpenID Connect providers used for authentication. Requires an Authorization header with a JWT token. ```bash curl -X GET http://localhost:6277/api/oauth2/settings \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Get System Settings Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves the current site-wide system configuration. This is a public endpoint. ```APIDOC ## GET /api/settings ### Description Retrieves the current site-wide system configuration. This is a public endpoint. ### Method GET ### Endpoint /api/settings ### Response #### Success Response (200) - **code** (integer) - Indicates success. - **msg** (string) - Success message. - **data** (object) - Contains system settings. - **site_title** (string) - The title of the website. - **server_logo** (string) - URL of the server logo. - **server_name** (string) - The name of the server. - **server_url** (string) - The URL of the server. - **allow_register** (boolean) - Whether user registration is allowed. - **icp_number** (string) - ICP registration number (if applicable). - **meting_api** (string) - URL for the Meting API. - **custom_css** (string) - Custom CSS styles. - **custom_js** (string) - Custom JavaScript code. #### Response Example ```json { "code": 1, "msg": "Success", "data": { "site_title": "My Ech0 Instance", "server_logo": "https://example.com/logo.png", "server_name": "Ech0", "server_url": "https://memo.example.com", "allow_register": true, "icp_number": "", "meting_api": "https://api.example.com/meting", "custom_css": ".custom-class { color: blue; }", "custom_js": "console.log('Custom script loaded');" } } ``` ``` -------------------------------- ### Install Ech0 with Kubernetes Helm Source: https://github.com/lin-snow/ech0/blob/main/README.en.md Installs Ech0 onto a Kubernetes cluster using Helm. This requires cloning the repository first as no online Helm repository is provided. The default release name is 'ech0'. ```shell git clone https://github.com/lin-snow/Ech0.git cd Ech0 helm install ech0 ./charts/ech0 ``` -------------------------------- ### Get All Tags with Usage Counts (GET) Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves a list of all available tags along with their usage counts. This is a public endpoint. ```bash curl -X GET http://localhost:6277/api/tags ``` -------------------------------- ### Real-time System Metrics via WebSocket Source: https://context7.com/lin-snow/ech0/llms.txt Connect to the '/ws/dashboard/metrics' WebSocket endpoint to receive live system metrics such as CPU, memory, disk, and network usage. Includes example JavaScript for handling messages and errors. Also shows how to fetch a snapshot via HTTP. ```javascript // Connect to metrics WebSocket const ws = new WebSocket('ws://localhost:6277/ws/dashboard/metrics'); ws.onopen = () => { console.log('Connected to metrics stream'); }; ws.onmessage = (event) => { const metrics = JSON.parse(event.data); console.log('System Metrics:', metrics); // Example metrics structure: // { // "timestamp": "2026-01-06T12:30:00Z", // "cpu_percent": 15.5, // "memory_used_mb": 12.8, // "memory_total_mb": 16384, // "memory_percent": 0.08, // "disk_used_gb": 2.5, // "disk_total_gb": 100, // "disk_percent": 2.5, // "network_sent_mb": 150.2, // "network_recv_mb": 320.8, // "goroutines": 45, // "uptime_seconds": 86400 // } updateDashboard(metrics); }; ws.onerror = (error) => { console.error('WebSocket error:', error); }; ws.onclose = () => { console.log('Disconnected from metrics stream'); // Implement reconnection logic }; // Get snapshot metrics (HTTP endpoint) fetch('http://localhost:6277/api/dashboard/metrics', { headers: { 'Authorization': 'Bearer YOUR_JWT_TOKEN' } }) .then(response => response.json()) .then(data => { console.log('Metrics snapshot:', data); }); ``` -------------------------------- ### Get Paginated Echos (GET/POST) Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves a list of echos with pagination support. Supports both GET and POST requests. Accepts parameters like page, pageSize, and search query. The response includes a list of items and the total count. ```bash curl -X POST http://localhost:6277/api/echo/page \ -H "Content-Type: application/json" \ -d '{ "page": 1, "pageSize": 20, "search": "golang" }' ``` -------------------------------- ### Get All Tags Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves a list of all available tags along with their usage counts. ```APIDOC ## GET /api/tags ### Description Retrieves all tags with their usage counts. ### Method GET ### Endpoint /api/tags ### Response #### Success Response (200) - **code** (integer) - Indicates success. - **msg** (string) - Success message. - **data** (array) - Array of tag objects. - **id** (integer) - The tag's unique identifier. - **name** (string) - The name of the tag. - **usage_count** (integer) - The number of times the tag has been used. - **created_at** (string) - The timestamp when the tag was created (ISO 8601 format). #### Response Example ```json { "code": 1, "msg": "Success", "data": [ { "id": 1, "name": "technology", "usage_count": 45, "created_at": "2026-01-01T00:00:00Z" }, { "id": 2, "name": "golang", "usage_count": 32, "created_at": "2026-01-01T00:00:00Z" } ] } ``` ``` -------------------------------- ### Get Today's Echos (GET) Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves all echos created on the current day. Requires an Authorization header with a JWT token. ```bash curl -X GET http://localhost:6277/api/echo/today \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Get Presigned URL for Direct Upload Source: https://context7.com/lin-snow/ech0/llms.txt Generates a presigned URL for direct upload of files to S3. Requires authentication. ```APIDOC ## PUT /api/s3/presign ### Description Generates a presigned URL for direct upload of files to S3. Requires authentication. ### Method PUT ### Endpoint /api/s3/presign ### Parameters #### Request Body - **object_key** (string) - Required - The desired key (path and filename) for the object in the S3 bucket. - **content_type** (string) - Required - The MIME type of the file to be uploaded. ### Request Example ```json { "object_key": "uploads/image-123.jpg", "content_type": "image/jpeg" } ``` ### Response #### Success Response (200) - **code** (integer) - Indicates success. - **msg** (string) - Success message. - **data** (object) - Contains presigned URL information. - **presigned_url** (string) - The URL to which the file should be uploaded. - **object_key** (string) - The key of the uploaded object. - **expires_in** (integer) - The time in seconds until the presigned URL expires. #### Response Example ```json { "code": 1, "msg": "Success", "data": { "presigned_url": "https://bucket.s3.amazonaws.com/uploads/image-123.jpg?X-Amz-Algorithm=...", "object_key": "uploads/image-123.jpg", "expires_in": 3600 } } ``` ``` -------------------------------- ### Get S3 Settings Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves the current S3 storage configuration. Requires authentication. ```APIDOC ## GET /api/s3/settings ### Description Retrieves the current S3 storage configuration. Requires authentication. ### Method GET ### Endpoint /api/s3/settings ### Request Example ```bash curl -X GET http://localhost:6277/api/s3/settings \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Run Development Server with pnpm Source: https://github.com/lin-snow/ech0/blob/main/web/README.md Starts the Vite development server, enabling hot-reloading for rapid development cycles. This command is used during the development phase. ```shell pnpm dev ``` -------------------------------- ### Get OAuth2/OIDC Settings Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves the configuration for external OAuth2 or OpenID Connect providers. Requires authentication. ```APIDOC ## GET /api/oauth2/settings ### Description Retrieves the configuration for external OAuth2 or OpenID Connect providers. Requires authentication. ### Method GET ### Endpoint /api/oauth2/settings ### Request Example ```bash curl -X GET http://localhost:6277/api/oauth2/settings \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Get Presigned URL for Direct Upload (PUT) Source: https://context7.com/lin-snow/ech0/llms.txt Generates a presigned URL for direct upload of files to S3 storage. Requires an Authorization header and a JSON payload specifying the object key and content type. ```bash curl -X PUT http://localhost:6277/api/s3/presign \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "object_key": "uploads/image-123.jpg", "content_type": "image/jpeg" }' ``` -------------------------------- ### Get Application URL with Ingress Enabled Source: https://github.com/lin-snow/ech0/blob/main/charts/ech0/templates/NOTES.txt Retrieves the application URL when Ingress is enabled in the Helm chart. It iterates through configured hosts and applies HTTPS or HTTP based on TLS settings. No external dependencies are required beyond kubectl access to the cluster. ```go-template {{- if .Values.ingress.enabled }} {{- range .Values.ingress.hosts }} {{- if .tls }} https://{{ .host }}{{ .path }} {{- else }} http://{{ .host }}{{ .path }} {{- end }} {{- end }} {{- end }} ``` -------------------------------- ### Get Application URL with LoadBalancer Service Source: https://github.com/lin-snow/ech0/blob/main/charts/ech0/templates/NOTES.txt Fetches the application URL for a LoadBalancer service. It highlights that the LoadBalancer IP might take time to provision and provides a command to monitor its status. Outputs an HTTP URL. Requires kubectl and a cloud provider supporting LoadBalancers. ```shell {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "ech0.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ech0.fullname" . }} --template "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}") echo http://$SERVICE_IP:{{ .Values.service.httpPort }} {{- end }} ``` -------------------------------- ### Get Paginated Echos (Supports GET and POST) Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves a paginated list of echos. Supports search and filtering. ```APIDOC ## POST /api/echo/page ### Description Retrieves a paginated list of echos with support for search parameters. ### Method POST ### Endpoint /api/echo/page ### Parameters #### Request Body - **page** (integer) - Required - The page number to retrieve. - **pageSize** (integer) - Required - The number of items per page. - **search** (string) - Optional - The search query string. ### Request Example ```json { "page": 1, "pageSize": 20, "search": "golang" } ``` ### Response #### Success Response (200) - **code** (integer) - Indicates success. - **msg** (string) - Success message. - **data** (object) - Contains the paginated data. - **items** (array) - Array of echo objects. - **id** (integer) - The echo's unique identifier. - **content** (string) - The content of the echo. - **username** (string) - The username of the author. - **images** (array) - Array of image URLs associated with the echo. - **tags** (array) - Array of tags associated with the echo. - **fav_count** (integer) - The number of favorites. - **created_at** (string) - The timestamp when the echo was created (ISO 8601 format). - **total** (integer) - The total number of echos available. #### Response Example ```json { "code": 1, "msg": "Success", "data": { "items": [ { "id": 42, "content": "# My First Post...", "username": "admin", "images": [], "tags": [], "fav_count": 5, "created_at": "2026-01-06T12:30:00Z" } ], "total": 150 } } ``` ``` -------------------------------- ### Deploy Ech0 with Docker Compose Source: https://github.com/lin-snow/ech0/blob/main/README.en.md Sets up Ech0 using a `docker-compose.yml` file. This method simplifies multi-container application deployment. Ensure the `docker-compose.yml` file is correctly configured before running. ```shell docker-compose up -d ``` -------------------------------- ### Ech0 Docker Deployment Source: https://context7.com/lin-snow/ech0/llms.txt Instructions for deploying Ech0 using Docker, including basic container startup and Docker Compose configurations. ```APIDOC ## Docker Deployment ### Description Deploy Ech0 using Docker with volume mounts and environment variables. ### Run with Docker ```bash docker run -d \ --name ech0 \ -p 6277:6277 \ -v /opt/ech0/data:/app/data \ -v /opt/ech0/backup:/app/backup \ -e JWT_SECRET="your-secret-key-change-this" \ sn0wl1n/ech0:latest ``` ### Docker Compose Deployment Create a `docker-compose.yml` file with the following content: ```yaml version: '3.8' services: ech0: image: sn0wl1n/ech0:latest container_name: ech0 restart: unless-stopped ports: - "6277:6277" volumes: - ./data:/app/data - ./backup:/app/backup environment: - JWT_SECRET=your-secret-key-change-this ``` Then run: ```bash docker-compose up -d ``` ### View Logs ```bash docker logs -f ech0 ``` ### Update to Latest Version ```bash docker stop ech0 docker rm ech0 docker pull sn0wl1n/ech0:latest docker run -d \ --name ech0 \ -p 6277:6277 \ -v /opt/ech0/data:/app/data \ -v /opt/ech0/backup:/app/backup \ -e JWT_SECRET="your-secret-key-change-this" \ sn0wl1n/ech0:latest ``` ``` -------------------------------- ### Import and Restore System Backup using curl Source: https://context7.com/lin-snow/ech0/llms.txt Imports a system backup from a ZIP file and restores the system. This process supports zero-downtime restoration, allowing the system to remain accessible. Requires JWT authentication. ```bash # Import backup from ZIP file curl -X POST http://localhost:6277/api/backup/import \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -F "file=@ech0_backup_20260106.zip" ``` -------------------------------- ### Get Specific Echo by ID (GET) Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves a single echo by its unique identifier. Requires an Authorization header with a JWT token. ```bash curl -X GET http://localhost:6277/api/echo/42 \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Configure AI Agent Source: https://context7.com/lin-snow/ech0/llms.txt Configures AI agents for content assistance. Supports providers like OpenAI, DeepSeek, and Ollama. Requires specifying the provider, model name, API key (if applicable), and base URL. The `prompt` field can customize the agent's behavior. ```bash # Get agent settings curl -X GET http://localhost:6277/api/agent/settings \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` ```bash # Configure OpenAI agent curl -X PUT http://localhost:6277/api/agent/settings \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "enable": true, "provider": "openai", "model": "gpt-4", "api_key": "sk-xxxxxxxxxxxxxxxx", "prompt": "You are a helpful assistant for Ech0 platform users.", "base_url": "https://api.openai.com/v1" }' ``` ```bash # Configure DeepSeek agent curl -X PUT http://localhost:6277/api/agent/settings \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "enable": true, "provider": "deepseek", "model": "deepseek-chat", "api_key": "your-deepseek-key", "base_url": "https://api.deepseek.com" }' ``` ```bash # Configure Ollama (local models) curl -X PUT http://localhost:6277/api/agent/settings \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "enable": true, "provider": "ollama", "model": "llama2", "base_url": "http://localhost:11434" }' ``` -------------------------------- ### Get Echos by Tag ID (GET) Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves echos associated with a specific tag ID. Requires an Authorization header with a JWT token. ```bash curl -X GET http://localhost:6277/api/echo/tag/1 \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Create and Export System Backup using curl Source: https://context7.com/lin-snow/ech0/llms.txt Initiates a system backup and provides metadata about the created backup. It also shows how to export the backup as a downloadable ZIP file. Requires JWT authentication. ```bash # Create backup (returns backup metadata) curl -X GET http://localhost:6277/api/backup \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` ```bash # Export backup as downloadable ZIP file curl -X GET "http://localhost:6277/api/backup/export?token=YOUR_JWT_TOKEN" \ --output ech0_backup_20260106.zip ``` -------------------------------- ### Backup and Restore API Source: https://context7.com/lin-snow/ech0/llms.txt Endpoints for managing system backups and restores. This includes creating and exporting backups, importing backups from ZIP files, and configuring automated backup schedules. ```APIDOC ## Backup Management ### Create and Export Backups #### Create backup (returns backup metadata) ##### Method GET ##### Endpoint `/api/backup` ##### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. ##### Response (Success Response - 200) - **code** (integer) - Status code, 1 indicates success. - **msg** (string) - Message indicating success. - **data** (object) - Backup metadata. - **backup_id** (string) - Unique ID for the backup. - **created_at** (string) - Timestamp of backup creation. - **size_bytes** (integer) - Total size of the backup in bytes. - **database_size** (integer) - Size of the database backup in bytes. - **files_size** (integer) - Size of the file backup in bytes. ##### Request Example ```bash curl -X GET http://localhost:6277/api/backup \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` ##### Response Example ```json { "code": 1, "msg": "Backup created successfully", "data": { "backup_id": "backup_20260106_123000", "created_at": "2026-01-06T12:30:00Z", "size_bytes": 15728640, "database_size": 10485760, "files_size": 5242880 } } ``` #### Export backup as downloadable ZIP file ##### Method GET ##### Endpoint `/api/backup/export` ##### Parameters #### Query Parameters - **token** (string) - Required - JWT token for authentication. ##### Request Example ```bash curl -X GET "http://localhost:6277/api/backup/export?token=YOUR_JWT_TOKEN" \ --output ech0_backup_20260106.zip ``` ### Import and Restore Backups #### Import backup from ZIP file ##### Method POST ##### Endpoint `/api/backup/import` ##### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. #### Form Data - **file** (file) - Required - The backup ZIP file to import. ##### Response (Success Response - 200) - **code** (integer) - Status code, 1 indicates success. - **msg** (string) - Message indicating successful restoration. - **data** (object) - Restoration summary. - **restored_at** (string) - Timestamp of restoration. - **echos_count** (integer) - Number of echos restored. - **users_count** (integer) - Number of users restored. - **files_count** (integer) - Number of files restored. ##### Request Example ```bash curl -X POST http://localhost:6277/api/backup/import \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -F "file=@ech0_backup_20260106.zip" ``` ##### Response Example ```json { "code": 1, "msg": "Backup restored successfully", "data": { "restored_at": "2026-01-06T13:00:00Z", "echos_count": 150, "users_count": 5, "files_count": 230 } } ``` ### Automated Backup Schedule #### Get backup schedule ##### Method GET ##### Endpoint `/api/backup/schedule` ##### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. #### Configure automatic backups ##### Method POST ##### Endpoint `/api/backup/schedule` ##### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. - **Content-Type** (string) - Required - `application/json` #### Request Body - **enabled** (boolean) - Required - Whether the backup schedule is enabled. - **cron_expression** (string) - Required - Cron expression for scheduling backups (e.g., "0 2 * * *"). - **retention_days** (integer) - Optional - Number of days to retain backups. - **backup_location** (string) - Optional - Directory path for storing backups. ##### Response (Success Response - 200) - **code** (integer) - Status code, 1 indicates success. - **msg** (string) - Message indicating success. - **data** (object) - Backup schedule details. - **enabled** (boolean) - Indicates if the schedule is enabled. - **cron_expression** (string) - The configured cron expression. - **next_run** (string) - Timestamp for the next scheduled backup run. - **retention_days** (integer) - The configured retention period in days. ##### Request Example (Configure) ```bash curl -X POST http://localhost:6277/api/backup/schedule \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "enabled": true, "cron_expression": "0 2 * * *", "retention_days": 30, "backup_location": "/app/backup" }' ``` ##### Response Example ```json { "code": 1, "msg": "Backup schedule updated", "data": { "enabled": true, "cron_expression": "0 2 * * *", "next_run": "2026-01-07T02:00:00Z", "retention_days": 30 } } ``` ### Cron Expression Examples - `"0 2 * * *"` - Daily at 2:00 AM - `"0 0 * * 0"` - Weekly on Sunday at midnight - `"0 */6 * * *"` - Every 6 hours ``` -------------------------------- ### User Registration - Bash Source: https://context7.com/lin-snow/ech0/llms.txt Creates a new user account by sending a POST request to the /api/register endpoint with username and password. The first user to register is automatically assigned administrator privileges. The response includes a JWT token for the newly created user. ```bash curl -X POST http://localhost:6277/api/register \ -H "Content-Type: application/json" \ -d '{ "username": "newuser", "password": "secure_password123" }' # Response { "code": 1, "msg": "Registration successful", "data": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "user": { "id": 2, "username": "newuser", "is_admin": false, "created_at": "2026-01-06T00:00:00Z" } } } ``` -------------------------------- ### Get Echos by Tag ID Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves echos associated with a specific tag. ```APIDOC ## GET /api/echo/tag/{tagId} ### Description Retrieves echos associated with a specific tag. ### Method GET ### Endpoint /api/echo/tag/{tagId} ### Parameters #### Path Parameters - **tagId** (integer) - Required - The ID of the tag to filter by. ### Request Example ```bash curl -X GET http://localhost:6277/api/echo/tag/1 \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Manage Webhooks Source: https://context7.com/lin-snow/ech0/llms.txt Manages webhooks for event-driven integrations. Supports listing, creating, updating, and deleting webhooks. When creating a webhook, specify the URL, a secret for signature verification, and the events to subscribe to. ```bash # List all webhooks curl -X GET http://localhost:6277/api/webhook \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` ```bash # Create a new webhook curl -X POST http://localhost:6277/api/webhook \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "url": "https://api.example.com/webhook", "secret": "webhook-secret-key", "events": ["echo.created", "echo.updated", "user.created"], "enabled": true, "description": "Notify external system of content changes" }' ``` ```bash # Update webhook curl -X PUT http://localhost:6277/api/webhook \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "id": 1, "enabled": false }' ``` ```bash # Delete webhook curl -X DELETE http://localhost:6277/api/webhook/1 \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Get Today's Echos Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves all echos created on the current day. ```APIDOC ## GET /api/echo/today ### Description Retrieves all echos created on the current day. ### Method GET ### Endpoint /api/echo/today ### Request Example ```bash curl -X GET http://localhost:6277/api/echo/today \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Access Application with ClusterIP Service (Port Forwarding) Source: https://github.com/lin-snow/ech0/blob/main/charts/ech0/templates/NOTES.txt Provides instructions to access an application using a ClusterIP service by setting up port forwarding. It retrieves the pod name and initiates a local port forward to the service's HTTP port. This method is suitable for local development and testing. Requires kubectl. ```shell {{- else if contains "ClusterIP" .Values.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "ech0.name" . }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:{{ .Values.service.httpPort }} {{- end }} ``` -------------------------------- ### GET /api/echos Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves a list of 'Echo' posts with support for filtering, searching, and pagination. ```APIDOC ## Query Echos with Pagination ### Description Retrieve echos with filtering, search, and pagination support. ### Method GET ### Endpoint /api/echos ### Query Parameters - **search** (string) - Optional - Search term to filter echos. - **page** (integer) - Optional - Page number for pagination (defaults to 1). - **limit** (integer) - Optional - Number of results per page (defaults to 20). - **tag** (string) - Optional - Filter echos by a specific tag. ### Response #### Success Response (200) - **code** (integer) - Status code (1 for success). - **msg** (string) - Success message. - **data** (object) - Contains pagination information and a list of echos. - **echos** (array) - List of echo objects. - **id** (integer) - Unique identifier for the echo. - **content** (string) - The markdown content. - **username** (string) - The username of the echo creator. - **images** (array) - List of images included. - **layout** (string) - Image layout type. - **private** (boolean) - Privacy setting. - **tags** (array) - List of tags associated with the echo. - **id** (integer) - Tag ID. - **name** (string) - Tag name. - **usage_count** (integer) - How many times this tag has been used. - **fav_count** (integer) - Number of favorites. - **created_at** (string) - ISO 8601 timestamp of creation. - **pagination** (object) - Pagination details. - **current_page** (integer) - The current page number. - **next_page** (integer) - The next page number, or null if on the last page. - **prev_page** (integer) - The previous page number, or null if on the first page. - **total_pages** (integer) - The total number of pages. - **total_items** (integer) - The total number of items across all pages. ### Response Example { "code": 1, "msg": "Echos retrieved successfully", "data": { "echos": [ { "id": 42, "content": "# My First Post...", "username": "admin", "images": [...], "layout": "waterfall", "private": false, "tags": [ {"id": 1, "name": "technology", "usage_count": 15}, {"id": 2, "name": "golang", "usage_count": 8}, {"id": 3, "name": "tutorial", "usage_count": 3} ], "fav_count": 0, "created_at": "2026-01-06T12:30:00Z" } ], "pagination": { "current_page": 1, "next_page": 2, "prev_page": null, "total_pages": 10, "total_items": 200 } } } ``` -------------------------------- ### Ech0 CLI Commands Source: https://context7.com/lin-snow/ech0/llms.txt This section details the various commands available through the Ech0 command-line interface for managing the server, backups, and system information. ```APIDOC ## Ech0 CLI Commands ### Description Commands for starting the web server, managing the terminal UI, handling backups, and displaying system information. ### Commands - **`./ech0 serve`**: Start the web server. - **`./ech0 tui`**: Launch the Terminal UI for interactive management. - **`./ech0 backup`**: Create a backup of the system. - **`./ech0 restore /path/to/backup_20260106.zip`**: Restore from a backup file. - **`./ech0 version`**: Display version information. - **`./ech0 info`**: Display system information. - **`./ech0 hello`**: Display the Ech0 ASCII logo. ``` -------------------------------- ### Login with Passkey (JavaScript) Source: https://context7.com/lin-snow/ech0/llms.txt This function enables users to log in using their passkey. It begins by requesting login challenges from the server, then retrieves the user's credential via the WebAuthn API, and finally completes the login process by sending the credential for verification. It returns a JWT token upon successful authentication. ```javascript async function loginWithPasskey() { // Step 1: Begin login const beginResp = await fetch('/api/passkey/login/begin', { method: 'POST', headers: { 'Content-Type': 'application/json' } }); const { nonce, publicKey } = await beginResp.json(); // Step 2: Get credential const credential = await navigator.credentials.get({ publicKey: publicKey }); // Step 3: Complete login const finishResp = await fetch('/api/passkey/login/finish', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ nonce: nonce, credential: { id: credential.id, rawId: arrayBufferToBase64(credential.rawId), type: credential.type, response: { authenticatorData: arrayBufferToBase64(credential.response.authenticatorData), clientDataJSON: arrayBufferToBase64(credential.response.clientDataJSON), signature: arrayBufferToBase64(credential.response.signature), userHandle: arrayBufferToBase64(credential.response.userHandle) } } }) }); const result = await finishResp.json(); // result.data.token contains JWT for authenticated requests return result; } ``` -------------------------------- ### Get Specific Echo by ID Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves a single echo based on its unique identifier. ```APIDOC ## GET /api/echo/{id} ### Description Retrieves a specific echo by its ID. ### Method GET ### Endpoint /api/echo/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the echo to retrieve. ### Request Example ```bash curl -X GET http://localhost:6277/api/echo/42 \ -H "Authorization: Bearer YOUR_JWT_TOKEN" ``` -------------------------------- ### Update System Settings Source: https://context7.com/lin-snow/ech0/llms.txt Updates site-wide settings including branding, registration, and custom styles. Requires authentication. ```APIDOC ## PUT /api/settings ### Description Updates site-wide settings including branding, registration, and custom styles. Requires authentication. ### Method PUT ### Endpoint /api/settings ### Parameters #### Request Body - **site_title** (string) - Optional - The new title for the website. - **server_url** (string) - Optional - The new URL for the server. - **allow_register** (boolean) - Optional - Whether to allow user registration. - **custom_css** (string) - Optional - New custom CSS styles. ### Request Example ```json { "site_title": "Updated Ech0 Site", "server_url": "https://memo.example.com", "allow_register": false, "custom_css": ".header { background: #333; }" } ``` ``` -------------------------------- ### AI Agent Configuration Source: https://context7.com/lin-snow/ech0/llms.txt Configure AI models for content assistance and automation. ```APIDOC ## AI Agent Configuration ### Description Configure AI models for intelligent content assistance and automation. ## GET /api/agent/settings ### Description Retrieves the current AI agent settings. ### Method GET ### Endpoint /api/agent/settings ## PUT /api/agent/settings ### Description Configures or updates the AI agent settings. The request body depends on the provider. ### Method PUT ### Endpoint /api/agent/settings ### Parameters #### Request Body - **enable** (boolean) - Required - Whether to enable the AI agent. - **provider** (string) - Required - The AI provider (e.g., "openai", "deepseek", "ollama"). - **model** (string) - Required - The specific AI model to use. - **api_key** (string) - Required (for external providers) - The API key for the AI service. - **prompt** (string) - Optional - A system prompt to guide the AI's behavior. - **base_url** (string) - Optional - The base URL for the AI service (e.g., for self-hosted or alternative endpoints). ### Request Example (OpenAI) ```json { "enable": true, "provider": "openai", "model": "gpt-4", "api_key": "sk-xxxxxxxxxxxxxxxx", "prompt": "You are a helpful assistant for Ech0 platform users.", "base_url": "https://api.openai.com/v1" } ``` ### Request Example (DeepSeek) ```json { "enable": true, "provider": "deepseek", "model": "deepseek-chat", "api_key": "your-deepseek-key", "base_url": "https://api.deepseek.com" } ``` ### Request Example (Ollama) ```json { "enable": true, "provider": "ollama", "model": "llama2", "base_url": "http://localhost:11434" } ``` ``` -------------------------------- ### Create Echo with Markdown Content (cURL) Source: https://context7.com/lin-snow/ech0/llms.txt This command demonstrates how to create a new echo post with rich markdown content, including text formatting, code blocks, images from URLs or S3, layout options, privacy settings, tags, and multimedia extensions. It requires an authorization token and specifies the content structure in JSON format. ```bash # Create a new echo with markdown, images, and tags curl -X POST http://localhost:6277/api/echo \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "content": "# My First Post\n\nThis is a **markdown** formatted post with *rich* text support!\n\n- Feature 1\n- Feature 2\n- Feature 3\n\n```go\nfunc main() {\n fmt.Println(\"Hello Ech0!\")\n}\n```", "images": [ { "image_url": "https://example.com/photo1.jpg", "image_source": "url", "width": 1920, "height": 1080 }, { "image_url": "https://mybucket.s3.amazonaws.com/photo2.jpg", "image_source": "s3", "object_key": "uploads/photo2.jpg", "width": 1280, "height": 720 } ], "layout": "waterfall", "private": false, "tags": [ {"name": "technology"}, {"name": "golang"}, {"name": "tutorial"} ], "extension_type": "MUSIC", "extension": "https://music.163.com/#/song?id=12345" }' # Response { "code": 1, "msg": "Echo created successfully", "data": { "id": 42, "content": "# My First Post...", "username": "admin", "images": [...], "layout": "waterfall", "private": false, "tags": [ {"id": 1, "name": "technology", "usage_count": 15}, {"id": 2, "name": "golang", "usage_count": 8}, {"id": 3, "name": "tutorial", "usage_count": 3} ], "fav_count": 0, "created_at": "2026-01-06T12:30:00Z" } } ``` -------------------------------- ### Get Specific Object using curl Source: https://context7.com/lin-snow/ech0/llms.txt Retrieves a specific ActivityStreams object, such as a Note, by its ID. This requires the Accept header set to application/activity+json. ```bash curl -X GET https://memo.example.com/objects/42 \ -H "Accept: application/activity+json" ``` -------------------------------- ### Update System Settings (PUT) Source: https://context7.com/lin-snow/ech0/llms.txt Updates system-wide settings such as site title, registration status, and custom CSS. Requires an Authorization header and a JSON payload with the settings to be updated. ```bash curl -X PUT http://localhost:6277/api/settings \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "site_title": "Updated Ech0 Site", "server_url": "https://memo.example.com", "allow_register": false, "custom_css": ".header { background: #333; }" }' ``` -------------------------------- ### Get Following Collection using curl Source: https://context7.com/lin-snow/ech0/llms.txt Fetches the collection of users that a specific actor is following. This API call requires the Accept header set to application/activity+json. ```bash curl -X GET https://memo.example.com/users/admin/following \ -H "Accept: application/activity+json" ``` -------------------------------- ### OAuth2/OIDC Authentication - Bash Source: https://context7.com/lin-snow/ech0/llms.txt Initiates OAuth2/OIDC login flows for providers like GitHub, Google, and QQ. It also supports binding third-party accounts to an existing user using a JWT token. Endpoint /api/oauth/info retrieves information about currently bound accounts. ```bash # Initiate GitHub OAuth login curl http://localhost:6277/oauth/github/login?redirect_uri=https://yourdomain.com/callback # GitHub redirects to callback URL with authorization code # Backend automatically exchanges code for token and creates/logs in user # Bind GitHub account to existing user (requires authentication) curl -X POST http://localhost:6277/api/oauth/github/bind \ -H "Authorization: Bearer YOUR_JWT_TOKEN" # Get OAuth binding information curl -X GET http://localhost:6277/api/oauth/info \ -H "Authorization: Bearer YOUR_JWT_TOKEN" # Response showing bound accounts { "code": 1, "msg": "Success", "data": { "github": { "provider": "github", "provider_user_id": "12345678", "username": "githubuser", "email": "user@example.com", "bound_at": "2026-01-05T10:30:00Z" } } } ``` -------------------------------- ### Get Followers Collection using curl Source: https://context7.com/lin-snow/ech0/llms.txt Fetches the collection of users following a specific actor. This API call requires the Accept header set to application/activity+json. ```bash curl -X GET https://memo.example.com/users/admin/followers \ -H "Accept: application/activity+json" ``` -------------------------------- ### Build Project for Production with pnpm Source: https://github.com/lin-snow/ech0/blob/main/web/README.md Compiles and minifies the project for production deployment. This command generates optimized build artifacts. ```shell pnpm build ```