### Cloudreve Task Queue Startup Output Source: https://github.com/cloudreve/cloudreve/wiki/Onedrive对接说明 This is an example of the expected output when the Cloudreve task queue starts successfully. It indicates the version, author, configuration details, and the start of worker threads. ```text Cloudreve Queue Go Version 1.0 Author: AaronLiu 2018/10/20 18:27:29 [INFO] Config information: {XXX https://XXX/Queue 4 1} 2018/10/20 18:27:29 [INFO] Basic Info: {"basePath":"XXX"} 2018/10/20 18:27:29 [Info] Thread 1 start 2018/10/20 18:27:30 [Info] Thread 2 start 2018/10/20 18:27:31 [Info] Thread 3 start 2018/10/20 18:27:32 [Info] Thread 4 start ``` -------------------------------- ### Install Cloudreve with Composer Source: https://github.com/cloudreve/cloudreve/wiki/安装说明 Installs the development version of Cloudreve using Composer. After dependency installation, a setup script will prompt for database credentials. ```bash #安装开发版 $ composer create-project hfo4/cloudreve:dev-master ``` -------------------------------- ### Run Cloudreve Task Queue in Background (screen) Source: https://github.com/cloudreve/cloudreve/wiki/Onedrive对接说明 To keep the task queue running in the background, use tools like 'screen'. This example shows how to start 'screen', run the task queue, and then detach from the screen session. ```bash screen ./taskqueue Ctrl+A D ``` -------------------------------- ### Install Composer Source: https://github.com/cloudreve/cloudreve/wiki/安装说明 Installs Composer, a dependency manager for PHP. Ensure you have PHP installed first. This command downloads the installer and moves it to a global binary location. ```bash curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer ``` -------------------------------- ### Start Aria2 with Configuration File Source: https://github.com/cloudreve/cloudreve/wiki/离线下载对接说明 Launch the Aria2 daemon using a specified configuration file. Adjust the path to your aria2.conf. ```shell aria2c.exe -conf-path=/home/aria2.conf ``` -------------------------------- ### Install Google Authenticator and QR Code Libraries with Composer Source: https://github.com/cloudreve/cloudreve/wiki/安装及初次使用FAQ Use Composer to install the necessary libraries for two-factor authentication, specifically the Google Authenticator library and the QR code generation library. ```bash composer require phpgangsta/googleauthenticator:dev-master composer require endroid/qrcode ``` -------------------------------- ### Start Cloudreve Task Queue Source: https://github.com/cloudreve/cloudreve/wiki/Onedrive对接说明 Execute the task queue handler to start processing tasks. This command should be run after configuring the 'conf.yaml' file. ```bash ./taskqueue ``` -------------------------------- ### Nginx URL Rewriting Configuration Source: https://github.com/cloudreve/cloudreve/wiki/安装说明 Provides Nginx configuration for URL rewriting, essential for Cloudreve to function correctly. This example assumes Cloudreve is installed in the root directory. Adjust the 'location' block if installed in a subdirectory. ```nginx location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } } ``` -------------------------------- ### Get Global Download Options with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves all global options set for the aria2 client. This includes options that have default values or have been explicitly set. ```go func (id *Client) GetGlobalOption() (m map[string]interface{}, err error) ``` -------------------------------- ### Get Specific Download Options with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves the options configured for a specific download identified by its GID. Does not return unset options without default values. ```go func (id *Client) GetOption(gid string) (m map[string]interface{}, err error) ``` -------------------------------- ### Get Download Files with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves a list of files associated with a specific download identified by its GID. ```go func (id *Client) GetFiles(gid string) (m map[string]interface{}, err error) ``` -------------------------------- ### Get Peers for a Download with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves a list of peers connected to a specific download identified by its GID. ```go func (id *Client) GetPeers(gid string) (m []map[string]interface{}, err error) ``` -------------------------------- ### Get Global Statistics with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Fetches overall statistics for the aria2 client, including aggregate download and upload speeds. ```go func (id *Client) GetGlobalStat() (m map[string]interface{}, err error) ``` -------------------------------- ### ChangePosition Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Changes the position of a download within the queue. Supports setting position from the start, current, or end of the queue. ```APIDOC ## aria2.changePosition(gid, pos, how) ### Description Changes the position of the download denoted by `gid`. `pos` is the target position (integer), and `how` specifies the reference point ('POS_SET', 'POS_CUR', 'POS_END'). ### Parameters - **gid** (string) - The identifier of the download. - **pos** (integer) - The target position. - **how** (string) - The reference point for the position ('POS_SET', 'POS_CUR', 'POS_END'). ### Response - **integer** - The final destination position of the download. ``` -------------------------------- ### Nginx URL Rewriting for Subdirectory Source: https://github.com/cloudreve/cloudreve/wiki/安装说明 Configures Nginx URL rewriting for Cloudreve when installed in a subdirectory. Replace 'youdomain' with the actual directory name. ```nginx location /youdomain/ { if (!-e $request_filename){ rewrite ^/youdomain/(.*)$ /youdomain/index.php?s=/$1 last; } } ``` -------------------------------- ### Change Download Position with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Modifies the position of a download within the queue. Supports setting position relative to the start, current position, or end of the queue. ```go func (id *Client) ChangePosition(gid string, pos int, how string) (p int, err error) ``` -------------------------------- ### GetOption Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves the specific configuration options for a given download. ```APIDOC ## aria2.getOption(gid) ### Description Returns the configuration options for the download denoted by `gid`. ### Parameters - **gid** (string) - The identifier of the download. ### Response - **map[string]interface{}** - A map where keys are option names and values are their string representations. ``` -------------------------------- ### Initialize Aria2 Client Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Creates a new instance of the Aria2 client, connecting to the specified RPC URI. ```go func New(uri string) *Client ``` -------------------------------- ### Add URI Download Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Adds new HTTP(S)/FTP/BitTorrent Magnet URIs. For Magnet URIs, only one element should be in the `uris` array. All URIs should point to the same file. Options can customize the download, and it can be inserted at a specific position. ```go func (id *Client) AddUri(uri string, options ...interface{}) (gid string, err error) ``` -------------------------------- ### Go: Unpause All Downloads Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md This method is equivalent to calling Unpause for every active or waiting download. It returns 'OK' on success. ```go func (id *Client) UnpauseAll() (g string, err error) ``` -------------------------------- ### Download and Extract Cloudreve Task Queue (Linux) Source: https://github.com/cloudreve/cloudreve/wiki/Onedrive对接说明 Use these commands to download the Cloudreve task queue handler for Linux (amd64 architecture) and extract it. Ensure you replace 'X.X' with the actual version number. This program is necessary for handling Onedrive uploads. ```bash wget https://github.com/HFO4/CloudreveTaskQueue/releases/download/X.X/taskqueue_X.X_linux_amd64.tar.gz tar -zxvf taskqueue_X.X_linux_amd64.tar.gz ``` -------------------------------- ### Change Download Options Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Dynamically changes options for a specific download identified by its GID. Only certain options like 'bt-max-peers' are available for active downloads. ```go func (id *Client) ChangeOption(gid string, options map[string]interface{}) (g string, err error) ``` -------------------------------- ### Apache X-Sendfile Configuration Source: https://github.com/cloudreve/cloudreve/wiki/启用Sendfile下载支持 Load and enable the mod_xsendfile module in your Apache site configuration. Ensure XSendFile is turned on and XSendFileAllowAbove is set to On. Incorrect 'Sendfile Header' selection in the backend may result in empty files. ```apache LoadModule xsendfile_module modules/mod_xsendfile.so XSendFile On XSendFileAllowAbove On ``` -------------------------------- ### Add URI Download Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Adds a new download from one or more URIs (HTTP(S)/FTP/BitTorrent Magnet). For Magnet URIs, only one URI is supported. All URIs should point to the same file. Options can configure the download, and an optional position can set its place in the queue. ```APIDOC ## aria2.addUri ### Description Adds a new download from one or more URIs (HTTP(S)/FTP/BitTorrent Magnet). For Magnet URIs, only one URI is supported. All URIs should point to the same file. Options can configure the download, and an optional position can set its place in the queue. ### Method Signature `func (id *Client) AddUri(uri string, options ...interface{}) (gid string, err error)` ### Parameters - `uris` (array of strings): One or more URIs for the download. For Magnet URIs, this array must contain only one element. - `options` (...interface{}): Optional struct containing key-value pairs for download configuration. - `position` (integer, optional): The position in the waiting queue to insert the download. If not provided or out of bounds, it's appended to the end. ### Returns - `gid` (string): The GID of the registered download. - `err` (error): An error if the operation fails. ``` -------------------------------- ### Add Torrent Download Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Adds a BitTorrent download by uploading a Base64-encoded .torrent file. For Magnet URIs, use AddUri. Optional URIs can be provided for web-seeding, and options can customize the download. The download can be inserted at a specific position. ```go func (id *Client) AddTorrent(filename string, options ...interface{}) (gid string, err error) ``` -------------------------------- ### ForcePauseAll Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Pauses all active and waiting downloads immediately, similar to calling ForcePause on each. ```APIDOC ## aria2.forcePauseAll() ### Description Pauses all active and waiting downloads immediately without performing time-consuming actions. ### Response - **string** - 'OK' on success. ``` -------------------------------- ### Add Metalink Download Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Adds a Metalink download by uploading a Base64-encoded .metalink file. Options can be provided for customization, and the download can be inserted at a specific position in the queue. ```go func (id *Client) AddMetalink(uri string, options ...interface{}) (gid string, err error) ``` -------------------------------- ### Call RPC Method Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Use the Call function to invoke a remote method. Provide the server address, method name, parameters, and a reply interface. ```go func Call(address, method string, params, reply interface{}) error ``` -------------------------------- ### Go: Unpause a Specific Download Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Use this method to change the status of a download from paused to waiting, making it eligible to restart. Requires the download's GID. ```go func (id *Client) Unpause(gid string) (g string, err error) ``` -------------------------------- ### Configure Aria2 for RPC Service Source: https://github.com/cloudreve/cloudreve/wiki/离线下载对接说明 Enable the RPC service and set a secret token for secure communication with Cloudreve. Ensure the port is accessible. ```ini enable-rpc=true rpc-listen-port=6800 rpc-secret=SomeThingHardToGuess ``` -------------------------------- ### GetGlobalOption Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves the global configuration options for Aria2. ```APIDOC ## aria2.getGlobalOption() ### Description Returns the global options for Aria2. This includes options used as a template for new downloads. ### Response - **map[string]interface{}** - A map where keys are option names and values are their string representations. ``` -------------------------------- ### aria2.getServers Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves the list of connected HTTP(S)/FTP servers for a specified download GID. ```APIDOC ## aria2.getServers ### Description This method returns currently connected HTTP(S)/FTP servers of the download denoted by `gid`. ### Parameters #### Path Parameters - **gid** (string) - Required - The unique identifier for the download. ### Response #### Success Response (200) - **servers** (array) - A list of servers connected to the download. ``` -------------------------------- ### Add Torrent Download Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Adds a BitTorrent download by uploading a .torrent file. The .torrent content should be base64 encoded. URIs can be provided for Web-seeding. Options can configure the download, and an optional position can set its place in the queue. ```APIDOC ## aria2.addTorrent ### Description Adds a BitTorrent download by uploading a .torrent file. The .torrent content should be base64 encoded. URIs can be provided for Web-seeding. Options can configure the download, and an optional position can set its place in the queue. ### Method Signature `func (id *Client) AddTorrent(filename string, options ...interface{}) (gid string, err error)` ### Parameters - `filename` (string): Base64 encoded content of the .torrent file. - `uris` (array of strings, optional): URIs for Web-seeding. - `options` (...interface{}): Optional struct containing key-value pairs for download configuration. - `position` (integer, optional): The position in the waiting queue to insert the download. If not provided or out of bounds, it's appended to the end. ### Returns - `gid` (string): The GID of the registered download. - `err` (error): An error if the operation fails. ``` -------------------------------- ### aria2.tellWaiting Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves a list of waiting downloads, with options for pagination and filtering by keys. ```APIDOC ## aria2.tellWaiting ### Description This method returns the list of waiting download. `offset` is of type integer and specifies the `offset` from the oldest download. `num` is of type integer and specifies the number of downloads to be returned. For keys parameter, please refer to `aria2.tellStatus()` method. `offset` and `num` have the same semantics as `aria2.tellWaiting()` method. The response is of type array and its element is the same struct returned by `aria2.tellStatus()` method. ### Parameters #### Path Parameters - **offset** (integer) - Required - The offset from the oldest download. - **num** (integer) - Required - The number of downloads to return. - **keys** (array of string) - Optional - Specifies which keys to include in the response. If omitted, all keys are returned. ``` -------------------------------- ### ForcePause Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Immediately pauses a download without performing any time-consuming actions like contacting trackers. ```APIDOC ## aria2.forcePause(gid) ### Description Immediately pauses the download specified by `gid`, skipping any ongoing actions. ### Parameters - **gid** (string) - The identifier of the download to pause. ### Response - **string** - 'OK' on success. ``` -------------------------------- ### aria2.tellStopped Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves a list of stopped downloads, with options for pagination and filtering by keys. ```APIDOC ## aria2.tellStopped ### Description This method returns the list of stopped download. `offset` is of type integer and specifies the `offset` from the oldest download. `num` is of type integer and specifies the number of downloads to be returned. For keys parameter, please refer to `aria2.tellStatus()` method. `offset` and `num` have the same semantics as `aria2.tellWaiting()` method. The response is of type array and its element is the same struct returned by `aria2.tellStatus()` method. ### Parameters #### Path Parameters - **offset** (integer) - Required - The offset from the oldest download. - **num** (integer) - Required - The number of downloads to return. - **keys** (array of string) - Optional - Specifies which keys to include in the response. If omitted, all keys are returned. ``` -------------------------------- ### Cloudreve Task Queue Configuration (conf.yaml) Source: https://github.com/cloudreve/cloudreve/wiki/Onedrive对接说明 Configure the task queue by editing the 'conf.yaml' file. Set the token generated in the Cloudreve backend, the API endpoint for your Cloudreve site, the number of worker processes, and the polling interval. ```yaml #第2步中生成的Token token: SOME_THING_HARD_TO_GUESS #格式为:您的站点地址/Queue api: http://127.0.0.1/Queue #启动的进程数量 taskNum: 4 #轮询间隔 Duration: 20 ``` -------------------------------- ### aria2.pauseAll Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Pauses all active and waiting downloads. ```APIDOC ## aria2.pauseAll ### Description This method is equal to calling `aria2.pause()` for every active/waiting download. This methods returns OK for success. ### Response #### Success Response (200) - **status** (string) - 'OK' on success. ``` -------------------------------- ### Onedrive Callback URI Configuration Source: https://github.com/cloudreve/cloudreve/wiki/Onedrive对接说明 When creating a Microsoft application for Onedrive integration, ensure the callback URL is set to 'Your Site URL/Admin/oneDriveCalllback'. This is crucial for the authorization process. ```text 您的网站/Admin/oneDriveCalllback ``` -------------------------------- ### GetPeers Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves information about peers for a specific download. ```APIDOC ## aria2.getPeers(gid) ### Description Returns information about peers for the download denoted by `gid`. ### Parameters - **gid** (string) - The identifier of the download. ### Response - **[]map[string]interface{}** - A list of maps, where each map contains information about a peer. ``` -------------------------------- ### Schedule Cron Job Source: https://github.com/cloudreve/cloudreve/wiki/安装说明 Sets up a cron job to periodically execute a task for Cloudreve. This command should be added to your system's crontab. ```bash * * * * * curl http://你的域名/Cron ``` -------------------------------- ### GetFiles Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves the list of files associated with a specific download. ```APIDOC ## aria2.getFiles(gid) ### Description Returns the list of files for the download denoted by `gid`. ### Parameters - **gid** (string) - The identifier of the download. ### Response - **map[string]interface{}** - A map representing the file list. ``` -------------------------------- ### Add Metalink Download Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Adds a download from a Metalink file. The Metalink content should be base64 encoded. Options can be provided to configure the download, and an optional position can specify its place in the download queue. ```APIDOC ## aria2.addMetalink ### Description Adds a download from a Metalink file. The Metalink content should be base64 encoded. Options can be provided to configure the download, and an optional position can specify its place in the download queue. ### Method Signature `func (id *Client) AddMetalink(uri string, options ...interface{}) (gid string, err error)` ### Parameters - `uri` (string): Base64 encoded content of the .metalink file. - `options` (...interface{}): Optional struct containing key-value pairs for download configuration. - `position` (integer, optional): The position in the waiting queue to insert the download. If not provided or out of bounds, it's appended to the end. ### Returns - `gid` (string): The GID of the registered download. - `err` (error): An error if the operation fails. ``` -------------------------------- ### aria2.getVersion Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves the version of the Aria2 program and a list of its enabled features. ```APIDOC ## aria2.getVersion ### Description This method returns version of the program and the list of enabled features. ### Response #### Success Response (200) - **versionInfo** (map[string]interface{}) - A map containing version and features information. ``` -------------------------------- ### aria2.tellWaiting Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves a list of waiting and paused downloads. Supports pagination and reverse ordering. ```APIDOC ## aria2.tellWaiting ### Description This method returns the list of waiting download, including paused downloads. `offset` is of type integer and specifies the `offset` from the download waiting at the front. num is of type integer and specifies the number of downloads to be returned. For keys parameter, please refer to aria2.tellStatus() method. If `offset` is a positive integer, this method returns downloads in the range of `[offset, offset + num)`. `offset` can be a negative integer. `offset == -1` points last download in the waiting queue and `offset == -2` points the download before the last download, and so on. The downloads in the response are in reversed order. ### Parameters - **offset** (integer) - The starting offset for retrieving downloads. Can be positive or negative. - **num** (integer) - The number of downloads to return. - **keys** (array, optional) - Keys to filter the returned download status. Refer to `aria2.tellStatus()` for details. ### Response - **array** - An array of download status objects, in reversed order if offset is negative. ``` -------------------------------- ### aria2.unpauseAll Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Unpauses all active and waiting downloads. ```APIDOC ## aria2.unpauseAll ### Description This method is equal to calling `aria2.unpause()` for every active/waiting download. ### Method ```go func (id *Client) UnpauseAll() (g string, err error) ``` ### Response - **g** (string) - Returns "OK" for success. - **err** (error) - An error if the unpause operation fails. ``` -------------------------------- ### aria2.tellActive Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves a list of currently active downloads. Optional keys can filter the returned information. ```APIDOC ## aria2.tellActive ### Description This method returns the list of active downloads. The response is of type array and its element is the same struct returned by `aria2.tellStatus()` method. For `keys` parameter, please refer to `aria2.tellStatus()` method. ### Parameters #### Path Parameters - **keys** (array of string) - Optional - Specifies which keys to include in the response. If omitted, all keys are returned. ``` -------------------------------- ### Force Pause All Downloads with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Pauses all active and waiting downloads without performing any time-consuming actions. This is equivalent to calling ForcePause on each individual download. ```go func (id *Client) ForcePauseAll() (g string, err error) ``` -------------------------------- ### system.multicall Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Encapsulates multiple method calls into a single request for efficiency. ```APIDOC ## system.multicall ### Description This method encapsulates multiple method calls in a single request. `methods` is of type array and its element is struct. The struct contains two keys: `methodName` and `params`. `methodName` is the method name to call and `params` is array containing parameters to the method. This method returns array of responses. The element of array will either be a one-item array containing the return value of each method call or struct of fault element if an encapsulated method call fails. ### Parameters #### Path Parameters - **methods** (array) - Required - An array of method call objects, each with `methodName` and `params`. ### Response #### Success Response (200) - **responses** (array) - An array of results from the called methods. ``` -------------------------------- ### Grant Execute Permissions to Task Queue Source: https://github.com/cloudreve/cloudreve/wiki/Onedrive对接说明 After extracting the task queue handler, grant it execute permissions using chmod. This is a necessary step before running the program. ```bash chmod +x ./taskqueue ``` -------------------------------- ### Change Global Options Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Dynamically changes global options for Aria2. Accepts a map of option names and values. Some options like 'checksum', 'out', and 'pause' are not available for dynamic changes. ```go func (id *Client) ChangeGlobalOption(options map[string]interface{}) (g string, err error) ``` -------------------------------- ### Change Download Option Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Dynamically changes options for a specific download identified by its GID. This method is useful for modifying settings of active downloads. ```APIDOC ## aria2.changeOption ### Description Dynamically changes options for a specific download identified by its GID. This method is useful for modifying settings of active downloads. ### Method Signature `func (id *Client) ChangeOption(gid string, options map[string]interface{}) (g string, err error)` ### Parameters - `gid` (string): The unique identifier of the download whose options are to be changed. - `options` (map[string]interface{}): A map where keys are option names (e.g., `bt-max-peers`, `bt-request-peer-speed-limit`) and values are their new settings for the specified download. ### Returns - `g` (string): A confirmation string, typically "OK", upon successful modification. - `err` (error): An error if the operation fails. ``` -------------------------------- ### Force Pause a Download with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Immediately pauses a download without performing any time-consuming actions like contacting trackers. This is a more abrupt pause than the standard pause method. ```go func (id *Client) ForcePause(gid string) (g string, err error) ``` -------------------------------- ### aria2.unpause Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Changes the status of a download from paused to waiting, making it eligible to restart. ```APIDOC ## aria2.unpause ### Description This method changes the status of the download denoted by `gid` from paused to waiting. This makes the download eligible to restart. ### Method ```go func (id *Client) Unpause(gid string) (g string, err error) ``` ### Parameters - **gid** (string) - The unique identifier of the download to unpause. ### Response - **g** (string) - GID of the unpaused download. - **err** (error) - An error if the unpause operation fails. ``` -------------------------------- ### Aria2 Client Struct Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Defines the Client struct used for interacting with the Aria2 RPC. ```go type Client struct { // contains filtered or unexported fields } ``` -------------------------------- ### aria2.getPeers Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves the peer list for a given BitTorrent download identified by its GID. ```APIDOC ## aria2.getPeers ### Description This method returns peer list of the download denoted by `gid`. This method is for BitTorrent only. ### Parameters #### Path Parameters - **gid** (string) - Required - The unique identifier for the download. ### Response #### Success Response (200) - **peers** (array) - A list of peers connected to the download. ``` -------------------------------- ### aria2.tellStatus Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves the download progress status for a given GID. Supports filtering by specific keys. ```APIDOC ## aria2.tellStatus ### Description This method returns download progress of the download denoted by `gid`. `gid` is of type string. `keys` is array of string. If it is specified, the response contains only keys in `keys` array. If `keys` is empty or not specified, the response contains all keys. This is useful when you just want specific keys and avoid unnecessary transfers. For example, `aria2.tellStatus("2089b05ecca3d829", ["gid", "status"])` returns `gid` and `status` key. ### Parameters #### Path Parameters - **gid** (string) - Required - The unique identifier for the download. - **keys** (array of string) - Optional - Specifies which keys to include in the response. If omitted, all keys are returned. ``` -------------------------------- ### aria2.getSessionInfo Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves information about the current Aria2 session. ```APIDOC ## aria2.getSessionInfo ### Description This method returns session information. ### Response #### Success Response (200) - **sessionInfo** (map[string]interface{}) - A map containing session details. ``` -------------------------------- ### Force Remove a Download with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Removes a download immediately without performing any time-consuming actions like contacting trackers. This is a more abrupt removal than the standard remove method. ```go func (id *Client) ForceRemove(gid string) (g string, err error) ``` -------------------------------- ### aria2.getUris Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves the URIs associated with a specific download GID. ```APIDOC ## aria2.getUris ### Description This method returns URIs used in the download denoted by `gid`. ### Parameters #### Path Parameters - **gid** (string) - Required - The unique identifier for the download. ### Response #### Success Response (200) - **uris** (map[string]interface{}) - A map containing the URIs for the download. ``` -------------------------------- ### aria2.pause Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Pauses a download identified by its GID. The download status changes to 'paused'. ```APIDOC ## aria2.pause ### Description This method pauses the download denoted by `gid`. The status of paused download becomes paused. If the download is active, the download is placed on the first position of waiting queue. As long as the status is paused, the download is not started. To change status to waiting, use `aria2.unpause()` method. This method returns GID of paused download. ### Parameters #### Path Parameters - **gid** (string) - Required - The unique identifier for the download to pause. ### Response #### Success Response (200) - **gid** (string) - The GID of the paused download. ``` -------------------------------- ### aria2.purgeDownloadResult Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Purges completed, error, or removed downloads from memory to free up resources. ```APIDOC ## aria2.purgeDownloadResult ### Description This method purges completed/error/removed downloads to free memory. This method returns OK. ### Response #### Success Response (200) - **status** (string) - 'OK' on success. ``` -------------------------------- ### ForceRemove Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Removes a download immediately without performing any time-consuming actions like contacting trackers. ```APIDOC ## aria2.forceRemove(gid) ### Description Removes the download specified by `gid` immediately, skipping any ongoing actions. ### Parameters - **gid** (string) - The identifier of the download to remove. ### Response - **string** - 'OK' on success. ``` -------------------------------- ### Call Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md The Call function is used to make RPC calls to the Aria2 server. It takes the server address, the method name, parameters, and a reply interface to store the response. It returns an error if the call fails. ```APIDOC ## Call ### Description Makes an RPC call to the Aria2 server. ### Signature ```go func Call(address, method string, params, reply interface{}) error ``` ### Parameters - **address** (string) - The RPC server address (e.g., "http://localhost:6800/jsonrpc"). - **method** (string) - The RPC method to call (e.g., "aria2.addUri"). - **params** (interface{}) - The parameters for the RPC method. This should be a slice or array of arguments. - **reply** (interface{}) - A pointer to a variable where the RPC response will be stored. The type should match the expected response of the method. ### Returns - **error** - An error object if the RPC call fails, otherwise nil. ``` -------------------------------- ### Change Global Options Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Dynamically changes global options for aria2. This method accepts a map of option names and their new values. ```APIDOC ## aria2.changeGlobalOption ### Description Dynamically changes global options for aria2. This method accepts a map of option names and their new values. ### Method Signature `func (id *Client) ChangeGlobalOption(options map[string]interface{}) (g string, err error)` ### Parameters - `options` (map[string]interface{}): A map where keys are option names (e.g., `download-result`, `max-concurrent-downloads`, `save-session`) and values are their new settings. ### Returns - `g` (string): A confirmation string, typically "OK", upon successful modification. - `err` (error): An error if the operation fails. ``` -------------------------------- ### ForceShutdown Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Shuts down Aria2 immediately, skipping any time-consuming actions like contacting trackers. ```APIDOC ## aria2.forceShutdown() ### Description Shuts down Aria2 immediately, skipping any time-consuming actions. ### Response - **string** - 'OK' on success. ``` -------------------------------- ### Modify Download URIs with aria2 RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Removes specified URIs and adds new ones for a given download. Allows specifying a file index and the insertion position for new URIs. ```go func (id *Client) ChangeUri(gid string, fileindex int, delUris []string, addUris []string, position ...int) (p []int, err error) ``` -------------------------------- ### Nginx Internal Location for Protected Files Source: https://github.com/cloudreve/cloudreve/wiki/启用Sendfile下载支持 Configure an internal location block in your Nginx site configuration to serve protected files. Use the 'alias' directive to specify the absolute path to the upload directory. This block should be marked as 'internal' to prevent direct access. ```nginx location /protected_files { internal; #此处为public/uploads目录的绝对路径 alias /home/wwwroot/file.cloudreve.org/public/uploads/; } ``` -------------------------------- ### aria2.remove Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Removes a download identified by its GID. If the download is in progress, it is stopped first. ```APIDOC ## aria2.remove ### Description This method removes the download denoted by gid. If specified download is in progress, it is stopped at first. The status of removed download becomes removed. This method returns GID of removed download. ### Parameters #### Path Parameters - **gid** (string) - Required - The unique identifier for the download to remove. ### Response #### Success Response (200) - **gid** (string) - The GID of the removed download. ``` -------------------------------- ### Force Shutdown aria2 with RPC Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Shuts down the aria2 service immediately, skipping any time-consuming actions like contacting trackers. This is a forceful shutdown. ```go func (id *Client) ForceShutdown() (g string, err error) ``` -------------------------------- ### ChangeUri Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Modifies the URIs associated with a specific file within a download. Allows for removing existing URIs and adding new ones, with optional position specification. ```APIDOC ## aria2.changeUri(gid, fileIndex, delUris, addUris[, position]) ### Description Removes URIs specified in `delUris` and adds URIs from `addUris` to the file at `fileIndex` for the download `gid`. URIs can be inserted at a specific `position`. ### Parameters - **gid** (string) - The identifier of the download. - **fileIndex** (integer) - The 1-based index of the file to modify. - **delUris** (list of string) - URIs to remove. - **addUris** (list of string) - URIs to add. - **position** (integer, optional) - The 0-based index where new URIs should be inserted after removal. ### Response - **list of integers** - A list containing two integers: the number of URIs deleted and the number of URIs added. ``` -------------------------------- ### aria2.shutdown Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Shuts down the Aria2 service. ```APIDOC ## aria2.shutdown ### Description This method shutdowns aria2. This method returns OK. ### Response #### Success Response (200) - **status** (string) - 'OK' on success. ``` -------------------------------- ### GetGlobalStat Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Retrieves global statistics for Aria2, such as overall download and upload speeds. ```APIDOC ## aria2.getGlobalStat() ### Description Returns global statistics for Aria2, including overall download and upload speeds. ### Response - **map[string]interface{}** - A map containing global statistics. ``` -------------------------------- ### aria2.removeDownloadResult Source: https://github.com/cloudreve/cloudreve/blob/master/pkg/downloader/aria2/rpc/README.md Removes a completed, error, or removed download, identified by GID, from memory. ```APIDOC ## aria2.removeDownloadResult ### Description This method removes completed/error/removed download denoted by `gid` from memory. This method returns OK for success. ### Parameters #### Path Parameters - **gid** (string) - Required - The unique identifier for the download result to remove. ### Response #### Success Response (200) - **status** (string) - 'OK' on success. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.