Skip to content

Commit fc3d7e7

Browse files
committed
fix(public): support non-files and Files on Nextcloud 31
Signed-off-by: Grigorii K. Shartsev <[email protected]>
1 parent 05301a8 commit fc3d7e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/public.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
*/
55

66
import Vue from 'vue'
7+
import { getCurrentUser } from '@nextcloud/auth'
78
import UserApp from './UserApp.vue'
89

910
Vue.prototype.t = t
1011
Vue.prototype.n = n
1112
Vue.prototype.OC = OC
1213
Vue.prototype.OCA = OCA
1314

14-
const hasToken = (document.getElementById('sharingToken') !== null)
15+
const isPublicPage = getCurrentUser() === null
1516
const isPasswordProtected = (document.getElementById('password-submit') !== null)
1617

17-
if (hasToken && !isPasswordProtected) {
18+
if (isPublicPage && !isPasswordProtected) {
1819
const tofc = document.createElement('div')
1920
tofc.id = 'terms_of_service_confirm'
2021
document.body.insertAdjacentElement('afterbegin', tofc)

0 commit comments

Comments
 (0)