From 7bfb4b34677babe3fc74c5e3a503782d0b51a08d Mon Sep 17 00:00:00 2001 From: Ivan Date: Mon, 20 Apr 2026 21:12:40 -0500 Subject: [PATCH] refactor(docs): enhance documentation upload and sharing features in DocsPage component --- .../src/frontend/components/docs/DocsPage.vue | 154 ++++++------------ .../components/settings/SettingsPage.vue | 17 -- 2 files changed, 48 insertions(+), 123 deletions(-) diff --git a/meshchatx/src/frontend/components/docs/DocsPage.vue b/meshchatx/src/frontend/components/docs/DocsPage.vue index 0cb841a..30c31a3 100644 --- a/meshchatx/src/frontend/components/docs/DocsPage.vue +++ b/meshchatx/src/frontend/components/docs/DocsPage.vue @@ -193,21 +193,29 @@ - + + + +
-
+
@@ -374,52 +379,25 @@
{{ $t("docs.error") }}
{{ status.last_error }}
+ - -
- -
- or use alternate source -
-
- -
- - -
- - - Manage all sources in settings - + Dismiss +
@@ -431,22 +409,15 @@ >

- {{ - status.status === "downloading" ? $t("docs.status_downloading") : "Extracting Documentation..." - }} + {{ $t("docs.status_extracting") }}

{{ status.progress }}% Complete

-

- Please wait, setting up offline manual -

@@ -524,7 +495,7 @@ >
@@ -532,16 +503,17 @@

Reticulum Manual

-

- Download the official documentation for offline access. +

+ {{ $t("docs.empty_state_hint") }}

- + + {{ $t("docs.btn_upload") }} + +
@@ -578,7 +550,6 @@ export default { selectedDocPath: null, selectedDocContent: null, selectedReticulumPath: null, - alternateDocsUrl: "", languages: { en: "English", de: "Deutsch", @@ -635,12 +606,6 @@ export default { const response = await window.api.get("/api/v1/docs/status"); this.status = response.data; - // Auto-download Reticulum docs if missing and we're not already doing something - if (!this.status.has_docs && this.status.status === "idle" && !this.status.last_error) { - this.updateDocs(); - } - - // If we don't have Reticulum docs but have MeshChatX docs, default to MeshChatX tab if (!this.status.has_docs && this.status.has_meshchatx_docs && this.activeTab === "reticulum") { this.activeTab = "meshchatx"; } else if (this.status.has_docs && !this.status.has_meshchatx_docs && this.activeTab === "meshchatx") { @@ -650,6 +615,9 @@ export default { console.error("Failed to fetch docs status:", error); } }, + dismissError() { + this.status = { ...this.status, last_error: null }; + }, async fetchMeshChatXDocs() { try { const response = await window.api.get("/api/v1/meshchatx-docs/list"); @@ -675,35 +643,6 @@ export default { }; } }, - async updateDocs() { - try { - await window.api.post("/api/v1/docs/update"); - this.fetchStatus(); - } catch (error) { - console.error("Failed to trigger docs update:", error); - } - }, - async addAndRetryDocs() { - if (!this.alternateDocsUrl) return; - try { - // Get current config - const configResponse = await window.api.get("/api/v1/config"); - const currentUrls = configResponse.data.config.docs_download_urls || ""; - const newUrls = currentUrls ? `${currentUrls},${this.alternateDocsUrl}` : this.alternateDocsUrl; - - // Update config - await window.api.patch("/api/v1/config", { - docs_download_urls: newUrls, - }); - - // Clear input and retry - this.alternateDocsUrl = ""; - await this.updateDocs(); - } catch (error) { - console.error("Failed to add alternate source:", error); - ToastUtils.error(this.$t("docs.failed_update_docs")); - } - }, async switchVersion(version) { try { await window.api.post("/api/v1/docs/switch", { version }); @@ -760,6 +699,9 @@ export default { async exportDocs() { window.location.href = "/api/v1/docs/export"; }, + async exportReticulumDocs() { + window.location.href = "/api/v1/docs/export/reticulum"; + }, copyDocLink() { if (!this.selectedDocPath) return; const htmlPath = this.selectedDocPath.replace(/\.(md|txt)$/, ".html"); diff --git a/meshchatx/src/frontend/components/settings/SettingsPage.vue b/meshchatx/src/frontend/components/settings/SettingsPage.vue index e654d22..1789a6c 100644 --- a/meshchatx/src/frontend/components/settings/SettingsPage.vue +++ b/meshchatx/src/frontend/components/settings/SettingsPage.vue @@ -1793,21 +1793,6 @@ The base URL for your preferred Gitea instance. - -
-
- Documentation Download URLs -
- -
- List of ZIP URLs to try when downloading documentation. One URL per line. -
-
@@ -2380,7 +2365,6 @@ export default { location_manual_alt: "0.0", telemetry_enabled: false, gitea_base_url: "https://git.quad4.io", - docs_download_urls: "", csp_extra_connect_src: "", csp_extra_img_src: "", csp_extra_frame_src: "", @@ -3387,7 +3371,6 @@ export default { await this.updateConfig( { gitea_base_url: this.config.gitea_base_url, - docs_download_urls: this.config.docs_download_urls, }, "Infrastructure" );