Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

richdocuments: add host_session_id parameter #3763

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import axios from '@nextcloud/axios'
import { spawnDialog } from '@nextcloud/dialogs'
import SaveAs from './components/Modal/SaveAs.vue'
import { getCapabilities } from './services/capabilities.ts'

const PostMessages = new PostMessageService({
parent: window.parent,
Expand All @@ -36,7 +37,7 @@
const checkProxyStatus = () => {
checkingProxyStatus = true
const url = Config.get('urlsrc').slice(0, Config.get('urlsrc').indexOf('proxy.php') + 'proxy.php'.length)
$.get(url + '?status').done(function(val) {

Check warning on line 40 in src/document.js

View workflow job for this annotation

GitHub Actions / NPM lint

The global property or function $ was deprecated in Nextcloud 19.0.0
if (val && val.status && val.status !== 'OK') {
if (val.status === 'starting' || val.status === 'stopped') {
document.getElementById('proxyLoadingIcon').classList.add('icon-loading-small')
Expand Down Expand Up @@ -149,8 +150,8 @@
showViewer(fileId, title) {
// remove previous viewer, if open, and set a new one
if (documentsMain.isViewerMode) {
$('#revViewer').remove()

Check warning on line 153 in src/document.js

View workflow job for this annotation

GitHub Actions / NPM lint

The global property or function $ was deprecated in Nextcloud 19.0.0
$('#revViewerContainer').prepend($('<div id="revViewer">'))

Check warning on line 154 in src/document.js

View workflow job for this annotation

GitHub Actions / NPM lint

The global property or function $ was deprecated in Nextcloud 19.0.0

Check warning on line 154 in src/document.js

View workflow job for this annotation

GitHub Actions / NPM lint

The global property or function $ was deprecated in Nextcloud 19.0.0
}

const urlsrc = getWopiUrl({ fileId, title, readOnly: true, closeButton: !documentsMain.hideCloseButton })
Expand All @@ -168,20 +169,22 @@
+ '<input name="theme" value="' + getCollaboraTheme() + '" type="hidden"/>'
// buy product for new customer users
+ '<input name="buy_product" value="https://nextcloud.com/pricing" type="hidden"/>'
+ '<input name="host_session_id" value="nextcloud ' + OC.config.version
+ ' - richdocuments ' + getCapabilities().version + '" type="hidden"/>'
+ '</form>'

// iframe that contains the Collabora Online Viewer
const frame = '<iframe data-cy="coolframe" id="loleafletframe" name="loleafletframe_viewer" allowfullscreen allow="clipboard-read *; clipboard-write *" nonce="' + btoa(getRequestToken()) + '" style="width:100%;height:100%;position:absolute;"/>'

$('#revViewer').append(form)

Check warning on line 179 in src/document.js

View workflow job for this annotation

GitHub Actions / NPM lint

The global property or function $ was deprecated in Nextcloud 19.0.0
$('#revViewer').append(frame)

Check warning on line 180 in src/document.js

View workflow job for this annotation

GitHub Actions / NPM lint

The global property or function $ was deprecated in Nextcloud 19.0.0
$('#loleafletframe_viewer').focus()

Check warning on line 181 in src/document.js

View workflow job for this annotation

GitHub Actions / NPM lint

The global property or function $ was deprecated in Nextcloud 19.0.0

// submit that
$('#loleafletform_viewer').submit()

Check warning on line 184 in src/document.js

View workflow job for this annotation

GitHub Actions / NPM lint

The global property or function $ was deprecated in Nextcloud 19.0.0
documentsMain.isViewerMode = true
// for closing revision mode
$('#revViewerContainer .closeButton').click(function(e) {

Check warning on line 187 in src/document.js

View workflow job for this annotation

GitHub Actions / NPM lint

The global property or function $ was deprecated in Nextcloud 19.0.0
e.preventDefault()
documentsMain.onCloseViewer()
})
Expand Down Expand Up @@ -228,6 +231,8 @@
+ '<input name="theme" value="' + getCollaboraTheme() + '" type="hidden"/>'
// buy product for new customer users
+ '<input name="buy_product" value="https://nextcloud.com/pricing" type="hidden"/>'
+ '<input name="host_session_id" value="nextcloud ' + OC.config.version
+ ' - richdocuments ' + getCapabilities().version + '" type="hidden"/>'
+ '</form>'

// iframe that contains the Collabora Online
Expand Down
2 changes: 2 additions & 0 deletions src/view/Office.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<input name="css_variables" :value="formData.cssVariables" type="hidden">
<input name="theme" :value="formData.theme" type="hidden">
<input name="buy_product" value="https://nextcloud.com/pricing" type="hidden">
<input name="host_session_id" value="formData.hostSessionID" type="hidden">
</form>
<iframe :id="iframeId"
ref="documentFrame"
Expand Down Expand Up @@ -187,6 +188,7 @@ export default {
uiDefaults: getUIDefaults(),
cssVariables: generateCSSVarTokens(),
theme: getCollaboraTheme(),
hostSessionID: 'nextcloud ' + OC.config.version + ' - richdocuments ' + getCapabilities().version
},
}
},
Expand Down
Loading