mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 06:50:53 +00:00
fix: sync __version__ to 1.4.3, _remote_version() reads from __init__.py
This commit is contained in:
parent
40ee97c0f8
commit
8dbf188168
3 changed files with 8 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "PaperForge-Lite",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.3",
|
||||
"description": "Lightweight literature management automation for Obsidian + Zotero",
|
||||
"repository": "https://github.com/LLLin000/PaperForge",
|
||||
"update": {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
"""paperforge — PaperForge package."""
|
||||
|
||||
__version__ = "1.4.1"
|
||||
__version__ = "1.4.3"
|
||||
|
|
|
|||
|
|
@ -92,8 +92,10 @@ def protected_paths(vault: Path) -> set[str]:
|
|||
|
||||
|
||||
def _remote_version() -> str | None:
|
||||
"""Read version from __init__.py on GitHub (single source of truth)."""
|
||||
import re
|
||||
try:
|
||||
api = f"https://api.github.com/repos/{GITHUB_REPO}/contents/paperforge.json"
|
||||
api = f"https://api.github.com/repos/{GITHUB_REPO}/contents/paperforge/__init__.py"
|
||||
req = urllib.request.Request(
|
||||
api, headers={"Accept": "application/vnd.github.v3+json", "User-Agent": "PaperForge"}
|
||||
)
|
||||
|
|
@ -101,7 +103,9 @@ def _remote_version() -> str | None:
|
|||
data = json.loads(resp.read())
|
||||
req2 = urllib.request.Request(data["download_url"], headers={"User-Agent": "PaperForge"})
|
||||
with urllib.request.urlopen(req2, timeout=10) as resp2:
|
||||
return json.loads(resp2.read()).get("version")
|
||||
content = resp2.read().decode("utf-8")
|
||||
m = re.search(r'__version__\s*=\s*["\']([^"\']+)["\']', content)
|
||||
return m.group(1) if m else None
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue