aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorGrigorii K. Shartsev <me@shgk.me>2024-10-15 16:03:31 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-10-25 12:28:16 +0000
commit2f7eeab191a4b77bb4497a1075fec232d3d688d4 (patch)
treee5bc009f97beb38a45acb88fba6f071d997f067f /apps
parentc02e8517d411ab8809ac04ca756327c6e1cc0d92 (diff)
downloadnextcloud-server-2f7eeab191a4b77bb4497a1075fec232d3d688d4.tar.gz
nextcloud-server-2f7eeab191a4b77bb4497a1075fec232d3d688d4.zip
chore(files): migrate davUtils to TS
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/src/components/TemplatePreview.vue2
-rw-r--r--apps/files/src/utils/davUtils.js14
-rw-r--r--apps/files/src/utils/davUtils.ts23
3 files changed, 24 insertions, 15 deletions
diff --git a/apps/files/src/components/TemplatePreview.vue b/apps/files/src/components/TemplatePreview.vue
index 512a165989a..7737ebc030f 100644
--- a/apps/files/src/components/TemplatePreview.vue
+++ b/apps/files/src/components/TemplatePreview.vue
@@ -33,7 +33,7 @@
<script>
import { encodePath } from '@nextcloud/paths'
import { generateUrl } from '@nextcloud/router'
-import { getToken, isPublic } from '../utils/davUtils.js'
+import { getToken, isPublic } from '../utils/davUtils.ts'
// preview width generation
const previewWidth = 256
diff --git a/apps/files/src/utils/davUtils.js b/apps/files/src/utils/davUtils.js
deleted file mode 100644
index 8c28c25c044..00000000000
--- a/apps/files/src/utils/davUtils.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-import { getCurrentUser } from '@nextcloud/auth'
-
-export const isPublic = function() {
- return !getCurrentUser()
-}
-
-export const getToken = function() {
- return document.getElementById('sharingToken') && document.getElementById('sharingToken').value
-}
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
+}