aboutsummaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/updatenotification/src')
-rw-r--r--apps/updatenotification/src/components/AppChangelogDialog.vue6
-rw-r--r--apps/updatenotification/src/components/Markdown.vue4
-rw-r--r--apps/updatenotification/src/components/UpdateNotification.vue24
-rw-r--r--apps/updatenotification/src/composables/useMarkdown.ts4
-rw-r--r--apps/updatenotification/src/init.ts13
-rw-r--r--apps/updatenotification/src/update-notification-legacy.ts24
-rw-r--r--apps/updatenotification/src/updatenotification.js22
-rw-r--r--apps/updatenotification/src/view-changelog-page.ts4
-rw-r--r--apps/updatenotification/src/views/App.vue8
9 files changed, 73 insertions, 36 deletions
diff --git a/apps/updatenotification/src/components/AppChangelogDialog.vue b/apps/updatenotification/src/components/AppChangelogDialog.vue
index 5171f3e122c..0fb7432843c 100644
--- a/apps/updatenotification/src/components/AppChangelogDialog.vue
+++ b/apps/updatenotification/src/components/AppChangelogDialog.vue
@@ -1,3 +1,7 @@
+<!--
+ - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ - SPDX-License-Identifier: AGPL-3.0-or-later
+-->
<template>
<NcDialog content-classes="app-changelog-dialog"
:buttons="dialogButtons"
@@ -15,7 +19,7 @@ import { generateOcsUrl } from '@nextcloud/router'
import { ref, watchEffect } from 'vue'
import axios from '@nextcloud/axios'
-import NcDialog from '@nextcloud/vue/dist/Components/NcDialog.js'
+import NcDialog from '@nextcloud/vue/components/NcDialog'
import Markdown from './Markdown.vue'
const props = withDefaults(
diff --git a/apps/updatenotification/src/components/Markdown.vue b/apps/updatenotification/src/components/Markdown.vue
index ce69477a1bf..125b0ff96a9 100644
--- a/apps/updatenotification/src/components/Markdown.vue
+++ b/apps/updatenotification/src/components/Markdown.vue
@@ -1,3 +1,7 @@
+<!--
+ - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ - SPDX-License-Identifier: AGPL-3.0-or-later
+-->
<template>
<!-- eslint-disable-next-line vue/no-v-html -->
<div class="markdown" v-html="html" />
diff --git a/apps/updatenotification/src/components/UpdateNotification.vue b/apps/updatenotification/src/components/UpdateNotification.vue
index 093cbdd8a56..94c58dbdfd9 100644
--- a/apps/updatenotification/src/components/UpdateNotification.vue
+++ b/apps/updatenotification/src/components/UpdateNotification.vue
@@ -1,3 +1,7 @@
+<!--
+ - SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
+ - SPDX-License-Identifier: AGPL-3.0-or-later
+-->
<template>
<NcSettingsSection id="updatenotification" :name="t('updatenotification', 'Update')">
<div class="update">
@@ -163,18 +167,18 @@ import { getLoggerBuilder } from '@nextcloud/logger'
import { generateUrl, getRootUrl, generateOcsUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
-import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
-import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
-import NcActionCaption from '@nextcloud/vue/dist/Components/NcActionCaption.js'
-import NcActionLink from '@nextcloud/vue/dist/Components/NcActionLink.js'
-import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
-import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
-import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js'
+import NcActions from '@nextcloud/vue/components/NcActions'
+import NcActionButton from '@nextcloud/vue/components/NcActionButton'
+import NcActionCaption from '@nextcloud/vue/components/NcActionCaption'
+import NcActionLink from '@nextcloud/vue/components/NcActionLink'
+import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
+import NcSelect from '@nextcloud/vue/components/NcSelect'
+import NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'
import IconChevronDown from 'vue-material-design-icons/ChevronDown.vue'
import IconCloudCheckVariant from 'vue-material-design-icons/CloudCheckVariant.vue'
import IconLink from 'vue-material-design-icons/Link.vue'
import IconNewBox from 'vue-material-design-icons/NewBox.vue'
-import IconPencil from 'vue-material-design-icons/Pencil.vue'
+import IconPencil from 'vue-material-design-icons/PencilOutline.vue'
import IconSourceBranch from 'vue-material-design-icons/SourceBranch.vue'
import IconStar from 'vue-material-design-icons/Star.vue'
import IconWeatherNight from 'vue-material-design-icons/WeatherNight.vue'
@@ -353,10 +357,10 @@ export default {
this.missingAppUpdates = data.ocs.data.missing
this.isListFetched = true
this.appStoreFailed = false
- }).catch(({ data }) => {
+ }).catch(({ response }) => {
this.availableAppUpdates = []
this.missingAppUpdates = []
- this.appStoreDisabled = data.ocs.data.appstore_disabled
+ this.appStoreDisabled = response.data.ocs.data.appstore_disabled
this.isListFetched = true
this.appStoreFailed = true
})
diff --git a/apps/updatenotification/src/composables/useMarkdown.ts b/apps/updatenotification/src/composables/useMarkdown.ts
index 1fd97335ed6..71b496a10b3 100644
--- a/apps/updatenotification/src/composables/useMarkdown.ts
+++ b/apps/updatenotification/src/composables/useMarkdown.ts
@@ -1,3 +1,7 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
import type { Ref } from 'vue'
import { marked } from 'marked'
diff --git a/apps/updatenotification/src/init.ts b/apps/updatenotification/src/init.ts
index a2421340982..d82272bf4b2 100644
--- a/apps/updatenotification/src/init.ts
+++ b/apps/updatenotification/src/init.ts
@@ -1,10 +1,16 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+import type { INavigationEntry } from '../../../core/src/types/navigation'
+
import { subscribe } from '@nextcloud/event-bus'
import { loadState } from '@nextcloud/initial-state'
import { generateOcsUrl } from '@nextcloud/router'
import Vue, { defineAsyncComponent } from 'vue'
import axios from '@nextcloud/axios'
-const navigationEntries = loadState('core', 'apps', {})
+const navigationEntries = loadState<INavigationEntry[]>('core', 'apps', [])
const DialogVue = defineAsyncComponent(() => import('./components/AppChangelogDialog.vue'))
@@ -35,8 +41,9 @@ function showDialog(appId: string, version?: string) {
dialog.$destroy?.()
resolve(dismissed)
- if (dismissed && appId in navigationEntries) {
- window.location = navigationEntries[appId].href
+ const app = navigationEntries.find(({ app }) => app === appId)
+ if (dismissed && app !== undefined) {
+ window.location.href = app.href
}
}
},
diff --git a/apps/updatenotification/src/update-notification-legacy.ts b/apps/updatenotification/src/update-notification-legacy.ts
new file mode 100644
index 00000000000..5809c1761dc
--- /dev/null
+++ b/apps/updatenotification/src/update-notification-legacy.ts
@@ -0,0 +1,24 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import { showInfo } from '@nextcloud/dialogs'
+import { loadState } from '@nextcloud/initial-state'
+import { t } from '@nextcloud/l10n'
+
+interface IUpdateNotificationState {
+ updateLink: string
+ updateVersion: string
+}
+
+/**
+ * This only gets loaded if an update is available and the notifications app is not enabled for the user.
+ */
+window.addEventListener('DOMContentLoaded', function() {
+ const { updateLink, updateVersion } = loadState<IUpdateNotificationState>('updatenotification', 'updateState')
+ const text = t('core', '{version} is available. Get more information on how to update.', { version: updateVersion })
+
+ // On click open the update link in a new tab
+ showInfo(text, { onClick: () => window.open(updateLink, '_blank') })
+})
diff --git a/apps/updatenotification/src/updatenotification.js b/apps/updatenotification/src/updatenotification.js
index 8d0e18e1bf1..44b783e1454 100644
--- a/apps/updatenotification/src/updatenotification.js
+++ b/apps/updatenotification/src/updatenotification.js
@@ -1,24 +1,6 @@
/**
- * @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @license AGPL-3.0-or-later
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { translate, translatePlural } from '@nextcloud/l10n'
diff --git a/apps/updatenotification/src/view-changelog-page.ts b/apps/updatenotification/src/view-changelog-page.ts
index dc429bd5a1c..d7f8e84680d 100644
--- a/apps/updatenotification/src/view-changelog-page.ts
+++ b/apps/updatenotification/src/view-changelog-page.ts
@@ -1,3 +1,7 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
import Vue from 'vue'
import App from './views/App.vue'
diff --git a/apps/updatenotification/src/views/App.vue b/apps/updatenotification/src/views/App.vue
index 7d5a04db104..8bf1d86dfe2 100644
--- a/apps/updatenotification/src/views/App.vue
+++ b/apps/updatenotification/src/views/App.vue
@@ -1,3 +1,7 @@
+<!--
+ - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ - SPDX-License-Identifier: AGPL-3.0-or-later
+-->
<template>
<NcContent app-name="updatenotification">
<NcAppContent :page-heading="t('updatenotification', 'Changelog for app {app}', { app: appName })">
@@ -15,8 +19,8 @@
import { translate as t } from '@nextcloud/l10n'
import { loadState } from '@nextcloud/initial-state'
-import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent.js'
-import NcContent from '@nextcloud/vue/dist/Components/NcContent.js'
+import NcAppContent from '@nextcloud/vue/components/NcAppContent'
+import NcContent from '@nextcloud/vue/components/NcContent'
import Markdown from '../components/Markdown.vue'
const {