fixed bugs introduced in last version

This commit is contained in:
huangjx
2022-02-21 22:12:04 +08:00
parent 40e9d93f61
commit 7cd9a05a72
6 changed files with 25 additions and 16 deletions

View File

@@ -8,7 +8,7 @@ Search for torrents within the app from mutiple BT sites;
Control Aria2 and manage download tasks from the web;
download videos from 700+ video sites(youtube,youku,vimo,dailymotion,twitter,facebook and the likes
</description>
<version>0.7.0</version>
<version>0.7.1</version>
<licence>agpl</licence>
<author mail="freefallbenson@gmail.com" homepage="https://github.com/shiningw">jiaxinhuang</author>
<namespace>NCDownloader</namespace>

View File

@@ -60,7 +60,8 @@ class MainController extends Controller
$params['youtube_installed'] = $this->youtube->isInstalled();
$params['youtube_bin'] = $this->youtube->getBin();
$params['youtube_executable'] = $this->youtube->isExecutable();
$params['ncd_hide_errors'] = $this->settings->get("ncd_hide_errors");
$params['ncd_hide_errors'] = $this->settings->get("ncd_hide_errors",null);
$params['counter'] = $this->counters->getCounters();
$params['settings_url'] = $this->urlGenerator->linkToRoute("settings.PersonalSettings.index", ['section' => 'ncdownloader']);

View File

@@ -63,7 +63,7 @@ window.addEventListener('DOMContentLoaded', function () {
eventHandler.add("click", "#app-navigation", "#search-download", helper.showDownload);
eventHandler.add("change", "#app-navigation", "#ncd-hide-errors", e => {
let data = {};
data["ncd_hide_errors"] = e.target.checked === "true";
data["ncd_hide_errors"] = e.target.checked;
const url = helper.generateUrl(basePath + "/personal/save");
Http.getInstance(url).setData(data).setHandler(resp => {
if (resp['message']) {

View File

@@ -182,9 +182,11 @@ const helper = {
showErrors(target) {
let errors = document.querySelectorAll(target);
errors.forEach(element => {
helper.message(element.getAttribute('data-error-message'), 20000);
let msg;
if (msg = element.getAttribute('data-error-message'))
helper.message(msg, 20000);
})
}
},
}
export default helper

View File

@@ -1,17 +1,22 @@
<?php
extract($_);
$permission_error = sprintf("aria2 is installed but not executable.Please execute command sudo chmod 755 %s", $aria2_bin);
if ($youtube_installed && !$youtube_executable) {
$ytb_error = sprintf("youtube-dl is installed but not executable.Please execute command sudo chmod 755 %s", $youtube_bin);
} else if (!$youtube_installed && !$youtube_executable) {
$ytb_error = "youtube-dl is not installed!";
$errors = [];
if ($aria2_installed && !$aria2_executable) {
array_push($errors, sprintf("aria2 is installed but not executable.Please execute command sudo chmod 755 %s", $aria2_bin));
}
if ($youtube_installed && !$youtube_executable) {
array_push($errors, sprintf("youtube-dl is installed but not executable.Please execute command sudo chmod 755 %s", $youtube_bin));
} else if (!$youtube_installed) {
array_push($errors, "youtube-dl is not installed!");
}
?>
<div id="app-navigation">
<?php if ($ncd_hide_errors): ?>
<?php if (isset($ytb_error)): ?>
<div data-error-message="<?php print $l->t($ytb_error);?>"></div>
<?php endif;?>
<?php if (!$ncd_hide_errors): ?>
<?php foreach ($errors as $error): ?>
<div data-error-message="<?php print $l->t($error);?>"></div>
<?php endforeach;?>
<?php endif;?>
<div class="app-navigation-new" id="search-download" data-inputbox="form-input-wrapper">
@@ -27,7 +32,7 @@ if ($youtube_installed && !$youtube_executable) {
</button>
</button>
<?php elseif ($aria2_installed && !$aria2_executable): ?>
<button type="button" class="icon-power notinstalled" data-error-message="<?php print $l->t($permission_error);?>">
<button type="button" class="icon-power notinstalled" >
<?php print $l->t("aria2c is installed but not executable");?>
</button>
<?php else: ?>

View File

@@ -1,6 +1,7 @@
<?php
extract($_);
$checked = '';
$checkbox = $ncd_hide_errors ? "true" : "false";
if ($ncd_hide_errors) {
$checked = "checked";
}
@@ -16,7 +17,7 @@ if ($ncd_hide_errors) {
<div id="app-settings-content">
<ul id="ncdownloader-settings-collapsible-container">
<li class="ncdownloader-settings-item" data-tippy-content="check this to show or suppress errors">
<input class="checkbox" type="checkbox" value="<?php print($ncd_hide_errors);?>" <?php print($checked);?> id="ncd-hide-errors"><label for="ncd-hide-errors"><?php p($l->t('Hide Errors'));?></label>
<input class="checkbox" type="checkbox" value="<?php print($checkbox);?>" <?php print($checked);?> id="ncd-hide-errors"><label for="ncd-hide-errors"><?php p($l->t('Hide Errors'));?></label>
</li>
<li class="ncdownloader-settings-item">
<a href="<?php p($l->t($settings_url));?>" title="<?php p($l->t('Personal Settings'));?>" >