Skip to content

Commit

Permalink
chore(deps): Update @nextcloud/auth to v2.4.0 and use getCSPNonce
Browse files Browse the repository at this point in the history
… where possible

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Aug 13, 2024
1 parent 3e409fd commit ea021df
Show file tree
Hide file tree
Showing 28 changed files with 67 additions and 71 deletions.
4 changes: 2 additions & 2 deletions apps/comments/src/comments-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

// eslint-disable-next-line n/no-missing-import, import/no-unresolved
import MessageReplyText from '@mdi/svg/svg/message-reply-text.svg?raw'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import { registerCommentsPlugins } from './comments-activity-tab.ts'

// @ts-expect-error __webpack_nonce__ is injected by webpack
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

if (loadState('comments', 'activityEnabled', false) && OCA?.Activity?.registerSidebarAction !== undefined) {
// Do not mount own tab but mount into activity
Expand Down
8 changes: 4 additions & 4 deletions apps/comments/src/services/CommentsInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { translate as t, translatePlural as n } from '@nextcloud/l10n'
import { getRequestToken } from '@nextcloud/auth'
import Vue from 'vue'
import { getCSPNonce } from '@nextcloud/auth'
import { t, n } from '@nextcloud/l10n'
import { PiniaVuePlugin, createPinia } from 'pinia'
import Vue from 'vue'
import CommentsApp from '../views/Comments.vue'
import logger from '../logger.js'

Vue.use(PiniaVuePlugin)
// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

// Add translates functions
Vue.mixin({
Expand Down
9 changes: 5 additions & 4 deletions apps/dashboard/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import Vue from 'vue'
import DashboardApp from './DashboardApp.vue'
import { getCSPNonce } from '@nextcloud/auth'
import { translate as t } from '@nextcloud/l10n'
import VTooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'
import { getRequestToken } from '@nextcloud/auth'
import Vue from 'vue'

import DashboardApp from './DashboardApp.vue'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.directive('Tooltip', VTooltip)

Expand Down
4 changes: 2 additions & 2 deletions apps/federatedfilesharing/src/main-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { translate as t } from '@nextcloud/l10n'
import { loadState } from '@nextcloud/initial-state'

import AdminSettings from './components/AdminSettings.vue'

__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.mixin({
methods: {
Expand Down
4 changes: 2 additions & 2 deletions apps/federatedfilesharing/src/main-personal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { translate as t } from '@nextcloud/l10n'

import PersonalSettings from './components/PersonalSettings.vue'

__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.mixin({
methods: {
Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/main-personal-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
*/

import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'

import PersonalSettings from './components/PersonalSettings.vue'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.prototype.t = t

Expand Down
7 changes: 3 additions & 4 deletions apps/files/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { PiniaVuePlugin } from 'pinia'
import { getCSPNonce } from '@nextcloud/auth'
import { getNavigation } from '@nextcloud/files'
import { getRequestToken } from '@nextcloud/auth'
import { PiniaVuePlugin } from 'pinia'
import Vue from 'vue'

import { pinia } from './store/index.ts'
Expand All @@ -14,8 +14,7 @@ import SettingsModel from './models/Setting.js'
import SettingsService from './services/Settings.js'
import FilesApp from './FilesApp.vue'

// @ts-expect-error __webpack_nonce__ is injected by webpack
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

declare global {
interface Window {
Expand Down
6 changes: 3 additions & 3 deletions apps/files_sharing/src/files_sharing_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

import Vue from 'vue'
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { t, n } from '@nextcloud/l10n'

import ShareSearch from './services/ShareSearch.js'
import ExternalLinkActions from './services/ExternalLinkActions.js'
Expand All @@ -16,7 +16,7 @@ import TabSections from './services/TabSections.js'
import ShareVariant from '@mdi/svg/svg/share-variant.svg?raw'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

// Init Sharing Tab Service
if (!window.OCA.Sharing) {
Expand Down
4 changes: 2 additions & 2 deletions apps/files_sharing/src/personal-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { getCSPNonce } from '@nextcloud/auth'
import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'

import PersonalSettings from './components/PersonalSettings.vue'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.prototype.t = t

Expand Down
4 changes: 2 additions & 2 deletions apps/settings/src/main-admin-basic-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'

Expand All @@ -13,7 +13,7 @@ import logger from './logger.ts'
import ProfileSettings from './components/BasicSettings/ProfileSettings.vue'
import BackgroundJob from './components/BasicSettings/BackgroundJob.vue'

__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

const profileEnabledGlobally = loadState('settings', 'profileEnabledGlobally', true)

Expand Down
4 changes: 2 additions & 2 deletions apps/settings/src/main-apps-users-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { translate as t, translatePlural as n } from '@nextcloud/l10n'
import SettingsApp from './views/SettingsApp.vue'
import router from './router/index.ts'
import { useStore } from './store/index.js'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { PiniaVuePlugin, createPinia } from 'pinia'

Vue.use(VTooltip, { defaultHtml: false })
Expand All @@ -21,7 +21,7 @@ sync(store, router)

// CSP config for webpack dynamic chunk loading
// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken() ?? '')
__webpack_nonce__ = getCSPNonce()

// bind to window
Vue.prototype.t = t
Expand Down
4 changes: 2 additions & 2 deletions apps/settings/src/main-personal-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'

Expand All @@ -28,7 +28,7 @@ import ProfileVisibilitySection from './components/PersonalInfo/ProfileVisibilit
import BirthdaySection from './components/PersonalInfo/BirthdaySection.vue'
import FirstDayOfWeekSection from './components/PersonalInfo/FirstDayOfWeekSection.vue'

__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

const profileEnabledGlobally = loadState('settings', 'profileEnabledGlobally', true)

Expand Down
4 changes: 2 additions & 2 deletions apps/settings/src/main-personal-security.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { PiniaVuePlugin, createPinia } from 'pinia'
import VTooltipPlugin from 'v-tooltip'
import Vue from 'vue'
Expand All @@ -13,7 +13,7 @@ import AuthTokenSection from './components/AuthTokenSection.vue'
import '@nextcloud/password-confirmation/dist/style.css'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

const pinia = createPinia()

Expand Down
2 changes: 1 addition & 1 deletion apps/settings/src/webpack.shim.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
declare let __webpack_nonce__: string
declare let __webpack_nonce__: string | undefined
7 changes: 3 additions & 4 deletions apps/sharebymail/src/main-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { translate as t } from '@nextcloud/l10n'

import Vue from 'vue'
import AdminSettings from './components/AdminSettings.vue'

__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.mixin({
methods: {
Expand Down
5 changes: 2 additions & 3 deletions apps/systemtags/src/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { getCSPNonce } from '@nextcloud/auth'
import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'

import SystemTagsSection from './views/SystemTagsSection.vue'

// @ts-expect-error __webpack_nonce__ is injected by webpack
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

const SystemTagsSectionView = Vue.extend(SystemTagsSection)
new SystemTagsSectionView().$mount('#vue-admin-systemtags')
4 changes: 2 additions & 2 deletions apps/theming/src/admin-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import Vue from 'vue'

import App from './AdminTheming.vue'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.prototype.OC = OC
Vue.prototype.t = t
Expand Down
4 changes: 2 additions & 2 deletions apps/theming/src/personal-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import Vue from 'vue'

import { refreshStyles } from './helpers/refreshStyles.js'
import App from './UserTheming.vue'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.prototype.OC = OC
Vue.prototype.t = t
Expand Down
7 changes: 3 additions & 4 deletions apps/user_status/src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { subscribe } from '@nextcloud/event-bus'
import Vue from 'vue'

import UserStatus from './UserStatus.vue'

import store from './store/index.js'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.prototype.t = t
Vue.prototype.$t = t
Expand Down
4 changes: 2 additions & 2 deletions apps/weather_status/src/weather-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { getCSPNonce } from '@nextcloud/auth'
import Vue from 'vue'
import { getRequestToken } from '@nextcloud/auth'
import App from './App.vue'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

Vue.prototype.t = t

Expand Down
4 changes: 2 additions & 2 deletions core/src/legacy-unified-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
*/

import { getLoggerBuilder } from '@nextcloud/logger'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
import Vue from 'vue'

import UnifiedSearch from './views/LegacyUnifiedSearch.vue'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

const logger = getLoggerBuilder()
.setApp('unified-search')
Expand Down
4 changes: 2 additions & 2 deletions core/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import './globals.js'
import './jquery/index.js'
import { initCore } from './init.js'
import { registerAppsSlideToggle } from './OC/apps.js'
import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import { generateUrl } from '@nextcloud/router'
import Axios from '@nextcloud/axios'

// eslint-disable-next-line camelcase
__webpack_nonce__ = btoa(getRequestToken())
__webpack_nonce__ = getCSPNonce()

window.addEventListener('DOMContentLoaded', function() {
initCore()
Expand Down
5 changes: 2 additions & 3 deletions core/src/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { getRequestToken } from '@nextcloud/auth'
import { getCSPNonce } from '@nextcloud/auth'
import Vue from 'vue'

import Profile from './views/Profile.vue'
import ProfileSections from './profile/ProfileSections.js'

// @ts-expect-error Script nonce required for webpack loading additional scripts
__webpack_nonce__ = btoa(getRequestToken() ?? '')
__webpack_nonce__ = getCSPNonce()

if (!window.OCA) {
window.OCA = {}
Expand Down
Loading

0 comments on commit ea021df

Please sign in to comment.