mirror of
https://github.com/nextcloud/server.git
synced 2026-04-25 08:08:33 -04:00
chore(files): migrate davUtils to TS
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
This commit is contained in:
parent
c02e8517d4
commit
2f7eeab191
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
|
||||
}
|
||||
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