mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-27 00:04:23 -04:00 
			
		
		
		
	cleanup: remove docker volume validation (#2830)
* remove docker volume validation * remove imports & linting * remove missed
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -1,5 +1,6 @@ | ||||
| <template> | ||||
|   <v-container fluid class="narrow-container"> | ||||
|     <!-- Image --> | ||||
|     <BasePageTitle divider> | ||||
|       <template #header> | ||||
|         <v-img max-height="200" max-width="150" :src="require('~/static/svgs/admin-site-settings.svg')"></v-img> | ||||
| @@ -7,6 +8,7 @@ | ||||
|       <template #title> {{ $t("settings.site-settings") }} </template> | ||||
|     </BasePageTitle> | ||||
|  | ||||
|     <!-- Bug Report --> | ||||
|     <BaseDialog v-model="bugReportDialog" :title="$t('settings.bug-report')" :width="800" :icon="$globals.icons.github"> | ||||
|       <v-card-text> | ||||
|         <div class="pb-4"> | ||||
| @@ -27,7 +29,6 @@ | ||||
|       <BaseButton | ||||
|         color="info" | ||||
|         @click=" | ||||
|           dockerValidate(); | ||||
|           bugReportDialog = true; | ||||
|         " | ||||
|       > | ||||
| @@ -36,6 +37,7 @@ | ||||
|       </BaseButton> | ||||
|     </div> | ||||
|  | ||||
|     <!-- Configuration --> | ||||
|     <section> | ||||
|       <BaseCardSectionTitle class="pb-0" :icon="$globals.icons.cog" :title="$tc('settings.configuration')"> </BaseCardSectionTitle> | ||||
|       <v-card class="mb-4"> | ||||
| @@ -60,40 +62,7 @@ | ||||
|       </v-card> | ||||
|     </section> | ||||
|  | ||||
|     <section> | ||||
|       <BaseCardSectionTitle class="pt-2" :icon="$globals.icons.docker" :title="$tc('settings.docker-volume')" /> | ||||
|       <v-alert | ||||
|         border="left" | ||||
|         colored-border | ||||
|         :type="docker.state === DockerVolumeState.Error ? 'error' : 'info'" | ||||
|         :icon="$globals.icons.docker" | ||||
|         elevation="2" | ||||
|         :loading="docker.loading" | ||||
|       > | ||||
|         <div class="d-flex align-center font-weight-medium"> | ||||
|           {{ $t('settings.docker-volume') }} | ||||
|           <HelpIcon small class="my-n3"> | ||||
|             {{ $t('settings.docker-volume-help') }} | ||||
|           </HelpIcon> | ||||
|         </div> | ||||
|         <div> | ||||
|           <template v-if="docker.state === DockerVolumeState.Error"> {{ $t('settings.volumes-are-misconfigured') }} </template> | ||||
|           <template v-else-if="docker.state === DockerVolumeState.Success"> | ||||
|             {{ $t('settings.volumes-are-configured-correctly') }} | ||||
|           </template> | ||||
|           <template v-else-if="docker.state === DockerVolumeState.Unknown"> | ||||
|             {{ $t('settings.status-unknown-try-running-a-validation') }} | ||||
|           </template> | ||||
|         </div> | ||||
|         <div class="mt-4"> | ||||
|           <BaseButton color="info" :loading="docker.loading" @click="dockerValidate"> | ||||
|             <template #icon> {{ $globals.icons.checkboxMarkedCircle }} </template> | ||||
|             {{ $t('settings.validate') }} | ||||
|           </BaseButton> | ||||
|         </div> | ||||
|       </v-alert> | ||||
|     </section> | ||||
|  | ||||
|     <!-- Email --> | ||||
|     <section> | ||||
|       <BaseCardSectionTitle class="pt-2" :icon="$globals.icons.email" :title="$tc('user.email')" /> | ||||
|       <v-alert border="left" colored-border :type="appConfig.emailReady ? 'success' : 'error'" elevation="2"> | ||||
| @@ -219,30 +188,6 @@ export default defineComponent({ | ||||
|     components: { AppLoader }, | ||||
|     layout: "admin", | ||||
|     setup() { | ||||
|         // ========================================================== | ||||
|         // Docker Volume Validation | ||||
|         const docker = reactive({ | ||||
|             loading: false, | ||||
|             state: DockerVolumeState.Unknown, | ||||
|         }); | ||||
|         async function dockerValidate() { | ||||
|             docker.loading = true; | ||||
|             // Do API Check | ||||
|             const { data } = await adminApi.about.checkDocker(); | ||||
|             if (data == null) { | ||||
|                 docker.state = DockerVolumeState.Error; | ||||
|                 return; | ||||
|             } | ||||
|             // Get File Contents | ||||
|             const { data: fileContents } = await adminApi.about.getDockerValidateFileContents(); | ||||
|             if (data.text === fileContents) { | ||||
|                 docker.state = DockerVolumeState.Success; | ||||
|             } | ||||
|             else { | ||||
|                 docker.state = DockerVolumeState.Error; | ||||
|             } | ||||
|             docker.loading = false; | ||||
|         } | ||||
|         const state = reactive({ | ||||
|             loading: false, | ||||
|             address: "", | ||||
| @@ -444,15 +389,12 @@ export default defineComponent({ | ||||
|                 text += `${item.text.toString()}: ${status}\n`; | ||||
|             }); | ||||
|             text += `${i18n.tc("settings.email-configured")}: ${appConfig.value.emailReady ? i18n.tc("general.yes") : i18n.tc("general.no")}\n`; | ||||
|             text += `${i18n.tc("settings.docker-volume")}: ${docker.state}`; | ||||
|             return text; | ||||
|         }); | ||||
|         return { | ||||
|             bugReportDialog, | ||||
|             bugReportText, | ||||
|             DockerVolumeState, | ||||
|             docker, | ||||
|             dockerValidate, | ||||
|             simpleChecks, | ||||
|             appConfig, | ||||
|             validEmail, | ||||
|   | ||||
| @@ -1,15 +1,10 @@ | ||||
| import asyncio | ||||
| import random | ||||
| import shutil | ||||
| import string | ||||
|  | ||||
| from fastapi import APIRouter, BackgroundTasks | ||||
| from fastapi import APIRouter | ||||
| from recipe_scrapers import __version__ as recipe_scraper_version | ||||
|  | ||||
| from mealie.core.release_checker import get_latest_version | ||||
| from mealie.core.settings.static import APP_VERSION | ||||
| from mealie.routes._base import BaseAdminController, controller | ||||
| from mealie.schema.admin.about import AdminAboutInfo, AppStatistics, CheckAppConfig, DockerVolumeText | ||||
| from mealie.schema.admin.about import AdminAboutInfo, AppStatistics, CheckAppConfig | ||||
|  | ||||
| router = APIRouter(prefix="/about") | ||||
|  | ||||
| @@ -57,25 +52,3 @@ class AdminAboutController(BaseAdminController): | ||||
|             base_url_set=settings.BASE_URL != "http://localhost:8080", | ||||
|             is_up_to_date=APP_VERSION == "develop" or APP_VERSION == "nightly" or get_latest_version() == APP_VERSION, | ||||
|         ) | ||||
|  | ||||
|     @router.get("/docker/validate", response_model=DockerVolumeText) | ||||
|     def validate_docker_volume(self, bg: BackgroundTasks): | ||||
|         validation_dir = self.folders.DATA_DIR / "docker-validation" | ||||
|         validation_dir.mkdir(exist_ok=True) | ||||
|  | ||||
|         random_string = "".join(random.choice(string.ascii_uppercase + string.digits) for _ in range(100)) | ||||
|  | ||||
|         with validation_dir.joinpath("validate.txt").open("w") as f: | ||||
|             f.write(random_string) | ||||
|  | ||||
|         async def cleanup(): | ||||
|             await asyncio.sleep(60) | ||||
|  | ||||
|             try: | ||||
|                 shutil.rmtree(validation_dir) | ||||
|             except Exception as e: | ||||
|                 self.logger.error(f"Failed to remove docker validation directory: {e}") | ||||
|  | ||||
|         bg.add_task(cleanup) | ||||
|  | ||||
|         return DockerVolumeText(text=random_string) | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| # This file is auto-generated by gen_schema_exports.py | ||||
| from .about import AdminAboutInfo, AppInfo, AppStartupInfo, AppStatistics, AppTheme, CheckAppConfig, DockerVolumeText | ||||
| from .about import AdminAboutInfo, AppInfo, AppStartupInfo, AppStatistics, AppTheme, CheckAppConfig | ||||
| from .backup import AllBackups, BackupFile, BackupOptions, CreateBackup, ImportJob | ||||
| from .email import EmailReady, EmailSuccess, EmailTest | ||||
| from .maintenance import MaintenanceLogs, MaintenanceStorageDetails, MaintenanceSummary | ||||
| @@ -31,7 +31,6 @@ __all__ = [ | ||||
|     "AppStatistics", | ||||
|     "AppTheme", | ||||
|     "CheckAppConfig", | ||||
|     "DockerVolumeText", | ||||
|     "EmailReady", | ||||
|     "EmailSuccess", | ||||
|     "EmailTest", | ||||
|   | ||||
| @@ -59,7 +59,3 @@ class CheckAppConfig(MealieModel): | ||||
|     ldap_ready: bool | ||||
|     base_url_set: bool | ||||
|     is_up_to_date: bool | ||||
|  | ||||
|  | ||||
| class DockerVolumeText(MealieModel): | ||||
|     text: str | ||||
|   | ||||
		Reference in New Issue
	
	Block a user