Skip to content
Open
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
8 changes: 5 additions & 3 deletions src/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import Vue from 'vue'
import Office from './view/Office.vue'
import types from './helpers/types.js'
import axios from '@nextcloud/axios'
import { getRequestToken } from '@nextcloud/auth'
import { getCapabilities } from '@nextcloud/capabilities'
import { generateUrl, linkTo } from '@nextcloud/router'

import './css/icons.css'

// eslint-disable-next-line
__webpack_nonce__ = btoa(window.OC.requestToken)
__webpack_nonce__ = btoa(getRequestToken())

// eslint-disable-next-line
__webpack_public_path__ = window.OC.linkTo('officeonline', 'js/')
__webpack_public_path__ = linkTo('officeonline', 'js/')

Vue.prototype.t = window.t
Vue.prototype.n = window.n
Expand Down Expand Up @@ -82,7 +84,7 @@ const NewFilePlugin = {
})
}

axios.post(OC.generateUrl('apps/officeonline/ajax/documents/create'), { mimetype, filename, dir }).then(({ data }) => {
axios.post(generateUrl('apps/officeonline/ajax/documents/create'), { mimetype, filename, dir }).then(({ data }) => {
console.debug(data)
if (data && data.status === 'success') {
window.FileList.add(data.data, { animate: true, scrollTo: true })
Expand Down
20 changes: 10 additions & 10 deletions src/helpers/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { getRootUrl } from '@nextcloud/router'
import { getSharingToken } from '@nextcloud/sharing/public'
import { languageToBCP47 } from './index.js'
import Config from './../services/config.ts'
import { getRequestToken } from '@nextcloud/auth'
import { getRootUrl, generateUrl } from '@nextcloud/router'
import { languageToBCP47 } from './index'

Check failure on line 8 in src/helpers/url.js

View workflow job for this annotation

GitHub Actions / NPM lint

"./index" is not found

Check warning on line 8 in src/helpers/url.js

View workflow job for this annotation

GitHub Actions / NPM lint

Missing file extension "js" for "./index"
import Config from './../services/config'

Check failure on line 9 in src/helpers/url.js

View workflow job for this annotation

GitHub Actions / NPM lint

"./../services/config" is not found

Check failure on line 9 in src/helpers/url.js

View workflow job for this annotation

GitHub Actions / NPM lint

Unable to resolve path to module './../services/config'

Check warning on line 9 in src/helpers/url.js

View workflow job for this annotation

GitHub Actions / NPM lint

Missing file extension for "./../services/config"

const getSearchParam = (name) => {
const results = new RegExp('[?&]' + name + '=([^&#]*)').exec(window.location.href)
Expand Down Expand Up @@ -37,36 +37,36 @@
}

const getDocumentUrlFromTemplate = (templateId, fileName, fileDir, fillWithTemplate) => {
return OC.generateUrl(
return generateUrl(
'apps/officeonline/indexTemplate?templateId={templateId}&fileName={fileName}&dir={dir}&requesttoken={requesttoken}',
{
templateId,
fileName,
dir: encodeURIComponent(fileDir),
requesttoken: OC.requestToken,
requesttoken: getRequestToken(),
},
)
}

const getDocumentUrlForPublicFile = (fileName, fileId) => {
return OC.generateUrl(
return generateUrl(
'apps/officeonline/public?shareToken={shareToken}&fileName={fileName}&requesttoken={requesttoken}&fileId={fileId}',
{
shareToken: getSharingToken(),

Check failure on line 55 in src/helpers/url.js

View workflow job for this annotation

GitHub Actions / NPM lint

'getSharingToken' is not defined
fileName: encodeURIComponent(fileName),
fileId,
requesttoken: OC.requestToken,
requesttoken: getRequestToken(),
},
)
}

const getDocumentUrlForFile = (fileDir, fileId) => {
return OC.generateUrl(
return generateUrl(
'apps/officeonline/index?fileId={fileId}&requesttoken={requesttoken}',
{
fileId,
dir: fileDir,
requesttoken: OC.requestToken,
requesttoken: getRequestToken(),
})
}

Expand Down
Loading