diff --git a/l10n/messages.pot b/l10n/messages.pot index 685520ecd..d4f84560c 100644 --- a/l10n/messages.pot +++ b/l10n/messages.pot @@ -14,6 +14,9 @@ msgstr "" msgid "All files" msgstr "" +msgid "Cancel" +msgstr "" + msgid "Choose" msgstr "" @@ -46,6 +49,12 @@ msgstr "" msgid "Current view selector" msgstr "" +msgid "Enter your name" +msgstr "" + +msgid "Failed to set nickname." +msgstr "" + msgid "Favorites" msgstr "" @@ -61,6 +70,9 @@ msgstr "" msgid "Folder name cannot be empty." msgstr "" +msgid "Guest identification" +msgstr "" + msgid "Home" msgstr "" @@ -94,6 +106,9 @@ msgstr "" msgid "No matching files" msgstr "" +msgid "Please enter a name with at least 2 characters." +msgstr "" + msgid "Recent" msgstr "" @@ -109,8 +124,17 @@ msgstr "" msgid "Size" msgstr "" +msgid "Submit name" +msgstr "" + msgid "Undo" msgstr "" msgid "Upload some content or sync with your devices!" msgstr "" + +msgid "You are currently not identified." +msgstr "" + +msgid "You cannot leave the name empty." +msgstr "" diff --git a/lib/components/PublicAuthPrompt.vue b/lib/components/PublicAuthPrompt.vue new file mode 100644 index 000000000..1d3ee5748 --- /dev/null +++ b/lib/components/PublicAuthPrompt.vue @@ -0,0 +1,223 @@ + + + + + + diff --git a/lib/index.ts b/lib/index.ts index 9e6ed6d9a..86ed09b4f 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -47,3 +47,5 @@ export type { IFilePickerButton, IFilePickerFilter, } from './components/types.js' + +export { showGuestUserPrompt } from './public-auth.js' diff --git a/lib/public-auth.ts b/lib/public-auth.ts new file mode 100644 index 000000000..31c128d9a --- /dev/null +++ b/lib/public-auth.ts @@ -0,0 +1,28 @@ +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import type { ComponentProps } from 'vue-component-type-helpers' +import { defineAsyncComponent } from 'vue' +import { spawnDialog } from '@nextcloud/vue/functions/dialog' + +import type PublicAuthPrompt from './components/PublicAuthPrompt.vue' + +type PublicAuthPromptProps = ComponentProps + +/** + * Show the public auth prompt dialog + * This is used to ask the current user their nickname + * as well as show some additional contextual information + * @param props The props to pass to the dialog, see PublicAuthPrompt.vue for details + */ +export function showGuestUserPrompt(props: PublicAuthPromptProps) { + return new Promise((resolve) => { + spawnDialog( + defineAsyncComponent(() => import('./components/PublicAuthPrompt.vue')), + props, + resolve, + ) + }) +} diff --git a/package-lock.json b/package-lock.json index f36e5e13b..f3375e88c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@mdi/js": "^7.4.47", "@nextcloud/auth": "^2.4.0", "@nextcloud/axios": "^2.5.1", + "@nextcloud/browser-storage": "^0.4.0", "@nextcloud/event-bus": "^3.3.2", "@nextcloud/files": "^3.10.2", "@nextcloud/initial-state": "^2.2.0", @@ -51,6 +52,7 @@ "typescript-plugin-css-modules": "^5.1.0", "vite": "^6.3.3", "vitest": "^3.0.3", + "vue-component-type-helpers": "^2.2.10", "vue-material-design-icons": "^5.3.1", "vue-template-compiler": "^2.7.16" }, @@ -1451,6 +1453,7 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/@nextcloud/browser-storage/-/browser-storage-0.4.0.tgz", "integrity": "sha512-D6XxznxCYmJ3oBCC3p0JB6GZJ2RZ9dgbB1UqtTePXrIvHUMBAeF/YkiGKYxLAVZCZb+NSNZXgAYHm/3LnIUbDg==", + "license": "GPL-3.0-or-later", "dependencies": { "core-js": "3.37.0" }, @@ -13914,6 +13917,13 @@ "tinycolor2": "^1.1.2" } }, + "node_modules/vue-component-type-helpers": { + "version": "2.2.10", + "resolved": "https://registry.npmjs.org/vue-component-type-helpers/-/vue-component-type-helpers-2.2.10.tgz", + "integrity": "sha512-iDUO7uQK+Sab2tYuiP9D1oLujCWlhHELHMgV/cB13cuGbG4qwkLHvtfWb6FzvxrIOPDnU0oHsz2MlQjhYDeaHA==", + "dev": true, + "license": "MIT" + }, "node_modules/vue-eslint-parser": { "version": "9.4.2", "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.2.tgz", diff --git a/package.json b/package.json index 6d0dbb14f..9a8bdb86f 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "@mdi/js": "^7.4.47", "@nextcloud/auth": "^2.4.0", "@nextcloud/axios": "^2.5.1", + "@nextcloud/browser-storage": "^0.4.0", "@nextcloud/event-bus": "^3.3.2", "@nextcloud/files": "^3.10.2", "@nextcloud/initial-state": "^2.2.0", @@ -97,6 +98,7 @@ "typescript-plugin-css-modules": "^5.1.0", "vite": "^6.3.3", "vitest": "^3.0.3", + "vue-component-type-helpers": "^2.2.10", "vue-material-design-icons": "^5.3.1", "vue-template-compiler": "^2.7.16" },