Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions etc/ncp-templates/cron.hourly/ncp-previewgenerator.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env bash

cat <<'EOF'
#!/usr/bin/env bash
set -eu

GENERATE_JOB_ID="ncp-generate-previews"

if [[ "$(systemctl is-active "${GENERATE_JOB_ID}" ||:)" =~ ^(active|activating|deactivating)$ ]]
Expand All @@ -9,15 +12,13 @@ then
exit 0
fi

#!/usr/bin/env bash
set -eu
source /usr/local/etc/library.sh

if is_app_enabled memories
then
ncc config:app:set --value="256 4096" previewgenerator coverWidthHeightSizes
ncc config:app:set --value="256 4096" previewgenerator coverWidthHeightSizes > /dev/null
else
ncc config:app:set --value="" previewgenerator coverWidthHeightSizes
ncc config:app:set --value="" previewgenerator coverWidthHeightSizes > /dev/null
fi

for _ in $(seq 1 $(nproc)); do
Expand Down
9 changes: 7 additions & 2 deletions ncp-web/ncp-launcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
$l10nDir = "l10n";
ignore_user_abort(true);

function bash_escape_arg($arg): string
{
return "'" . str_replace("'", "\\'", $arg) . "'";
}

//
// language
//
Expand Down Expand Up @@ -105,7 +110,7 @@
echo ' "output": "" , ';
echo ' "ret": ';

exec( 'bash -c "sudo /home/www/ncp-launcher.sh ' . $ncp_app . '"' , $output , $ret );
exec( 'bash -c "sudo /home/www/ncp-launcher.sh ' . bash_escape_arg($ncp_app) . '"' , $output , $ret );
echo '"' . $ret . '" }';
}

Expand Down Expand Up @@ -159,7 +164,7 @@
exit('{ "output": "domain can\'t be empty", "ret": 1 }');
}
echo '{ "token": "' . getCSRFToken() . '",'; // Get new token
exec("/usr/bin/php /var/www/nextcloud/occ config:system:set overwrite.cli.url --value '" . $_POST['url'] . "'",
exec("/usr/bin/php /var/www/nextcloud/occ config:system:set overwrite.cli.url --value " . bash_escape_arg($_POST['url']),
$out, $ret);
echo ' "out": "' . htmlspecialchars(join("\n", $out), ENT_QUOTES, "UTF-8") . '", ';
echo ' "ret": "' . $ret . '"}';
Expand Down
7 changes: 7 additions & 0 deletions updates/1.57.1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -eu

source /usr/local/etc/library.sh

echo "Reconfigure automatic preview generation (if enabled)"
run_app nc-previews-auto
Loading