added section for displaying aria2 and yt-dlp version info
This commit is contained in:
@@ -412,4 +412,8 @@ class Aria2
|
|||||||
{
|
{
|
||||||
return $this->bin;
|
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',
|
"path" => '/apps/ncdownloader/personal/save',
|
||||||
"disallow_aria2_settings" => Helper::getAdminSettings("disallow_aria2_settings"),
|
"disallow_aria2_settings" => Helper::getAdminSettings("disallow_aria2_settings"),
|
||||||
"is_admin" => \OC_User::isAdminUser($this->uid),
|
"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\Files\Filesystem;
|
||||||
use OC_Util;
|
use OC_Util;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use OCA\NCDownloader\Aria2\Aria2;
|
||||||
|
use OCA\NCDownloader\Ytdl\Ytdl;
|
||||||
|
|
||||||
class Helper
|
class Helper
|
||||||
{
|
{
|
||||||
@@ -537,4 +539,15 @@ class Helper
|
|||||||
{
|
{
|
||||||
return Helper::getSettings("ncd_admin_settings", [], Settings::TYPE["SYSTEM"]);
|
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";
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="section ncdownloader-general-settings">
|
<div class="section ncdownloader-general-settings">
|
||||||
<h3>General Settings</h3>
|
<h3>General Settings</h3>
|
||||||
<settingsRow
|
<settingsRow v-for="(option, key) in optionRows" v-bind:key="key" :value="option.value" :id="option.id"
|
||||||
v-for="(option, key) in optionRows"
|
:label="option.label" :placeholder="option.placeholder" :path="option.path" :useBtn="true" />
|
||||||
v-bind:key="key"
|
|
||||||
:value="option.value"
|
|
||||||
:id="option.id"
|
|
||||||
:label="option.label"
|
|
||||||
:placeholder="option.placeholder"
|
|
||||||
:path="option.path"
|
|
||||||
:useBtn="true"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<customOptions
|
<customOptions v-if="!disallowAria2Settings || isAdmin" name="custom-aria2-settings" title="Personal Aria2 Settings"
|
||||||
v-if="!disallowAria2Settings || isAdmin"
|
@mounted="renderAria2" path="/apps/ncdownloader/personal/aria2/save" :validOptions="aria2Options">
|
||||||
name="custom-aria2-settings"
|
|
||||||
title="Personal Aria2 Settings"
|
|
||||||
@mounted="renderAria2"
|
|
||||||
path="/apps/ncdownloader/personal/aria2/save"
|
|
||||||
:validOptions="aria2Options"
|
|
||||||
>
|
|
||||||
<template #save>Save Aria2 Settings</template>
|
<template #save>Save Aria2 Settings</template>
|
||||||
</customOptions>
|
</customOptions>
|
||||||
<customOptions
|
<customOptions name="custom-ytdl-settings" title="Personal Youtbue-dl Settings" @mounted="renderYtdl"
|
||||||
name="custom-ytdl-settings"
|
path="/apps/ncdownloader/personal/ytdl/save" :validOptions="ytdlOptions">
|
||||||
title="Personal Youtbue-dl Settings"
|
|
||||||
@mounted="renderYtdl"
|
|
||||||
path="/apps/ncdownloader/personal/ytdl/save"
|
|
||||||
:validOptions="ytdlOptions"
|
|
||||||
>
|
|
||||||
<template #save>Save Youtube-dl Settings</template>
|
<template #save>Save Youtube-dl Settings</template>
|
||||||
</customOptions>
|
</customOptions>
|
||||||
|
<div class="system-info-wrapper section">
|
||||||
|
<h2 class="section-title">System Info</h2>
|
||||||
|
<div class="system-info">
|
||||||
|
<div class="system-info-item">
|
||||||
|
<div class="system-info-item-label">Aria2 Version: </div>
|
||||||
|
<div class="system-info-item-value">{{ aria2Version }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="system-info-item">
|
||||||
|
<div class="system-info-item-label">yt-dlp Version: </div>
|
||||||
|
<div class="system-info-item-value">{{ ytdVersion }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import customOptions from "./components/customOptions";
|
import customOptions from "./components/customOptions";
|
||||||
@@ -48,6 +42,9 @@ export default {
|
|||||||
ytdlOptions: ytdlOptions,
|
ytdlOptions: ytdlOptions,
|
||||||
disallowAria2Settings: false,
|
disallowAria2Settings: false,
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
|
aria2Version: "",
|
||||||
|
ytdVersion: "",
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -104,6 +101,8 @@ export default {
|
|||||||
let path = "/apps/ncdownloader/personal/save";
|
let path = "/apps/ncdownloader/personal/save";
|
||||||
this.disallowAria2Settings = helper.str2Boolean(data["disallow_aria2_settings"]);
|
this.disallowAria2Settings = helper.str2Boolean(data["disallow_aria2_settings"]);
|
||||||
this.isAdmin = data["is_admin"];
|
this.isAdmin = data["is_admin"];
|
||||||
|
this.aria2Version = data["aria2_version"];
|
||||||
|
this.ytdVersion = data["ytdl_version"];
|
||||||
this.options = [
|
this.options = [
|
||||||
{
|
{
|
||||||
label: "Downloads Folder ",
|
label: "Downloads Folder ",
|
||||||
@@ -126,3 +125,26 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.system-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-info-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-info-item-label {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-info-item-value {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user