File tree Expand file tree Collapse file tree 2 files changed +3
-21
lines changed
Expand file tree Collapse file tree 2 files changed +3
-21
lines changed Original file line number Diff line number Diff line change 4848
4949<script >
5050import { generateUrl } from ' @nextcloud/router'
51+ import { isPublicShare , getSharingToken } from ' @nextcloud/sharing/public'
5152import { encodeFilePath } from ' ../utils/fileUtils.ts'
52- import { getToken , isPublic } from ' ../utils/davUtils.js'
5353
5454// preview width generation
5555const previewWidth = 256
@@ -123,8 +123,8 @@ export default {
123123 return this .previewUrl
124124 }
125125 // TODO: find a nicer standard way of doing this?
126- if (isPublic ()) {
127- return generateUrl (` /apps/files_sharing/publicpreview/${ getToken ()} ?fileId=${ this .fileid } &file=${ encodeFilePath (this .filename )} &x=${ previewWidth} &y=${ previewWidth} &a=1` )
126+ if (isPublicShare ()) {
127+ return generateUrl (` /apps/files_sharing/publicpreview/${ getSharingToken ()} ?fileId=${ this .fileid } &file=${ encodeFilePath (this .filename )} &x=${ previewWidth} &y=${ previewWidth} &a=1` )
128128 }
129129 return generateUrl (` /core/preview?fileId=${ this .fileid } &x=${ previewWidth} &y=${ previewWidth} &a=1` )
130130 },
Original file line number Diff line number Diff line change 33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
55
6- import { getCurrentUser } from '@nextcloud/auth'
76import { t } from '@nextcloud/l10n'
87import type { WebDAVClientError } from 'webdav'
98
10- /**
11- * Check whether this is a public share
12- * @return {boolean } Whether this is a public share
13- */
14- export function isPublic ( ) {
15- return ! getCurrentUser ( )
16- }
17-
18- /**
19- * Get the sharing token
20- * @return {string|null } The sharing token
21- */
22- export function getToken ( ) {
23- const tokenElement = document . getElementById ( 'sharingToken' ) as ( HTMLInputElement | null )
24- return tokenElement ?. value
25- }
26-
279/**
2810 * Whether error is a WebDAVClientError
2911 * @param error - Any exception
You can’t perform that action at this time.
0 commit comments