Skip to content

Commit 4043d86

Browse files
committed
chore: remove deprecated hosts functions from OC
- deprecated since Nextcloud 17 - To replace `OC.getHost` use `window.location.host`. - To replace `OC.getHostName` use `window.location.hostname`. - To replace `OC.getPort` use `window.location.port`. - To replace `OC.getProtocol` use `window.location.protocol`. Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 9e1ed70 commit 4043d86

File tree

3 files changed

+5
-60
lines changed

3 files changed

+5
-60
lines changed

core/src/OC/host.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

core/src/OC/index.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ import { debug } from './debug.js'
5050
import Dialogs from './dialogs.js'
5151
import EventSource from './eventsource.js'
5252
import { get, set } from './get_set.js'
53-
import {
54-
getHost,
55-
getHostName,
56-
getPort,
57-
getProtocol,
58-
} from './host.js'
5953
import L10N from './l10n.js'
6054
import {
6155
hideMenus,
@@ -189,14 +183,6 @@ export default {
189183
*/
190184
joinPaths,
191185

192-
/**
193-
* Host (url) helpers
194-
*/
195-
getHost,
196-
getHostName,
197-
getPort,
198-
getProtocol,
199-
200186
/**
201187
* @deprecated 20.0.0 use `getCanonicalLocale` from https://www.npmjs.com/package/@nextcloud/l10n
202188
*/

core/src/files/client.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: AGPL-3.0-or-later
55
*/
66

7+
import { getCurrentUser } from '@nextcloud/auth'
78
import escapeHTML from 'escape-html'
89
import $ from 'jquery'
910
import _ from 'underscore'
@@ -958,10 +959,10 @@ import logger from '../logger.js'
958959
}
959960

960961
const client = new OC.Files.Client({
961-
host: OC.getHost(),
962-
port: OC.getPort(),
963-
root: OC.linkToRemoteBase('dav') + '/files/' + OC.getCurrentUser().uid,
964-
useHTTPS: OC.getProtocol() === 'https',
962+
host: window.location.host,
963+
port: window.location.port,
964+
root: OC.linkToRemoteBase('dav') + '/files/' + getCurrentUser().uid,
965+
useHTTPS: window.location.protocol.startsWith('https'),
965966
})
966967
OC.Files._defaultClient = client
967968
return client

0 commit comments

Comments
 (0)