Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

Add plugin compatibility and loading error handling

Tonhof9ec52f77638
diff --git a/src-tauri/src/commands/plugins.rs b/src-tauri/src/commands/plugins.rs
index 0a7bac27..f78a0995 100644
--- a/src-tauri/src/commands/plugins.rs
+++ b/src-tauri/src/commands/plugins.rs
@@ -3,7 +3,7 @@ use std::sync::Arc;
use omniget_plugin_sdk::{PluginManifest, RegistryEntry};
use serde::{Deserialize, Serialize};
-use crate::plugin_loader::PluginManager;
+use crate::plugin_loader::{PluginLoadError, PluginManager};
#[derive(Debug, Serialize)]
pub struct PluginInfo {
@@ -16,6 +16,8 @@ pub struct PluginInfo {
pub loaded: bool,
pub icon: Option<String>,
pub nav: Vec<PluginNavInfo>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub load_error: Option<PluginLoadError>,
}
#[derive(Debug, Serialize)]
@@ -63,8 +65,10 @@ pub fn list_plugins(
order: n.order,
})
.collect(),
+ load_error: None,
},
None => {
+ let load_error = manager.load_error(&entry.id).cloned();
let manifest_path = manager.plugins_dir().join(&entry.id).join("plugin.json");
let manifest: Option<omniget_plugin_sdk::PluginManifest> =
std::fs::read_to_string(&manifest_path)
@@ -96,6 +100,7 @@ pub fn list_plugins(
order: n.order,
})
.collect(),
+ load_error,
},
None => PluginInfo {
id: entry.id.clone(),
@@ -107,6 +112,7 @@ pub fn list_plugins(
loaded: false,
icon: None,
nav: Vec::new(),
+ load_error,
},
}
}
diff --git a/src-tauri/src/plugin_loader.rs b/src-tauri/src/plugin_loader.rs
index b1a1773a..77db5285 100644
--- a/src-tauri/src/plugin_loader.rs
+++ b/src-tauri/src/plugin_loader.rs
@@ -4,6 +4,7 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use omniget_plugin_sdk::{InstalledPlugin, OmnigetPlugin, PluginHost, PluginManifest, ABI_VERSION};
+use serde::Serialize;
use tracing;
pub struct LoadedPlugin {
@@ -15,10 +16,30 @@ pub struct LoadedPlugin {
unsafe impl Send for LoadedPlugin {}
unsafe impl Sync for LoadedPlugin {}
+#[derive(Debug, Clone, Serialize)]
+pub struct PluginLoadError {
+ pub message: String,
+ pub kind: String,
+ pub plugin_abi: Option<u32>,
+ pub expected_abi: Option<u32>,
+}
+
+impl PluginLoadError {
+ fn simple(kind: &str, message: impl Into<String>) -> Self {
+ Self {
+ message: message.into(),
+ kind: kind.to_string(),
+ plugin_abi: None,
+ expected_abi: None,
+ }
+ }
+}
+
pub struct PluginManager {
plugins_dir: PathBuf,
loaded: HashMap<String, LoadedPlugin>,
installed: Vec<InstalledPlugin>,
+ load_errors: HashMap<String, PluginLoadError>,
}
impl PluginManager {
@@ -28,6 +49,7 @@ impl PluginManager {
plugins_dir,
loaded: HashMap::new(),
installed,
+ load_errors: HashMap::new(),
}
}
@@ -54,9 +76,11 @@ impl PluginManager {
loaded.manifest.version
);
self.loaded.insert(entry.id.clone(), loaded);
+ self.load_errors.remove(&entry.id);
}
Err(e) => {
- tracing::warn!("Plugin {} not loaded: {e}", entry.id);
+ tracing::warn!("Plugin {} not loaded ({}): {}", entry.id, e.kind, e.message);
+ self.load_errors.insert(entry.id.clone(), e);
}
}
}
@@ -66,6 +90,10 @@ impl PluginManager {
self.loaded.get(id)
}
+ pub fn load_error(&self, id: &str) -> Option<&PluginLoadError> {
+ self.load_errors.get(id)
+ }
+
pub fn loaded_plugins(&self) -> Vec<&LoadedPlugin> {
self.loaded.values().collect()
}
@@ -116,6 +144,7 @@ impl PluginManager {
let _leaked_lib = loaded._lib.take();
std::mem::forget(_leaked_lib);
}
+ self.load_errors.remove(plugin_id);
self.installed.retain(|p| p.id != plugin_id);
self.save_installed()?;
@@ -141,38 +170,64 @@ impl PluginManager {
fn load_single_plugin(
plugin_dir: &Path,
host: Arc<dyn PluginHost>,
-) -> anyhow::Result<LoadedPlugin> {
+) -> Result<LoadedPlugin, PluginLoadError> {
let manifest_path = plugin_dir.join("plugin.json");
- let manifest_str = fs::read_to_string(&manifest_path)
- .map_err(|e| anyhow::anyhow!("Cannot read plugin.json: {e}"))?;
- let manifest: PluginManifest = serde_json::from_str(&manifest_str)
- .map_err(|e| anyhow::anyhow!("Invalid plugin.json: {e}"))?;
-
- let lib_path = find_native_lib(plugin_dir)
- .ok_or_else(|| anyhow::anyhow!("No native library found in {}", plugin_dir.display()))?;
-
- let lib = unsafe { libloading::Library::new(&lib_path) }
- .map_err(|e| anyhow::anyhow!("Failed to load {}: {e}", lib_path.display()))?;
+ let manifest_str = fs::read_to_string(&manifest_path).map_err(|e| {
+ PluginLoadError::simple("manifest_read", format!("Cannot read plugin.json: {e}"))
+ })?;
+ let manifest: PluginManifest = serde_json::from_str(&manifest_str).map_err(|e| {
+ PluginLoadError::simple("manifest_parse", format!("Invalid plugin.json: {e}"))
+ })?;
+
+ let lib_path = find_native_lib(plugin_dir).ok_or_else(|| {
+ PluginLoadError::simple(
+ "no_native_lib",
+ format!("No native library found in {}", plugin_dir.display()),
+ )
+ })?;
+
+ let lib = unsafe { libloading::Library::new(&lib_path) }.map_err(|e| {
+ PluginLoadError::simple(
+ "library_load",
+ format!("Failed to load {}: {e}", lib_path.display()),
+ )
+ })?;
let abi_fn: libloading::Symbol<extern "C" fn() -> u32> =
- unsafe { lib.get(b"omniget_plugin_abi_version") }
- .map_err(|_| anyhow::anyhow!("Missing omniget_plugin_abi_version symbol"))?;
+ unsafe { lib.get(b"omniget_plugin_abi_version") }.map_err(|_| {
+ PluginLoadError {
+ message: format!(
+ "Missing omniget_plugin_abi_version symbol (plugin built against an older SDK; core expects ABI v{})",
+ ABI_VERSION
+ ),
+ kind: "missing_abi_symbol".to_string(),
+ plugin_abi: None,
+ expected_abi: Some(ABI_VERSION),
+ }
+ })?;
let plugin_abi = abi_fn();
if plugin_abi != ABI_VERSION {
- anyhow::bail!(
- "ABI mismatch: plugin has v{}, core expects v{}",
- plugin_abi,
- ABI_VERSION
- );
+ return Err(PluginLoadError {
+ message: format!(
+ "ABI mismatch: plugin has v{}, core expects v{}",
+ plugin_abi, ABI_VERSION
+ ),
+ kind: "abi_mismatch".to_string(),
+ plugin_abi: Some(plugin_abi),
+ expected_abi: Some(ABI_VERSION),
+ });
}
let init_fn: libloading::Symbol<extern "C" fn() -> *mut dyn OmnigetPlugin> =
- unsafe { lib.get(b"omniget_plugin_init") }
- .map_err(|_| anyhow::anyhow!("Missing omniget_plugin_init symbol"))?;
+ unsafe { lib.get(b"omniget_plugin_init") }.map_err(|_| {
+ PluginLoadError::simple("missing_init_symbol", "Missing omniget_plugin_init symbol")
+ })?;
let mut plugin = unsafe { Box::from_raw(init_fn()) };
- plugin.initialize(host)?;
+ plugin.initialize(host).map_err(|e| {
+ PluginLoadError::simple("initialize", format!("Plugin init failed: {e}"))
+ })?;
Ok(LoadedPlugin {
_lib: Some(lib),
diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.json
index 513be49e..89237444 100644
--- a/src/lib/i18n/el.json
+++ b/src/lib/i18n/el.json
@@ -470,7 +470,13 @@
"plugin_not_installed": "Το plugin δεν ειναι εγκατεστημενο",
"plugin_install_hint": "Εγκαταστηστε το απο το Marketplace.",
"go_to_marketplace": "Μεταβαση στο Marketplace",
- "plugin_restart_hint": "Επανεκκινηστε το OmniGet για να φορτωσει το plugin."
+ "plugin_restart_hint": "Επανεκκινηστε το OmniGet για να φορτωσει το plugin.",
+ "plugin_incompatible_title": "Το plugin δεν ειναι συμβατο με αυτη την εκδοση",
+ "plugin_incompatible_hint": "Αυτο το plugin εχει χτιστει για παλαιοτερη εκδοση του OmniGet και δεν μπορει να φορτωσει. Επανεγκαταστηστε το απο το Marketplace για να παρετε συμβατη εκδοση — η επανεκκινηση δεν θα το διορθωσει.",
+ "plugin_load_failed_title": "Αποτυχια φορτωσης plugin",
+ "plugin_load_failed_hint": "Το OmniGet δεν μπορεσε να φορτωσει αυτο το plugin. Δοκιμαστε να το επανεγκαταστησετε απο το Marketplace.",
+ "plugin_load_error_details": "Λεπτομερειες: {{error}}",
+ "reinstall": "Επανεγκατασταση"
},
"services": {
"title": "Υποστηριζει YouTube, Instagram και 1000+ ιστοτοπους",
@@ -805,6 +811,34 @@
"no_results": "Δεν υπάρχουν αποτελέσματα για «{{term}}»",
"hint": "Πατήστε Ctrl+K για άνοιγμα · Esc για κλείσιμο"
},
+ "palette": {
+ "aria_modes": "Λειτουργιες παλετας",
+ "tab_search": "Αναζητηση",
+ "tab_jump": "Μεταβαση",
+ "tab_action": "Ενεργειες",
+ "heading_shortcuts": "Συντομευσεις",
+ "heading_recent_pages": "Προσφατες σελιδες",
+ "heading_actions": "Ενεργειες",
+ "empty_pages": "Δεν υπαρχουν σελιδες ακομα.",
+ "shortcut_daily": "Σημερινο daily",
+ "shortcut_journal_history": "Ιστορικο journal",
+ "shortcut_graph": "Γραφος",
+ "shortcut_templates": "Προτυπα",
+ "aria_xp_progress": "{{pct}}% για επιπεδο {{level}}",
+ "action_create_page_label": "Δημιουργια σελιδας",
+ "action_create_page_hint": "Νεα κενη σελιδα",
+ "action_open_daily_label": "Ανοιξτε το σημερινο daily",
+ "action_open_templates_label": "Ανοιξτε τα προτυπα",
+ "action_open_graph_label": "Ανοιξτε τον γραφο",
+ "action_open_graph_hint": "Οπτικοποιηση γραφου",
+ "action_rebuild_fts_label": "Ανακατασκευη αναζητησης (FTS)",
+ "action_rebuild_fts_hint": "Ανακατασκευη full-text index",
+ "action_export_graph_label": "Εξαγωγη γραφου (JSON)",
+ "action_export_graph_hint": "Ληψη notes-graph.json",
+ "action_open_settings_label": "Ανοιξτε τις ρυθμισεις",
+ "action_vacuum_label": "Συμπιεση βασης (vacuum)",
+ "action_vacuum_hint": "Συντηρηση SQLite"
+ },
"library": {
"title": "Βιβλιοθήκη",
"empty": "Δεν έχει γίνει ακόμα ευρετηρίαση μαθημάτων. Εκτελέστε σάρωση από τις Ρυθμίσεις.",
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 449b96a7..3b2aab95 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -470,7 +470,13 @@
"plugin_not_installed": "Plugin not installed",
"plugin_install_hint": "Install this plugin from the Marketplace to use it.",
"go_to_marketplace": "Go to Marketplace",
- "plugin_restart_hint": "Restart OmniGet to load this plugin."
+ "plugin_restart_hint": "Restart OmniGet to load this plugin.",
+ "plugin_incompatible_title": "Plugin incompatible with this version",
+ "plugin_incompatible_hint": "This plugin was built for an older version of OmniGet and cannot be loaded. Reinstall it from the Marketplace to get a compatible build — restarting will not fix this.",
+ "plugin_load_failed_title": "Plugin failed to load",
+ "plugin_load_failed_hint": "OmniGet couldn't load this plugin. Try reinstalling it from the Marketplace.",
+ "plugin_load_error_details": "Details: {{error}}",
+ "reinstall": "Reinstall"
},
"services": {
"title": "Supports YouTube, Instagram and 1000+ sites",
@@ -805,6 +811,34 @@
"no_results": "No results for \"{{term}}\"",
"hint": "Press Ctrl+K to open · Esc to close"
},
+ "palette": {
+ "aria_modes": "Palette modes",
+ "tab_search": "Search",
+ "tab_jump": "Jump to",
+ "tab_action": "Actions",
+ "heading_shortcuts": "Shortcuts",
+ "heading_recent_pages": "Recent pages",
+ "heading_actions": "Actions",
+ "empty_pages": "No pages yet.",
+ "shortcut_daily": "Today's daily",
+ "shortcut_journal_history": "Journal history",
+ "shortcut_graph": "Graph",
+ "shortcut_templates": "Templates",
+ "aria_xp_progress": "{{pct}}% to level {{level}}",
+ "action_create_page_label": "Create page",
+ "action_create_page_hint": "New blank page",
+ "action_open_daily_label": "Open today's daily",
+ "action_open_templates_label": "Open templates",
+ "action_open_graph_label": "Open graph",
+ "action_open_graph_hint": "Graph visualization",
+ "action_rebuild_fts_label": "Rebuild search (FTS)",
+ "action_rebuild_fts_hint": "Rebuild full-text index",
+ "action_export_graph_label": "Export graph (JSON)",
+ "action_export_graph_hint": "Download notes-graph.json",
+ "action_open_settings_label": "Open settings",
+ "action_vacuum_label": "Compact database (vacuum)",
+ "action_vacuum_hint": "SQLite maintenance"
+ },
"library": {
"title": "Library",
"empty": "No courses indexed yet. Run a scan from Settings.",
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index d657205d..a96b5553 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -470,7 +470,13 @@
"plugin_not_installed": "Plugin non installe",
"plugin_install_hint": "Installez ce plugin depuis le Marketplace.",
"go_to_marketplace": "Aller au Marketplace",
- "plugin_restart_hint": "Redemarrez OmniGet pour charger ce plugin."
+ "plugin_restart_hint": "Redemarrez OmniGet pour charger ce plugin.",
+ "plugin_incompatible_title": "Plugin incompatible avec cette version",
+ "plugin_incompatible_hint": "Ce plugin a ete compile pour une ancienne version d'OmniGet et ne peut pas etre charge. Reinstallez-le depuis le Marketplace pour obtenir une version compatible — un redemarrage ne resoudra rien.",
+ "plugin_load_failed_title": "Echec du chargement du plugin",
+ "plugin_load_failed_hint": "OmniGet n'a pas pu charger ce plugin. Essayez de le reinstaller depuis le Marketplace.",
+ "plugin_load_error_details": "Details: {{error}}",
+ "reinstall": "Reinstaller"
},
"services": {
"title": "YouTube, Instagram et plus de 1000 sites pris en charge",
@@ -805,6 +811,34 @@
"no_results": "Aucun résultat pour « {{term}} »",
"hint": "Appuyez sur Ctrl+K pour ouvrir · Échap pour fermer"
},
+ "palette": {
+ "aria_modes": "Modes de la palette",
+ "tab_search": "Rechercher",
+ "tab_jump": "Aller a",
+ "tab_action": "Actions",
+ "heading_shortcuts": "Raccourcis",
+ "heading_recent_pages": "Pages recentes",
+ "heading_actions": "Actions",
+ "empty_pages": "Aucune page pour l'instant.",
+ "shortcut_daily": "Daily du jour",
+ "shortcut_journal_history": "Historique du journal",
+ "shortcut_graph": "Graphe",
+ "shortcut_templates": "Modeles",
+ "aria_xp_progress": "{{pct}}% jusqu'au niveau {{level}}",
+ "action_create_page_label": "Creer une page",
+ "action_create_page_hint": "Nouvelle page vierge",
+ "action_open_daily_label": "Ouvrir le daily du jour",
+ "action_open_templates_label": "Ouvrir les modeles",
+ "action_open_graph_label": "Ouvrir le graphe",
+ "action_open_graph_hint": "Visualisation du graphe",
+ "action_rebuild_fts_label": "Reindexer la recherche (FTS)",
+ "action_rebuild_fts_hint": "Reconstruire l'index plein texte",
+ "action_export_graph_label": "Exporter le graphe (JSON)",
+ "action_export_graph_hint": "Telecharger notes-graph.json",
+ "action_open_settings_label": "Ouvrir les parametres",
+ "action_vacuum_label": "Compacter la base (vacuum)",
+ "action_vacuum_hint": "Maintenance SQLite"
+ },
"library": {
"title": "Bibliothèque",
"empty": "Aucun cours indexé. Lancez une analyse depuis les paramètres.",
diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.json
index 023dcb3f..05ede7be 100644
--- a/src/lib/i18n/it.json
+++ b/src/lib/i18n/it.json
@@ -470,7 +470,13 @@
"plugin_not_installed": "Plugin non installato",
"plugin_install_hint": "Installa questo plugin dal Marketplace.",
"go_to_marketplace": "Vai al Marketplace",
- "plugin_restart_hint": "Riavvia OmniGet per caricare questo plugin."
+ "plugin_restart_hint": "Riavvia OmniGet per caricare questo plugin.",
+ "plugin_incompatible_title": "Plugin incompatibile con questa versione",
+ "plugin_incompatible_hint": "Questo plugin e stato compilato per una versione precedente di OmniGet e non puo essere caricato. Reinstallalo dal Marketplace per ottenere una build compatibile — riavviare non risolvera il problema.",
+ "plugin_load_failed_title": "Caricamento del plugin non riuscito",
+ "plugin_load_failed_hint": "OmniGet non e riuscito a caricare questo plugin. Prova a reinstallarlo dal Marketplace.",
+ "plugin_load_error_details": "Dettagli: {{error}}",
+ "reinstall": "Reinstalla"
},
"services": {
"title": "Supporta YouTube, Instagram e oltre 1000 siti",
@@ -805,6 +811,34 @@
"no_results": "Nessun risultato per \"{{term}}\"",
"hint": "Premi Ctrl+K per aprire · Esc per chiudere"
},
+ "palette": {
+ "aria_modes": "Modalita palette",
+ "tab_search": "Cerca",
+ "tab_jump": "Vai a",
+ "tab_action": "Azioni",
+ "heading_shortcuts": "Scorciatoie",
+ "heading_recent_pages": "Pagine recenti",
+ "heading_actions": "Azioni",
+ "empty_pages": "Ancora nessuna pagina.",
+ "shortcut_daily": "Daily di oggi",
+ "shortcut_journal_history": "Cronologia journal",
+ "shortcut_graph": "Grafo",
+ "shortcut_templates": "Template",
+ "aria_xp_progress": "{{pct}}% al livello {{level}}",
+ "action_create_page_label": "Crea pagina",
+ "action_create_page_hint": "Nuova pagina vuota",
+ "action_open_daily_label": "Apri il daily di oggi",
+ "action_open_templates_label": "Apri template",
+ "action_open_graph_label": "Apri grafo",
+ "action_open_graph_hint": "Visualizzazione grafo",
+ "action_rebuild_fts_label": "Reindicizza ricerca (FTS)",
+ "action_rebuild_fts_hint": "Ricostruisci indice full-text",
+ "action_export_graph_label": "Esporta grafo (JSON)",
+ "action_export_graph_hint": "Scarica notes-graph.json",
+ "action_open_settings_label": "Apri impostazioni",
+ "action_vacuum_label": "Compatta database (vacuum)",
+ "action_vacuum_hint": "Manutenzione SQLite"
+ },
"library": {
"title": "Libreria",
"empty": "Nessun corso indicizzato. Avvia una scansione dalle impostazioni.",
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index c4346160..17e39fd7 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -470,7 +470,13 @@
"plugin_not_installed": "プラグイン未インストール",
"plugin_install_hint": "マーケットプレイスからインストールしてください。",
"go_to_marketplace": "マーケットプレイスへ",
- "plugin_restart_hint": "このプラグインを読み込むにはOmniGetを再起動してください。"
+ "plugin_restart_hint": "このプラグインを読み込むにはOmniGetを再起動してください。",
+ "plugin_incompatible_title": "このバージョンと互換性がありません",
+ "plugin_incompatible_hint": "このプラグインは古いバージョンのOmniGet向けにビルドされており、読み込めません。マーケットプレイスから再インストールして互換版を取得してください — 再起動では解決しません。",
+ "plugin_load_failed_title": "プラグインの読み込みに失敗",
+ "plugin_load_failed_hint": "OmniGetはこのプラグインを読み込めませんでした。マーケットプレイスから再インストールしてください。",
+ "plugin_load_error_details": "詳細: {{error}}",
+ "reinstall": "再インストール"
},
"services": {
"title": "YouTube、Instagram、1000以上のサイトに対応",
@@ -805,6 +811,34 @@
"no_results": "「{{term}}」の結果はありません",
"hint": "Ctrl+K で開く · Esc で閉じる"
},
+ "palette": {
+ "aria_modes": "パレットモード",
+ "tab_search": "検索",
+ "tab_jump": "ジャンプ",
+ "tab_action": "アクション",
+ "heading_shortcuts": "ショートカット",
+ "heading_recent_pages": "最近のページ",
+ "heading_actions": "アクション",
+ "empty_pages": "まだページがありません。",
+ "shortcut_daily": "今日の日報",
+ "shortcut_journal_history": "ジャーナル履歴",
+ "shortcut_graph": "グラフ",
+ "shortcut_templates": "テンプレート",
+ "aria_xp_progress": "レベル {{level}} まで {{pct}}%",
+ "action_create_page_label": "ページを作成",
+ "action_create_page_hint": "新しい空白のページ",
+ "action_open_daily_label": "今日の日報を開く",
+ "action_open_templates_label": "テンプレートを開く",
+ "action_open_graph_label": "グラフを開く",
+ "action_open_graph_hint": "グラフの可視化",
+ "action_rebuild_fts_label": "検索インデックスを再構築 (FTS)",
+ "action_rebuild_fts_hint": "全文インデックスを再構築",
+ "action_export_graph_label": "グラフをエクスポート (JSON)",
+ "action_export_graph_hint": "notes-graph.json をダウンロード",
+ "action_open_settings_label": "設定を開く",
+ "action_vacuum_label": "DB を圧縮 (vacuum)",
+ "action_vacuum_hint": "SQLite メンテナンス"
+ },
"library": {
"title": "ライブラリ",
"empty": "まだコースがインデックス化されていません。設定からスキャンを実行してください。",
diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.ts
index 1e51442a..e836179f 100644
--- a/src/lib/i18n/keys.ts
+++ b/src/lib/i18n/keys.ts
@@ -285,9 +285,15 @@ export type TranslationKeys =
| 'marketplace.installed_badge'
| 'marketplace.no_plugins'
| 'marketplace.official_badge'
+ | 'marketplace.plugin_incompatible_hint'
+ | 'marketplace.plugin_incompatible_title'
| 'marketplace.plugin_install_hint'
+ | 'marketplace.plugin_load_error_details'
+ | 'marketplace.plugin_load_failed_hint'
+ | 'marketplace.plugin_load_failed_title'
| 'marketplace.plugin_not_installed'
| 'marketplace.plugin_restart_hint'
+ | 'marketplace.reinstall'
| 'marketplace.restart_required'
| 'marketplace.title'
| 'marketplace.uninstall'
@@ -1134,6 +1140,32 @@ export type TranslationKeys =
| 'study.notes.to_flashcard'
| 'study.notes.toggle_preview'
| 'study.notes.untitled'
+ | 'study.palette.action_create_page_hint'
+ | 'study.palette.action_create_page_label'
+ | 'study.palette.action_export_graph_hint'
+ | 'study.palette.action_export_graph_label'
+ | 'study.palette.action_open_daily_label'
+ | 'study.palette.action_open_graph_hint'
+ | 'study.palette.action_open_graph_label'
+ | 'study.palette.action_open_settings_label'
+ | 'study.palette.action_open_templates_label'
+ | 'study.palette.action_rebuild_fts_hint'
+ | 'study.palette.action_rebuild_fts_label'
+ | 'study.palette.action_vacuum_hint'
+ | 'study.palette.action_vacuum_label'
+ | 'study.palette.aria_modes'
+ | 'study.palette.aria_xp_progress'
+ | 'study.palette.empty_pages'
+ | 'study.palette.heading_actions'
+ | 'study.palette.heading_recent_pages'
+ | 'study.palette.heading_shortcuts'
+ | 'study.palette.shortcut_daily'
+ | 'study.palette.shortcut_graph'
+ | 'study.palette.shortcut_journal_history'
+ | 'study.palette.shortcut_templates'
+ | 'study.palette.tab_action'
+ | 'study.palette.tab_jump'
+ | 'study.palette.tab_search'
| 'study.player.placeholder'
| 'study.player.title'
| 'study.progress.cards_per_day'
diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.json
index 00387389..3ee4e0ff 100644
--- a/src/lib/i18n/pt.json
+++ b/src/lib/i18n/pt.json
@@ -213,10 +213,10 @@
"organize_by_platform": "Organizar por plataforma",
"organize_by_platform_desc": "Salvar arquivos em subpastas com o nome da plataforma",
"download_subtitles": "Baixar legendas",
+ "download_subtitles_desc": "Baixar legendas disponíveis junto com vídeos (YouTube)",
"what_to_also_save": "O que também salvar",
"youtube_specific": "Específico do YouTube",
"telegram_plugin_section": "Telegram (plugin)",
- "download_subtitles_desc": "Baixar legendas disponíveis junto com vídeos (YouTube)",
"include_auto_subtitles": "Incluir legendas auto-geradas",
"include_auto_subtitles_desc": "Também baixar legendas geradas pelo YouTube quando não há legendas manuais (qualidade varia)",
"translate_metadata": "Traduzir título e descrição do vídeo para o idioma do app",
@@ -291,6 +291,18 @@
"preset_tech_minimal_name": "Tech minimal",
"preset_tech_minimal_desc": "Plex Mono em tudo. Divisivo. Para devs que gostam."
},
+ "proxy": {
+ "title": "Proxy",
+ "enabled": "Ativar proxy",
+ "type": "Tipo",
+ "host": "Host",
+ "port": "Porta",
+ "username": "Usuário",
+ "password": "Senha"
+ },
+ "ytdlp_flags": {
+ "title": "Flags do yt-dlp"
+ },
"advanced": {
"title": "Avançado",
"max_concurrent_downloads": "Downloads simultâneos",
@@ -308,18 +320,6 @@
"cookies_from_browser": "Ler cookies direto de um perfil do navegador (avançado)",
"cookies_from_browser_desc": "Só configure se a extensão do navegador não funcionar. A maioria dos usuários deve deixar vazio."
},
- "ytdlp_flags": {
- "title": "Flags do yt-dlp"
- },
- "proxy": {
- "title": "Proxy",
- "enabled": "Ativar proxy",
- "type": "Tipo",
- "host": "Host",
- "port": "Porta",
- "username": "Usuário",
- "password": "Senha"
- },
"cat_appearance": "Aparência",
"cat_typography": "Tipografia",
"cat_plugins": "Plugins",
@@ -470,7 +470,13 @@
"plugin_not_installed": "Plugin nao instalado",
"plugin_install_hint": "Instale este plugin pelo Marketplace para usa-lo.",
"go_to_marketplace": "Ir para o Marketplace",
- "plugin_restart_hint": "Reinicie o OmniGet para carregar este plugin."
+ "plugin_restart_hint": "Reinicie o OmniGet para carregar este plugin.",
+ "plugin_incompatible_title": "Plugin incompativel com esta versao",
+ "plugin_incompatible_hint": "Este plugin foi compilado para uma versao mais antiga do OmniGet e nao pode ser carregado. Reinstale-o pelo Marketplace para obter uma versao compativel — reiniciar nao vai resolver.",
+ "plugin_load_failed_title": "Falha ao carregar o plugin",
+ "plugin_load_failed_hint": "O OmniGet nao conseguiu carregar este plugin. Tente reinstala-lo pelo Marketplace.",
+ "plugin_load_error_details": "Detalhes: {{error}}",
+ "reinstall": "Reinstalar"
},
"services": {
"title": "Suporta YouTube, Instagram e mais 1000 sites",
@@ -805,6 +811,34 @@
"no_results": "Nenhum resultado para \"{{term}}\"",
"hint": "Ctrl+K para abrir · Esc para fechar"
},
+ "palette": {
+ "aria_modes": "Modos do palette",
+ "tab_search": "Buscar",
+ "tab_jump": "Ir para",
+ "tab_action": "Ações",
+ "heading_shortcuts": "Atalhos",
+ "heading_recent_pages": "Páginas recentes",
+ "heading_actions": "Ações",
+ "empty_pages": "Sem páginas ainda.",
+ "shortcut_daily": "Daily de hoje",
+ "shortcut_journal_history": "Histórico de journal",
+ "shortcut_graph": "Grafo",
+ "shortcut_templates": "Templates",
+ "aria_xp_progress": "{{pct}}% até nível {{level}}",
+ "action_create_page_label": "Criar página",
+ "action_create_page_hint": "Nova página em branco",
+ "action_open_daily_label": "Abrir daily de hoje",
+ "action_open_templates_label": "Abrir templates",
+ "action_open_graph_label": "Abrir grafo",
+ "action_open_graph_hint": "Visualização do grafo",
+ "action_rebuild_fts_label": "Reindexar busca (FTS)",
+ "action_rebuild_fts_hint": "Rebuild full-text index",
+ "action_export_graph_label": "Exportar grafo (JSON)",
+ "action_export_graph_hint": "Download notes-graph.json",
+ "action_open_settings_label": "Abrir configurações",
+ "action_vacuum_label": "Compactar banco (vacuum)",
+ "action_vacuum_hint": "Manutenção do SQLite"
+ },
"library": {
"title": "Biblioteca",
"empty": "Nenhum curso indexado. Rode uma varredura em Configurações.",
@@ -1065,7 +1099,6 @@
"copy_to": "Copiar para…",
"upload_files": "Enviar",
"upload_hint": "Enviar arquivos pra este chat",
- "keymap_title": "Atalhos de teclado",
"kbd_help": "Abrir esta ajuda",
"kbd_esc": "Fechar player / limpar seleção",
"kbd_click": "Abrir player",
diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.json
index 2fe893fe..7ee74b0d 100644
--- a/src/lib/i18n/zh-TW.json
+++ b/src/lib/i18n/zh-TW.json
@@ -470,7 +470,13 @@
"plugin_not_installed": "插件未安装",
"plugin_install_hint": "从 Marketplace 安装此插件即可使用。",
"go_to_marketplace": "前往 Marketplace",
- "plugin_restart_hint": "重启 OmniGet 以加载此插件。"
+ "plugin_restart_hint": "重启 OmniGet 以加载此插件。",
+ "plugin_incompatible_title": "外掛與此版本不相容",
+ "plugin_incompatible_hint": "此外掛是為舊版 OmniGet 建置的,無法載入。請從 Marketplace 重新安裝以取得相容版本——重新啟動無法解決此問題。",
+ "plugin_load_failed_title": "外掛載入失敗",
+ "plugin_load_failed_hint": "OmniGet 無法載入此外掛。請嘗試從 Marketplace 重新安裝。",
+ "plugin_load_error_details": "詳細資訊: {{error}}",
+ "reinstall": "重新安裝"
},
"services": {
"title": "支援的服務",
@@ -805,6 +811,34 @@
"no_results": "沒有與「{{term}}」相符的結果",
"hint": "按 Ctrl+K 開啟 · Esc 關閉"
},
+ "palette": {
+ "aria_modes": "命令面板模式",
+ "tab_search": "搜尋",
+ "tab_jump": "跳轉",
+ "tab_action": "操作",
+ "heading_shortcuts": "捷徑",
+ "heading_recent_pages": "最近頁面",
+ "heading_actions": "操作",
+ "empty_pages": "還沒有頁面。",
+ "shortcut_daily": "今日日記",
+ "shortcut_journal_history": "日記歷史",
+ "shortcut_graph": "關係圖",
+ "shortcut_templates": "範本",
+ "aria_xp_progress": "{{pct}}% 至 {{level}} 級",
+ "action_create_page_label": "新建頁面",
+ "action_create_page_hint": "新空白頁面",
+ "action_open_daily_label": "開啟今日日記",
+ "action_open_templates_label": "開啟範本",
+ "action_open_graph_label": "開啟關係圖",
+ "action_open_graph_hint": "關係圖視覺化",
+ "action_rebuild_fts_label": "重建搜尋索引 (FTS)",
+ "action_rebuild_fts_hint": "重建全文索引",
+ "action_export_graph_label": "匯出關係圖 (JSON)",
+ "action_export_graph_hint": "下載 notes-graph.json",
+ "action_open_settings_label": "開啟設定",
+ "action_vacuum_label": "壓縮資料庫 (vacuum)",
+ "action_vacuum_hint": "SQLite 維護"
+ },
"library": {
"title": "課程庫",
"empty": "尚未索引任何課程。請從設定中執行掃描。",
diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.json
index eaa2c4bf..d621f393 100644
--- a/src/lib/i18n/zh.json
+++ b/src/lib/i18n/zh.json
@@ -470,7 +470,13 @@
"plugin_not_installed": "插件未安装",
"plugin_install_hint": "从 Marketplace 安装此插件即可使用。",
"go_to_marketplace": "前往 Marketplace",
- "plugin_restart_hint": "重启 OmniGet 以加载此插件。"
+ "plugin_restart_hint": "重启 OmniGet 以加载此插件。",
+ "plugin_incompatible_title": "插件与当前版本不兼容",
+ "plugin_incompatible_hint": "此插件是为旧版 OmniGet 构建的,无法加载。请从 Marketplace 重新安装以获取兼容版本——重启无法解决此问题。",
+ "plugin_load_failed_title": "插件加载失败",
+ "plugin_load_failed_hint": "OmniGet 无法加载此插件。请尝试从 Marketplace 重新安装。",
+ "plugin_load_error_details": "详情: {{error}}",
+ "reinstall": "重新安装"
},
"services": {
"title": "支持 YouTube、Instagram 及 1000+ 网站",
@@ -805,6 +811,34 @@
"no_results": "没有与 \"{{term}}\" 匹配的结果",
"hint": "按 Ctrl+K 打开 · Esc 关闭"
},
+ "palette": {
+ "aria_modes": "命令面板模式",
+ "tab_search": "搜索",
+ "tab_jump": "跳转",
+ "tab_action": "操作",
+ "heading_shortcuts": "快捷方式",
+ "heading_recent_pages": "最近页面",
+ "heading_actions": "操作",
+ "empty_pages": "还没有页面。",
+ "shortcut_daily": "今日日记",
+ "shortcut_journal_history": "日记历史",
+ "shortcut_graph": "关系图",
+ "shortcut_templates": "模板",
+ "aria_xp_progress": "{{pct}}% 至 {{level}} 级",
+ "action_create_page_label": "新建页面",
+ "action_create_page_hint": "新空白页面",
+ "action_open_daily_label": "打开今日日记",
+ "action_open_templates_label": "打开模板",
+ "action_open_graph_label": "打开关系图",
+ "action_open_graph_hint": "关系图可视化",
+ "action_rebuild_fts_label": "重建搜索索引 (FTS)",
+ "action_rebuild_fts_hint": "重建全文索引",
+ "action_export_graph_label": "导出关系图 (JSON)",
+ "action_export_graph_hint": "下载 notes-graph.json",
+ "action_open_settings_label": "打开设置",
+ "action_vacuum_label": "压缩数据库 (vacuum)",
+ "action_vacuum_hint": "SQLite 维护"
+ },
"library": {
"title": "课程库",
"empty": "尚未索引任何课程。请从设置中运行扫描。",
diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelte
index 40d437e4..e7156394 100644
--- a/src/routes/convert/+page.svelte
+++ b/src/routes/convert/+page.svelte
@@ -22,19 +22,46 @@
type HwAccelInfo,
} from "$lib/stores/convert-store.svelte";
- type PluginStatus = "checking" | "ready" | "needs-restart" | "not-installed";
+ type PluginStatus =
+ | "checking"
+ | "ready"
+ | "needs-restart"
+ | "not-installed"
+ | "incompatible"
+ | "load-failed";
+ type PluginLoadError = {
+ message: string;
+ kind: string;
+ plugin_abi?: number | null;
+ expected_abi?: number | null;
+ };
let pluginStatus = $state<PluginStatus>("checking");
+ let loadError = $state<PluginLoadError | null>(null);
onMount(async () => {
try {
- const plugins = await invoke<{ id: string; enabled: boolean; loaded: boolean }[]>("list_plugins");
+ const plugins = await invoke<{
+ id: string;
+ enabled: boolean;
+ loaded: boolean;
+ load_error?: PluginLoadError | null;
+ }[]>("list_plugins");
const plugin = plugins.find((p) => p.id === "convert");
if (!plugin || !plugin.enabled) {
pluginStatus = "not-installed";
return;
}
if (!plugin.loaded) {
- pluginStatus = "needs-restart";
+ if (plugin.load_error) {
+ loadError = plugin.load_error;
+ pluginStatus =
+ plugin.load_error.kind === "abi_mismatch" ||
+ plugin.load_error.kind === "missing_abi_symbol"
+ ? "incompatible"
+ : "load-failed";
+ } else {
+ pluginStatus = "needs-restart";
+ }
return;
}
pluginStatus = "ready";
@@ -216,6 +243,24 @@
<h2>{$t("marketplace.restart_required")}</h2>
<p>{$t("marketplace.plugin_restart_hint")}</p>
</div>
+{:else if pluginStatus === "incompatible"}
+ <div class="plugin-guard">
+ <h2>{$t("marketplace.plugin_incompatible_title")}</h2>
+ <p>{$t("marketplace.plugin_incompatible_hint")}</p>
+ <a href="/marketplace" class="guard-link">{$t("marketplace.go_to_marketplace")}</a>
+ {#if loadError}
+ <p class="guard-detail"><code>{loadError.message}</code></p>
+ {/if}
+ </div>
+{:else if pluginStatus === "load-failed"}
+ <div class="plugin-guard">
+ <h2>{$t("marketplace.plugin_load_failed_title")}</h2>
+ <p>{$t("marketplace.plugin_load_failed_hint")}</p>
+ <a href="/marketplace" class="guard-link">{$t("marketplace.go_to_marketplace")}</a>
+ {#if loadError}
+ <p class="guard-detail"><code>{loadError.message}</code></p>
+ {/if}
+ </div>
{:else}
<div class="convert">
<h2 class="page-title">{$t('convert.title')}</h2>
@@ -417,6 +462,8 @@
.plugin-guard h2 { font-size: 18px; color: var(--secondary); }
.plugin-guard p { font-size: 14px; max-width: 300px; }
.guard-link { padding: 10px 24px; font-size: 14px; font-weight: 500; background: var(--cta); color: var(--on-cta); border-radius: var(--border-radius); text-decoration: none; }
+ .guard-detail { font-size: 12px; color: var(--tertiary); max-width: 480px; margin-top: calc(var(--padding) * 0.5); }
+ .guard-detail code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; word-break: break-word; background: var(--surface); padding: 2px 6px; border-radius: 4px; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--input-border); border-top-color: var(--secondary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
diff --git a/src/routes/courses/+page.svelte b/src/routes/courses/+page.svelte
index 60eff032..5967e86a 100644
--- a/src/routes/courses/+page.svelte
+++ b/src/routes/courses/+page.svelte
@@ -27,8 +27,21 @@
{ id: "rocketseat", name: "Rocketseat", color: "#8257E5", icon: "rocketseat", commands: { check_session: "rocketseat_check_session" } },
];
- type PluginStatus = "checking" | "ready" | "not-installed" | "needs-restart";
+ type PluginStatus =
+ | "checking"
+ | "ready"
+ | "not-installed"
+ | "needs-restart"
+ | "incompatible"
+ | "load-failed";
+ type PluginLoadError = {
+ message: string;
+ kind: string;
+ plugin_abi?: number | null;
+ expected_abi?: number | null;
+ };
let pluginStatus = $state<PluginStatus>("checking");
+ let loadError = $state<PluginLoadError | null>(null);
let platforms: PlatformConfig[] = $state([]);
let searchQuery = $state("");
@@ -46,7 +59,12 @@
onMount(async () => {
console.log("[courses] onMount start");
try {
- const plugins = await invoke<{ id: string; enabled: boolean; loaded: boolean }[]>("list_plugins");
+ const plugins = await invoke<{
+ id: string;
+ enabled: boolean;
+ loaded: boolean;
+ load_error?: PluginLoadError | null;
+ }[]>("list_plugins");
console.log("[courses] list_plugins:", JSON.stringify(plugins));
const courses = plugins.find((p) => p.id === "courses");
if (!courses || !courses.enabled) {
@@ -55,8 +73,18 @@
return;
}
if (!courses.loaded) {
- console.log("[courses] plugin enabled but not loaded — needs restart");
- pluginStatus = "needs-restart";
+ if (courses.load_error) {
+ loadError = courses.load_error;
+ pluginStatus =
+ courses.load_error.kind === "abi_mismatch" ||
+ courses.load_error.kind === "missing_abi_symbol"
+ ? "incompatible"
+ : "load-failed";
+ console.log("[courses] plugin load failed:", courses.load_error);
+ } else {
+ console.log("[courses] plugin enabled but not loaded — needs restart");
+ pluginStatus = "needs-restart";
+ }
return;
}
console.log("[courses] plugin ready");
@@ -125,6 +153,24 @@
<h2>{$t("marketplace.restart_required")}</h2>
<p>{$t("marketplace.plugin_restart_hint")}</p>
</div>
+{:else if pluginStatus === "incompatible"}
+ <div class="plugin-guard">
+ <h2>{$t("marketplace.plugin_incompatible_title")}</h2>
+ <p>{$t("marketplace.plugin_incompatible_hint")}</p>
+ <a href="/marketplace" class="guard-link">{$t("marketplace.go_to_marketplace")}</a>
+ {#if loadError}
+ <p class="guard-detail"><code>{loadError.message}</code></p>
+ {/if}
+ </div>
+{:else if pluginStatus === "load-failed"}
+ <div class="plugin-guard">
+ <h2>{$t("marketplace.plugin_load_failed_title")}</h2>
+ <p>{$t("marketplace.plugin_load_failed_hint")}</p>
+ <a href="/marketplace" class="guard-link">{$t("marketplace.go_to_marketplace")}</a>
+ {#if loadError}
+ <p class="guard-detail"><code>{loadError.message}</code></p>
+ {/if}
+ </div>
{:else}
<div class="courses-page">
<h1 class="page-title">{$t("courses.title")}</h1>
@@ -325,6 +371,8 @@
.plugin-guard h2 { font-size: 18px; color: var(--secondary); }
.plugin-guard p { font-size: 14px; max-width: 300px; }
.guard-link { padding: 10px 24px; font-size: 14px; font-weight: 500; background: var(--cta); color: var(--on-cta); border-radius: var(--border-radius); text-decoration: none; }
+ .guard-detail { font-size: 12px; color: var(--tertiary); max-width: 480px; margin-top: calc(var(--padding) * 0.5); }
+ .guard-detail code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; word-break: break-word; background: var(--surface); padding: 2px 6px; border-radius: 4px; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--input-border); border-top-color: var(--secondary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
</style>
diff --git a/src/routes/marketplace/+page.svelte b/src/routes/marketplace/+page.svelte
index c3fdd779..74240f93 100644
--- a/src/routes/marketplace/+page.svelte
+++ b/src/routes/marketplace/+page.svelte
@@ -12,6 +12,13 @@
order: number;
};
+ type PluginLoadError = {
+ message: string;
+ kind: string;
+ plugin_abi?: number | null;
+ expected_abi?: number | null;
+ };
+
type PluginInfo = {
id: string;
name: string;
@@ -22,6 +29,7 @@
loaded: boolean;
icon: string | null;
nav: PluginNavInfo[];
+ load_error?: PluginLoadError | null;
};
type MarketplaceEntry = {
@@ -251,6 +259,24 @@
{#if updates[plugin.id]}
<span class="update-hint">{$t("marketplace.update_hint", { version: updates[plugin.id].latest_version })}</span>
{/if}
+ {#if plugin.enabled && !plugin.loaded && plugin.load_error}
+ {@const incompatible =
+ plugin.load_error.kind === "abi_mismatch" ||
+ plugin.load_error.kind === "missing_abi_symbol"}
+ <div class="load-error" class:incompatible>
+ <strong>
+ {incompatible
+ ? $t("marketplace.plugin_incompatible_title")
+ : $t("marketplace.plugin_load_failed_title")}
+ </strong>
+ <span>
+ {incompatible
+ ? $t("marketplace.plugin_incompatible_hint")
+ : $t("marketplace.plugin_load_failed_hint")}
+ </span>
+ <code>{plugin.load_error.message}</code>
+ </div>
+ {/if}
{#if plugin.description}
<p class="plugin-desc">{plugin.description}</p>
{/if}
@@ -607,6 +633,37 @@
font-weight: 500;
}
+ .load-error {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ padding: 10px 12px;
+ border-radius: var(--border-radius);
+ background: color-mix(in srgb, var(--error, #c1121f) 12%, transparent);
+ border: 1px solid color-mix(in srgb, var(--error, #c1121f) 35%, transparent);
+ font-size: 12px;
+ color: var(--secondary);
+ }
+
+ .load-error.incompatible {
+ background: color-mix(in srgb, var(--warning, #f59e0b) 12%, transparent);
+ border-color: color-mix(in srgb, var(--warning, #f59e0b) 35%, transparent);
+ }
+
+ .load-error strong {
+ font-size: 12px;
+ color: var(--secondary);
+ }
+
+ .load-error code {
+ font-family: var(--font-mono, ui-monospace, monospace);
+ font-size: 11px;
+ word-break: break-word;
+ background: var(--surface);
+ padding: 2px 6px;
+ border-radius: 4px;
+ }
+
.uninstall-btn {
padding: 6px 14px;
font-size: 12px;
diff --git a/src/routes/study/+layout.svelte b/src/routes/study/+layout.svelte
index 55c94fbf..3fae6c0a 100644
--- a/src/routes/study/+layout.svelte
+++ b/src/routes/study/+layout.svelte
@@ -248,8 +248,8 @@
? [
{
id: "create-page",
- label: "Criar página",
- hint: "Nova página em branco",
+ label: $t("study.palette.action_create_page_label"),
+ hint: $t("study.palette.action_create_page_hint"),
icon: "+",
run: () => {
closePalette();
@@ -258,7 +258,7 @@
},
{
id: "open-daily",
- label: "Abrir daily de hoje",
+ label: $t("study.palette.action_open_daily_label"),
hint: "Ctrl+J",
icon: "📅",
run: () => {
@@ -268,7 +268,7 @@
},
{
id: "open-templates",
- label: "Abrir templates",
+ label: $t("study.palette.action_open_templates_label"),
hint: "/study/notes/templates",
icon: "▤",
run: () => {
@@ -278,8 +278,8 @@
},
{
id: "open-graph",
- label: "Abrir grafo",
- hint: "Visualização do grafo",
+ label: $t("study.palette.action_open_graph_label"),
+ hint: $t("study.palette.action_open_graph_hint"),
icon: "◈",
run: () => {
closePalette();
@@ -288,8 +288,8 @@
},
{
id: "rebuild-fts",
- label: "Reindexar busca (FTS)",
- hint: "Rebuild full-text index",
+ label: $t("study.palette.action_rebuild_fts_label"),
+ hint: $t("study.palette.action_rebuild_fts_hint"),
icon: "↻",
run: () => {
closePalette();
@@ -298,8 +298,8 @@
},
{
id: "export-graph",
- label: "Exportar grafo (JSON)",
- hint: "Download notes-graph.json",
+ label: $t("study.palette.action_export_graph_label"),
+ hint: $t("study.palette.action_export_graph_hint"),
icon: "↓",
run: () => {
closePalette();
@@ -313,7 +313,7 @@
...notesActions,
{
id: "open-settings",
- label: "Abrir configurações",
+ label: $t("study.palette.action_open_settings_label"),
hint: "/study/settings",
icon: "⚙",
run: () => {
@@ -323,8 +323,8 @@
},
{
id: "vacuum",
- label: "Compactar banco (vacuum)",
- hint: "Manutenção do SQLite",
+ label: $t("study.palette.action_vacuum_label"),
+ hint: $t("study.palette.action_vacuum_hint"),
icon: "▽",
run: () => {
closePalette();
@@ -549,7 +549,7 @@
onclick={(e) => e.stopPropagation()}
onkeydown={(e) => { if (e.key === "Escape") { e.stopPropagation(); closePalette(); } }}
>
- <div class="palette-tabs" role="tablist" aria-label="Modos do palette">
+ <div class="palette-tabs" role="tablist" aria-label={$t("study.palette.aria_modes")}>
<button
type="button"
class="palette-tab"
@@ -557,7 +557,7 @@
role="tab"
aria-selected={paletteTab === "search"}
onclick={() => (paletteTab = "search")}
- >Buscar</button>
+ >{$t("study.palette.tab_search")}</button>
{#if STUDY_NOTES_ENABLED}
<button
type="button"
@@ -566,7 +566,7 @@
role="tab"
aria-selected={paletteTab === "jump"}
onclick={() => (paletteTab = "jump")}
- >Ir para</button>
+ >{$t("study.palette.tab_jump")}</button>
{/if}
<button
type="button"
@@ -575,7 +575,7 @@
role="tab"
aria-selected={paletteTab === "action"}
onclick={() => (paletteTab = "action")}
- >Ações</button>
+ >{$t("study.palette.tab_action")}</button>
</div>
{#if paletteTab === "search"}
@@ -654,7 +654,7 @@
{:else if paletteTab === "jump"}
<div class="palette-body">
<section>
- <h4>Atalhos</h4>
+ <h4>{$t("study.palette.heading_shortcuts")}</h4>
<ul>
<li>
<button
@@ -664,7 +664,7 @@
void openJournalToday();
}}
>
- 📅 Daily de hoje
+ 📅 {$t("study.palette.shortcut_daily")}
<small>Ctrl+J</small>
</button>
</li>
@@ -676,7 +676,7 @@
void goto("/study/notes/journal");
}}
>
- 📆 Histórico de journal
+ 📆 {$t("study.palette.shortcut_journal_history")}
</button>
</li>
<li>
@@ -687,7 +687,7 @@
void goto("/study/notes/graph");
}}
>
- ◈ Grafo
+ ◈ {$t("study.palette.shortcut_graph")}
</button>
</li>
<li>
@@ -698,15 +698,15 @@
void goto("/study/notes/templates");
}}
>
- ▤ Templates
+ ▤ {$t("study.palette.shortcut_templates")}
</button>
</li>
</ul>
</section>
<section>
- <h4>Páginas recentes</h4>
+ <h4>{$t("study.palette.heading_recent_pages")}</h4>
{#if jumpRecents.length === 0}
- <p class="muted">Sem páginas ainda.</p>
+ <p class="muted">{$t("study.palette.empty_pages")}</p>
{:else}
<ul>
{#each jumpRecents as p (p.id)}
@@ -730,7 +730,7 @@
{:else}
<div class="palette-body">
<section>
- <h4>Ações</h4>
+ <h4>{$t("study.palette.heading_actions")}</h4>
<ul>
{#each sortedActions as a (a.id)}
<li>
@@ -754,7 +754,7 @@
aria-valuenow={xpState.level_progress_pct}
aria-valuemin="0"
aria-valuemax="100"
- aria-label={`${xpState.level_progress_pct}% até nível ${xpState.level + 1}`}
+ aria-label={$t("study.palette.aria_xp_progress", { pct: xpState.level_progress_pct, level: xpState.level + 1 })}
>
<div
class="palette-bar-fill"
diff --git a/src/routes/study/+page.svelte b/src/routes/study/+page.svelte
index 17260980..e7c6e556 100644
--- a/src/routes/study/+page.svelte
+++ b/src/routes/study/+page.svelte
@@ -5,8 +5,21 @@
import { pluginInvoke } from "$lib/plugin-invoke";
import { t } from "$lib/i18n";
- type PluginStatus = "checking" | "ready" | "not-installed" | "needs-restart";
+ type PluginStatus =
+ | "checking"
+ | "ready"
+ | "not-installed"
+ | "needs-restart"
+ | "incompatible"
+ | "load-failed";
+ type PluginLoadError = {
+ message: string;
+ kind: string;
+ plugin_abi?: number | null;
+ expected_abi?: number | null;
+ };
let pluginStatus = $state<PluginStatus>("checking");
+ let loadError = $state<PluginLoadError | null>(null);
type Course = {
id: number;
@@ -137,16 +150,28 @@
onMount(async () => {
try {
- const plugins = await invoke<{ id: string; enabled: boolean; loaded: boolean }[]>(
- "list_plugins",
- );
+ const plugins = await invoke<{
+ id: string;
+ enabled: boolean;
+ loaded: boolean;
+ load_error?: PluginLoadError | null;
+ }[]>("list_plugins");
const study = plugins.find((p) => p.id === "study");
if (!study || !study.enabled) {
pluginStatus = "not-installed";
return;
}
if (!study.loaded) {
- pluginStatus = "needs-restart";
+ if (study.load_error) {
+ loadError = study.load_error;
+ pluginStatus =
+ study.load_error.kind === "abi_mismatch" ||
+ study.load_error.kind === "missing_abi_symbol"
+ ? "incompatible"
+ : "load-failed";
+ } else {
+ pluginStatus = "needs-restart";
+ }
return;
}
pluginStatus = "ready";
@@ -216,6 +241,24 @@
<h2>{$t("marketplace.restart_required")}</h2>
<p>{$t("marketplace.plugin_restart_hint")}</p>
</div>
+{:else if pluginStatus === "incompatible"}
+ <div class="plugin-guard">
+ <h2>{$t("marketplace.plugin_incompatible_title")}</h2>
+ <p>{$t("marketplace.plugin_incompatible_hint")}</p>
+ <a href="/marketplace" class="guard-link">{$t("marketplace.go_to_marketplace")}</a>
+ {#if loadError}
+ <p class="guard-detail"><code>{loadError.message}</code></p>
+ {/if}
+ </div>
+{:else if pluginStatus === "load-failed"}
+ <div class="plugin-guard">
+ <h2>{$t("marketplace.plugin_load_failed_title")}</h2>
+ <p>{$t("marketplace.plugin_load_failed_hint")}</p>
+ <a href="/marketplace" class="guard-link">{$t("marketplace.go_to_marketplace")}</a>
+ {#if loadError}
+ <p class="guard-detail"><code>{loadError.message}</code></p>
+ {/if}
+ </div>
{:else}
<section class="hub">
<header class="masthead">
@@ -626,6 +669,20 @@
border-radius: var(--border-radius);
text-decoration: none;
}
+ .guard-detail {
+ font-size: 12px;
+ color: var(--tertiary);
+ max-width: 480px;
+ margin-top: calc(var(--padding) * 0.5);
+ }
+ .guard-detail code {
+ font-family: var(--font-mono, ui-monospace, monospace);
+ font-size: 11px;
+ word-break: break-word;
+ background: var(--surface);
+ padding: 2px 6px;
+ border-radius: 4px;
+ }
.spinner {
width: 24px;
height: 24px;
diff --git a/src/routes/telegram/+page.svelte b/src/routes/telegram/+page.svelte
index 19669cb5..719d3f43 100644
--- a/src/routes/telegram/+page.svelte
+++ b/src/routes/telegram/+page.svelte
@@ -18,8 +18,21 @@
import { onMount } from "svelte";
import { t } from "$lib/i18n";
- type PluginStatus = "checking_plugin" | "ready" | "not-installed" | "needs-restart";
+ type PluginStatus =
+ | "checking_plugin"
+ | "ready"
+ | "not-installed"
+ | "needs-restart"
+ | "incompatible"
+ | "load-failed";
+ type PluginLoadError = {
+ message: string;
+ kind: string;
+ plugin_abi?: number | null;
+ expected_abi?: number | null;
+ };
let pluginStatus = $state<PluginStatus>("checking_plugin");
+ let loadError = $state<PluginLoadError | null>(null);
type TelegramChat = {
id: number;
@@ -241,14 +254,28 @@
onMount(async () => {
try {
- const plugins = await invoke<{ id: string; enabled: boolean; loaded: boolean }[]>("list_plugins");
+ const plugins = await invoke<{
+ id: string;
+ enabled: boolean;
+ loaded: boolean;
+ load_error?: PluginLoadError | null;
+ }[]>("list_plugins");
const plugin = plugins.find((p) => p.id === "telegram");
if (!plugin || !plugin.enabled) {
pluginStatus = "not-installed";
return;
}
if (!plugin.loaded) {
- pluginStatus = "needs-restart";
+ if (plugin.load_error) {
+ loadError = plugin.load_error;
+ pluginStatus =
+ plugin.load_error.kind === "abi_mismatch" ||
+ plugin.load_error.kind === "missing_abi_symbol"
+ ? "incompatible"
+ : "load-failed";
+ } else {
+ pluginStatus = "needs-restart";
+ }
return;
}
pluginStatus = "ready";
@@ -947,6 +974,24 @@
<h2>{$t("marketplace.restart_required")}</h2>
<p>{$t("marketplace.plugin_restart_hint")}</p>
</div>
+{:else if pluginStatus === "incompatible"}
+ <div class="plugin-guard">
+ <h2>{$t("marketplace.plugin_incompatible_title")}</h2>
+ <p>{$t("marketplace.plugin_incompatible_hint")}</p>
+ <a href="/marketplace" class="guard-link">{$t("marketplace.go_to_marketplace")}</a>
+ {#if loadError}
+ <p class="guard-detail"><code>{loadError.message}</code></p>
+ {/if}
+ </div>
+{:else if pluginStatus === "load-failed"}
+ <div class="plugin-guard">
+ <h2>{$t("marketplace.plugin_load_failed_title")}</h2>
+ <p>{$t("marketplace.plugin_load_failed_hint")}</p>
+ <a href="/marketplace" class="guard-link">{$t("marketplace.go_to_marketplace")}</a>
+ {#if loadError}
+ <p class="guard-detail"><code>{loadError.message}</code></p>
+ {/if}
+ </div>
{:else}
{#if view === "checking"}
<div class="page-center">
@@ -1541,6 +1586,8 @@
.plugin-guard h2 { font-size: 18px; color: var(--secondary); }
.plugin-guard p { font-size: 14px; max-width: 300px; }
.guard-link { padding: 10px 24px; font-size: 14px; font-weight: 500; background: var(--cta); color: var(--on-cta); border-radius: var(--border-radius); text-decoration: none; }
+ .guard-detail { font-size: 12px; color: var(--tertiary); max-width: 480px; margin-top: calc(var(--padding) * 0.5); }
+ .guard-detail code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; word-break: break-word; background: var(--surface); padding: 2px 6px; border-radius: 4px; }
.page-center {
display: flex;