added section for displaying aria2 and yt-dlp version info
This commit is contained in:
@@ -412,4 +412,8 @@ class Aria2
|
||||
{
|
||||
return $this->bin;
|
||||
}
|
||||
public function version(){
|
||||
$resp = $this->getVersion();
|
||||
return $resp['result']['version'] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ class Personal implements ISettings
|
||||
"path" => '/apps/ncdownloader/personal/save',
|
||||
"disallow_aria2_settings" => Helper::getAdminSettings("disallow_aria2_settings"),
|
||||
"is_admin" => \OC_User::isAdminUser($this->uid),
|
||||
"aria2_version" => Helper::getAria2Version(),
|
||||
"ytdl_version" => Helper::getYtdlVersion(),
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ use OCP\IUser;
|
||||
use OC\Files\Filesystem;
|
||||
use OC_Util;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use OCA\NCDownloader\Aria2\Aria2;
|
||||
use OCA\NCDownloader\Ytdl\Ytdl;
|
||||
|
||||
class Helper
|
||||
{
|
||||
@@ -537,4 +539,15 @@ class Helper
|
||||
{
|
||||
return Helper::getSettings("ncd_admin_settings", [], Settings::TYPE["SYSTEM"]);
|
||||
}
|
||||
public static function getAria2Version(): ?string
|
||||
{
|
||||
//get aria2 instance
|
||||
$aria2 = self::query(Aria2::class);
|
||||
return $aria2->version();
|
||||
}
|
||||
public static function getYtdlVersion(): ?string
|
||||
{
|
||||
$ytdl = self::query(Ytdl::class);
|
||||
return $ytdl->version();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,4 +265,14 @@ class Ytdl
|
||||
{
|
||||
return "https://github.com/shiningw/ncdownloader-bin/raw/master/yt-dlp";
|
||||
}
|
||||
|
||||
public function version()
|
||||
{
|
||||
$process = new Process([$this->bin, '--version']);
|
||||
$process->run();
|
||||
if ($process->isSuccessful()) {
|
||||
return $process->getOutput();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user