Skip to content
Open
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
109 changes: 109 additions & 0 deletions .github/workflows/node-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT

name: Node tests

on:
pull_request:
push:
branches:
- main
- master
- stable*

permissions:
contents: read

concurrency:
group: node-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
changes:
runs-on: ubuntu-latest-low
permissions:
contents: read
pull-requests: read

outputs:
src: ${{ steps.changes.outputs.src}}

steps:
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/**'
- '__tests__/**'
- '__mocks__/**'
- 'src/**'
- 'appinfo/info.xml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- '**.js'
- '**.ts'
- '**.vue'

test:
runs-on: ubuntu-latest

needs: changes
if: needs.changes.outputs.src != 'false'

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Read package.json node and npm engines version
uses: nextcloud-libraries/parse-package-engines-action@39fcc545a815c353dd0a3fd8fd2ef6e59fd02b92 # v0.2.0
id: versions

- name: Set up node ${{ steps.versions.outputs.node-version }}
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ steps.versions.outputs.node-version }}

- name: Set up npm ${{ steps.versions.outputs.package-manager-version }}
run: npm i -g 'npm@${{ steps.versions.outputs.package-manager-version }}'

- name: Install dependencies & build
env:
CYPRESS_INSTALL_BINARY: 0
run: |
npm ci
npm run build --if-present

- name: Test
run: npm run test --if-present

- name: Test and process coverage
run: npm run test:coverage --if-present

- name: Collect coverage
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: ./coverage/lcov.info

summary:
permissions:
contents: none
runs-on: ubuntu-latest-low
needs: [changes, test]

if: always()

name: test-summary

steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi
1 change: 1 addition & 0 deletions .nextcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ src/
tests/
vendor-bin/
vite.config.mjs
vitest.config.mjs
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ directory **nextcloud/apps/serverinfo**

## Operating system

The app keeps track of what keeps the Linux distribution under Nextcloud
secure:
The **Operating system** page shows what keeps the Linux distribution under
Nextcloud secure:

- pending updates, security fixes first, with the packages Nextcloud itself
runs on (PHP, the web server, the database, Redis …) marked
Expand All @@ -36,12 +36,13 @@ secure:
time synchronisation, SELinux and AppArmor

Debian, Ubuntu, RHEL and its rebuilds, Fedora, openSUSE and SLES, Arch and
Alpine are supported. Inside Docker, Podman, Kubernetes or a snap the status says
Alpine are supported. Inside Docker, Podman, Kubernetes or a snap the page says
what can and cannot be known from inside; LXC and systemd-nspawn guests are
treated like machines without a kernel of their own.

Nothing is installed or changed. To find out, the app reads `/etc/os-release`,
`/proc` (uptime, `/proc/1/cgroup`, its own process maps), `/sys/class/dmi/id`,
Nothing is installed or changed. Each command shown on the page is for the
admin to copy. To find out, the app reads `/etc/os-release`, `/proc` (uptime,
`/proc/1/cgroup`, its own process maps), `/sys/class/dmi/id`,
`/sys/kernel/livepatch`, the SELinux and AppArmor state under `/sys`, the
package manager's configuration, state and logs, `/run/reboot-required` and the
installed kernel modules. It runs the package manager's query commands (updates
Expand All @@ -62,8 +63,9 @@ The status is collected by a background job once an hour, when background
jobs run from system cron; under AJAX or webcron the commands would hold a web
request for minutes. A status older than three job intervals (at least six
hours), or background jobs that do not run from system cron, count as a
warning, so an old all-clear is never shown as current. Admins can also check
it right away with:
warning, so an old all-clear is never shown as current. "Check now" on the page
queues a check for the next cron run and shows the result when it is done;
only one check runs at a time. Admins can also run:

```
occ serverinfo:os-status [--refresh] [--output=json]
Expand All @@ -75,8 +77,8 @@ collected yet, or nothing is wrong but the pending updates could not be
determined. The same verdict appears as setup checks on Settings → Overview
(only for admins; sub-admins, who may load the setup checks too, get no
details), in a notification to admins when a concern escalates, and in the
**Server health** dashboard widget for admins. When something counts as a warning or an error is set by
the `os_*_days` app config values, see `lib/Config/ConfigLexicon.php`.
**Server health** dashboard widget for admins. When something counts as a
warning or an error can be adjusted on the page.

Release support dates are bundled with the app (see
`build/update-os-support.php`, data from [endoflife.date](https://endoflife.date),
Expand Down
3 changes: 3 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
['name' => 'database#settings', 'url' => '/database/settings', 'verb' => 'GET'],
['name' => 'database#updateSettings', 'url' => '/database/settings', 'verb' => 'PUT'],
['name' => 'database#testConnection', 'url' => '/database/test-connection', 'verb' => 'POST'],
['name' => 'os#status', 'url' => '/os', 'verb' => 'GET'],
['name' => 'os#refresh', 'url' => '/os/refresh', 'verb' => 'POST'],
['name' => 'os#updateSettings', 'url' => '/os/settings', 'verb' => 'PUT'],
],
'ocs' => [
['name' => 'api#info', 'url' => '/api/v1/info', 'verb' => 'GET'],
Expand Down
4 changes: 2 additions & 2 deletions css/main-BRcDN8pq.chunk.css → css/main-C-zeP7Uf.chunk.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/serverinfo-main.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/* extracted by css-entry-points-plugin */
@import './main-BRcDN8pq.chunk.css';
@import './main-C-zeP7Uf.chunk.css';
36 changes: 18 additions & 18 deletions js/serverinfo-main.mjs

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion js/serverinfo-main.mjs.license
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
SPDX-FileCopyrightText: Rob Cresswell <robcresswell@pm.me>
SPDX-FileCopyrightText: atomiks
SPDX-FileCopyrightText: chart.js developers
SPDX-FileCopyrightText: debounce developers
SPDX-FileCopyrightText: escape-html developers
SPDX-FileCopyrightText: serverinfo developers

Expand Down Expand Up @@ -47,15 +48,24 @@ This file is generated from multiple sources. Included packages:
- @nextcloud/browser-storage
- version: 0.5.0
- license: GPL-3.0-or-later
- @nextcloud/capabilities
- version: 1.2.1
- license: GPL-3.0-or-later
- @nextcloud/event-bus
- version: 3.3.3
- license: GPL-3.0-or-later
- @nextcloud/initial-state
- version: 3.0.0
- license: GPL-3.0-or-later
- @nextcloud/l10n
- version: 3.4.1
- license: GPL-3.0-or-later
- @nextcloud/logger
- version: 3.0.3
- license: GPL-3.0-or-later
- @nextcloud/password-confirmation
- version: 6.1.0
- license: MIT
- @nextcloud/router
- version: 3.2.0
- license: GPL-3.0-or-later
Expand All @@ -66,7 +76,7 @@ This file is generated from multiple sources. Included packages:
- version: 4.1.0
- license: MIT
- @vitejs/plugin-vue
- version: 6.0.7
- version: 6.0.10
- license: MIT
- @vue/reactivity
- version: 3.5.43
Expand All @@ -92,6 +102,9 @@ This file is generated from multiple sources. Included packages:
- chart.js
- version: 4.5.1
- license: MIT
- debounce
- version: 3.0.0
- license: MIT
- dompurify
- version: 3.4.16
- license: (MPL-2.0 OR Apache-2.0)
Expand Down
2 changes: 1 addition & 1 deletion js/serverinfo-main.mjs.map

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion js/serverinfo-main.mjs.map.license
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
SPDX-FileCopyrightText: Rob Cresswell <robcresswell@pm.me>
SPDX-FileCopyrightText: atomiks
SPDX-FileCopyrightText: chart.js developers
SPDX-FileCopyrightText: debounce developers
SPDX-FileCopyrightText: escape-html developers
SPDX-FileCopyrightText: serverinfo developers

Expand Down Expand Up @@ -47,15 +48,24 @@ This file is generated from multiple sources. Included packages:
- @nextcloud/browser-storage
- version: 0.5.0
- license: GPL-3.0-or-later
- @nextcloud/capabilities
- version: 1.2.1
- license: GPL-3.0-or-later
- @nextcloud/event-bus
- version: 3.3.3
- license: GPL-3.0-or-later
- @nextcloud/initial-state
- version: 3.0.0
- license: GPL-3.0-or-later
- @nextcloud/l10n
- version: 3.4.1
- license: GPL-3.0-or-later
- @nextcloud/logger
- version: 3.0.3
- license: GPL-3.0-or-later
- @nextcloud/password-confirmation
- version: 6.1.0
- license: MIT
- @nextcloud/router
- version: 3.2.0
- license: GPL-3.0-or-later
Expand All @@ -66,7 +76,7 @@ This file is generated from multiple sources. Included packages:
- version: 4.1.0
- license: MIT
- @vitejs/plugin-vue
- version: 6.0.7
- version: 6.0.10
- license: MIT
- @vue/reactivity
- version: 3.5.43
Expand All @@ -92,6 +102,9 @@ This file is generated from multiple sources. Included packages:
- chart.js
- version: 4.5.1
- license: MIT
- debounce
- version: 3.0.0
- license: MIT
- dompurify
- version: 3.4.16
- license: (MPL-2.0 OR Apache-2.0)
Expand Down
5 changes: 5 additions & 0 deletions lib/Commands/ShowOsStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public function __invoke(
bool $refresh = false,
): int {
if ($refresh) {
if ($this->collector->isCollecting()) {
$output->writeln('<error>The operating system status is being collected right now; try again in a few minutes.</error>');

return self::EXIT_UNKNOWN;
}
if ($this->collector->collectAndStore() === null) {
$output->writeln('<error>The operating system status could not be collected; see the Nextcloud log.</error>');

Expand Down
Loading
Loading