Skip to content

Commit

Permalink
config: support hasSettingIframeSupport capability
Browse files Browse the repository at this point in the history
Signed-off-by: codewithvk <[email protected]>
  • Loading branch information
codewithvk committed Feb 5, 2025
1 parent 66c1253 commit 2bbca24
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/Service/CapabilitiesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public function hasZoteroSupport(): bool {
return $this->getCapabilities()['hasZoteroSupport'] ?? false;
}

public function hasSettingIframeSupport(): bool {
return $this->getCapabilities()['hasSettingIframeSupport'] ?? false;
}

public function hasWASMSupport(): bool {
return $this->getCapabilities()['hasWASMSupport'] ?? false;
}
Expand Down
1 change: 1 addition & 0 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function getForm(): TemplateResponse {
'esignature_base_url' => $this->config->getAppValue('richdocuments', 'esignature_base_url'),
'esignature_client_id' => $this->config->getAppValue('richdocuments', 'esignature_client_id'),
'esignature_secret' => $this->config->getAppValue('richdocuments', 'esignature_secret'),
'hasSettingIframeSupport' => $this->capabilitiesService->hasSettingIframeSupport(),
],
],
'blank'
Expand Down
1 change: 1 addition & 0 deletions lib/Settings/Personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function getForm() {
'documentSigningKey' => $this->config->getUserValue($this->userId, 'richdocuments', 'documentSigningKey', ''),
'documentSigningCa' => $this->config->getUserValue($this->userId, 'richdocuments', 'documentSigningCa', ''),
'hasZoteroSupport' => $this->capabilitiesService->hasZoteroSupport(),
'hasSettingIframeSupport' => $this->capabilitiesService->hasSettingIframeSupport(),
'zoteroAPIKey' => $this->config->getUserValue($this->userId, 'richdocuments', 'zoteroAPIKey', ''),
'publicWopiUrl' => $this->appConfig->getCollaboraUrlPublic(),
],
Expand Down
6 changes: 4 additions & 2 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ export default {
text: '',
},
fonts: [],
hasSettingIframeSupport: false,
},
accessToken: '',
accessTokenTTL: '',
Expand Down Expand Up @@ -575,15 +576,15 @@ export default {
},
},
async mounted() {
if (this.userId && this.userId.length > 0) {
if (this.hasSettingIframeSupport && this.userId && this.userId.length > 0) {
await this.generateAccessToken()
if (this.accessToken) {
this.wopiSettingBaseUrl = getConfigFileUrl()
console.debug('wopiSettingBaseUrl', this.wopiSettingBaseUrl)
this.tokenGenerated = true
}
} else {
console.error('User not authenticated')
console.error('Setting Iframe not supported')
}
},
beforeMount() {
Expand All @@ -607,6 +608,7 @@ export default {
Vue.set(this.settings, 'edit_groups', this.settings.edit_groups ? this.settings.edit_groups.split('|') : null)
Vue.set(this.settings, 'use_groups', this.settings.use_groups ? this.settings.use_groups.split('|') : null)
Vue.set(this.settings, 'fonts', this.initial.fonts ? this.initial.fonts : [])
Vue.set(this.settings, 'hasSettingIframeSupport', this.initial.hasSettingIframeSupport ?? false)

this.uiVisible.canonical_webroot = !!(this.settings.canonical_webroot && this.settings.canonical_webroot !== '')
this.uiVisible.external_apps = !!(this.settings.external_apps && this.settings.external_apps !== '')
Expand Down
5 changes: 3 additions & 2 deletions src/components/PersonalSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export default {
return {
templateFolder: this.initial.templateFolder || '',
hasZoteroSupport: this.initial.hasZoteroSupport || false,
hasSettingIframeSupport: this.initial.hasSettingIframeSupport || false,
zoteroAPIKey: this.initial.zoteroAPIKey || '',
hasDocumentSigningSupport: this.initial.hasDocumentSigningSupport || false,
documentSigningCert: this.initial.documentSigningCert || '',
Expand All @@ -177,15 +178,15 @@ export default {
},
},
async mounted() {
if (this.userId && this.userId.length > 0) {
if (this.hasSettingIframeSupport && this.userId && this.userId.length > 0) {
await this.generateAccessToken()
if (this.accessToken) {
this.wopiSettingBaseUrl = getConfigFileUrl()
console.debug('wopiSettingBaseUrl', this.wopiSettingBaseUrl)
this.tokenGenerated = true
}
} else {
console.error('User not authenticated')
console.error('Setting Iframe not supported')
}
},
methods: {
Expand Down

0 comments on commit 2bbca24

Please sign in to comment.