### Run frontend locally Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development-workflow.md Commands to install dependencies and start the frontend development server. ```bash # Run frontend locally cd webs yarn install yarn run start ``` -------------------------------- ### Install Frontend Dependencies Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/build-and-deployment.md Prepares the environment and installs dependencies for the frontend build. ```bash cd webs corepack enable yarn install --immutable ``` -------------------------------- ### Run frontend development Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development.md Install dependencies and start the Vite development server from the webs directory. ```bash yarn install yarn run start ``` -------------------------------- ### Execute Installation or Update Script Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/installation.md A one-line script to perform a fresh install, update an existing installation, or restore data. ```bash sh -c "$(wget -qO- https://raw.githubusercontent.com/ZeroDeng01/sublinkPro/refs/heads/main/install.sh)" ``` -------------------------------- ### Run backend locally Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development-workflow.md Commands to initialize dependencies and start the backend service. ```bash # Run backend locally go mod download go run main.go ``` -------------------------------- ### Run backend development Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development.md Download dependencies and start the Go backend server on port 8000. ```bash go mod download go run main.go ``` -------------------------------- ### Install cloudflared on Windows Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Install cloudflared using Winget or by manually adding the executable to the system PATH. ```powershell winget install --id Cloudflare.cloudflared cloudflared version ``` ```powershell cloudflared version ``` -------------------------------- ### Install cloudflared binary on Linux Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Downloads the cloudflared binary for x86_64 architecture, sets executable permissions, and verifies the installation. ```bash sudo curl -L "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64" -o /usr/local/bin/cloudflared sudo chmod +x /usr/local/bin/cloudflared cloudflared version ``` -------------------------------- ### Install cloudflared on Alpine Linux Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Install the cloudflared binary manually on Alpine Linux systems. ```bash sudo mkdir -p /usr/local/bin sudo curl -L "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64" -o /usr/local/bin/cloudflared sudo chmod +x /usr/local/bin/cloudflared cloudflared version ``` -------------------------------- ### GET /c/ Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Fetches the rendered configuration output for a client. ```APIDOC ## GET /c/ ### Description Fetches the raw rendered output (clash/v2ray/surge) for a specific share token. ### Method GET ### Endpoint /c/ ### Parameters #### Query Parameters - **token** (string) - Required - The share token. - **client** (string) - Optional - Client type index. ``` -------------------------------- ### Start Development Mode Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/build-and-deployment.md Run the backend and frontend services in separate terminals for development. ```bash # Terminal 1: Backend go run main.go # Terminal 2: Frontend cd webs && yarn run start ``` -------------------------------- ### Install cloudflared on Arch Linux and Manjaro Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Download and install the cloudflared binary directly for Arch-based distributions. ```bash sudo curl -L "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64" -o /usr/local/bin/cloudflared sudo chmod +x /usr/local/bin/cloudflared cloudflared version ``` ```bash sudo curl -L "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64" -o /usr/local/bin/cloudflared sudo chmod +x /usr/local/bin/cloudflared cloudflared version ``` -------------------------------- ### Commit Message Example Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development-workflow.md Example of a completed commit message following the project standards. ```text feat(airports): support batch subscription updates Added batch update dialog with progress tracking. Users can select multiple airports and update them in parallel. Validation: - Backend: gofmt ✅, golangci-lint ✅, go test ./... ✅ - Frontend: yarn lint ✅, yarn build ✅ Cross-layer sync: - Backend: api/clients.go, services/subscription_service.go - Frontend: webs/src/api/airports.js, AirportBatchUpdateDialog.jsx - i18n: Added zh-CN and en-US translations - Docs: Updated skill-sublinkpro/reference/api.md Tests: - Added TestBatchUpdateAirports - Added service layer batch update tests - All tests passing ✅ Closes #789 ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/deploy.md Commands to initialize the defined Docker Compose services. ```bash docker-compose up -d # or: docker compose up -d ``` -------------------------------- ### Build and Test Commands Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/practical-recipes.md Standard commands for linting, building, and starting the development server for manual verification. ```bash cd webs yarn run lint yarn run build # Manual testing yarn run start # Switch between light/dark mode # Test on different screen sizes ``` -------------------------------- ### Implement Task with Progress Reporting Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development.md Example of creating a task, updating its progress, and marking it as complete using the TaskManager. ```go func ExecuteYourTaskWithProgress() { tm := getTaskManager() task, ctx, err := tm.CreateTask( models.TaskTypeYourType, "你的任务名称", models.TaskTriggerScheduled, 100, ) if err != nil { utils.Error("创建任务失败: %v", err) return } taskID := task.ID for i := 1; i <= 100; i++ { select { case <-ctx.Done(): utils.Info("任务被取消") return default: } tm.UpdateProgress(taskID, i, "当前处理项", map[string]interface{}{ "status": "success", }) } tm.CompleteTask(taskID, "任务完成", map[string]interface{}{ "total": 100, }) } ``` -------------------------------- ### Verify cloudflared installation Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Check that the cloudflared utility is correctly installed and accessible in the system PATH. ```bash cloudflared version ``` -------------------------------- ### Install cloudflared on macOS Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Use Homebrew to install or upgrade the cloudflared utility on macOS systems. ```bash brew install cloudflared cloudflared version ``` ```bash brew upgrade cloudflared ``` -------------------------------- ### Deploy with Docker Compose Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/build-and-deployment.md Commands to build and start the application services using Docker Compose. ```bash docker-compose build docker-compose up -d ``` -------------------------------- ### Provide AI instructions Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/template-ai.md Example of a clear, bounded instruction for the AI model. ```text Keep the existing comments and node placeholder structure. Only add one manual switching policy group for Japan. ``` -------------------------------- ### Install Cloudflare Tunnel Connector Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Commands to install the Cloudflare Tunnel service on Linux or Windows using the provided tunnel token. ```bash sudo cloudflared service install eyJhIjoi...省略...In0= ``` ```powershell cloudflared.exe service install eyJhIjoi...省略...In0= ``` -------------------------------- ### Install the SublinkPro skill Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/README.md Copy the skill directory to the AI agent's local configuration path. ```bash cp -r skill-sublinkpro ~/.claude/skills/sublinkpro # or symlink if you cloned the repo ``` -------------------------------- ### Check host prerequisites Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/deploy.md Verify Docker installation, architecture, and root privileges on the target host before deployment. ```bash docker --version # is Docker installed? docker compose version # v2 compose plugin (preferred) docker-compose version # v1 standalone compose (older hosts) uname -m # arch: x86_64 -> amd64, aarch64 -> arm64, armv7l -> armv7, i386/i686 -> x86 id -u # 0 means root (the install script requires root) ``` -------------------------------- ### Public Hostname Configuration Summary Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Example configuration values for mapping a public hostname to a local service URL. ```text Public hostname: https://sub.example.com Service type: HTTP Service URL: localhost:8000 ``` -------------------------------- ### Start SublinkPro Service Source: https://github.com/zerodeng01/sublinkpro/blob/main/README.md Command to initialize the Docker container in detached mode. ```bash docker-compose up -d ``` -------------------------------- ### Migration DSN Configuration Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/configuration.md Example DSN configurations for setting up a new instance during the migration process. ```yaml # MySQL dsn: mysql://user:pass@tcp(mysql:3306)/sublink?charset=utf8mb4&parseTime=True&loc=Local # PostgreSQL dsn: postgres://user:pass@postgres:5432/sublink?sslmode=disable ``` -------------------------------- ### Command Line Interface Usage Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/configuration.md Common CLI commands for starting the application, specifying database connections, and managing administrative settings. ```bash # Show help ./sublinkpro help # Start with a specific port ./sublinkpro run --port 9000 # Use a specific SQLite database ./sublinkpro run --dsn "sqlite:///data/sublink.db" # Use MySQL ./sublinkpro run --dsn "mysql://user:pass@tcp(127.0.0.1:3306)/sublink?charset=utf8mb4&parseTime=True&loc=Local" # Use PostgreSQL ./sublinkpro run --dsn "postgres://user:pass@127.0.0.1:5432/sublink?sslmode=disable" # Set the local data directory, used for config file, GeoIP, and default SQLite ./sublinkpro run --db /data # Reset admin password ./sublinkpro setting -username admin -password newpass ``` -------------------------------- ### Cron Format Reference Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/practical-recipes.md Visual guide for configuring cron schedule strings. ```text ┌───────────── minute (0 - 59) │ ┌───────────── hour (0 - 23) │ │ ┌───────────── day of month (1 - 31) │ │ │ ┌───────────── month (1 - 12) │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday) │ │ │ │ │ * * * * * ``` -------------------------------- ### API Request Examples with Python Helper Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/SKILL.md Using the optional sublink.py script to handle authentication and content-type routing automatically. ```bash python scripts/sublink.py GET /api/v1/nodes/get --query page=1 --query pageSize=50 python scripts/sublink.py POST /api/v1/nodes/add --form link='vless://...' --form group='US' python scripts/sublink.py POST /api/v1/airports --json name='MyAirport' --json enabled=true python scripts/sublink.py GET /c/ --query token='' --raw ``` -------------------------------- ### Run SublinkPro with Docker Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/installation.md Commands to start the SublinkPro container with persistent volumes for database, templates, and logs. ```bash docker run --name sublinkpro -p 8000:8000 \ -v $PWD/db:/app/db \ -v $PWD/template:/app/template \ -v $PWD/logs:/app/logs \ -d zerodeng/sublink-pro ``` ```bash docker run --name sublinkpro -p 8000:8000 \ -v $PWD/db:/app/db \ -v $PWD/template:/app/template \ -v $PWD/logs:/app/logs \ -d zerodeng/sublink-pro:dev ``` -------------------------------- ### Allowed Temporary File Creation Source: https://github.com/zerodeng01/sublinkpro/blob/main/AGENTS.md Examples of the correct approach for creating temporary files within the designated project-local directory. ```bash # Use project-local .tmp/ for temporary files mkdir -p .tmp echo "# Summary" > .agents/.tmp/implementation_summary.md # Use project-local .tmp/ for test files cat > .agents/.tmp/test_feature.go << 'EOF' ``` -------------------------------- ### API Request Examples with curl Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/SKILL.md Common curl patterns for different API content types and operations. ```bash # Get version (public, no key needed) curl -s "$SUBLINK_BASE_URL/api/v1/version" # Add a node (form) curl -s -H "X-API-Key: $SUBLINK_API_KEY" \ --data-urlencode 'link=vless://...' --data-urlencode 'group=US' \ "$SUBLINK_BASE_URL/api/v1/nodes/add" # Create an airport (JSON) curl -s -H "X-API-Key: $SUBLINK_API_KEY" -H "Content-Type: application/json" \ -d '{"name":"MyAirport","url":"https://...","cronExpr":"0 */6 * * *","enabled":true}' \ "$SUBLINK_BASE_URL/api/v1/airports" # List nodes (GET + query) curl -s -H "X-API-Key: $SUBLINK_API_KEY" \ "$SUBLINK_BASE_URL/api/v1/nodes/get?page=1&pageSize=50" # Fetch subscription output (raw — uses a share token, not the API key) curl -s "$SUBLINK_BASE_URL/c/?token=" ``` -------------------------------- ### Configure Node Name Rule Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/subscription-share.md Example of a naming rule string using variables to format the output node name. ```text [$Flag] $LinkCountryName - $LinkName $DuplicateIndex ``` -------------------------------- ### Database Connection Strings Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/deploy.md Examples of DSN strings for MySQL and PostgreSQL connections to be used with the SUBLINK_DSN environment variable. ```text mysql://user:pass@tcp(mysql:3306)/sublink?charset=utf8mb4&parseTime=True&loc=Local postgres://user:pass@postgres:5432/sublink?sslmode=disable ``` -------------------------------- ### Define Host Mapping Use Cases Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/host.md Examples of common scenarios for host mapping, such as CDN optimization and DNS pollution bypass. ```text Case 1: CDN preferred IPs ├── Map Cloudflare node domains to preferred IPs └── Save the best resolved result automatically after speed tests Case 2: DNS pollution bypass ├── Manually set the correct IP for polluted domains └── Use the correct resolution in all proxy operations Case 3: Batch import ├── Edit many mappings at once in text mode └── Format: example.com 192.168.1.1 # note ``` -------------------------------- ### Lint and Build Frontend for Production Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/build-and-deployment.md Runs linting and creates optimized static assets for production. ```bash cd webs yarn run lint yarn run build ``` -------------------------------- ### Clone the project Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development.md Initial step to download the repository and navigate to the project directory. ```bash git clone https://github.com/ZeroDeng01/sublinkPro.git cd sublinkPro ``` -------------------------------- ### Build backend binary Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development.md Compile the backend into an executable for local development or quick testing. ```bash go build -o sublinkpro main.go ``` -------------------------------- ### Install cloudflared on Debian-based Linux Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Install cloudflared using the official Cloudflare APT repository for Debian and Ubuntu distributions. ```bash sudo mkdir -p --mode=0755 /usr/share/keyrings curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main' | sudo tee /etc/apt/sources.list.d/cloudflared.list sudo apt-get update sudo apt-get install cloudflared cloudflared version ``` ```bash echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared noble main' | sudo tee /etc/apt/sources.list.d/cloudflared.list sudo apt-get update sudo apt-get install cloudflared cloudflared version ``` -------------------------------- ### Register a new protocol Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development.md Use this template to register a protocol with full parsing and Surge support. The init function initializes the protocol specification and registers it with the system. ```go func init() { base := newProtocolSpec( "myprotocol", []string{"myprotocol://"}, "MyProtocol", "#1976d2", "M", MyProtocol{}, "Name", DecodeMyProtocolURL, EncodeMyProtocolURL, func(p MyProtocol) LinkIdentity { return buildIdentity("myprotocol", p.Name, p.Server, utils.GetPortString(p.Port)) }, // Optional: manual field schema. If omitted, reflection generates it from the struct. ) // Optional: override client compatibility. If omitted, constructor defaults are used. // base = base.WithClientSupport(ClientClash, ClientMihomo) MustRegisterProtocol(newProxySurgeProtocolSpec( base, buildMyProtocolProxy, func(proxy Proxy) bool { return proxyTypeMatches(proxy, "myprotocol") }, ConvertProxyToMyProtocol, EncodeMyProtocolURL, buildMyProtocolSurgeLine, )) } ``` -------------------------------- ### Install cloudflared on RPM-based Linux Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/cloudflare-tunnel.md Install or update cloudflared on RHEL, CentOS, Fedora, and Amazon Linux using RPM packages. ```bash curl -L --output cloudflared.rpm "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-x86_64.rpm" sudo rpm -i cloudflared.rpm cloudflared version ``` ```bash curl -L --output cloudflared.rpm "https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-aarch64.rpm" sudo rpm -i cloudflared.rpm cloudflared version ``` ```bash sudo rpm -U cloudflared.rpm ``` -------------------------------- ### GET /api/v1/hosts/list Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves a list of hosts. ```APIDOC ## GET /api/v1/hosts/list ### Description Retrieves a list of all configured hosts. ### Method GET ### Endpoint /api/v1/hosts/list ``` -------------------------------- ### Define Protocol File Path Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development.md Create a new protocol implementation file within the designated directory. ```text node/protocol/myprotocol.go ``` -------------------------------- ### GET /api/v1/tags/list Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves a list of all tags. ```APIDOC ## GET /api/v1/tags/list ### Description Retrieves a list of all tags. ### Method GET ### Endpoint /api/v1/tags/list ``` -------------------------------- ### GET /api/v1/auth/captcha Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves a captcha challenge. ```APIDOC ## GET /api/v1/auth/captcha ### Description Retrieves a captcha challenge for authentication. ### Method GET ### Endpoint /api/v1/auth/captcha ``` -------------------------------- ### GET /api/v1/total/sub Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves the total count of subscriptions. ```APIDOC ## GET /api/v1/total/sub ### Description Retrieves the total count of subscriptions. ### Method GET ### Endpoint /api/v1/total/sub ``` -------------------------------- ### Build Backend for Local Development Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/build-and-deployment.md Compiles the Go application into a development binary without embedded frontend assets. ```bash # From repository root go build -o sublinkpro main.go ``` -------------------------------- ### GET /api/v1/group-sort/groups Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves a list of groups for sorting. ```APIDOC ## GET /api/v1/group-sort/groups ### Description Retrieves a list of groups available for sorting. ### Method GET ### Endpoint /api/v1/group-sort/groups ``` -------------------------------- ### Run Backend Development Tasks Source: https://github.com/zerodeng01/sublinkpro/blob/main/CONTRIBUTING.md Commands to be executed from the repository root for formatting, linting, and testing Go code. ```bash gofmt -w # Format changed Go files golangci-lint run # Run linter go test ./... # Run all tests ``` -------------------------------- ### GET /api/v1/geoip/status Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves the current GeoIP status. ```APIDOC ## GET /api/v1/geoip/status ### Description Retrieves the current status of the GeoIP service. ### Method GET ### Endpoint /api/v1/geoip/status ``` -------------------------------- ### GET /api/v1/node-check/meta Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves metadata for node checks. ```APIDOC ## GET /api/v1/node-check/meta ### Description Retrieves metadata for node checks. ### Method GET ### Endpoint /api/v1/node-check/meta ``` -------------------------------- ### GET /api/v1/tasks Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Lists tasks with pagination support. ```APIDOC ## GET /api/v1/tasks ### Description Lists tasks with pagination support. ### Method GET ### Endpoint /api/v1/tasks ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number - **pageSize** (integer) - Optional - Number of items per page ``` -------------------------------- ### GET /api/v1/script/list Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves a paginated list of scripts. ```APIDOC ## GET /api/v1/script/list ### Description Retrieves a paginated list of scripts. ### Method GET ### Endpoint /api/v1/script/list ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number - **pageSize** (integer) - Optional - Number of items per page ``` -------------------------------- ### Production Credential Management Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/security-guidelines.md Instructions for handling default credentials during initial deployment. ```bash # Login with default credentials # Navigate to: Settings → Security → Change Password # Or use API to change password programmatically ``` -------------------------------- ### GET /country-rules/export Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Export all country rules as text. ```APIDOC ## GET /country-rules/export ### Description Export all country rules as text. ### Method GET ### Endpoint /api/v1/country-rules/export ``` -------------------------------- ### GET /api/v1/airports Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieve a paginated list of airports. ```APIDOC ## GET /api/v1/airports ### Description List all airports with pagination support. ### Method GET ### Endpoint /api/v1/airports ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number - **pageSize** (integer) - Optional - Number of items per page ``` -------------------------------- ### Run Backend Validation Commands Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development-workflow.md Execute formatting, linting, and testing for the Go backend. ```bash # Format gofmt -w # Lint golangci-lint run # Test go test ./... ``` -------------------------------- ### Prepare Static Assets Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/build-and-deployment.md Copies the built frontend assets into the root static directory for embedding. ```bash # From repository root rm -rf static mkdir -p static cp -R webs/dist/. static/ ``` -------------------------------- ### GET /api/v1/nodes/get Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves a paginated list of nodes. ```APIDOC ## GET /api/v1/nodes/get ### Description Retrieves a list of nodes with pagination support. ### Method GET ### Endpoint /api/v1/nodes/get ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number to retrieve. - **pageSize** (integer) - Optional - The number of items per page. ``` -------------------------------- ### GET /api/v1/airports/{id} Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieve details for a specific airport. ```APIDOC ## GET /api/v1/airports/{id} ### Description Retrieve details for a single airport by its ID. ### Method GET ### Endpoint /api/v1/airports/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the airport ``` -------------------------------- ### Get Subscriptions Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves a list of subscriptions, optionally paginated. ```APIDOC ## GET /subcription/get ### Description Retrieves subscriptions. Returns a paginated object if page parameters are provided, otherwise returns an array. ### Method GET ### Endpoint /subcription/get ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number - **pageSize** (integer) - Optional - Items per page ``` -------------------------------- ### GET /api/v1/backup/download Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Downloads a system backup. Note that this endpoint is demo-restricted. ```APIDOC ## GET /api/v1/backup/download ### Description Downloads a system backup. Note that this endpoint is demo-restricted. ### Method GET ### Endpoint /api/v1/backup/download ``` -------------------------------- ### Validate backend Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/development.md Format Go files, run linting, and execute tests to ensure code quality. ```bash gofmt -w golangci-lint run go test ./... ``` -------------------------------- ### GET /api/v1/tasks/{id} Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves details for a specific task by ID. ```APIDOC ## GET /api/v1/tasks/{id} ### Description Retrieves details for a specific task by ID. ### Method GET ### Endpoint /api/v1/tasks/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The task ID ``` -------------------------------- ### GET /api/v1/nodes/nodes/get Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves a paginated list of nodes based on filters. ```APIDOC ## GET /api/v1/nodes/nodes/get ### Description Returns a paginated list of nodes filtered by various criteria. ### Method GET ### Endpoint /api/v1/nodes/nodes/get ### Parameters #### Query Parameters - **search** (string) - Optional - **group** (string) - Optional - **source** (string) - Optional - **protocol** (string) - Optional - **maxDelay** (number) - Optional - **minSpeed** (number) - Optional - **sortBy** (string) - Optional - **sortOrder** (string) - Optional - **page** (number) - Optional - **pageSize** (number) - Optional - **countries[]** (array) - Optional - **tags[]** (array) - Optional ``` -------------------------------- ### Run Frontend Development Tasks Source: https://github.com/zerodeng01/sublinkpro/blob/main/CONTRIBUTING.md Commands to be executed from the webs/ directory for linting, building, and formatting frontend code. ```bash yarn run lint # Required for all frontend changes yarn run build # Required when affecting build, routing, or assets yarn run lint:fix # Auto-fix linting issues yarn run prettier # Format code ``` -------------------------------- ### GET /api/v1/accesskey/get/{userId} Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Lists API keys for a specific user. ```APIDOC ## GET /api/v1/accesskey/get/{userId} ### Description Retrieves a list of API keys associated with the specified user ID. ### Method GET ### Endpoint /api/v1/accesskey/get/{userId} ### Parameters #### Path Parameters - **userId** (string) - Required #### Query Parameters - **page** (integer) - Optional - **pageSize** (integer) - Optional ``` -------------------------------- ### Configure Asset Serving via Build Tags Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/build-and-deployment.md Conditional asset serving logic based on the presence of the prod build tag. ```go // Development: serves from filesystem http.FileServer(http.Dir("./webs/dist")) ``` ```go //go:embed static var staticFS embed.FS // Production: serves from embedded FS http.FS(staticFS) ``` -------------------------------- ### GET /country-rules Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md List all country rules with support for pagination and keyword filtering. ```APIDOC ## GET /country-rules ### Description List country rules. Query supports `page`, `pageSize`, and `keyword`. ### Method GET ### Endpoint /api/v1/country-rules ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number - **pageSize** (integer) - Optional - Number of items per page - **keyword** (string) - Optional - Search keyword ``` -------------------------------- ### Build Frontend for Local Development Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/build-and-deployment.md Compiles the React application into the webs/dist/ directory. ```bash # From webs/ directory cd webs yarn run build ``` -------------------------------- ### GET /api/v1/shares/get Source: https://github.com/zerodeng01/sublinkpro/blob/main/skill-sublinkpro/reference/api.md Retrieves a list of shares for a specific subscription with optional pagination and filtering. ```APIDOC ## GET /api/v1/shares/get ### Description Retrieves shares associated with a subscription ID. Supports pagination and sorting. ### Method GET ### Endpoint /api/v1/shares/get ### Parameters #### Query Parameters - **subId** (integer) - Required - The subscription ID. - **page** (integer) - Optional - Page number. - **pageSize** (integer) - Optional - Items per page. - **keyword** (string) - Optional - Search keyword. - **ipFilter** (string) - Optional - Filter by IP. - **sortBy** (string) - Optional - Sort field (access_count or name). - **sortOrder** (string) - Optional - Sort order (asc or desc). ``` -------------------------------- ### Implement Task Logic Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/practical-recipes.md Create a struct and Run method to encapsulate the task's execution logic. ```go package scheduler import ( "log" "time" "gorm.io/gorm" ) type CleanupTask struct { db *gorm.DB } func NewCleanupTask(db *gorm.DB) *CleanupTask { return &CleanupTask{db: db} } func (t *CleanupTask) Run() error { log.Println("Starting cleanup task...") // Cleanup logic here cutoff := time.Now().AddDate(0, 0, -30) // 30 days ago result := t.db.Where("created_at < ?", cutoff). Delete(&models.LogEntry{}) if result.Error != nil { return result.Error } log.Printf("Cleanup completed: %d rows deleted", result.RowsAffected) return nil } ``` -------------------------------- ### Build Backend with Embedded Assets Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/build-and-deployment.md Compiles the Go binary with production tags and stripped debug information. ```bash # From repository root CGO_ENABLED=0 go build -tags=prod -ldflags="-s -w" -o sublinkPro ``` -------------------------------- ### GET /api/v1/template/ai/edit-sessions/:sessionId Source: https://github.com/zerodeng01/sublinkpro/blob/main/docs/features/template-ai.md Retrieves the current state of a specific edit session preview. ```APIDOC ## GET /api/v1/template/ai/edit-sessions/:sessionId ### Description Read the current session preview state. ### Method GET ### Endpoint /api/v1/template/ai/edit-sessions/:sessionId ### Parameters #### Path Parameters - **sessionId** (string) - Required - The unique identifier for the edit session. ```