aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/utils/davUtils.ts
diff options
context:
space:
mode:
authorGrigorii K. Shartsev <me@shgk.me>2024-10-15 16:03:31 +0200
committerGrigorii K. Shartsev <me@shgk.me>2024-10-25 13:01:30 +0200
commit2696715d90a1cb40a27c657a525c6b9efcb3dcd8 (patch)
treeeef8ba31f28b69920a9759c9ba182454989cb918 /apps/files/src/utils/davUtils.ts
parent7723faf51a2bb2e1e119779ae831ab646506aa45 (diff)
downloadnextcloud-server-2696715d90a1cb40a27c657a525c6b9efcb3dcd8.tar.gz
nextcloud-server-2696715d90a1cb40a27c657a525c6b9efcb3dcd8.zip
chore(files): migrate davUtils to TS
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Diffstat (limited to 'apps/files/src/utils/davUtils.ts')
-rw-r--r--apps/files/src/utils/davUtils.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/files/src/utils/davUtils.ts b/apps/files/src/utils/davUtils.ts
new file mode 100644
index 00000000000..38137a04d16
--- /dev/null
+++ b/apps/files/src/utils/davUtils.ts
@@ -0,0 +1,23 @@
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import { getCurrentUser } from '@nextcloud/auth'
+
+/**
+ * Check whether this is a public share
+ * @return {boolean} Whether this is a public share
+ */
+export function isPublic() {
+ return !getCurrentUser()
+}
+
+/**
+ * Get the sharing token
+ * @return {string|null} The sharing token
+ */
+export function getToken() {
+ const tokenElement = document.getElementById('sharingToken') as (HTMLInputElement | null)
+ return tokenElement?.value
+}