mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 17:00:23 +00:00
fix: sync Obsidian plugin even when update is already current
This commit is contained in:
parent
bac8414456
commit
0741d65d6d
4 changed files with 14 additions and 8 deletions
|
|
@ -1,3 +1,3 @@
|
|||
"""paperforge — PaperForge package."""
|
||||
|
||||
__version__ = "1.4.8"
|
||||
__version__ = "1.4.9"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "paperforge",
|
||||
"name": "PaperForge",
|
||||
"version": "1.4.8",
|
||||
"version": "1.4.9",
|
||||
"minAppVersion": "1.0.0",
|
||||
"description": "PaperForge — Zotero + Obsidian literature pipeline. Sync, OCR, and deep-reading commands in your command palette.",
|
||||
"author": "PaperForge",
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ def run_status(vault: Path, verbose: bool = False, json_output: bool = False) ->
|
|||
print(f"- vault: {vault}")
|
||||
print(f"- system_dir: {cfg['system_dir']}")
|
||||
print(f"- resources_dir: {cfg['resources_dir']}")
|
||||
print(f"- literature_dir: cfg['literature_dir']")
|
||||
print(f"- literature_dir: {cfg['literature_dir']}")
|
||||
print(f"- control_dir: {cfg['control_dir']}")
|
||||
print(f"- exports: {len(export_files)} JSON file(s)")
|
||||
print(f"- domains: {len(config.get('domains', []))}")
|
||||
|
|
|
|||
|
|
@ -25,6 +25,15 @@ logger = logging.getLogger(__name__)
|
|||
GITHUB_PIP_SOURCE = f"git+https://github.com/{GITHUB_REPO}.git"
|
||||
|
||||
|
||||
def _sync_obsidian_plugin(vault: Path) -> None:
|
||||
"""Reload utils and sync the Obsidian plugin into the current vault."""
|
||||
import importlib
|
||||
import paperforge.worker._utils as _pf_utils
|
||||
|
||||
importlib.reload(_pf_utils)
|
||||
_pf_utils.install_obsidian_plugin(vault)
|
||||
|
||||
|
||||
def protected_paths(vault: Path) -> set[str]:
|
||||
cfg = load_vault_config(vault)
|
||||
pf = f"{cfg['system_dir']}/PaperForge"
|
||||
|
|
@ -241,6 +250,7 @@ def run_update(vault: Path) -> int:
|
|||
except ValueError:
|
||||
needs = remote != local
|
||||
if not needs:
|
||||
_sync_obsidian_plugin(vault)
|
||||
logger.info("当前已是最新版本")
|
||||
return 0
|
||||
logger.info("发现新版本: %s -> %s", local, remote)
|
||||
|
|
@ -276,11 +286,7 @@ def run_update(vault: Path) -> int:
|
|||
success = _update_via_zip(vault)
|
||||
|
||||
if success:
|
||||
# Reload _utils to get latest install_obsidian_plugin after pip/git/zip update
|
||||
import importlib
|
||||
import paperforge.worker._utils as _pf_utils
|
||||
importlib.reload(_pf_utils)
|
||||
_pf_utils.install_obsidian_plugin(vault)
|
||||
_sync_obsidian_plugin(vault)
|
||||
logger.info("更新完成!请重启 Obsidian")
|
||||
return 0 if success else 1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue