mirror of
https://github.com/nextcloud/server.git
synced 2026-03-02 13:31:14 -05:00
Nevertheless this causes a huge amount of new warnings. Previously the shell script for directories to lint was wrong it was generating all app names to lint, but was missing the `apps/` prefix. Causing only `core` to be linted. Co-authored-by: Grigorii K. Shartsev <me@shgk.me> Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
27 lines
733 B
JavaScript
27 lines
733 B
JavaScript
/**
|
|
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
import { createClient } from 'webdav'
|
|
import { getRootPath } from '../utils/davUtils.js'
|
|
import { getRequestToken, onRequestTokenUpdate } from '@nextcloud/auth'
|
|
|
|
// init webdav client
|
|
const client = createClient(getRootPath())
|
|
|
|
// set CSRF token header
|
|
const setHeaders = (token) => {
|
|
client.setHeaders({
|
|
// Add this so the server knows it is an request from the browser
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
// Inject user auth
|
|
requesttoken: token ?? '',
|
|
})
|
|
}
|
|
|
|
// refresh headers when request token changes
|
|
onRequestTokenUpdate(setHeaders)
|
|
setHeaders(getRequestToken())
|
|
|
|
export default client
|