Révision 12cb1134
[nextcloud_] Allow to control warnings on the number of available updates
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
| plugins/nextcloud/nextcloud_ | ||
|---|---|---|
| 1 | 1 |
#!/bin/sh |
| 2 |
# shellcheck shell=dash |
|
| 2 | 3 |
|
| 3 | 4 |
set -e |
| 4 | 5 |
|
| ... | ... | |
| 30 | 31 |
env.password <nextcloud_password> |
| 31 | 32 |
env.api_path <default: /ocs/v2.php/apps/serverinfo/api/v1/info> |
| 32 | 33 |
env.timeout <default: 2s> |
| 34 |
env.updates_warning <default: 1> |
|
| 33 | 35 |
|
| 34 | 36 |
It's advised to set an app password (for this plugin) in your nextcloud |
| 35 | 37 |
instance and not to use the "real" password of your nextcloud user. |
| ... | ... | |
| 59 | 61 |
API_PATH="${api_path:-/ocs/v2.php/apps/serverinfo/api/v1/info}?format=json"
|
| 60 | 62 |
DOMAIN="${0##*nextcloud_}"
|
| 61 | 63 |
TIMEOUT="${timeout:-2}"
|
| 64 |
UPDATES_WARNING="${updates_warning:-1}"
|
|
| 62 | 65 |
CLEANDOMAIN="$(clean_fieldname "$DOMAIN")" |
| 63 | 66 |
USERNAME="${username:-}"
|
| 64 | 67 |
PASSWORD="${password:-}"
|
| 65 | 68 |
|
| 66 | 69 |
print_json_data() {
|
| 67 |
# shellcheck disable=SC2039 |
|
| 68 | 70 |
local FIRST="$1" |
| 69 | 71 |
[ -z "$FIRST" ] && exit 0 |
| 70 | 72 |
shift 1 |
| ... | ... | |
| 202 | 204 |
num_updates_available.label available app updates |
| 203 | 205 |
num_updates_available.info number of available app updates |
| 204 | 206 |
num_updates_available.min 0 |
| 205 |
num_updates_available.warning 1
|
|
| 207 |
num_updates_available.warning ${UPDATES_WARNING}
|
|
| 206 | 208 |
num_installed.label installed apps |
| 207 | 209 |
num_installed.info number of installed apps |
| 208 | 210 |
num_installed.min 0 |
Formats disponibles : Unified diff