mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 01:55:56 -04:00
chore(files): migrate davUtils to TS
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
This commit is contained in:
parent
70d9e4a229
commit
d717176e9c
2 changed files with 23 additions and 31 deletions
|
|
@ -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
|
||||
}
|
||||
23
apps/files/src/utils/davUtils.ts
Normal file
23
apps/files/src/utils/davUtils.ts
Normal 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
|
||||
}
|
||||
Loading…
Reference in a new issue