mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
Merge pull request #1877 from nextcloud/devel
Add support for Nextcloud 28
This commit is contained in:
commit
29d6375050
29
.github/workflows/build-lxd.yml
vendored
29
.github/workflows/build-lxd.yml
vendored
@ -207,6 +207,7 @@ jobs:
|
||||
lxc image import -q "./${{ needs.build-previous.outputs.artifact_file }}" --alias "ncp/update"
|
||||
systemd-run --user --scope -p "Delegate=yes" lxc launch -q "ncp/update" ncp
|
||||
lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done'
|
||||
lxc exec ncp -- rm -f /opt/ncdata/data/nextcloud.log
|
||||
sleep 30
|
||||
ip="$(lxc list -c n4 -f csv | grep '^ncp' | cut -d ',' -f2)"
|
||||
ip="${ip/% *}"
|
||||
@ -221,7 +222,7 @@ jobs:
|
||||
tail -n 20 geckodriver.log >&2 || true
|
||||
echo "================"
|
||||
echo "ncp.log: "
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log"
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log" || true
|
||||
exit 1
|
||||
}
|
||||
python system_tests.py --non-interactive || {
|
||||
@ -234,7 +235,11 @@ jobs:
|
||||
tail -n 20 geckodriver.log >&2 || true
|
||||
echo "================"
|
||||
echo "ncp.log: "
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log"
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log" || true
|
||||
echo "================"
|
||||
echo "nextcloud log: "
|
||||
datadir="$(lxc exec ncp -- ncc config:system:get datadirectory)"
|
||||
lxc exec ncp -- cat "$datadir/nextcloud.log" || true
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -265,6 +270,8 @@ jobs:
|
||||
lxc exec ncp -- bash -c "DBG=x ncp-update-nc ${latest_nc_version?}"
|
||||
fi
|
||||
|
||||
lxc exec ncp -- rm -f /opt/ncdata/data/nextcloud.log
|
||||
|
||||
lxc stop ncp
|
||||
- name: Relaunch container
|
||||
run: |
|
||||
@ -289,7 +296,11 @@ jobs:
|
||||
tail -n 20 geckodriver.log >&2 || true
|
||||
echo "================"
|
||||
echo "ncp.log: "
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log"
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log" || true
|
||||
echo "================"
|
||||
echo "nextcloud log: "
|
||||
datadir="$(lxc exec ncp -- ncc config:system:get datadirectory)"
|
||||
lxc exec ncp -- cat "$datadir/nextcloud.log" || true
|
||||
exit 1
|
||||
}
|
||||
lxc stop ncp
|
||||
@ -363,7 +374,11 @@ jobs:
|
||||
tail -n 20 geckodriver.log >&2 || true
|
||||
echo "================"
|
||||
echo "ncp.log: "
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log"
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log" || true
|
||||
echo "================"
|
||||
echo "nextcloud log: "
|
||||
datadir="$(lxc exec ncp -- ncc config:system:get datadirectory)"
|
||||
lxc exec ncp -- cat "$datadir/nextcloud.log" || true
|
||||
exit 1
|
||||
}
|
||||
python system_tests.py --non-interactive || {
|
||||
@ -376,7 +391,11 @@ jobs:
|
||||
tail -n 20 geckodriver.log >&2 || true
|
||||
echo "================"
|
||||
echo "ncp.log: "
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log"
|
||||
lxc exec ncp -- "tail -n20 /var/log/ncp.log" || true
|
||||
echo "================"
|
||||
echo "nextcloud log: "
|
||||
datadir="$(lxc exec ncp -- ncc config:system:get datadirectory)"
|
||||
lxc exec ncp -- cat "$datadir/nextcloud.log" || true
|
||||
exit 1
|
||||
}
|
||||
lxc stop ncp
|
||||
|
||||
3
.github/workflows/build-sd-images.yml
vendored
3
.github/workflows/build-sd-images.yml
vendored
@ -307,6 +307,9 @@ jobs:
|
||||
echo -e "${LOG_CICD} ================"
|
||||
echo -e "${LOG_DIAG} ncp.log: "
|
||||
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c "tail -n20 /var/log/ncp.log" |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
|
||||
echo "================"
|
||||
echo "Nextcloud log: "
|
||||
"${CONTAINER_CMD[@]}" -q ncp cat /opt/ncdata/data/nextcloud.log
|
||||
sleep 12
|
||||
continue
|
||||
}
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@
|
||||
/ncp-web/ncp-web.cfg
|
||||
/docker-armhf/qemu-arm-static
|
||||
.vagrant/
|
||||
/.idea/
|
||||
|
||||
@ -127,11 +127,11 @@ EOF
|
||||
}
|
||||
|
||||
mysql nextcloud <<EOF
|
||||
replace into oc_appconfig values ( 'theming', 'name' , "NextCloudPi" );
|
||||
replace into oc_appconfig values ( 'theming', 'slogan' , "keep your data close" );
|
||||
replace into oc_appconfig values ( 'theming', 'url' , "https://ownyourbits.com" );
|
||||
replace into oc_appconfig values ( 'theming', 'logoMime' , "image/svg+xml" );
|
||||
replace into oc_appconfig values ( 'theming', 'backgroundMime', "image/png" );
|
||||
replace into oc_appconfig values ( 'theming', 'name' , "NextCloudPi" , 2, null);
|
||||
replace into oc_appconfig values ( 'theming', 'slogan' , "keep your data close" , 2, null);
|
||||
replace into oc_appconfig values ( 'theming', 'url' , "https://ownyourbits.com" , 2, null);
|
||||
replace into oc_appconfig values ( 'theming', 'logoMime' , "image/svg+xml" , 2, null);
|
||||
replace into oc_appconfig values ( 'theming', 'backgroundMime', "image/png" , 2, null);
|
||||
EOF
|
||||
|
||||
# NCP app
|
||||
@ -152,12 +152,6 @@ EOF
|
||||
# we handle this ourselves
|
||||
ncc app:disable updatenotification
|
||||
|
||||
# News dropped support for 32-bit -> https://github.com/nextcloud/news/issues/1423
|
||||
if ! [[ "$ARCH" =~ armv7 ]]; then
|
||||
ncc app:install news
|
||||
ncc app:enable news
|
||||
fi
|
||||
|
||||
# ncp-previewgenerator
|
||||
local ncver
|
||||
ncver="$(ncc status 2>/dev/null | grep "version:" | awk '{ print $3 }')"
|
||||
|
||||
@ -31,8 +31,7 @@ prepare_dirs # tmp cache output
|
||||
|
||||
# get latest armbian
|
||||
[[ -d armbian ]] || {
|
||||
git clone --depth 100 https://github.com/armbian/build armbian
|
||||
( cd armbian && git checkout c47c9372bf6970d6ca8c32bc5f7ec2a1416ab5bd; )
|
||||
git clone --depth 1 --branch v24.2.1 https://github.com/armbian/build armbian
|
||||
}
|
||||
#( cd armbian && git pull --ff-only --tags && git checkout v23.02 )
|
||||
#sed -i -e '/export rootfs_size=/s/du -sm/du --apparent-size -sm/' armbian/lib/functions/image/partitioning.sh
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
{
|
||||
"id": "VER",
|
||||
"name": "Version",
|
||||
"value": "27.1.6"
|
||||
"value": "28.0.2"
|
||||
},
|
||||
{
|
||||
"id": "MAXFILESIZE",
|
||||
|
||||
0
etc/ncp-templates/systemd/nc-unlock.service.sh
Normal file
0
etc/ncp-templates/systemd/nc-unlock.service.sh
Normal file
0
etc/ncp-templates/systemd/nc-unlock.socket.sh
Normal file
0
etc/ncp-templates/systemd/nc-unlock.socket.sh
Normal file
@ -1,5 +1,5 @@
|
||||
{
|
||||
"nextcloud_version": "27.1.6",
|
||||
"nextcloud_version": "28.0.2",
|
||||
"php_version": "8.1",
|
||||
"release": "bullseye"
|
||||
}
|
||||
|
||||
@ -79,6 +79,7 @@ mkdir -p /opt/ncdata
|
||||
DISABLE_FS_CHECK=1 NCPCFG="/usr/local/etc/ncp.cfg" run_app_unsafe bin/ncp/CONFIG/nc-datadir.sh
|
||||
[[ -z "$should_rm_datadir_cfg" ]] || rm /usr/local/etc/ncp-config.d/nc-datadir.cfg
|
||||
rm /.ncp-image
|
||||
rm -f /opt/ncdata/data/nextcloud.log
|
||||
|
||||
# skip on Armbian / Vagrant / LXD ...
|
||||
[[ "${CODE_DIR}" != "" ]] || bash /usr/local/bin/ncp-provisioning.sh
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<category>tools</category>
|
||||
<bugs>https://github.com/nextcloud/nextcloudpi/issues</bugs>
|
||||
<dependencies>
|
||||
<nextcloud min-version="22" max-version="27"/>
|
||||
<nextcloud min-version="22" max-version="28"/>
|
||||
</dependencies>
|
||||
<navigations>
|
||||
<navigation>
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
return [
|
||||
'routes' => [
|
||||
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
|
||||
['name' => 'settings#save', 'url' => '/api/settings', 'verb' => 'POST']
|
||||
['name' => 'settings#saveNcpSettings', 'url' => '/api/settings/ncp', 'verb' => 'POST'],
|
||||
['name' => 'settings#saveNcSettings', 'url' => '/api/settings/nextcloud', 'verb' => 'POST']
|
||||
]
|
||||
];
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,6 +5,7 @@ namespace OCA\NextcloudPi\Controller;
|
||||
use OCA\NextcloudPi\Exceptions\InvalidSettingsException;
|
||||
use OCA\NextcloudPi\Exceptions\SaveSettingsException;
|
||||
use OCA\NextcloudPi\Service\SettingsService;
|
||||
use OCP\HintException;
|
||||
use OCP\IRequest;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
@ -26,14 +27,13 @@ class SettingsController extends Controller {
|
||||
|
||||
|
||||
/**
|
||||
* @NoCSRFRequired
|
||||
* @CORS
|
||||
*
|
||||
* @param array $settings
|
||||
*/
|
||||
public function save(array $settings): JSONResponse {
|
||||
public function saveNcpSettings(array $settings): JSONResponse {
|
||||
try {
|
||||
$this->service->saveSettings($settings);
|
||||
$this->service->saveNcpSettings($settings);
|
||||
return new JSONResponse([]);
|
||||
} catch(InvalidSettingsException $e) {
|
||||
return new JSONResponse(["error" => $e->getMessage()], Http::STATUS_BAD_REQUEST);
|
||||
@ -41,6 +41,22 @@ class SettingsController extends Controller {
|
||||
return new JSONResponse(["error" => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @CORS
|
||||
*
|
||||
* @param array $settings
|
||||
*/
|
||||
public function saveNcSettings(array $settings): JSONResponse {
|
||||
try {
|
||||
$this->service->saveNcSettings($settings);
|
||||
return new JSONResponse([]);
|
||||
} catch(InvalidSettingsException $e) {
|
||||
return new JSONResponse(["error" => $e->getMessage()], Http::STATUS_BAD_REQUEST);
|
||||
} catch(SaveSettingsException|HintException $e) {
|
||||
return new JSONResponse(["error" => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -6,13 +6,18 @@ namespace OCA\NextcloudPi\Service;
|
||||
|
||||
use OCA\NextcloudPi\Exceptions\InvalidSettingsException;
|
||||
use OCA\NextcloudPi\Exceptions\SaveSettingsException;
|
||||
use OCP\HintException;
|
||||
use OCP\IConfig;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class SettingsService {
|
||||
private LoggerInterface $logger;
|
||||
private IConfig $config;
|
||||
|
||||
public function __construct(LoggerInterface $logger) {
|
||||
|
||||
public function __construct(LoggerInterface $logger, IConfig $config) {
|
||||
$this->logger = $logger;
|
||||
$this->config =$config;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,6 +47,7 @@ class SettingsService {
|
||||
* @param string $defaults Default value to use if the file can't be loaded
|
||||
* @return string
|
||||
*/
|
||||
// TODO: return type?
|
||||
public function getFileContent(string $name, string $defaults): string
|
||||
{
|
||||
[$ret, $file_contents, $stderr] = $this->runCommand( "bash -c \"sudo /home/www/ncp-app-bridge.sh file $name\"");
|
||||
@ -55,7 +61,7 @@ class SettingsService {
|
||||
* @throws InvalidSettingsException
|
||||
* @throws SaveSettingsException
|
||||
*/
|
||||
public function saveSettings(array $settings) {
|
||||
public function saveNcpSettings(array $settings) {
|
||||
$parseBool = function ($val): string {
|
||||
return $val ? "yes" : "no";
|
||||
};
|
||||
@ -86,6 +92,39 @@ class SettingsService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws HintException
|
||||
* @throws SaveSettingsException
|
||||
* @throws InvalidSettingsException
|
||||
*/
|
||||
public function saveNcSettings(array $settings)
|
||||
{
|
||||
foreach ($settings as $k => $value) {
|
||||
if ($k === 'maintenance_window_start') {
|
||||
if (!is_numeric($value) || (int)$value < 0 || (int)$value > 23) {
|
||||
throw new SaveSettingsException("Failed to parse maintenance window start: Make sure it's a number between 0 and 23 (was $value).");
|
||||
}
|
||||
$hour = (int)$value;
|
||||
|
||||
$this->config->setSystemValue('maintenance_window_start', $hour);
|
||||
|
||||
} elseif ($k === 'default_phone_region') {
|
||||
$this->config->setSystemValue('default_phone_region', $value);
|
||||
} else {
|
||||
throw new InvalidSettingsException("key error for '$k'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Nextcloud system config value (of type string)
|
||||
* @param string $key
|
||||
* @return string
|
||||
*/
|
||||
public function getSystemConfigValueString(string $key): string {
|
||||
return $this->config->getSystemValueString($key);
|
||||
}
|
||||
|
||||
private function runCommand(string $cmd): array {
|
||||
$descriptorSpec = [
|
||||
0 => ["pipe", "r"],
|
||||
|
||||
@ -8,8 +8,7 @@ use OCP\Settings\ISettings;
|
||||
|
||||
class AdminSettings implements ISettings {
|
||||
|
||||
/** @var SettingsService */
|
||||
private $service;
|
||||
private SettingsService $service;
|
||||
|
||||
|
||||
/**
|
||||
@ -23,7 +22,8 @@ class AdminSettings implements ISettings {
|
||||
/**
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function getForm() {
|
||||
public function getForm(): TemplateResponse
|
||||
{
|
||||
$ncp_config = $this->service->getConfig("ncp",
|
||||
["nextcloud_version" => "unknown", "php_version" => "unknown", "release" => "unknown"]);
|
||||
$community_config = $this->service->getConfig("ncp-community",
|
||||
@ -31,14 +31,19 @@ class AdminSettings implements ISettings {
|
||||
"CANARY" => 'no',
|
||||
"USAGE_SURVEYS" => 'no',
|
||||
"ADMIN_NOTIFICATIONS" => 'no',
|
||||
"NOTIFICATION_ACCOUNTS" => ""
|
||||
"NOTIFICATION_ACCOUNTS" => ''
|
||||
]);
|
||||
$ncp_version = trim($this->service->getFileContent("ncp-version", "unknown"));
|
||||
|
||||
$default_phone_region = $this->service->getSystemConfigValueString("default_phone_region");
|
||||
$maintenance_window_start = $this->service->getSystemConfigValueString("maintenance_window_start");
|
||||
|
||||
return new TemplateResponse('nextcloudpi', 'admin', [
|
||||
'community' => $community_config,
|
||||
'ncp' => $ncp_config,
|
||||
'ncp_version' => $ncp_version
|
||||
'ncp_version' => $ncp_version,
|
||||
'default_phone_region' => $default_phone_region,
|
||||
'maintenance_window_start' => $maintenance_window_start
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
2676
ncp-app/package-lock.json
generated
2676
ncp-app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -20,11 +20,11 @@ __webpack_public_path__ = generateFilePath(appName, '', 'js/')
|
||||
// })
|
||||
|
||||
|
||||
async function saveSettings() {
|
||||
let settings = collectSettings();
|
||||
async function saveNcpSettings() {
|
||||
let settings = collectNcpSettings();
|
||||
console.log("Saving nextcloudpi settings: ", settings);
|
||||
try {
|
||||
let response = await axios.post(generateUrl('/apps/nextcloudpi/api/settings'), {settings: settings})
|
||||
let response = await axios.post(generateUrl('/apps/nextcloudpi/api/settings/ncp'), {settings: settings})
|
||||
console.log("Saving ncp settings succeeded")
|
||||
return {success: true, error: null}
|
||||
} catch (e) {
|
||||
@ -35,24 +35,50 @@ async function saveSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
function collectSettings() {
|
||||
async function saveNcSettings() {
|
||||
let settings = collectNcSettings()
|
||||
console.log("Saving nextcloud settings: ", settings)
|
||||
try {
|
||||
let response = await axios.post(generateUrl('/apps/nextcloudpi/api/settings/nextcloud'), {settings: settings})
|
||||
console.log("Saving nextcloud settings succeeded")
|
||||
return {success: true, error: null}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
let errMsg = e.response.data.error;
|
||||
throw Error(`${errMsg ? errMsg : e.message} (HTTP ${e.response.status}`)
|
||||
}
|
||||
}
|
||||
|
||||
function collectNcpSettings() {
|
||||
let settings = {};
|
||||
document.querySelectorAll("#nextcloudpi input").forEach(element => {
|
||||
document.querySelectorAll("#ncp-settings input").forEach(element => {
|
||||
if (element.type === "checkbox") {
|
||||
settings[element.name] = element.checked;
|
||||
} else {
|
||||
settings[element.name] = element.value;
|
||||
}
|
||||
});
|
||||
return settings;
|
||||
return settings
|
||||
}
|
||||
|
||||
function collectNcSettings() {
|
||||
let settings = {};
|
||||
document.querySelectorAll("#ncp-settings-nc input").forEach(element => {
|
||||
if (element.type === "checkbox") {
|
||||
settings[element.name] = element.checked;
|
||||
} else {
|
||||
settings[element.name] = element.value;
|
||||
}
|
||||
})
|
||||
return settings
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
console.log("Listening to ncp settings changes");
|
||||
let errorBox = document.querySelector("#nextcloudpi .error-message");
|
||||
document.querySelectorAll("#nextcloudpi input").forEach(element => {
|
||||
document.querySelectorAll("#ncp-settings input").forEach(element => {
|
||||
element.addEventListener("change", async () => {
|
||||
saveSettings()
|
||||
saveNcpSettings()
|
||||
.then(() => {
|
||||
errorBox.classList.add("hidden");
|
||||
})
|
||||
@ -63,4 +89,17 @@ window.addEventListener('load', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
document.querySelectorAll("#ncp-settings-nc input").forEach(element => {
|
||||
element.addEventListener("change", async () => {
|
||||
saveNcSettings()
|
||||
.then(() => {
|
||||
errorBox.classList.add("hidden")
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(e)
|
||||
errorBox.innerText = "Failed to save Nextcloud settings: " + e.message
|
||||
errorBox.classList.remove("hidden")
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -8,28 +8,44 @@ style('nextcloudpi', 'admin');
|
||||
<h3>System Info</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<div>NCP Version:</div><div><?php echo $_["ncp_version"] ?></div>
|
||||
<div>NCP Version:</div>
|
||||
<div><?php echo $_["ncp_version"] ?></div>
|
||||
</li>
|
||||
<li>
|
||||
<div>PHP Version:</div><div><?php echo $_["ncp"]["php_version"] ?></div>
|
||||
<div>PHP Version:</div>
|
||||
<div><?php echo $_["ncp"]["php_version"] ?></div>
|
||||
</li>
|
||||
<li>
|
||||
<div>Debian Release:</div><div><?php echo $_["ncp"]["release"] ?></div>
|
||||
<div>Debian Release:</div>
|
||||
<div><?php echo $_["ncp"]["release"] ?></div>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Settings</h3>
|
||||
<ul>
|
||||
<h3>Nextcloud Settings</h3>
|
||||
<ul id="ncp-settings-nc">
|
||||
<li>
|
||||
<input name="maintenance_window_start" type="number" value="<?php echo $_['maintenance_window_start']; ?>"/>
|
||||
<label for="maintenance_window_start">Maintenance Window Start Hour</label>
|
||||
</li>
|
||||
<li>
|
||||
<input name="default_phone_region" type="text" value="<?php echo $_['default_phone_region']; ?>"/>
|
||||
<label for="default_phone_region">Default Phone Region</label>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>NCP Settings</h3>
|
||||
<ul id="ncp-settings">
|
||||
<li>
|
||||
<input name="canary" type="checkbox" <?php echo $_['community']['CANARY'] === 'yes' ? ' checked="checked"' : ''; ?>"/>
|
||||
<label for="canary">Enable updates from canary (testing) channel</label>
|
||||
</li>
|
||||
<li>
|
||||
<input name="adminNotifications" type="checkbox" <?php echo $_['community']['ADMIN_NOTIFICATIONS'] === 'yes' ? ' checked="checked"' : ''; ?>"/>
|
||||
<input name="adminNotifications"
|
||||
type="checkbox" <?php echo $_['community']['ADMIN_NOTIFICATIONS'] === 'yes' ? ' checked="checked"' : ''; ?>"/>
|
||||
<label for="adminNotifications">Enable notifications about relevant changes in NCP</label>
|
||||
</li>
|
||||
<li>
|
||||
<input name="usageSurveys" type="checkbox" <?php echo $_['community']['USAGE_SURVEYS'] === 'yes' ? ' checked="checked"' : ''; ?>"/>
|
||||
<label for="usageSurveys">Enable notifications for surveys that help to improve NCP</label>
|
||||
<input name="usageSurveys"
|
||||
type="checkbox" <?php echo $_['community']['USAGE_SURVEYS'] === 'yes' ? ' checked="checked"' : ''; ?>"/>
|
||||
<label for="adminNotifications">Enable notifications for surveys that help to improve NCP</label>
|
||||
</li>
|
||||
<li>
|
||||
<div>Accounts to notify:</div>
|
||||
|
||||
@ -25,7 +25,7 @@ The first time you install this app, before using a cron job, you properly want
|
||||
</types>
|
||||
<dependencies>
|
||||
<php min-version="7.2"/>
|
||||
<nextcloud min-version="20" max-version="27" />
|
||||
<nextcloud min-version="20" max-version="28" />
|
||||
</dependencies>
|
||||
|
||||
<commands>
|
||||
|
||||
@ -121,6 +121,25 @@ def is_admin_notifications_checkbox(item: WebElement):
|
||||
return False
|
||||
|
||||
|
||||
def close_first_run_wizard(driver: WebDriver):
|
||||
wait = WebDriverWait(driver, 60)
|
||||
first_run_wizard = None
|
||||
try:
|
||||
first_run_wizard = driver.find_element(By.CSS_SELECTOR, "#firstrunwizard")
|
||||
except NoSuchElementException:
|
||||
pass
|
||||
if first_run_wizard is not None and first_run_wizard.is_displayed():
|
||||
wait.until(VisibilityOfElementLocatedByAnyLocator([(By.CLASS_NAME, "modal-container__close"),
|
||||
(By.CLASS_NAME, "first-run-wizard__close-button")]))
|
||||
try:
|
||||
overlay_close_btn = driver.find_element(By.CLASS_NAME, "first-run-wizard__close-button")
|
||||
overlay_close_btn.click()
|
||||
except NoSuchElementException:
|
||||
overlay_close_btn = driver.find_element(By.CLASS_NAME, "modal-container__close")
|
||||
overlay_close_btn.click()
|
||||
time.sleep(3)
|
||||
|
||||
|
||||
def test_nextcloud(IP: str, nc_port: str, driver: WebDriver):
|
||||
""" Login and assert admin page checks"""
|
||||
test = Test()
|
||||
@ -159,9 +178,24 @@ def test_nextcloud(IP: str, nc_port: str, driver: WebDriver):
|
||||
|
||||
if element_warn.is_displayed():
|
||||
|
||||
if driver.find_element(By.CSS_SELECTOR, "#postsetupchecks > .errors").is_displayed() \
|
||||
or driver.find_element(By.CSS_SELECTOR, "#postsetupchecks > .warnings").is_displayed():
|
||||
raise ConfigTestFailure("There have been errors or warnings")
|
||||
warnings = driver.find_elements(By.CSS_SELECTOR, "#postsetupchecks > .warnings > li")
|
||||
for warning in warnings:
|
||||
if re.match(r'.*Server has no maintenance window start time configured.*', warning.text):
|
||||
continue
|
||||
elif re.match(r'.*Could not check for JavaScript support.*', warning.text):
|
||||
continue
|
||||
# TODO: Solve redis error logs at the source
|
||||
elif re.match(r'.*\d+ errors in the logs since.*', warning.text):
|
||||
continue
|
||||
else:
|
||||
raise ConfigTestFailure(f"WARN: {warning.text}")
|
||||
|
||||
if driver.find_element(By.CSS_SELECTOR, "#postsetupchecks > .errors").is_displayed():
|
||||
try:
|
||||
first_error = driver.find_element(By.CSS_SELECTOR, "#postsetupchecks > .errors > li")
|
||||
except NoSuchElementException:
|
||||
first_error = None
|
||||
raise ConfigTestFailure(f"ERROR: {first_error.text if first_error is not None else 'unexpected error'}")
|
||||
|
||||
infos = driver.find_elements(By.CSS_SELECTOR, "#postsetupchecks > .info > li")
|
||||
for info in infos:
|
||||
@ -169,7 +203,7 @@ def test_nextcloud(IP: str, nc_port: str, driver: WebDriver):
|
||||
or re.match(r'The PHP module "imagick" is not enabled', info.text):
|
||||
continue
|
||||
else:
|
||||
print('text', info.text)
|
||||
print(f'INFO: {info.text}')
|
||||
php_modules = info.find_elements(By.CSS_SELECTOR, "li")
|
||||
if len(php_modules) != 1:
|
||||
raise ConfigTestFailure(f"Could not find the list of php modules within the info message "
|
||||
@ -186,13 +220,7 @@ def test_nextcloud(IP: str, nc_port: str, driver: WebDriver):
|
||||
except Exception as e:
|
||||
test.check(e)
|
||||
|
||||
try:
|
||||
overlay_close_btn = driver.find_element(By.CLASS_NAME, "modal-container__close")
|
||||
if overlay_close_btn.is_displayed():
|
||||
overlay_close_btn.click()
|
||||
time.sleep(3)
|
||||
except NoSuchElementException:
|
||||
pass
|
||||
close_first_run_wizard(driver)
|
||||
|
||||
test.new("admin section (1)")
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user