2019-01-28 13:24:08 +03:00
|
|
|
/*
|
|
|
|
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
|
|
*
|
|
|
|
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-05-08 11:03:13 +03:00
|
|
|
import {addScript, addStyle} from './legacy-loader'
|
2019-01-28 17:06:01 +03:00
|
|
|
import Apps from './apps'
|
2019-05-03 09:42:42 +03:00
|
|
|
import {AppConfig, appConfig} from './appconfig'
|
2019-05-07 10:03:14 +03:00
|
|
|
import appswebroots from './appswebroots'
|
2019-01-30 10:39:35 +03:00
|
|
|
import Backbone from './backbone'
|
2019-05-13 17:37:38 +03:00
|
|
|
import {
|
|
|
|
basename,
|
|
|
|
dirname,
|
|
|
|
encodePath,
|
|
|
|
isSamePath,
|
|
|
|
joinPaths,
|
|
|
|
} from './path'
|
2019-04-29 19:04:45 +03:00
|
|
|
import Config from './config'
|
2019-05-07 17:25:01 +03:00
|
|
|
import {
|
2019-05-07 19:11:08 +03:00
|
|
|
coreApps,
|
|
|
|
menuSpeed,
|
2019-05-07 17:25:01 +03:00
|
|
|
PERMISSION_ALL,
|
|
|
|
PERMISSION_CREATE,
|
|
|
|
PERMISSION_DELETE,
|
|
|
|
PERMISSION_NONE,
|
|
|
|
PERMISSION_READ,
|
|
|
|
PERMISSION_SHARE,
|
|
|
|
PERMISSION_UPDATE,
|
|
|
|
TAG_FAVORITE,
|
|
|
|
} from './constants'
|
2019-01-30 10:39:35 +03:00
|
|
|
import ContactsMenu from './contactsmenu'
|
2019-05-07 21:29:51 +03:00
|
|
|
import {currentUser, getCurrentUser} from './currentuser'
|
2019-04-29 19:16:15 +03:00
|
|
|
import Dialogs from './dialogs'
|
2019-01-29 11:23:38 +03:00
|
|
|
import EventSource from './eventsource'
|
2019-04-29 18:50:34 +03:00
|
|
|
import {get, set} from './get_set'
|
2019-05-13 22:29:40 +03:00
|
|
|
import {getCapabilities} from './capabilities'
|
2019-05-13 21:46:13 +03:00
|
|
|
import {
|
|
|
|
getHost,
|
|
|
|
getHostName,
|
|
|
|
getPort,
|
|
|
|
getProtocol,
|
|
|
|
} from './host'
|
2019-05-10 15:18:08 +03:00
|
|
|
import {
|
|
|
|
getToken as getRequestToken,
|
|
|
|
subscribe as subscribeToRequestTokenChange,
|
|
|
|
} from './requesttoken'
|
2019-05-08 09:34:32 +03:00
|
|
|
import {
|
|
|
|
hideMenus,
|
|
|
|
registerMenu,
|
|
|
|
showMenu,
|
|
|
|
unregisterMenu,
|
|
|
|
} from './menu'
|
2019-05-03 10:07:31 +03:00
|
|
|
import {isUserAdmin} from './admin'
|
2019-01-29 11:28:45 +03:00
|
|
|
import L10N from './l10n'
|
2019-05-13 19:42:49 +03:00
|
|
|
import {
|
|
|
|
getCanonicalLocale,
|
|
|
|
getLanguage,
|
|
|
|
getLocale,
|
|
|
|
} from './l10n'
|
2019-04-29 18:42:27 +03:00
|
|
|
import {
|
2019-05-13 17:37:38 +03:00
|
|
|
filePath,
|
2019-04-29 18:42:27 +03:00
|
|
|
generateUrl,
|
2019-05-02 17:03:58 +03:00
|
|
|
getRootPath,
|
2019-05-13 17:37:38 +03:00
|
|
|
imagePath,
|
2019-04-29 18:42:27 +03:00
|
|
|
linkTo,
|
|
|
|
linkToOCS,
|
|
|
|
linkToRemote,
|
|
|
|
linkToRemoteBase,
|
|
|
|
} from './routing'
|
2019-01-31 20:28:26 +03:00
|
|
|
import msg from './msg'
|
2019-01-31 20:01:45 +03:00
|
|
|
import Notification from './notification'
|
2019-01-31 20:41:06 +03:00
|
|
|
import PasswordConfirmation from './password-confirmation'
|
2019-01-31 20:30:52 +03:00
|
|
|
import Plugins from './plugins'
|
2019-01-31 20:37:22 +03:00
|
|
|
import search from './search'
|
2019-01-31 20:50:59 +03:00
|
|
|
import Util from './util'
|
2019-04-29 19:51:45 +03:00
|
|
|
import {debug} from './debug'
|
2019-04-29 18:55:27 +03:00
|
|
|
import {redirect, reload} from './navigation'
|
2019-05-02 17:03:58 +03:00
|
|
|
import webroot from './webroot'
|
2019-01-28 17:06:01 +03:00
|
|
|
|
2019-01-28 13:24:08 +03:00
|
|
|
/** @namespace OC */
|
2019-01-28 17:06:01 +03:00
|
|
|
export default {
|
2019-05-07 17:25:01 +03:00
|
|
|
/*
|
|
|
|
* Constants
|
|
|
|
*/
|
2019-05-07 19:11:08 +03:00
|
|
|
coreApps,
|
|
|
|
menuSpeed,
|
2019-05-07 17:25:01 +03:00
|
|
|
PERMISSION_ALL,
|
|
|
|
PERMISSION_CREATE,
|
|
|
|
PERMISSION_DELETE,
|
|
|
|
PERMISSION_NONE,
|
|
|
|
PERMISSION_READ,
|
|
|
|
PERMISSION_SHARE,
|
|
|
|
PERMISSION_UPDATE,
|
|
|
|
TAG_FAVORITE,
|
|
|
|
|
2019-05-14 11:06:17 +03:00
|
|
|
/*
|
|
|
|
* Deprecated helpers to be removed
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Check if a user file is allowed to be handled.
|
|
|
|
* @param {string} file to check
|
|
|
|
* @deprecated 17.0.0
|
|
|
|
*/
|
|
|
|
fileIsBlacklisted: file => !!(file.match(Config.blacklist_files_regex)),
|
|
|
|
|
2019-05-08 11:03:13 +03:00
|
|
|
addScript,
|
|
|
|
addStyle,
|
2019-01-28 17:06:01 +03:00
|
|
|
Apps,
|
2019-01-29 11:17:11 +03:00
|
|
|
AppConfig,
|
2019-05-03 09:42:42 +03:00
|
|
|
appConfig,
|
2019-05-07 10:03:14 +03:00
|
|
|
appswebroots,
|
2019-01-28 19:00:56 +03:00
|
|
|
Backbone,
|
|
|
|
ContactsMenu,
|
2019-04-29 19:04:45 +03:00
|
|
|
config: Config,
|
2019-05-07 21:29:51 +03:00
|
|
|
/**
|
|
|
|
* Currently logged in user or null if none
|
|
|
|
*
|
|
|
|
* @type String
|
|
|
|
* @deprecated use {@link OC.getCurrentUser} instead
|
|
|
|
*/
|
|
|
|
currentUser,
|
2019-04-29 19:16:15 +03:00
|
|
|
dialogs: Dialogs,
|
2019-01-29 11:28:45 +03:00
|
|
|
EventSource,
|
2019-05-07 21:29:51 +03:00
|
|
|
/**
|
|
|
|
* Returns the currently logged in user or null if there is no logged in
|
|
|
|
* user (public page mode)
|
|
|
|
*
|
|
|
|
* @since 9.0.0
|
|
|
|
*/
|
|
|
|
getCurrentUser,
|
2019-05-03 10:07:31 +03:00
|
|
|
isUserAdmin,
|
2019-01-29 11:28:45 +03:00
|
|
|
L10N,
|
2019-05-08 09:34:32 +03:00
|
|
|
|
2019-05-13 22:29:40 +03:00
|
|
|
/**
|
|
|
|
* Capabilities
|
|
|
|
*
|
|
|
|
* @type {Array}
|
|
|
|
* @deprecated 17.0.0 use OC.getCapabilities() instead
|
|
|
|
*/
|
|
|
|
_capabilities: getCapabilities(),
|
|
|
|
getCapabilities,
|
|
|
|
|
2019-05-08 09:34:32 +03:00
|
|
|
/*
|
|
|
|
* Legacy menu helpers
|
|
|
|
*/
|
|
|
|
hideMenus,
|
|
|
|
registerMenu,
|
|
|
|
showMenu,
|
|
|
|
unregisterMenu,
|
|
|
|
|
2019-05-13 17:37:38 +03:00
|
|
|
/*
|
|
|
|
* Path helpers
|
|
|
|
*/
|
|
|
|
basename,
|
|
|
|
encodePath,
|
|
|
|
dirname,
|
|
|
|
isSamePath,
|
|
|
|
joinPaths,
|
|
|
|
|
2019-05-13 21:46:13 +03:00
|
|
|
/**
|
|
|
|
* Host (url) helpers
|
|
|
|
*/
|
|
|
|
getHost,
|
|
|
|
getHostName,
|
|
|
|
getPort,
|
|
|
|
getProtocol,
|
|
|
|
|
2019-05-13 19:42:49 +03:00
|
|
|
/**
|
|
|
|
* L10n
|
|
|
|
*/
|
|
|
|
getCanonicalLocale,
|
|
|
|
getLocale,
|
|
|
|
getLanguage,
|
2019-05-14 10:08:08 +03:00
|
|
|
/**
|
|
|
|
* Loads translations for the given app asynchronously.
|
|
|
|
*
|
|
|
|
* @param {String} app app name
|
|
|
|
* @param {Function} callback callback to call after loading
|
|
|
|
* @return {Promise}
|
|
|
|
* @deprecated 17.0.0 use OC.L10N.load instead
|
|
|
|
*/
|
|
|
|
addTranslations: L10N.load,
|
2019-05-13 19:42:49 +03:00
|
|
|
|
2019-01-31 20:28:26 +03:00
|
|
|
msg,
|
2019-01-31 20:01:45 +03:00
|
|
|
Notification,
|
2019-01-31 20:41:06 +03:00
|
|
|
PasswordConfirmation,
|
2019-01-31 20:30:52 +03:00
|
|
|
Plugins,
|
2019-01-31 20:37:22 +03:00
|
|
|
search,
|
2019-01-31 20:50:59 +03:00
|
|
|
Util,
|
2019-04-29 19:51:45 +03:00
|
|
|
debug,
|
2019-05-13 17:37:38 +03:00
|
|
|
filePath,
|
2019-04-29 18:42:27 +03:00
|
|
|
generateUrl,
|
2019-04-29 18:50:34 +03:00
|
|
|
get: get(window),
|
|
|
|
set: set(window),
|
2019-05-02 17:03:58 +03:00
|
|
|
getRootPath,
|
2019-05-13 17:37:38 +03:00
|
|
|
imagePath,
|
2019-04-29 18:55:27 +03:00
|
|
|
redirect,
|
|
|
|
reload,
|
2019-05-10 15:18:08 +03:00
|
|
|
requestToken: getRequestToken(),
|
2019-04-29 18:42:27 +03:00
|
|
|
linkTo,
|
|
|
|
linkToOCS,
|
|
|
|
linkToRemote,
|
|
|
|
linkToRemoteBase,
|
2019-05-02 17:03:58 +03:00
|
|
|
/**
|
|
|
|
* Relative path to Nextcloud root.
|
|
|
|
* For example: "/nextcloud"
|
|
|
|
*
|
|
|
|
* @type string
|
|
|
|
*
|
|
|
|
* @deprecated since 8.2, use OC.getRootPath() instead
|
|
|
|
* @see OC#getRootPath
|
|
|
|
*/
|
|
|
|
webroot,
|
2019-01-30 10:39:35 +03:00
|
|
|
}
|
2019-05-10 15:18:08 +03:00
|
|
|
|
|
|
|
// Keep the request token prop in sync
|
|
|
|
subscribeToRequestTokenChange(token => OC.requestToken = token)
|