取消https验证,并添加vendor文件夹。

This commit is contained in:
2025-04-18 12:58:39 +08:00
parent 552909d82b
commit 2d3f7d8511
727 changed files with 132015 additions and 19 deletions

5
vendor/daijie/aria2/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
.DS_Store
playground/data
playground/www/composer.lock
playground/www/vendor

49
vendor/daijie/aria2/Aria2.php vendored Normal file
View File

@@ -0,0 +1,49 @@
<?php
class Aria2
{
protected $ch;
protected $token;
function __construct($server='http://127.0.0.1:6800/jsonrpc', $token=null)
{
$this->ch = curl_init($server);
curl_setopt_array($this->ch, [
CURLOPT_POST=>true,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_HEADER=>false
]);
if(!is_null($token)) {
$this->token = $token;
}
}
function __destruct()
{
curl_close($this->ch);
}
protected function req($data)
{
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
return curl_exec($this->ch);
}
function __call($name, $arg)
{
if(!is_null($this->token)) {
array_unshift($arg, 'token:'.$this->token);
}
$data = [
'jsonrpc'=>'2.0',
'id'=>'1',
'method'=>'aria2.'.$name,
'params'=>$arg
];
$data = json_encode($data);
$response = $this->req($data);
if($response===false) {
trigger_error(curl_error($this->ch));
}
return json_decode($response, 1);
}
}

13
vendor/daijie/aria2/LICENSE.txt vendored Normal file
View File

@@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

380
vendor/daijie/aria2/README.md vendored Normal file
View File

@@ -0,0 +1,380 @@
php-aria2
=========
# Talk with aria2 using json-RPC
## Install
### 1. Install aria2c
Make sure aria2c is running and rpc is enabled, You can add this into /etc/rc.local
`/usr/local/bin/aria2c --enable-rpc --rpc-allow-origin-all -c -D`
> [Also See The Document of Aria2](https://aria2.github.io/manual/en/html/aria2c.html#rpc-interface)
### 2. Require Aria2.php
The codes just 50 lines but support all RPC methods. Using php's magic method `__call`
#### 2.1 Install by composer
`composer require daijie/aria2`
> Thanks to [@Yuav](https://github.com/Yuav)
#### 2.2 Or copy Aria2.php
## Docker playground
#### require [docker-compose](https://docs.docker.com/compose/install/)
#### init playground
```
git clone https://github.com/shiny/php-aria2/
cd php-aria2/playground
docker-compose up
docker-compose exec php composer require daijie/aria2
```
#### After that, the playground structure:
```
├── aria2.conf # Aria2 conf file
├── data # Store downloaded file
├── docker-compose.yml
├── nginx.conf # nginx conf
└── www # Web dir
├── composer.json
├── composer.lock
├── index.php
└── vendor
├── autoload.php
├── composer
│   ├── ClassLoader.php
│   ├── LICENSE
│   ├── autoload_classmap.php
│   ├── autoload_namespaces.php
│   ├── autoload_psr4.php
│   ├── autoload_real.php
│   ├── autoload_static.php
│   └── installed.json
└── daijie
└── aria2
├── Aria2.php
├── LICENSE.txt
├── README.md
└── composer.json
```
Edit www/index.php and Open Browser To Visit http://127.0.0.1
## Class Aria2
```
Aria2 {
__construct ( string $server [, string $token ] )
__destruct ( void )
__call(string $name, array $arg)
protected string req ( array $data )
}
```
## Usage
$aria2 = new Aria2('http://127.0.0.1:6800/jsonrpc');
// http://127.0.0.1:6800/jsonrpc is the default value,
// equals to $aria2 = new Aria2
$aria2->getGlobalStat();
$aria2->tellActive();
$aria2->tellWaiting(0,1000);
$aria2->tellStopped(0,1000);
$aria2->addUri(
['https://www.google.com.hk/images/srpr/logo3w.png'],
['dir'=>'/tmp']
);
$aria2->tellStatus('1');
$aria2->removeDownloadResult('1');
//and more ...
Also See [Manual of Aria2 RPC Interface to get the method list](https://aria2.github.io/manual/en/html/aria2c.html#rpc-interface)
## Updates
### v1.1
Now support default token(secret) in php-aria2, compatible with v1.0
Before
```
$aria2 = new Aria2('http://aria2:6800/jsonrpc');
$aria2->addUri(
"token:e6c3778f-6361-4ed0-b126-f2cf8fca06db",
['https://www.docker.com/sites/default/files/moby.svg']
);
$aria2->getGlobalStat("token:e6c3778f-6361-4ed0-b126-f2cf8fca06db");
```
After
```
$aria2 = new Aria2('http://aria2:6800/jsonrpc', "token:e6c3778f-6361-4ed0-b126-f2cf8fca06db");
$aria2->addUri(
['https://www.docker.com/sites/default/files/moby.svg']
);
$status = $aria2->getGlobalStat();
```
### Example #1: Download File
$aria2->addUri(
['https://www.google.com.hk/images/srpr/logo3w.png'],
['dir'=>'/tmp']
);
[More Options Here](https://aria2.github.io/manual/en/html/aria2c.html#input-file)
#### Example #2: The Returned Data
#### Case: `Can't Download`
array(3) {
["id"]=>
string(1) "1"
["jsonrpc"]=>
string(3) "2.0"
["result"]=>
array(13) {
["completedLength"]=>
string(1) "0"
["connections"]=>
string(1) "0"
["dir"]=>
string(4) "/tmp"
["downloadSpeed"]=>
string(1) "0"
["errorCode"]=>
string(1) "1"
["files"]=>
array(1) {
[0]=>
array(6) {
["completedLength"]=>
string(1) "0"
["index"]=>
string(1) "1"
["length"]=>
string(1) "0"
["path"]=>
string(0) ""
["selected"]=>
string(4) "true"
["uris"]=>
array(1) {
[0]=>
array(2) {
["status"]=>
string(4) "used"
["uri"]=>
string(48) "https://www.google.com.hk/images/srpr/logo3w.png"
}
}
}
}
["gid"]=>
string(1) "2"
["numPieces"]=>
string(1) "0"
["pieceLength"]=>
string(7) "1048576"
["status"]=>
string(5) "error"
["totalLength"]=>
string(1) "0"
["uploadLength"]=>
string(1) "0"
["uploadSpeed"]=>
string(1) "0"
}
}
#### Case: `Downloading (Active)`
array(3) {
["id"]=>
string(1) "1"
["jsonrpc"]=>
string(3) "2.0"
["result"]=>
array(13) {
["bitfield"]=>
string(8) "e0000000"
["completedLength"]=>
string(7) "3932160"
["connections"]=>
string(1) "1"
["dir"]=>
string(18) "/data/files/lixian"
["downloadSpeed"]=>
string(5) "75972"
["files"]=>
array(1) {
[0]=>
array(6) {
["completedLength"]=>
string(7) "3145728"
["index"]=>
string(1) "1"
["length"]=>
string(8) "31550548"
["path"]=>
string(48) "/data/files/lixian/[茶经].陆羽.扫描版.pdf"
["selected"]=>
string(4) "true"
["uris"]=>
array(5) {
[0]=>
array(2) {
["status"]=>
string(4) "used"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
[1]=>
array(2) {
["status"]=>
string(7) "waiting"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
[2]=>
array(2) {
["status"]=>
string(7) "waiting"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
[3]=>
array(2) {
["status"]=>
string(7) "waiting"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
[4]=>
array(2) {
["status"]=>
string(7) "waiting"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
}
}
}
["gid"]=>
string(1) "3"
["numPieces"]=>
string(2) "31"
["pieceLength"]=>
string(7) "1048576"
["status"]=>
string(6) "active"
["totalLength"]=>
string(8) "31550548"
["uploadLength"]=>
string(1) "0"
["uploadSpeed"]=>
string(1) "0"
}
}
#### Case: `Downloaded`
array(3) {
["id"]=>
string(1) "1"
["jsonrpc"]=>
string(3) "2.0"
["result"]=>
array(14) {
["bitfield"]=>
string(8) "fffffffe"
["completedLength"]=>
string(8) "31550548"
["connections"]=>
string(1) "0"
["dir"]=>
string(18) "/data/files/lixian"
["downloadSpeed"]=>
string(1) "0"
["errorCode"]=>
string(1) "0"
["files"]=>
array(1) {
[0]=>
array(6) {
["completedLength"]=>
string(8) "31550548"
["index"]=>
string(1) "1"
["length"]=>
string(8) "31550548"
["path"]=>
string(48) "/data/files/lixian/[茶经].陆羽.扫描版.pdf"
["selected"]=>
string(4) "true"
["uris"]=>
array(6) {
[0]=>
array(2) {
["status"]=>
string(4) "used"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
[1]=>
array(2) {
["status"]=>
string(7) "waiting"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
[2]=>
array(2) {
["status"]=>
string(7) "waiting"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
[3]=>
array(2) {
["status"]=>
string(7) "waiting"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
[4]=>
array(2) {
["status"]=>
string(7) "waiting"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
[5]=>
array(2) {
["status"]=>
string(7) "waiting"
["uri"]=>
string(417) "http://gdl.lixian.vip.xunlei.com/download?fid=zKHWI/O2IbQ07pi/0hPYP1OLwrBUbOEBAAAAACaqKvQbmfR7K7JcbWGT3XQBlDzs&mid=666&threshold=150&tid=3018BA81C31480902DC937770AC2734F&srcid=4&verno=1&g=26AA2AF41B99F47B2BB25C6D6193DD7401943CEC&scn=c7&i=0D2B59F64D6CCBB5A1507A03C3B685BC&t=4&ui=222151634&ti=106821253185&s=31550548&m=0&n=013A830CE1AD5D2EC2DCE21471C9A8C3E8D1D7CA2F64660000&ff=0&co=33BB9833AB0EE7AAEA94105B64C8013F&cm=1"
}
}
}
}
["gid"]=>
string(1) "3"
["numPieces"]=>
string(2) "31"
["pieceLength"]=>
string(7) "1048576"
["status"]=>
string(8) "complete"
["totalLength"]=>
string(8) "31550548"
["uploadLength"]=>
string(1) "0"
["uploadSpeed"]=>
string(1) "0"
}
}

26
vendor/daijie/aria2/composer.json vendored Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "daijie/aria2",
"type": "library",
"description": "talk with aria2",
"keywords": ["aria2"],
"homepage": "https://github.com/shiny/php-aria2",
"license": "WTFPL",
"authors": [
{
"name": "DaiJie",
"email": "daijie@php.net"
}
],
"require": {
"php": ">=5.4.0",
"ext-curl": "*"
},
"require-dev": {
},
"autoload": {
"psr-4": {
"": ""
}
}
}

View File

@@ -0,0 +1,5 @@
dir=/home/aria2
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-port=6800
rpc-listen-all=true

View File

@@ -0,0 +1,24 @@
version: '2'
services:
aria2:
image: vimagick/aria2
volumes:
- "./data:/home/aria2"
- "./aria2.conf:/etc/aria2/aria2.conf"
environment:
- TOKEN=e6c3778f-6361-4ed0-b126-f2cf8fca06db
php:
image: daijie/php7-alpine
depends_on:
- aria2
volumes:
- ./www:/var/www
nginx:
image: nginx:1-alpine
depends_on:
- php
ports:
- 8080:80
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./www:/var/www

View File

@@ -0,0 +1,26 @@
server {
listen 80;
#listen 443 ssl http2;
server_name _;
#ssl_certificate ssl.crt;
#ssl_certificate_key ssl.key;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers HIGH:!aNULL:!MD5;
keepalive_timeout 120;
root /var/www;
location / {
index index.html index.htm index.php;
try_files $uri $uri/ $uri.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /.well-known/acme-challenge/ {
try_files $uri /dev/null =404;
}
}

View File

@@ -0,0 +1,5 @@
{
"require": {
"daijie/aria2": "^1.0"
}
}

View File

@@ -0,0 +1,10 @@
<?php
require 'vendor/autoload.php';
$aria2 = new Aria2('http://aria2:6800/jsonrpc', "token:e6c3778f-6361-4ed0-b126-f2cf8fca06db");
$status = $aria2->addUri(
['https://www.docker.com/sites/default/files/moby.svg']
);
?>
<code>
<?=var_export($status, 1);?>
</code>