diff --git a/changelog/unreleased/enhancement-configurable-legal-links.md b/changelog/unreleased/enhancement-configurable-legal-links.md new file mode 100644 index 00000000000..f0b9dd1f74c --- /dev/null +++ b/changelog/unreleased/enhancement-configurable-legal-links.md @@ -0,0 +1,7 @@ +Enhancement: Add configurable software license and help page links + +Themes can now set `common.urls.softwareLicense` and `common.urls.helpPage` to +surface deployment-specific legal/help links in the web UI. When set, links +appear in a new "Help" menu in the topbar and on the account page. + +https://github.com/owncloud/ocis/pull/12528 diff --git a/web/packages/web-pkg/src/composables/piniaStores/theme.ts b/web/packages/web-pkg/src/composables/piniaStores/theme.ts index 41e2eb825ae..5c36cc5922a 100644 --- a/web/packages/web-pkg/src/composables/piniaStores/theme.ts +++ b/web/packages/web-pkg/src/composables/piniaStores/theme.ts @@ -26,7 +26,9 @@ const CommonSection = z.object({ privacy: z.string(), accessibilityStatement: z.string().optional(), universalAccessEasyLanguage: z.string().optional(), - universalAccessSignLanguage: z.string().optional() + universalAccessSignLanguage: z.string().optional(), + softwareLicense: z.string().optional(), + helpPage: z.string().optional() }), shareRoles: z.record( z.string(), diff --git a/web/packages/web-runtime/src/components/Topbar/HelpMenu.vue b/web/packages/web-runtime/src/components/Topbar/HelpMenu.vue new file mode 100644 index 00000000000..ae27a83d5ef --- /dev/null +++ b/web/packages/web-runtime/src/components/Topbar/HelpMenu.vue @@ -0,0 +1,116 @@ + + + + + diff --git a/web/packages/web-runtime/src/components/Topbar/TopBar.vue b/web/packages/web-runtime/src/components/Topbar/TopBar.vue index 8cbd3267427..c9aa2975e72 100644 --- a/web/packages/web-runtime/src/components/Topbar/TopBar.vue +++ b/web/packages/web-runtime/src/components/Topbar/TopBar.vue @@ -75,6 +75,7 @@ v-bind="feedbackLinkOptions" /> + @@ -95,6 +96,7 @@ import Notifications from './Notifications.vue' import FeedbackLink from './FeedbackLink.vue' import SideBarToggle from './SideBarToggle.vue' import UniversalAccessDropdown from './UniversalAccessDropdown.vue' +import HelpMenu from './HelpMenu.vue' import { ApplicationInformation, CustomComponentTarget, @@ -118,6 +120,7 @@ export default { ApplicationsMenu, CustomComponentTarget, FeedbackLink, + HelpMenu, Notifications, SideBarToggle, UserMenu, diff --git a/web/packages/web-runtime/src/helpers/staticAppMenuItems.ts b/web/packages/web-runtime/src/helpers/staticAppMenuItems.ts new file mode 100644 index 00000000000..42837c84ab7 --- /dev/null +++ b/web/packages/web-runtime/src/helpers/staticAppMenuItems.ts @@ -0,0 +1,40 @@ +import { AppMenuItemExtension, WebThemeType } from '@ownclouders/web-pkg' +import { Language } from 'vue3-gettext' + +export const buildStaticAppMenuItems = ( + common: WebThemeType['common'], + $pgettext: Language['$pgettext'] +): AppMenuItemExtension[] => { + const items: AppMenuItemExtension[] = [] + + const softwareLicenseUrl = common?.urls?.softwareLicense + const helpPageUrl = common?.urls?.helpPage + + if (softwareLicenseUrl) { + items.push({ + id: 'app.runtime.header.app-menu.software-license', + type: 'appMenuItem', + label: () => + $pgettext( + 'Apps menu: link label; opens the software license information page.', + 'Software License Information' + ), + icon: 'scales', + priority: 900, + url: softwareLicenseUrl + }) + } + + if (helpPageUrl) { + items.push({ + id: 'app.runtime.header.app-menu.help-page', + type: 'appMenuItem', + label: () => $pgettext('Apps menu: link label; opens the help pages.', 'Help Pages'), + icon: 'question', + priority: 910, + url: helpPageUrl + }) + } + + return items +} diff --git a/web/packages/web-runtime/src/index.ts b/web/packages/web-runtime/src/index.ts index e8494d3a1fc..79ccb9e96e1 100644 --- a/web/packages/web-runtime/src/index.ts +++ b/web/packages/web-runtime/src/index.ts @@ -1,6 +1,6 @@ import { loadDesignSystem, pages, loadTranslations, supportedLanguages } from './defaults' import { router } from './router' -import { PortalTarget, useVault } from '@ownclouders/web-pkg' +import { PortalTarget, useThemeStore, useVault } from '@ownclouders/web-pkg' import { createHead } from '@vueuse/head' import { abilitiesPlugin } from '@casl/vue' import { createMongoAbility } from '@casl/ability' @@ -39,7 +39,8 @@ import { PublicSpaceResource } from '@ownclouders/web-client' import { loadCustomTranslations } from './helpers/customTranslations' -import { createApp, onWatcherCleanup, watch } from 'vue' +import { buildStaticAppMenuItems } from './helpers/staticAppMenuItems' +import { createApp, computed, onWatcherCleanup, watch } from 'vue' import PortalVue, { createWormhole } from 'portal-vue' import { createPinia } from 'pinia' import Avatar from './components/Avatar.vue' @@ -146,6 +147,13 @@ export const bootstrapApp = async (configurationPath: string, appsReadyCallback: themePromise ]) + app.runWithContext(() => { + const themeStore = useThemeStore() + extensionRegistry.registerExtensions( + computed(() => buildStaticAppMenuItems(themeStore.currentTheme.common, gettext.$pgettext)) + ) + }) + // Important: has to happen AFTER native applications are loaded. // Reason: the `external` app serves as a blueprint for creating the app provider apps. if (applicationStore.has('web-app-external')) { diff --git a/web/packages/web-runtime/src/pages/account.vue b/web/packages/web-runtime/src/pages/account.vue index b8aedcf6b01..d773d70b12b 100644 --- a/web/packages/web-runtime/src/pages/account.vue +++ b/web/packages/web-runtime/src/pages/account.vue @@ -40,6 +40,34 @@ + +