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 70d9e4a229
commit d717176e9c
2 changed files with 23 additions and 31 deletions

View file

@ -1,31 +0,0 @@
/**
* @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
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
}