diff options
author | Grigorii K. Shartsev <me@shgk.me> | 2024-10-15 16:03:31 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-10-28 12:08:41 +0000 |
commit | d717176e9c7c50da0fcc04f5bbbc65e3dcd0cdaa (patch) | |
tree | a0241a4ce41d436c613482b45451652511995207 /apps/files/src | |
parent | 70d9e4a229f638c37c7c721efcb222d90568311b (diff) | |
download | nextcloud-server-d717176e9c7c50da0fcc04f5bbbc65e3dcd0cdaa.tar.gz nextcloud-server-d717176e9c7c50da0fcc04f5bbbc65e3dcd0cdaa.zip |
chore(files): migrate davUtils to TS
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Diffstat (limited to 'apps/files/src')
-rw-r--r-- | apps/files/src/utils/davUtils.js | 31 | ||||
-rw-r--r-- | apps/files/src/utils/davUtils.ts | 23 |
2 files changed, 23 insertions, 31 deletions
diff --git a/apps/files/src/utils/davUtils.js b/apps/files/src/utils/davUtils.js deleted file mode 100644 index d86b69eaabd..00000000000 --- a/apps/files/src/utils/davUtils.js +++ /dev/null @@ -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 -} 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 +} |