chore(files): migrate davUtils to TS

Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
This commit is contained in:
Grigorii K. Shartsev 2024-10-15 16:03:31 +02:00 committed by backportbot[bot]
parent c02e8517d4
commit 2f7eeab191
3 changed files with 24 additions and 15 deletions

View file

@ -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

View file

@ -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
}

View file

@ -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
}