2FAuth/public/build/assets/AppSetup-CjgtJWbk.js.map
2024-11-27 12:03:02 +01:00

1 line
12 KiB
Plaintext

{"version":3,"file":"AppSetup-CjgtJWbk.js","sources":["../../../resources/js/services/systemService.js","../../../resources/js/components/VersionChecker.vue","../../../resources/js/views/admin/AppSetup.vue"],"sourcesContent":["import { httpClientFactory } from '@/services/httpClientFactory'\n\nconst webClient = httpClientFactory('web')\n\nexport default {\n /**\n * \n * @returns Promise\n */\n getSystemInfos(config = {}) {\n return webClient.get('system/infos', { ...config })\n },\n\n /**\n * \n * @returns Promise\n */\n getLastRelease(config = {}) {\n return webClient.get('system/latestRelease', { ...config })\n },\n\n /**\n * \n * @returns Promise\n */\n sendTestEmail(config = {}) {\n return webClient.post('system/test-email', { ...config })\n },\n\n /**\n * \n * @returns Promise\n */\n clearCache(config = {}) {\n return webClient.get('system/clear-cache', { ...config })\n },\n\n /**\n * \n * @returns Promise\n */\n optimize(config = {}) {\n return webClient.get('system/optimize', { ...config })\n },\n \n}","<script setup>\n import systemService from '@/services/systemService'\n import { useAppSettingsStore } from '@/stores/appSettings'\n import { UseColorMode } from '@vueuse/components'\n\n const appSettings = useAppSettingsStore()\n const isScanning = ref(false)\n const isUpToDate = ref()\n\n async function getLatestRelease() {\n isScanning.value = true;\n isUpToDate.value = undefined\n\n await systemService.getLastRelease({returnError: true})\n .then(response => {\n appSettings.latestRelease = response.data.newRelease\n isUpToDate.value = response.data.newRelease === null ? null : response.data.newRelease === false\n })\n .catch(() => {\n isUpToDate.value = null\n })\n\n isScanning.value = false;\n }\n\n</script>\n\n<template>\n <div class=\"columns is-mobile is-vcentered\">\n <div class=\"column is-narrow\">\n <button type=\"button\" :class=\"isScanning ? 'is-loading' : ''\" class=\"button is-link is-rounded is-small\" @click=\"getLatestRelease\">{{ $t('admin.check_now') }}</button>\n </div>\n <div class=\"column\">\n <UseColorMode v-slot=\"{ mode }\">\n <span v-if=\"appSettings.latestRelease\" class=\"mt-2\" :class=\"mode == 'dark' ? 'has-text-warning' : 'has-text-warning-dark'\">\n <span class=\"release-flag\"></span>{{ $t('admin.x_is_available', { version: appSettings.latestRelease }) }}&nbsp;<a class=\"is-size-7\" href=\"https://github.com/Bubka/2FAuth/releases\">{{ $t('admin.view_on_github') }}</a>\n </span>\n <span v-if=\"isUpToDate\" class=\"has-text-grey\">\n <FontAwesomeIcon :icon=\"['fas', 'check']\" class=\"mr-1 has-text-success\" /> {{ $t('commons.you_are_up_to_date') }}\n </span>\n <span v-else-if=\"isUpToDate === null\" class=\"has-text-grey\">\n <FontAwesomeIcon :icon=\"['fas', 'times']\" class=\"mr-1 has-text-danger\" />{{ $t('errors.check_failed_try_later') }}\n </span>\n </UseColorMode>\n </div>\n </div>\n</template>\n","<script setup>\n import AdminTabs from '@/layouts/AdminTabs.vue'\n import systemService from '@/services/systemService'\n import { useAppSettingsUpdater } from '@/composables/appSettingsUpdater'\n import { useAppSettingsStore } from '@/stores/appSettings'\n import { useNotifyStore } from '@/stores/notify'\n import { useUserStore } from '@/stores/user'\n import VersionChecker from '@/components/VersionChecker.vue'\n import CopyButton from '@/components/CopyButton.vue'\n\n const $2fauth = inject('2fauth')\n const user = useUserStore()\n const notify = useNotifyStore()\n const appSettings = useAppSettingsStore()\n const returnTo = useStorage($2fauth.prefix + 'returnTo', 'accounts')\n\n const infos = ref()\n const listInfos = ref(null)\n const isSendingTestEmail = ref(false)\n const isClearingCache = ref(false)\n const healthEndPoint = $2fauth.config.subdirectory + '/up'\n const healthEndPointFullPath = location.hostname + $2fauth.config.subdirectory + '/up'\n\n /**\n * Sends a test email\n */\n function sendTestEmail() {\n isSendingTestEmail.value = true;\n\n systemService.sendTestEmail()\n .finally(() => {\n isSendingTestEmail.value = false;\n })\n }\n\n /**\n * clears app cache\n */\n function clearCache() {\n isClearingCache.value = true;\n\n systemService.clearCache().then(response => {\n useNotifyStore().success({ type: 'is-success', text: trans('admin.cache_cleared') })\n })\n .finally(() => {\n isClearingCache.value = false;\n })\n }\n\n onBeforeRouteLeave((to) => {\n if (! to.name.startsWith('admin.')) {\n notify.clear()\n }\n })\n\n onMounted(async () => {\n await appSettings.fetch()\n\n systemService.getSystemInfos({returnError: true}).then(response => {\n infos.value = response.data.common\n })\n .catch(() => {\n infos.value = null\n })\n })\n\n</script>\n\n<template>\n <div>\n <AdminTabs activeTab=\"admin.appSetup\" />\n <div class=\"options-tabs\">\n <FormWrapper>\n <form>\n <h4 class=\"title is-4 pt-4 has-text-grey-light\">{{ $t('settings.general') }}</h4>\n <!-- Check for update -->\n <FormCheckbox v-model=\"appSettings.checkForUpdate\" @update:model-value=\"val => useAppSettingsUpdater('checkForUpdate', val)\" fieldName=\"checkForUpdate\" label=\"commons.check_for_update\" help=\"commons.check_for_update_help\" />\n <VersionChecker />\n <!-- email config test -->\n <div class=\"field\">\n <label class=\"label\" for=\"btnTestEmail\" v-html=\"$t('admin.forms.test_email.label')\" />\n <p class=\"help\" v-html=\"$t('admin.forms.test_email.help')\" />\n <p class=\"help\" v-html=\"$t('admin.forms.test_email.email_will_be_send_to_x', { email: user.email })\" />\n </div>\n <div class=\"columns is-mobile is-vcentered\">\n <div class=\"column is-narrow\">\n <button id=\"btnTestEmail\" type=\"button\" :class=\"isSendingTestEmail ? 'is-loading' : ''\" class=\"button is-link is-rounded is-small\" @click=\"sendTestEmail\" >\n <span class=\"icon is-small\">\n <FontAwesomeIcon :icon=\"['far', 'paper-plane']\" />\n </span>\n <span>{{ $t('commons.send') }}</span>\n </button> \n </div>\n </div>\n <!-- healthcheck -->\n <div class=\"field\">\n <label class=\"label\" for=\"lnkHealthCheck\" v-html=\"$t('admin.forms.health_endpoint.label')\" />\n <p class=\"help\" v-html=\"$t('admin.forms.health_endpoint.help')\" />\n </div>\n <div class=\"field mb-5\">\n <a id=\"lnkHealthCheck\" target=\"_blank\" :href=\"healthEndPoint\">{{ healthEndPointFullPath }}</a>\n </div>\n <h4 class=\"title is-4 pt-5 has-text-grey-light\">{{ $t('admin.storage') }}</h4>\n <!-- store icons in database -->\n <FormCheckbox v-model=\"appSettings.storeIconsInDatabase\" @update:model-value=\"val => useAppSettingsUpdater('storeIconsInDatabase', val)\" fieldName=\"storeIconsInDatabase\" label=\"admin.forms.store_icon_to_database.label\" help=\"admin.forms.store_icon_to_database.help\" />\n <h4 class=\"title is-4 pt-5 has-text-grey-light\">{{ $t('settings.security') }}</h4>\n <!-- protect db -->\n <FormCheckbox v-model=\"appSettings.useEncryption\" @update:model-value=\"val => useAppSettingsUpdater('useEncryption', val)\" fieldName=\"useEncryption\" label=\"admin.forms.use_encryption.label\" help=\"admin.forms.use_encryption.help\" />\n </form>\n\n <h4 class=\"title is-4 pt-5 has-text-grey-light\">{{ $t('commons.environment') }}</h4>\n <!-- cache management -->\n <div class=\"field\">\n <!-- <h5 class=\"title is-5\">{{ $t('settings.security') }}</h5> -->\n <label for=\"btnClearCache\" class=\"label\" v-html=\"$t('admin.forms.cache_management.label')\" />\n <p class=\"help\" v-html=\"$t('admin.forms.cache_management.help')\" />\n </div>\n <div class=\"field mb-5 is-grouped\">\n <p class=\"control\">\n <button id=\"btnClearCache\" type=\"button\" :class=\"isClearingCache ? 'is-loading' : ''\" class=\"button is-link is-rounded is-small\" @click=\"clearCache\">\n {{ $t('commons.clear') }}\n </button>\n </p>\n </div>\n <!-- env vars -->\n <div class=\"field\">\n <label for=\"btnCopyEnvVars\" class=\"label\" v-html=\"$t('admin.variables')\" />\n </div>\n <div v-if=\"infos\" class=\"about-debug box is-family-monospace is-size-7\">\n <CopyButton id=\"btnCopyEnvVars\" :token=\"listInfos?.innerText\" />\n <ul ref=\"listInfos\" id=\"listInfos\">\n <li v-for=\"(value, preference) in infos\" :value=\"value\" :key=\"preference\">\n <b>{{ preference }}</b>: <span class=\"has-text-grey\">{{ value }}</span>\n </li>\n </ul>\n </div>\n <div v-else-if=\"infos === null\" class=\"about-debug box is-family-monospace is-size-7 has-text-warning-dark\">\n {{ $t('errors.error_during_data_fetching') }}\n </div>\n </FormWrapper>\n </div>\n <VueFooter :showButtons=\"true\">\n <ButtonBackCloseCancel :returnTo=\"{ name: returnTo }\" action=\"close\" />\n </VueFooter>\n </div>\n</template>"],"names":["webClient","httpClientFactory","systemService","config","appSettings","useAppSettingsStore","isScanning","ref","isUpToDate","getLatestRelease","response","$2fauth","inject","user","useUserStore","notify","useNotifyStore","returnTo","useStorage","infos","listInfos","isSendingTestEmail","isClearingCache","healthEndPoint","healthEndPointFullPath","sendTestEmail","clearCache","trans","onBeforeRouteLeave","to","onMounted"],"mappings":"2aAEA,MAAMA,EAAYC,EAAkB,KAAK,EAE1BC,EAAA,CAKX,eAAeC,EAAS,GAAI,CACxB,OAAOH,EAAU,IAAI,eAAgB,CAAE,GAAGG,CAAQ,CAAA,CACrD,EAMD,eAAeA,EAAS,GAAI,CACxB,OAAOH,EAAU,IAAI,uBAAwB,CAAE,GAAGG,CAAQ,CAAA,CAC7D,EAMD,cAAcA,EAAS,GAAI,CACvB,OAAOH,EAAU,KAAK,oBAAqB,CAAE,GAAGG,CAAQ,CAAA,CAC3D,EAMD,WAAWA,EAAS,GAAI,CACpB,OAAOH,EAAU,IAAI,qBAAsB,CAAE,GAAGG,CAAQ,CAAA,CAC3D,EAMD,SAASA,EAAS,GAAI,CAClB,OAAOH,EAAU,IAAI,kBAAmB,CAAE,GAAGG,CAAQ,CAAA,CACxD,CAEL,6QCxCI,MAAMC,EAAcC,EAAmB,EACjCC,EAAaC,EAAI,EAAK,EACtBC,EAAaD,EAAG,EAEtB,eAAeE,GAAmB,CAC9BH,EAAW,MAAQ,GACnBE,EAAW,MAAQ,OAEnB,MAAMN,EAAc,eAAe,CAAC,YAAa,EAAI,CAAC,EACrD,KAAKQ,GAAY,CACdN,EAAY,cAAgBM,EAAS,KAAK,WAC1CF,EAAW,MAAQE,EAAS,KAAK,aAAe,KAAO,KAAOA,EAAS,KAAK,aAAe,EAC9F,CAAA,EACA,MAAM,IAAM,CACTF,EAAW,MAAQ,IACtB,CAAA,EAEDF,EAAW,MAAQ,EAC3B,go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