chore(files): migrate davUtils to TS

Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
pull/48625/head
Grigorii K. Shartsev 2024-10-15 16:03:31 +07:00
parent 7723faf51a
commit 2696715d90
3 changed files with 24 additions and 15 deletions

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

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

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