nextcloud-server/dist/federatedfilesharing-settin...

1 line
14 KiB
Plaintext

{"version":3,"file":"federatedfilesharing-settings-admin.mjs","sources":["../build/frontend/apps/federatedfilesharing/src/components/AdminSettings.vue","../build/frontend/apps/federatedfilesharing/src/settings-admin.ts"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n-->\n\n<script setup lang=\"ts\">\nimport type { OCSResponse } from '@nextcloud/typings/ocs'\n\nimport axios from '@nextcloud/axios'\nimport { showConfirmation, showError } from '@nextcloud/dialogs'\nimport { loadState } from '@nextcloud/initial-state'\nimport { t } from '@nextcloud/l10n'\nimport { confirmPassword } from '@nextcloud/password-confirmation'\nimport { generateOcsUrl } from '@nextcloud/router'\nimport { reactive } from 'vue'\nimport NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'\nimport NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'\nimport logger from '../services/logger.ts'\n\nconst sharingFederatedDocUrl = loadState<string>('federatedfilesharing', 'sharingFederatedDocUrl')\n\nconst internalState = new Proxy({\n\toutgoingServer2serverShareEnabled: [\n\t\tloadState<boolean>('federatedfilesharing', 'outgoingServer2serverShareEnabled'),\n\t\t'outgoing_server2server_share_enabled',\n\t],\n\tincomingServer2serverShareEnabled: [\n\t\tloadState<boolean>('federatedfilesharing', 'incomingServer2serverShareEnabled'),\n\t\t'incoming_server2server_share_enabled',\n\t],\n\toutgoingServer2serverGroupShareEnabled: [\n\t\tloadState<boolean>('federatedfilesharing', 'outgoingServer2serverGroupShareEnabled'),\n\t\t'outgoing_server2server_group_share_enabled',\n\t],\n\tincomingServer2serverGroupShareEnabled: [\n\t\tloadState<boolean>('federatedfilesharing', 'incomingServer2serverGroupShareEnabled'),\n\t\t'incoming_server2server_group_share_enabled',\n\t],\n\tfederatedGroupSharingSupported: [\n\t\tloadState<boolean>('federatedfilesharing', 'federatedGroupSharingSupported'),\n\t\t'federated_group_sharing_supported',\n\t],\n\tfederatedTrustedShareAutoAccept: [\n\t\tloadState<boolean>('federatedfilesharing', 'federatedTrustedShareAutoAccept'),\n\t\t'federatedTrustedShareAutoAccept',\n\t],\n\tlookupServerEnabled: [\n\t\tloadState<boolean>('federatedfilesharing', 'lookupServerEnabled'),\n\t\t'lookupServerEnabled',\n\t],\n\tlookupServerUploadEnabled: [\n\t\tloadState<boolean>('federatedfilesharing', 'lookupServerUploadEnabled'),\n\t\t'lookupServerUploadEnabled',\n\t],\n}, {\n\tget(target, prop) {\n\t\treturn target[prop]?.[0]\n\t},\n\tset(target, prop, value) {\n\t\tif (prop in target) {\n\t\t\ttarget[prop][0] = value\n\t\t\tupdateAppConfig(target[prop][1], value)\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t},\n})\n\nconst state = reactive<Record<string, boolean>>(internalState as never)\n\n/**\n * Show confirmation dialog for enabling lookup server upload\n *\n * @param value - The new state\n */\nasync function showLookupServerUploadConfirmation(value: boolean) {\n\t// No confirmation needed for disabling\n\tif (value === false) {\n\t\treturn state.lookupServerUploadEnabled = false\n\t}\n\n\tawait showConfirmation({\n\t\tname: t('federatedfilesharing', 'Confirm data upload to lookup server'),\n\t\ttext: t('federatedfilesharing', 'When enabled, all account properties (e.g. email address) with scope visibility set to \"published\", will be automatically synced and transmitted to an external system and made available in a public, global address book.'),\n\t\tlabelConfirm: t('federatedfilesharing', 'Enable data upload'),\n\t\tlabelReject: t('federatedfilesharing', 'Disable upload'),\n\t\tseverity: 'warning',\n\t}).then(() => {\n\t\tstate.lookupServerUploadEnabled = true\n\t}).catch(() => {\n\t\tstate.lookupServerUploadEnabled = false\n\t})\n}\n\n/**\n * Show confirmation dialog for enabling lookup server\n *\n * @param value - The new state\n */\nasync function showLookupServerConfirmation(value: boolean) {\n\t// No confirmation needed for disabling\n\tif (value === false) {\n\t\treturn state.lookupServerEnabled = false\n\t}\n\n\tawait showConfirmation({\n\t\tname: t('federatedfilesharing', 'Confirm querying lookup server'),\n\t\ttext: t('federatedfilesharing', 'When enabled, the search input when creating shares will be sent to an external system that provides a public and global address book.')\n\t\t\t+ t('federatedfilesharing', 'This is used to retrieve the federated cloud ID to make federated sharing easier.')\n\t\t\t+ t('federatedfilesharing', 'Moreover, email addresses of users might be sent to that system in order to verify them.'),\n\t\tlabelConfirm: t('federatedfilesharing', 'Enable querying'),\n\t\tlabelReject: t('federatedfilesharing', 'Disable querying'),\n\t\tseverity: 'warning',\n\t}).then(() => {\n\t\tstate.lookupServerEnabled = true\n\t}).catch(() => {\n\t\tstate.lookupServerEnabled = false\n\t})\n}\n\n/**\n * Update the app config\n *\n * @param key - The config key\n * @param value - The config value\n */\nasync function updateAppConfig(key: string, value: boolean) {\n\tawait confirmPassword()\n\n\tconst url = generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/{appId}/{key}', {\n\t\tappId: 'files_sharing',\n\t\tkey,\n\t})\n\n\tconst stringValue = value ? 'yes' : 'no'\n\ttry {\n\t\tconst { data } = await axios.post<OCSResponse>(url, {\n\t\t\tvalue: stringValue,\n\t\t})\n\t\tif (data.ocs.meta.status !== 'ok') {\n\t\t\tif (data.ocs.meta.message) {\n\t\t\t\tshowError(data.ocs.meta.message)\n\t\t\t\tlogger.error('Error updating federated files sharing config', { error: data.ocs })\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Failed to update federatedfilesharing config, ${data.ocs.meta.statuscode}`)\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tlogger.error('Error updating federated files sharing config', { error })\n\t\tshowError(t('federatedfilesharing', 'Unable to update federated files sharing config'))\n\t}\n}\n</script>\n\n<template>\n\t<NcSettingsSection\n\t\t:name=\"t('federatedfilesharing', 'Federated Cloud Sharing')\"\n\t\t:description=\"t('federatedfilesharing', 'Adjust how people can share between servers. This includes shares between people on this server as well if they are using federated sharing.')\"\n\t\t:doc-url=\"sharingFederatedDocUrl\">\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"state.outgoingServer2serverShareEnabled\"\n\t\t\ttype=\"switch\">\n\t\t\t{{ t('federatedfilesharing', 'Allow people on this server to send shares to other servers (this option also allows WebDAV access to public shares)') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"state.incomingServer2serverShareEnabled\"\n\t\t\ttype=\"switch\">\n\t\t\t{{ t('federatedfilesharing', 'Allow people on this server to receive shares from other servers') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-if=\"state.federatedGroupSharingSupported\"\n\t\t\tv-model=\"state.outgoingServer2serverGroupShareEnabled\"\n\t\t\ttype=\"switch\">\n\t\t\t{{ t('federatedfilesharing', 'Allow people on this server to send shares to groups on other servers') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-if=\"state.federatedGroupSharingSupported\"\n\t\t\tv-model=\"state.incomingServer2serverGroupShareEnabled\"\n\t\t\ttype=\"switch\">\n\t\t\t{{ t('federatedfilesharing', 'Allow people on this server to receive group shares from other servers') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<fieldset>\n\t\t\t<legend>{{ t('federatedfilesharing', 'The lookup server is only available for global scale.') }}</legend>\n\n\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\ttype=\"switch\"\n\t\t\t\t:model-value=\"state.lookupServerEnabled\"\n\t\t\t\tdisabled\n\t\t\t\t@update:model-value=\"showLookupServerConfirmation\">\n\t\t\t\t{{ t('federatedfilesharing', 'Search global and public address book for people') }}\n\t\t\t</NcCheckboxRadioSwitch>\n\n\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\ttype=\"switch\"\n\t\t\t\t:model-value=\"state.lookupServerUploadEnabled\"\n\t\t\t\tdisabled\n\t\t\t\t@update:model-value=\"showLookupServerUploadConfirmation\">\n\t\t\t\t{{ t('federatedfilesharing', 'Allow people to publish their data to a global and public address book') }}\n\t\t\t</NcCheckboxRadioSwitch>\n\t\t</fieldset>\n\n\t\t<!-- Trusted server handling -->\n\t\t<div class=\"settings-subsection\">\n\t\t\t<h3 class=\"settings-subsection__name\">\n\t\t\t\t{{ t('federatedfilesharing', 'Trusted federation') }}\n\t\t\t</h3>\n\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\tv-model=\"state.federatedTrustedShareAutoAccept\"\n\t\t\t\ttype=\"switch\">\n\t\t\t\t{{ t('federatedfilesharing', 'Automatically accept shares from trusted federated accounts and groups by default') }}\n\t\t\t</NcCheckboxRadioSwitch>\n\t\t</div>\n\t</NcSettingsSection>\n</template>\n\n<style scoped>\n.settings-subsection {\n\tmargin-top: 20px;\n}\n\n.settings-subsection__name {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tfont-size: 16px;\n\tfont-weight: bold;\n\tmax-width: 900px;\n\tmargin-top: 0;\n}\n</style>\n","/*!\n * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { loadState } from '@nextcloud/initial-state'\nimport { createApp } from 'vue'\nimport AdminSettings from './components/AdminSettings.vue'\n\nimport 'vite/modulepreload-polyfill'\n\nconst internalOnly = loadState('federatedfilesharing', 'internalOnly', false)\n\nif (!internalOnly) {\n\tconst app = createApp(AdminSettings)\n\tapp.mount('#vue-admin-federated')\n}\n"],"names":["sharingFederatedDocUrl","loadState","internalState","target","prop","value","updateAppConfig","state","reactive","showLookupServerUploadConfirmation","showConfirmation","t","showLookupServerConfirmation","key","confirmPassword","url","generateOcsUrl","stringValue","data","axios","showError","logger","error","_createBlock","_unref","NcSettingsSection","_createVNode","NcCheckboxRadioSwitch","_cache","$event","_createElementVNode","_hoisted_1","_hoisted_2","_toDisplayString","internalOnly","createApp","AdminSettings"],"mappings":"okBAmBA,MAAMA,EAAyBC,EAAkB,uBAAwB,wBAAwB,EAE3FC,EAAgB,IAAI,MAAM,CAC/B,kCAAmC,CAClC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