You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
15 KiB
1 lines
15 KiB
{"version":3,"file":"encryption-settings_admin.mjs","sources":["../build/frontend/apps/encryption/src/components/SettingsAdminHomeStorage.vue","../build/frontend/apps/encryption/src/components/SettingsAdminRecoveryKey.vue","../build/frontend/apps/encryption/src/components/SettingsAdminRecoveryKeyChange.vue","../build/frontend/apps/encryption/src/views/SettingsAdmin.vue","../build/frontend/apps/encryption/src/settings-admin.ts"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n -->\n\n<script setup lang=\"ts\">\nimport axios from '@nextcloud/axios'\nimport { t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { watchDebounced } from '@vueuse/core'\nimport { ref, watch } from 'vue'\nimport NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'\n\nconst encryptHomeStorage = defineModel<boolean>({ required: true })\nconst isSavingHomeStorageEncryption = ref(false)\n\nwatch(encryptHomeStorage, () => {\n\tisSavingHomeStorageEncryption.value = true\n})\nwatchDebounced(encryptHomeStorage, async (encryptHomeStorage, oldValue) => {\n\tif (encryptHomeStorage === oldValue) {\n\t\t// user changed their mind (likely quickly toggled), do nothing\n\t\tisSavingHomeStorageEncryption.value = false\n\t\treturn\n\t}\n\n\ttry {\n\t\tawait axios.post(\n\t\t\tgenerateUrl('/apps/encryption/ajax/setEncryptHomeStorage'),\n\t\t\t{ encryptHomeStorage },\n\t\t)\n\t} finally {\n\t\tisSavingHomeStorageEncryption.value = false\n\t}\n}, { debounce: 800 })\n</script>\n\n<template>\n\t<NcCheckboxRadioSwitch\n\t\tv-model=\"encryptHomeStorage\"\n\t\t:loading=\"isSavingHomeStorageEncryption\"\n\t\t:description=\"t('encryption', 'Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted')\"\n\t\ttype=\"switch\">\n\t\t{{ t('encryption', 'Encrypt the home storage') }}\n\t</NcCheckboxRadioSwitch>\n</template>\n","<!--\n - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n -->\n\n<script setup lang=\"ts\">\nimport axios from '@nextcloud/axios'\nimport { showSuccess } from '@nextcloud/dialogs'\nimport { t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { computed, ref, useTemplateRef } from 'vue'\nimport NcButton from '@nextcloud/vue/components/NcButton'\nimport NcFormGroup from '@nextcloud/vue/components/NcFormGroup'\nimport NcNoteCard from '@nextcloud/vue/components/NcNoteCard'\nimport NcPasswordField from '@nextcloud/vue/components/NcPasswordField'\nimport { logger } from '../utils/logger.ts'\n\nconst recoveryEnabled = defineModel<boolean>({ required: true })\nconst formElement = useTemplateRef('form')\n\nconst isLoading = ref(false)\nconst hasError = ref(false)\n\nconst password = ref('')\nconst confirmPassword = ref('')\nconst passwordMatch = computed(() => password.value === confirmPassword.value)\n\n/**\n * Handle the form submission to enable or disable the admin recovery key\n */\nasync function onSubmit() {\n\tif (isLoading.value) {\n\t\treturn\n\t}\n\n\tif (!passwordMatch.value) {\n\t\treturn\n\t}\n\n\thasError.value = false\n\tisLoading.value = true\n\ttry {\n\t\tconst { data } = await axios.post(\n\t\t\tgenerateUrl('/apps/encryption/ajax/adminRecovery'),\n\t\t\t{\n\t\t\t\tadminEnableRecovery: !recoveryEnabled.value,\n\t\t\t\trecoveryPassword: password.value,\n\t\t\t\tconfirmPassword: confirmPassword.value,\n\t\t\t},\n\t\t)\n\t\trecoveryEnabled.value = !recoveryEnabled.value\n\t\tpassword.value = confirmPassword.value = ''\n\t\tformElement.value?.reset()\n\t\tif (data.data.message) {\n\t\t\tshowSuccess(data.data.message)\n\t\t}\n\t} catch (error) {\n\t\thasError.value = true\n\t\tlogger.error('Failed to update recovery key settings', { error })\n\t} finally {\n\t\tisLoading.value = false\n\t}\n}\n</script>\n\n<template>\n\t<form ref=\"form\" @submit.prevent=\"onSubmit\">\n\t\t<NcFormGroup\n\t\t\t:label=\"recoveryEnabled ? t('encryption', 'Disable recovery key') : t('encryption', 'Enable recovery key')\"\n\t\t\t:description=\"t('encryption', 'The recovery key is an additional encryption key used to encrypt files. It is used to recover files from an account if the password is forgotten.')\">\n\t\t\t<NcPasswordField\n\t\t\t\tv-model=\"password\"\n\t\t\t\trequired\n\t\t\t\tname=\"password\"\n\t\t\t\t:label=\"t('encryption', 'Recovery key password')\" />\n\t\t\t<NcPasswordField\n\t\t\t\tv-model=\"confirmPassword\"\n\t\t\t\trequired\n\t\t\t\tname=\"confirmPassword\"\n\t\t\t\t:error=\"!!confirmPassword && !passwordMatch\"\n\t\t\t\t:helper-text=\"(passwordMatch || !confirmPassword) ? '' : t('encryption', 'Passwords fields do not match')\"\n\t\t\t\t:label=\"t('encryption', 'Repeat recovery key password')\" />\n\n\t\t\t<NcButton type=\"submit\" :variant=\"recoveryEnabled ? 'error' : 'primary'\">\n\t\t\t\t{{ recoveryEnabled ? t('encryption', 'Disable recovery key') : t('encryption', 'Enable recovery key') }}\n\t\t\t</NcButton>\n\n\t\t\t<NcNoteCard v-if=\"hasError\" type=\"error\">\n\t\t\t\t{{ t('encryption', 'An error occurred while updating the recovery key settings. Please try again.') }}\n\t\t\t</NcNoteCard>\n\t\t</NcFormGroup>\n\t</form>\n</template>\n","<!--\n - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n -->\n\n<script setup lang=\"ts\">\nimport axios from '@nextcloud/axios'\nimport { t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { computed, ref, useTemplateRef } from 'vue'\nimport NcButton from '@nextcloud/vue/components/NcButton'\nimport NcFormGroup from '@nextcloud/vue/components/NcFormGroup'\nimport NcNoteCard from '@nextcloud/vue/components/NcNoteCard'\nimport NcPasswordField from '@nextcloud/vue/components/NcPasswordField'\nimport { logger } from '../utils/logger.ts'\n\nconst formElement = useTemplateRef('form')\n\nconst isLoading = ref(false)\nconst hasError = ref(false)\n\nconst oldPassword = ref('')\nconst password = ref('')\nconst confirmPassword = ref('')\nconst passwordMatch = computed(() => password.value === confirmPassword.value)\n\n/**\n * Handle the form submission to change the admin recovery key password\n */\nasync function onSubmit() {\n\tif (isLoading.value) {\n\t\treturn\n\t}\n\n\tif (!passwordMatch.value) {\n\t\treturn\n\t}\n\n\thasError.value = false\n\tisLoading.value = true\n\ttry {\n\t\tawait axios.post(\n\t\t\tgenerateUrl('/apps/encryption/ajax/changeRecoveryPassword'),\n\t\t\t{\n\t\t\t\toldPassword: oldPassword.value,\n\t\t\t\tnewPassword: password.value,\n\t\t\t\tconfirmPassword: confirmPassword.value,\n\t\t\t},\n\t\t)\n\t\toldPassword.value = password.value = confirmPassword.value = ''\n\t\tformElement.value?.reset()\n\t} catch (error) {\n\t\thasError.value = true\n\t\tlogger.error('Failed to update recovery key settings', { error })\n\t} finally {\n\t\tisLoading.value = false\n\t}\n}\n</script>\n\n<template>\n\t<form ref=\"form\" :class=\"$style.settingsAdminRecoveryKeyChange\" @submit.prevent=\"onSubmit\">\n\t\t<NcFormGroup\n\t\t\t:label=\"t('encryption', 'Change recovery key password')\">\n\t\t\t<NcPasswordField\n\t\t\t\tv-model=\"oldPassword\"\n\t\t\t\trequired\n\t\t\t\tname=\"oldPassword\"\n\t\t\t\t:label=\"t('encryption', 'Old recovery key password')\" />\n\t\t\t<NcPasswordField\n\t\t\t\tv-model=\"password\"\n\t\t\t\trequired\n\t\t\t\tname=\"password\"\n\t\t\t\t:label=\"t('encryption', 'New recovery key password')\" />\n\t\t\t<NcPasswordField\n\t\t\t\tv-model=\"confirmPassword\"\n\t\t\t\trequired\n\t\t\t\tname=\"confirmPassword\"\n\t\t\t\t:error=\"!passwordMatch && !!confirmPassword\"\n\t\t\t\t:helper-text=\"(passwordMatch || !confirmPassword) ? '' : t('encryption', 'Passwords fields do not match')\"\n\t\t\t\t:label=\"t('encryption', 'Repeat new recovery key password')\" />\n\n\t\t\t<NcButton type=\"submit\" variant=\"primary\">\n\t\t\t\t{{ t('encryption', 'Change recovery key password') }}\n\t\t\t</NcButton>\n\n\t\t\t<NcNoteCard v-if=\"hasError\" type=\"error\">\n\t\t\t\t{{ t('encryption', 'An error occurred while changing the recovery key password. Please try again.') }}\n\t\t\t</NcNoteCard>\n\t\t</NcFormGroup>\n\t</form>\n</template>\n\n<style module>\n.settingsAdminRecoveryKeyChange {\n\tmargin-top: var(--clickable-area-small);\n}\n</style>\n","<!--\n - SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n -->\n\n<script setup lang=\"ts\">\nimport { loadState } from '@nextcloud/initial-state'\nimport { t } from '@nextcloud/l10n'\nimport { NcNoteCard, NcSettingsSection } from '@nextcloud/vue'\nimport { ref } from 'vue'\nimport SettingsAdminHomeStorage from '../components/SettingsAdminHomeStorage.vue'\nimport SettingsAdminRecoveryKey from '../components/SettingsAdminRecoveryKey.vue'\nimport SettingsAdminRecoveryKeyChange from '../components/SettingsAdminRecoveryKeyChange.vue'\nimport { InitStatus } from '../utils/types.ts'\n\nconst adminSettings = loadState<{\n\trecoveryEnabled: boolean\n\tmasterKeyEnabled: boolean\n\tencryptHomeStorage: boolean\n\tinitStatus: typeof InitStatus[keyof typeof InitStatus]\n}>('encryption', 'adminSettings')\n\nconst encryptHomeStorage = ref(adminSettings.encryptHomeStorage!)\nconst recoveryEnabled = ref(adminSettings.recoveryEnabled!)\n</script>\n\n<template>\n\t<NcSettingsSection :name=\"t('encryption', 'Default encryption module')\">\n\t\t<NcNoteCard v-if=\"adminSettings.initStatus === InitStatus.NotInitialized && !adminSettings.masterKeyEnabled\" type=\"warning\">\n\t\t\t{{ t('encryption', 'Encryption app is enabled but your keys are not initialized, please log-out and log-in again') }}\n\t\t</NcNoteCard>\n\n\t\t<template v-else>\n\t\t\t<SettingsAdminHomeStorage v-model=\"encryptHomeStorage\" />\n\t\t\t<br>\n\t\t\t<SettingsAdminRecoveryKey v-if=\"adminSettings.masterKeyEnabled\" v-model=\"recoveryEnabled\" />\n\t\t\t<SettingsAdminRecoveryKeyChange v-if=\"adminSettings.masterKeyEnabled && recoveryEnabled\" />\n\t\t</template>\n\t</NcSettingsSection>\n</template>\n","/*!\n * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { createApp } from 'vue'\nimport SettingsAdmin from './views/SettingsAdmin.vue'\n\nconst app = createApp(SettingsAdmin)\napp.mount('#encryption-settings-section')\n"],"names":["encryptHomeStorage","_useModel","__props","isSavingHomeStorageEncryption","ref","watch","watchDebounced","oldValue","axios","generateUrl","_createBlock","_unref","NcCheckboxRadioSwitch","$event","t","recoveryEnabled","formElement","useTemplateRef","isLoading","hasError","password","confirmPassword","passwordMatch","computed","onSubmit","data","showSuccess","error","logger","_createElementBlock","_createVNode","NcFormGroup","NcPasswordField","NcButton","NcNoteCard","oldPassword","_normalizeClass","$style","adminSettings","loadState","NcSettingsSection","InitStatus","_Fragment","SettingsAdminHomeStorage","_createElementVNode","SettingsAdminRecoveryKey","SettingsAdminRecoveryKeyChange","app","createApp","SettingsAdmin"],"mappings":"mzDAaA,MAAMA,EAAqBC,EAAoBC,EAAA,YAAmB,EAC5DC,EAAgCC,EAAI,EAAK,EAE/C,OAAAC,EAAML,EAAoB,IAAM,CAC/BG,EAA8B,MAAQ,EACvC,CAAC,EACDG,EAAeN,EAAoB,MAAOA,EAAoBO,IAAa,CAC1E,GAAIP,IAAuBO,EAAU,CAEpCJ,EAA8B,MAAQ,GACtC,MACD,CAEA,GAAI,CACH,MAAMK,EAAM,KACXC,EAAY,6CAA6C,EACzD,CAAE,mBAAAT,CAAAA,CAAmB,CAEvB,QAAA,CACCG,EAA8B,MAAQ,EACvC,CACD,EAAG,CAAE,SAAU,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