System API Documentation

Base Path

/system

Endpoints

System Information

GET /

Returns system initialization status and version information.

Response

{
  code: 200,
  data: {
    isInitialized: boolean,
    version: string,
    publishTime: number,  // Unix timestamp
    branch: string,
    changeLog: string,
    changeLogLink: string
  }
}

System Configuration

Get Configuration

GET /config

Retrieves system configuration.

Update Log Remove Frequency

PUT /config/log-remove-frequency

Request Body

{
  logRemoveFrequency: number | null
}

Update Cron Concurrency

PUT /config/cron-concurrency

Request Body

{
  cronConcurrency: number | null
}

Update Dependence Proxy

PUT /config/dependence-proxy

Request Body

{
  dependenceProxy: string | null
}

Update Node Mirror

PUT /config/node-mirror

Request Body

{
  nodeMirror: string | null
}

Update Python Mirror

PUT /config/python-mirror

Request Body

{
  pythonMirror: string | null
}

Update Linux Mirror

PUT /config/linux-mirror

Request Body

{
  linuxMirror: string | null
}

System Operations

Check Updates

PUT /update-check

Checks for system updates.

Update System

PUT /update

Performs system update.

Reload System

PUT /reload

Request Body

{
  type?: string | null
}

Send Notification

PUT /notify

Request Body

{
  title: string,
  content: string
}

Command Management

Run Command

PUT /command-run

Request Body

{
  command: string
}

Response Headers

  • Content-type: application/octet-stream
  • QL-Task-Pid: <process_id>

Stop Command

PUT /command-stop

Request Body

{
  command?: string,
  pid?: number
}

Data Management

Export Data

PUT /data/export

Exports system data.

Import Data

PUT /data/import

Request

  • Content-Type: multipart/form-data
  • Field: data (file)

Log Management

Get System Logs

GET /log

Query Parameters

{
  startTime?: string,
  endTime?: string,
  t?: string
}

Delete System Logs

DELETE /log

Deletes system logs.

Error Handling

All endpoints follow the same error handling pattern:

  • Errors are passed to the next middleware
  • Most successful responses return { code: 200, data: ... }
  • Error logging is handled by Winston logger

Notes

  • All routes are protected by celebrate/Joi validation
  • File operations use async fs promises
  • Temporary files are stored in configured tmp path
  • Log files include timestamps in format: YYYY-MM-DD-HH-mm-ss-SSS