Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
394e108c22 | ||
|
|
fb06950389 | ||
|
|
9f04b96eb6 | ||
|
|
4eb8f75072 | ||
|
|
928badc87c | ||
|
|
d547a6da25 | ||
|
|
c48dc38e92 | ||
|
|
d8b5e2e436 | ||
|
|
4f7059e585 | ||
|
|
acaee4a0a0 | ||
|
|
3bb238be3f | ||
|
|
c6e4145f5d | ||
|
|
33d6b0c004 | ||
|
|
419ab7a627 |
No files matched your search
@@ -0,0 +1,10 @@
|
||||
# Wires the "Sponsor" button on the repo header to the maintainer's
|
||||
# funding destinations. GitHub renders one button per non-empty entry.
|
||||
#
|
||||
# Email + PayPal intentionally omitted — see commit log for v1.5.1 and
|
||||
# the v1.5.1 hotfix plan: public handles only, no personal identifiers.
|
||||
|
||||
github: [poli0981]
|
||||
ko_fi: skullmute
|
||||
buy_me_a_coffee: skullmute
|
||||
patreon: skullmute
|
||||
@@ -0,0 +1,658 @@
|
||||
"""
|
||||
Discord webhook notification helper — phase 2.
|
||||
|
||||
Extends phase 1 with four new commands:
|
||||
|
||||
python discord_notify.py release # phase 1: release announcement
|
||||
python discord_notify.py failure # phase 1: generic CI failure
|
||||
python discord_notify.py deploy # phase 2: deploy success/fail
|
||||
python discord_notify.py release-build # phase 2: release pipeline build status
|
||||
python discord_notify.py dependabot-summary # phase 2: org-wide dependabot digest
|
||||
python discord_notify.py weekly-digest # phase 2: org-wide weekly activity
|
||||
|
||||
Stdlib-only. Drop into .github/scripts/ in any repo.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from urllib.error import HTTPError, URLError
|
||||
from urllib.parse import urlencode
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
# ---------- Embed colors ----------
|
||||
|
||||
COLOR_RELEASE = 0x57F287 # green
|
||||
COLOR_FAILURE = 0xED4245 # red
|
||||
COLOR_PRERELEASE = 0xFEE75C # yellow
|
||||
COLOR_DEPLOY_OK = 0x3BA55D # darker green (distinct from release)
|
||||
COLOR_DEPLOY_FAIL = 0xE74C3C # darker red
|
||||
COLOR_BUILD_OK = 0x5865F2 # blurple — neutral build success
|
||||
COLOR_BUILD_FAIL = 0xED4245
|
||||
COLOR_DEPENDABOT = 0xFAA61A # orange
|
||||
COLOR_DIGEST = 0x9B59B6 # purple
|
||||
|
||||
# ---------- Truncation limits ----------
|
||||
|
||||
MAX_NOTES_CHARS = 1500
|
||||
MAX_FIELD_VALUE = 1000
|
||||
MAX_ASSETS_LISTED = 5
|
||||
MAX_DIGEST_REPOS_PER_FIELD = 8
|
||||
|
||||
|
||||
# ---------- Helpers ----------
|
||||
|
||||
def _post_webhook(url: str, payload: dict) -> bool:
|
||||
"""POST a JSON payload to a Discord webhook. Returns True on 2xx."""
|
||||
if not url:
|
||||
print("[SKIP] No webhook URL provided.")
|
||||
return False
|
||||
|
||||
url = url.replace("https://discordapp.com/", "https://discord.com/")
|
||||
if "/webhooks/" in url and "/api/webhooks/" not in url:
|
||||
url = url.replace("/webhooks/", "/api/webhooks/")
|
||||
url = url.rstrip("/")
|
||||
|
||||
body = json.dumps(payload).encode("utf-8")
|
||||
req = Request(
|
||||
url,
|
||||
data=body,
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": "poli0981-cicd/2.0 (+https://github.com/poli0981)",
|
||||
},
|
||||
)
|
||||
|
||||
try:
|
||||
with urlopen(req, timeout=30) as resp:
|
||||
print(f"[OK] Discord webhook posted (HTTP {resp.status}).")
|
||||
return True
|
||||
except HTTPError as e:
|
||||
body_text = e.read().decode("utf-8", errors="replace")
|
||||
print(f"[ERROR] Discord webhook: {e.code} — {body_text}")
|
||||
return False
|
||||
except URLError as e:
|
||||
print(f"[ERROR] Discord webhook: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def _gh_api(path: str, token: str, method: str = "GET", params: dict | None = None) -> dict | list:
|
||||
"""Call GitHub REST API. Returns parsed JSON."""
|
||||
base = "https://api.github.com"
|
||||
url = f"{base}{path}"
|
||||
if params:
|
||||
url += "?" + urlencode(params)
|
||||
|
||||
req = Request(
|
||||
url,
|
||||
method=method,
|
||||
headers={
|
||||
"Accept": "application/vnd.github+json",
|
||||
"Authorization": f"Bearer {token}",
|
||||
"X-GitHub-Api-Version": "2022-11-28",
|
||||
"User-Agent": "poli0981-cicd/2.0",
|
||||
},
|
||||
)
|
||||
|
||||
try:
|
||||
with urlopen(req, timeout=30) as resp:
|
||||
return json.loads(resp.read())
|
||||
except HTTPError as e:
|
||||
print(f"[ERROR] GitHub API {method} {path}: {e.code} — {e.read().decode('utf-8', errors='replace')}")
|
||||
raise
|
||||
except URLError as e:
|
||||
print(f"[ERROR] GitHub API {method} {path}: {e}")
|
||||
raise
|
||||
|
||||
|
||||
def _gh_search(query: str, token: str, kind: str = "issues") -> list:
|
||||
"""Run a GitHub search. Returns the items list (paginated, capped at 100)."""
|
||||
result = _gh_api(f"/search/{kind}", token, params={"q": query, "per_page": 100})
|
||||
if isinstance(result, dict):
|
||||
return result.get("items", [])
|
||||
return []
|
||||
|
||||
|
||||
def _truncate(text: str, limit: int, suffix: str = "…") -> str:
|
||||
if not text or len(text) <= limit:
|
||||
return text or ""
|
||||
cut = text[: limit - len(suffix)]
|
||||
last_break = max(cut.rfind("\n"), cut.rfind(". "))
|
||||
if last_break > limit * 0.6:
|
||||
cut = cut[:last_break]
|
||||
return cut.rstrip() + suffix
|
||||
|
||||
|
||||
def _env(name: str, default: str = "") -> str:
|
||||
return os.environ.get(name, default).strip()
|
||||
|
||||
|
||||
def _required(name: str) -> str:
|
||||
v = _env(name)
|
||||
if not v:
|
||||
print(f"[ERROR] Required env var not set: {name}")
|
||||
sys.exit(1)
|
||||
return v
|
||||
|
||||
|
||||
# ---------- Phase 1: Release announcement ----------
|
||||
|
||||
def build_release_embed() -> dict:
|
||||
repo = _required("GITHUB_REPOSITORY")
|
||||
repo_name = repo.split("/", 1)[1]
|
||||
server_url = _env("GITHUB_SERVER_URL", "https://github.com")
|
||||
|
||||
tag = _required("RELEASE_TAG")
|
||||
name = _env("RELEASE_NAME") or tag
|
||||
body = _env("RELEASE_BODY")
|
||||
html_url = _env("RELEASE_URL") or f"{server_url}/{repo}/releases/tag/{tag}"
|
||||
is_prerelease = _env("RELEASE_PRERELEASE", "false").lower() == "true"
|
||||
|
||||
assets_raw = _env("RELEASE_ASSETS_JSON", "[]")
|
||||
try:
|
||||
assets = json.loads(assets_raw) if assets_raw else []
|
||||
except json.JSONDecodeError:
|
||||
assets = []
|
||||
|
||||
color = COLOR_PRERELEASE if is_prerelease else COLOR_RELEASE
|
||||
badge = " (pre-release)" if is_prerelease else ""
|
||||
description = _truncate(body, MAX_NOTES_CHARS) if body else "*No release notes provided.*"
|
||||
|
||||
fields = []
|
||||
if assets:
|
||||
priority_order = (".msi", ".exe", ".dmg", ".AppImage", ".deb", ".rpm", ".zip")
|
||||
|
||||
def asset_priority(a: dict) -> int:
|
||||
n = a.get("name", "").lower()
|
||||
for i, ext in enumerate(priority_order):
|
||||
if n.endswith(ext.lower()):
|
||||
return i
|
||||
return len(priority_order)
|
||||
|
||||
sorted_assets = sorted(assets, key=asset_priority)[:MAX_ASSETS_LISTED]
|
||||
asset_lines = []
|
||||
for a in sorted_assets:
|
||||
n = a.get("name", "asset")
|
||||
u = a.get("browser_download_url") or a.get("url", "")
|
||||
size_mb = a.get("size", 0) / (1024 * 1024) if a.get("size") else 0
|
||||
size_str = f" ({size_mb:.1f} MB)" if size_mb > 0.1 else ""
|
||||
asset_lines.append(f"• [{n}]({u}){size_str}")
|
||||
|
||||
if len(assets) > MAX_ASSETS_LISTED:
|
||||
asset_lines.append(f"• … +{len(assets) - MAX_ASSETS_LISTED} more on the release page")
|
||||
|
||||
fields.append({
|
||||
"name": "📥 Downloads",
|
||||
"value": _truncate("\n".join(asset_lines), MAX_FIELD_VALUE),
|
||||
"inline": False,
|
||||
})
|
||||
|
||||
embed = {
|
||||
"title": f"🚀 {repo_name} {tag}{badge}",
|
||||
"url": html_url,
|
||||
"description": description,
|
||||
"color": color,
|
||||
"fields": fields,
|
||||
"footer": {"text": f"{repo} • {name}" if name != tag else repo},
|
||||
"timestamp": _env("RELEASE_PUBLISHED_AT") or None,
|
||||
}
|
||||
return {k: v for k, v in embed.items() if v}
|
||||
|
||||
|
||||
def post_release() -> int:
|
||||
embed = build_release_embed()
|
||||
repo = _required("GITHUB_REPOSITORY")
|
||||
tag = _required("RELEASE_TAG")
|
||||
|
||||
webhooks = [w.strip() for w in _required("DISCORD_WEBHOOKS").split(",") if w.strip()]
|
||||
payload = {"username": "Release Bot", "embeds": [embed]}
|
||||
if _env("DISCORD_CONTENT"):
|
||||
payload["content"] = _env("DISCORD_CONTENT")
|
||||
|
||||
print(f"[INFO] Announcing {repo}@{tag} to {len(webhooks)} webhook(s).")
|
||||
failures = sum(1 for url in webhooks if not _post_webhook(url, payload))
|
||||
if failures == len(webhooks):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
# ---------- Phase 1: Generic CI failure ----------
|
||||
|
||||
def build_failure_embed() -> dict:
|
||||
repo = _required("GITHUB_REPOSITORY")
|
||||
server_url = _env("GITHUB_SERVER_URL", "https://github.com")
|
||||
|
||||
workflow_name = _env("WORKFLOW_NAME", "Unknown workflow")
|
||||
run_id = _required("RUN_ID")
|
||||
run_number = _env("RUN_NUMBER", "?")
|
||||
run_attempt = _env("RUN_ATTEMPT", "1")
|
||||
branch = _env("BRANCH", "")
|
||||
commit_sha = _env("COMMIT_SHA", "")
|
||||
commit_short = commit_sha[:7] if commit_sha else "?"
|
||||
commit_msg = _env("COMMIT_MESSAGE", "").splitlines()[0] if _env("COMMIT_MESSAGE") else ""
|
||||
actor = _env("ACTOR", "")
|
||||
event = _env("EVENT_NAME", "")
|
||||
|
||||
run_url = f"{server_url}/{repo}/actions/runs/{run_id}"
|
||||
commit_url = f"{server_url}/{repo}/commit/{commit_sha}" if commit_sha else None
|
||||
|
||||
fields = [{"name": "Workflow", "value": f"`{workflow_name}` (run #{run_number}, attempt {run_attempt})", "inline": False}]
|
||||
if branch:
|
||||
fields.append({"name": "Branch", "value": f"`{branch}`", "inline": True})
|
||||
if event:
|
||||
fields.append({"name": "Trigger", "value": f"`{event}`", "inline": True})
|
||||
if actor:
|
||||
fields.append({"name": "Actor", "value": f"@{actor}", "inline": True})
|
||||
if commit_sha:
|
||||
commit_line = f"[`{commit_short}`]({commit_url})"
|
||||
if commit_msg:
|
||||
commit_line += f" — {_truncate(commit_msg, 100)}"
|
||||
fields.append({"name": "Commit", "value": commit_line, "inline": False})
|
||||
|
||||
return {
|
||||
"title": f"❌ CI failed: {repo}",
|
||||
"url": run_url,
|
||||
"description": f"**[View run logs →]({run_url})**",
|
||||
"color": COLOR_FAILURE,
|
||||
"fields": fields,
|
||||
"footer": {"text": repo},
|
||||
}
|
||||
|
||||
|
||||
def post_failure() -> int:
|
||||
embed = build_failure_embed()
|
||||
webhook = _required("DISCORD_CI_WEBHOOK")
|
||||
return 0 if _post_webhook(webhook, {"username": "CI Bot", "embeds": [embed]}) else 1
|
||||
|
||||
|
||||
# ---------- Phase 2: Deploy alert ----------
|
||||
|
||||
def post_deploy() -> int:
|
||||
"""
|
||||
Post a deploy success/fail alert.
|
||||
|
||||
Distinct from generic CI failure: includes the deployed URL when known,
|
||||
and uses 🌐 / 🚫 icons so the channel scan reads as deploys, not random builds.
|
||||
|
||||
Env:
|
||||
DISCORD_CI_WEBHOOK — same channel as failure alerts (per user choice)
|
||||
DEPLOY_STATUS — 'success' | 'failure'
|
||||
DEPLOY_TARGET — e.g. 'GitHub Pages', 'Cloudflare Pages'
|
||||
DEPLOY_URL — optional; live site URL when status=success
|
||||
WORKFLOW_NAME, RUN_ID, BRANCH, COMMIT_SHA, COMMIT_MESSAGE, ACTOR — context
|
||||
"""
|
||||
repo = _required("GITHUB_REPOSITORY")
|
||||
server_url = _env("GITHUB_SERVER_URL", "https://github.com")
|
||||
status = _env("DEPLOY_STATUS", "failure").lower()
|
||||
target = _env("DEPLOY_TARGET", "deploy")
|
||||
deploy_url = _env("DEPLOY_URL", "")
|
||||
|
||||
workflow_name = _env("WORKFLOW_NAME", "?")
|
||||
run_id = _required("RUN_ID")
|
||||
run_number = _env("RUN_NUMBER", "?")
|
||||
branch = _env("BRANCH", "")
|
||||
commit_sha = _env("COMMIT_SHA", "")
|
||||
commit_short = commit_sha[:7] if commit_sha else "?"
|
||||
commit_msg = _env("COMMIT_MESSAGE", "").splitlines()[0] if _env("COMMIT_MESSAGE") else ""
|
||||
actor = _env("ACTOR", "")
|
||||
|
||||
run_url = f"{server_url}/{repo}/actions/runs/{run_id}"
|
||||
commit_url = f"{server_url}/{repo}/commit/{commit_sha}" if commit_sha else None
|
||||
|
||||
if status == "success":
|
||||
icon, color, verb = "🌐", COLOR_DEPLOY_OK, "deployed"
|
||||
title = f"{icon} {target} deploy OK: {repo}"
|
||||
else:
|
||||
icon, color, verb = "🚫", COLOR_DEPLOY_FAIL, "deploy failed"
|
||||
title = f"{icon} {target} deploy FAILED: {repo}"
|
||||
|
||||
description = f"**[View run logs →]({run_url})**"
|
||||
if status == "success" and deploy_url:
|
||||
description = f"**[Open live site →]({deploy_url})** • [run logs]({run_url})"
|
||||
|
||||
fields = [{"name": "Workflow", "value": f"`{workflow_name}` (run #{run_number})", "inline": False}]
|
||||
if branch:
|
||||
fields.append({"name": "Branch", "value": f"`{branch}`", "inline": True})
|
||||
if actor:
|
||||
fields.append({"name": "Actor", "value": f"@{actor}", "inline": True})
|
||||
if commit_sha:
|
||||
commit_line = f"[`{commit_short}`]({commit_url})"
|
||||
if commit_msg:
|
||||
commit_line += f" — {_truncate(commit_msg, 100)}"
|
||||
fields.append({"name": "Commit", "value": commit_line, "inline": False})
|
||||
|
||||
embed = {
|
||||
"title": title,
|
||||
"url": run_url,
|
||||
"description": description,
|
||||
"color": color,
|
||||
"fields": fields,
|
||||
"footer": {"text": repo},
|
||||
}
|
||||
|
||||
webhook = _required("DISCORD_CI_WEBHOOK")
|
||||
return 0 if _post_webhook(webhook, {"username": "Deploy Bot", "embeds": [embed]}) else 1
|
||||
|
||||
|
||||
# ---------- Phase 2: Release pipeline build status ----------
|
||||
|
||||
def post_release_build() -> int:
|
||||
"""
|
||||
Post a release-pipeline build status (Velopack / Tauri matrix etc.).
|
||||
|
||||
Both success and failure post — channel is #release-pipeline (low-volume,
|
||||
only fires during release tag pushes).
|
||||
|
||||
Env:
|
||||
DISCORD_RELEASE_PIPELINE_WEBHOOK — webhook for #release-pipeline
|
||||
BUILD_STATUS — 'success' | 'failure' | 'cancelled'
|
||||
BUILD_PLATFORM — e.g. 'win-x64', 'macos-14', 'ubuntu-latest'
|
||||
BUILD_PACKAGER — optional; e.g. 'Velopack', 'Tauri'
|
||||
RELEASE_TAG — the tag that triggered the build
|
||||
WORKFLOW_NAME, RUN_ID, BRANCH, ACTOR
|
||||
"""
|
||||
repo = _required("GITHUB_REPOSITORY")
|
||||
repo_name = repo.split("/", 1)[1]
|
||||
server_url = _env("GITHUB_SERVER_URL", "https://github.com")
|
||||
status = _env("BUILD_STATUS", "failure").lower()
|
||||
platform = _env("BUILD_PLATFORM", "?")
|
||||
packager = _env("BUILD_PACKAGER", "")
|
||||
tag = _env("RELEASE_TAG", "")
|
||||
|
||||
workflow_name = _env("WORKFLOW_NAME", "?")
|
||||
run_id = _required("RUN_ID")
|
||||
run_url = f"{server_url}/{repo}/actions/runs/{run_id}"
|
||||
|
||||
if status == "success":
|
||||
icon, color = "✅", COLOR_BUILD_OK
|
||||
verb = "OK"
|
||||
elif status == "cancelled":
|
||||
icon, color = "⚠️", COLOR_PRERELEASE
|
||||
verb = "cancelled"
|
||||
else:
|
||||
icon, color = "❌", COLOR_BUILD_FAIL
|
||||
verb = "FAILED"
|
||||
|
||||
packager_str = f" {packager}" if packager else ""
|
||||
title_tag = f" {tag}" if tag else ""
|
||||
title = f"{icon} {repo_name}{title_tag} —{packager_str} {platform} {verb}"
|
||||
|
||||
fields = [{"name": "Workflow", "value": f"`{workflow_name}`", "inline": False}]
|
||||
if tag:
|
||||
fields.append({"name": "Tag", "value": f"`{tag}`", "inline": True})
|
||||
fields.append({"name": "Platform", "value": f"`{platform}`", "inline": True})
|
||||
if packager:
|
||||
fields.append({"name": "Packager", "value": packager, "inline": True})
|
||||
|
||||
embed = {
|
||||
"title": title,
|
||||
"url": run_url,
|
||||
"description": f"**[View build logs →]({run_url})**",
|
||||
"color": color,
|
||||
"fields": fields,
|
||||
"footer": {"text": repo},
|
||||
}
|
||||
|
||||
webhook = _required("DISCORD_RELEASE_PIPELINE_WEBHOOK")
|
||||
return 0 if _post_webhook(webhook, {"username": "Build Bot", "embeds": [embed]}) else 1
|
||||
|
||||
|
||||
# ---------- Phase 2: Dependabot consolidator ----------
|
||||
|
||||
def _list_org_repos(owner: str, token: str) -> list[dict]:
|
||||
"""List all repos owned by `owner` (user or org). Paginated, capped at 200."""
|
||||
repos: list[dict] = []
|
||||
for page in range(1, 3): # 100 per page × 2 pages = 200 max
|
||||
# `/users/{owner}/repos` works for users; for orgs use `/orgs/{owner}/repos`.
|
||||
# Try user endpoint first, fall back to org if 404.
|
||||
try:
|
||||
page_repos = _gh_api(f"/users/{owner}/repos", token, params={"per_page": 100, "page": page, "type": "owner"})
|
||||
except HTTPError:
|
||||
page_repos = _gh_api(f"/orgs/{owner}/repos", token, params={"per_page": 100, "page": page})
|
||||
if not isinstance(page_repos, list) or not page_repos:
|
||||
break
|
||||
repos.extend(page_repos)
|
||||
if len(page_repos) < 100:
|
||||
break
|
||||
return repos
|
||||
|
||||
|
||||
def post_dependabot_summary() -> int:
|
||||
"""
|
||||
Daily Dependabot summary across all repos.
|
||||
|
||||
Lists open PRs authored by 'dependabot[bot]', grouped by repo. If zero PRs,
|
||||
posts a quiet 'all clean' message (configurable).
|
||||
|
||||
Env:
|
||||
DISCORD_DEPENDABOT_WEBHOOK — webhook for #dependabot
|
||||
OPS_GH_TOKEN — PAT with `repo` scope (or fine-grained read across all repos)
|
||||
GH_OWNER — GitHub username (e.g. 'poli0981')
|
||||
QUIET_WHEN_EMPTY — 'true' to skip posting when zero PRs (default: false)
|
||||
"""
|
||||
webhook = _required("DISCORD_DEPENDABOT_WEBHOOK")
|
||||
token = _required("OPS_GH_TOKEN")
|
||||
owner = _required("GH_OWNER")
|
||||
quiet_when_empty = _env("QUIET_WHEN_EMPTY", "false").lower() == "true"
|
||||
|
||||
# Use search API to find all open dependabot PRs across owner's repos in one call.
|
||||
# Search is rate-limited at 30 req/min for authenticated users — well under that.
|
||||
query = f"is:open is:pr author:app/dependabot user:{owner}"
|
||||
print(f"[INFO] Searching: {query}")
|
||||
items = _gh_search(query, token)
|
||||
|
||||
print(f"[INFO] Found {len(items)} open Dependabot PR(s).")
|
||||
|
||||
if not items and quiet_when_empty:
|
||||
print("[INFO] No PRs and QUIET_WHEN_EMPTY=true; skipping post.")
|
||||
return 0
|
||||
|
||||
# Group by repo
|
||||
by_repo: dict[str, list[dict]] = defaultdict(list)
|
||||
for item in items:
|
||||
# repository_url is "https://api.github.com/repos/{owner}/{name}"
|
||||
repo_url = item.get("repository_url", "")
|
||||
repo_full = repo_url.rsplit("/repos/", 1)[-1] if "/repos/" in repo_url else "unknown"
|
||||
by_repo[repo_full].append(item)
|
||||
|
||||
fields = []
|
||||
for repo_full in sorted(by_repo.keys()):
|
||||
prs = by_repo[repo_full]
|
||||
# Sort: oldest first within a repo, so stale ones are visible
|
||||
prs.sort(key=lambda p: p.get("created_at", ""))
|
||||
|
||||
lines = []
|
||||
for pr in prs[:5]: # cap per repo to keep field under 1024
|
||||
title = _truncate(pr.get("title", ""), 80)
|
||||
number = pr.get("number", "?")
|
||||
url = pr.get("html_url", "")
|
||||
created = pr.get("created_at", "")
|
||||
try:
|
||||
age_days = (datetime.now(timezone.utc) - datetime.fromisoformat(created.replace("Z", "+00:00"))).days
|
||||
age_str = f" ({age_days}d)" if age_days >= 1 else " (today)"
|
||||
except (ValueError, AttributeError):
|
||||
age_str = ""
|
||||
lines.append(f"• [#{number}]({url}) {title}{age_str}")
|
||||
|
||||
if len(prs) > 5:
|
||||
lines.append(f"• … +{len(prs) - 5} more")
|
||||
|
||||
fields.append({
|
||||
"name": f"{repo_full} ({len(prs)})",
|
||||
"value": _truncate("\n".join(lines), MAX_FIELD_VALUE),
|
||||
"inline": False,
|
||||
})
|
||||
|
||||
# Discord caps embeds at 25 fields; truncate gracefully
|
||||
if len(fields) >= 24 and len(by_repo) > 24:
|
||||
remaining_repos = len(by_repo) - 24
|
||||
remaining_prs = sum(len(by_repo[r]) for r in sorted(by_repo.keys())[24:])
|
||||
fields.append({
|
||||
"name": "…and more",
|
||||
"value": f"+{remaining_prs} PR(s) in {remaining_repos} other repo(s)",
|
||||
"inline": False,
|
||||
})
|
||||
break
|
||||
|
||||
if items:
|
||||
title = f"🤖 Dependabot: {len(items)} open PR(s) across {len(by_repo)} repo(s)"
|
||||
description = "Daily summary of open dependency-update PRs."
|
||||
else:
|
||||
title = "🤖 Dependabot: all clean"
|
||||
description = "No open dependency-update PRs across any repo. ✨"
|
||||
|
||||
embed = {
|
||||
"title": title,
|
||||
"description": description,
|
||||
"color": COLOR_DEPENDABOT,
|
||||
"fields": fields,
|
||||
"footer": {"text": f"{owner} • daily summary"},
|
||||
"timestamp": datetime.now(timezone.utc).isoformat(),
|
||||
}
|
||||
|
||||
return 0 if _post_webhook(webhook, {"username": "Dependabot Digest", "embeds": [embed]}) else 1
|
||||
|
||||
|
||||
# ---------- Phase 2: Weekly digest ----------
|
||||
|
||||
def post_weekly_digest() -> int:
|
||||
"""
|
||||
Weekly activity digest. Aggregates last 7 days of:
|
||||
- merged PRs
|
||||
- closed issues
|
||||
- releases published
|
||||
- commits to default branches
|
||||
|
||||
Posted to #announcements (configurable).
|
||||
|
||||
Env:
|
||||
DISCORD_DIGEST_WEBHOOK — webhook for #announcements
|
||||
OPS_GH_TOKEN — PAT with read access
|
||||
GH_OWNER — owner username
|
||||
"""
|
||||
webhook = _required("DISCORD_DIGEST_WEBHOOK")
|
||||
token = _required("OPS_GH_TOKEN")
|
||||
owner = _required("GH_OWNER")
|
||||
|
||||
since = (datetime.now(timezone.utc) - timedelta(days=7)).strftime("%Y-%m-%d")
|
||||
print(f"[INFO] Aggregating activity since {since} for {owner}")
|
||||
|
||||
# Use search for merged PRs and closed issues — fastest cross-repo aggregation
|
||||
merged_prs = _gh_search(f"user:{owner} is:pr is:merged merged:>={since}", token)
|
||||
closed_issues = _gh_search(f"user:{owner} is:issue is:closed closed:>={since}", token)
|
||||
|
||||
# Releases: list per repo via the repos endpoint, filter by published_at locally.
|
||||
# GitHub search doesn't index releases, so this is unavoidable.
|
||||
repos = _list_org_repos(owner, token)
|
||||
releases_by_repo: dict[str, list[dict]] = defaultdict(list)
|
||||
since_dt = datetime.now(timezone.utc) - timedelta(days=7)
|
||||
for repo in repos:
|
||||
repo_full = repo.get("full_name", "")
|
||||
if repo.get("archived") or repo.get("disabled"):
|
||||
continue
|
||||
try:
|
||||
rels = _gh_api(f"/repos/{repo_full}/releases", token, params={"per_page": 10})
|
||||
if isinstance(rels, list):
|
||||
for r in rels:
|
||||
pub = r.get("published_at")
|
||||
if not pub:
|
||||
continue
|
||||
try:
|
||||
pub_dt = datetime.fromisoformat(pub.replace("Z", "+00:00"))
|
||||
except ValueError:
|
||||
continue
|
||||
if pub_dt >= since_dt:
|
||||
releases_by_repo[repo_full].append(r)
|
||||
except HTTPError:
|
||||
continue # skip repos we can't read
|
||||
|
||||
# Top-active repos (by PR + issue count)
|
||||
repo_activity: dict[str, int] = defaultdict(int)
|
||||
for pr in merged_prs:
|
||||
repo_full = pr.get("repository_url", "").rsplit("/repos/", 1)[-1]
|
||||
repo_activity[repo_full] += 1
|
||||
for iss in closed_issues:
|
||||
repo_full = iss.get("repository_url", "").rsplit("/repos/", 1)[-1]
|
||||
repo_activity[repo_full] += 1
|
||||
|
||||
fields = []
|
||||
|
||||
# Summary numbers
|
||||
total_releases = sum(len(rs) for rs in releases_by_repo.values())
|
||||
summary_lines = [
|
||||
f"• **{len(merged_prs)}** PR(s) merged",
|
||||
f"• **{len(closed_issues)}** issue(s) closed",
|
||||
f"• **{total_releases}** release(s) published",
|
||||
f"• Activity in **{len(repo_activity)}** repo(s)",
|
||||
]
|
||||
fields.append({
|
||||
"name": "📊 Last 7 days",
|
||||
"value": "\n".join(summary_lines),
|
||||
"inline": False,
|
||||
})
|
||||
|
||||
# Releases list
|
||||
if releases_by_repo:
|
||||
rel_lines = []
|
||||
for repo_full in sorted(releases_by_repo.keys()):
|
||||
for r in releases_by_repo[repo_full]:
|
||||
tag = r.get("tag_name", "?")
|
||||
url = r.get("html_url", "")
|
||||
rel_lines.append(f"• [{repo_full} {tag}]({url})")
|
||||
fields.append({
|
||||
"name": f"🚀 Releases ({total_releases})",
|
||||
"value": _truncate("\n".join(rel_lines), MAX_FIELD_VALUE),
|
||||
"inline": False,
|
||||
})
|
||||
|
||||
# Top active repos
|
||||
if repo_activity:
|
||||
top_repos = sorted(repo_activity.items(), key=lambda x: x[1], reverse=True)[:MAX_DIGEST_REPOS_PER_FIELD]
|
||||
repo_lines = [f"• **{repo}**: {count} change(s)" for repo, count in top_repos]
|
||||
fields.append({
|
||||
"name": "🔥 Most active",
|
||||
"value": _truncate("\n".join(repo_lines), MAX_FIELD_VALUE),
|
||||
"inline": False,
|
||||
})
|
||||
|
||||
embed = {
|
||||
"title": f"📅 Weekly digest — week of {since}",
|
||||
"description": f"Activity across @{owner}'s repos.",
|
||||
"color": COLOR_DIGEST,
|
||||
"fields": fields,
|
||||
"footer": {"text": f"{owner} • weekly"},
|
||||
"timestamp": datetime.now(timezone.utc).isoformat(),
|
||||
}
|
||||
|
||||
return 0 if _post_webhook(webhook, {"username": "Weekly Digest", "embeds": [embed]}) else 1
|
||||
|
||||
|
||||
# ---------- Entry point ----------
|
||||
|
||||
def main() -> int:
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: discord_notify.py <release|failure|deploy|release-build|dependabot-summary|weekly-digest>")
|
||||
return 2
|
||||
|
||||
cmd = sys.argv[1].lower()
|
||||
handlers = {
|
||||
"release": post_release,
|
||||
"failure": post_failure,
|
||||
"deploy": post_deploy,
|
||||
"release-build": post_release_build,
|
||||
"dependabot-summary": post_dependabot_summary,
|
||||
"weekly-digest": post_weekly_digest,
|
||||
}
|
||||
handler = handlers.get(cmd)
|
||||
if not handler:
|
||||
print(f"[ERROR] Unknown command: {cmd}")
|
||||
return 2
|
||||
return handler()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Announce Release to Discord
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Existing release tag to re-announce"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
# Reusable announce-release.yml only needs `contents: read` to fetch
|
||||
# release metadata via the gh CLI.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
announce:
|
||||
# Pinned to commit SHA instead of @main — guards against a malicious or
|
||||
# accidental push to poli0981/.github landing in our release pipeline
|
||||
# silently. Dependabot bumps this weekly via the github-actions ecosystem
|
||||
# rule in .github/dependabot.yml.
|
||||
uses: poli0981/.github/.github/workflows/announce-release.yml@e973e2f15725356653ef07539016670ad2733f83
|
||||
with:
|
||||
tag_override: ${{ inputs.tag || '' }}
|
||||
secrets: inherit
|
||||
@@ -5,6 +5,11 @@ name: CI
|
||||
# net9.0-windows10.0.22621.0 and the WGC integration tests require a real
|
||||
# desktop session with Windows 11 22H2 SDK.
|
||||
|
||||
# Minimum permissions required to checkout the repo and run dotnet
|
||||
# build/test. No package writes, no release uploads, no PR comments.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
name: Welcome new discussions
|
||||
|
||||
# Auto-post a brief bilingual greeting (Vietnamese + English) the first time
|
||||
# a non-maintainer opens a Discussion thread. The goal is to lower triage
|
||||
# burden by directing posters at the right venue up front:
|
||||
# - Bugs -> the in-app "About -> Report a bug" button or the
|
||||
# bug-report issue template (requires Windows build,
|
||||
# GPU, log snippet — the data the solo maintainer
|
||||
# actually needs to act on a report).
|
||||
# - Security holes -> GitHub Security Advisories, NOT a public discussion.
|
||||
# - Q&A / ideas -> stay here, you're in the right place.
|
||||
|
||||
on:
|
||||
discussion:
|
||||
types: [created]
|
||||
|
||||
# `discussions: write` is the only scope required to add a discussion comment
|
||||
# via the GraphQL `addDiscussionComment` mutation. Default everything else to
|
||||
# read so a compromised step can't push code or open releases.
|
||||
permissions:
|
||||
contents: read
|
||||
discussions: write
|
||||
|
||||
jobs:
|
||||
welcome:
|
||||
runs-on: ubuntu-latest
|
||||
# Skip greetings for OWNER / COLLABORATOR / MEMBER — the maintainer and
|
||||
# any future collaborators don't need a venue cheat-sheet on their own
|
||||
# threads.
|
||||
if: >-
|
||||
github.event.discussion.author_association != 'OWNER'
|
||||
&& github.event.discussion.author_association != 'COLLABORATOR'
|
||||
&& github.event.discussion.author_association != 'MEMBER'
|
||||
|
||||
steps:
|
||||
- name: Add welcome comment
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const body = [
|
||||
"Cảm ơn bạn đã mở thread tại **CaptureImage Discussions** — thanks for opening a discussion!",
|
||||
"",
|
||||
"**Tiếng Việt**",
|
||||
"",
|
||||
"- Báo lỗi (crash, capture lỗi, OCR sai, hotkey không hoạt động): dùng nút **About → Report a bug** ngay trong app, hoặc mở [bug-report template](https://github.com/poli0981/captureimg/issues/new?template=bug_report.yml). Issue tracker yêu cầu các field (Windows build, GPU, log snippet) cần để debug nhanh.",
|
||||
"- Lỗi bảo mật (security vulnerability): **không** post công khai — báo riêng qua [GitHub Security Advisories](https://github.com/poli0981/captureimg/security/advisories/new).",
|
||||
"- Câu hỏi sử dụng, ý tưởng, show & tell: bạn đang ở đúng chỗ rồi.",
|
||||
"",
|
||||
"**English**",
|
||||
"",
|
||||
"- Bug reports (crash, broken capture, OCR mistakes, hotkey not firing): use the **About → Report a bug** button in-app, or open the [bug-report template](https://github.com/poli0981/captureimg/issues/new?template=bug_report.yml). The issue tracker requires the fields (Windows build, GPU, log snippet) needed to debug.",
|
||||
"- Security vulnerabilities: please **don't** post publicly — file privately via [GitHub Security Advisories](https://github.com/poli0981/captureimg/security/advisories/new).",
|
||||
"- Usage questions, ideas, show & tell: you're in the right place.",
|
||||
"",
|
||||
"_posted automatically by [.github/workflows/discussion-welcome.yml](https://github.com/poli0981/captureimg/blob/main/.github/workflows/discussion-welcome.yml)_"
|
||||
].join("\n");
|
||||
|
||||
await github.graphql(
|
||||
`mutation($discussionId: ID!, $body: String!) {
|
||||
addDiscussionComment(input: { discussionId: $discussionId, body: $body }) {
|
||||
comment { id }
|
||||
}
|
||||
}`,
|
||||
{
|
||||
discussionId: context.payload.discussion.node_id,
|
||||
body
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,25 @@
|
||||
name: Notify CI Failures
|
||||
|
||||
# Previously listened to `workflows: ["*"]`, which fired this caller on every
|
||||
# workflow completion in the repo — every release run, every announce run,
|
||||
# every notify run itself — and the Actions tab filled with skipped entries.
|
||||
# Narrowed to the single workflow this is supposed to monitor: ci.yml (name
|
||||
# "CI"). The job-level `if` further skips successful CI runs so the reusable
|
||||
# isn't pulled in on green builds.
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["CI"]
|
||||
types: [completed]
|
||||
|
||||
# REQUIRED: declare permissions matching the reusable workflow's needs.
|
||||
# Reusable needs `actions: read` to inspect workflow_run details.
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
||||
# Pinned to commit SHA — see comment in announce-release.yml.
|
||||
uses: poli0981/.github/.github/workflows/notify-ci-failure.yml@e973e2f15725356653ef07539016670ad2733f83
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,21 @@
|
||||
name: Notify Release Pipeline
|
||||
|
||||
# Previously listened to `workflows: ["*"]`. Narrowed to the actual release
|
||||
# build workflow ("Release" — release.yml) so the Actions tab no longer fills
|
||||
# with skipped runs after every CI / notify completion. announce-release.yml
|
||||
# is intentionally NOT included here — it already posts to Discord on its own,
|
||||
# routing it through this notifier too would double-post.
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Release"]
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
# Pinned to commit SHA — see comment in announce-release.yml.
|
||||
uses: poli0981/.github/.github/workflows/notify-release-pipeline.yml@e973e2f15725356653ef07539016670ad2733f83
|
||||
secrets: inherit
|
||||
@@ -7,6 +7,88 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.5.1] - 2026-05-11
|
||||
|
||||
Hotfix cycle. CI hardening, supply-chain pinning of reusable
|
||||
workflows, and a small public-attribution surface in About + repo
|
||||
root.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **CI workflow missing permissions block.** Code Scanning flagged
|
||||
`.github/workflows/ci.yml` as not declaring an explicit
|
||||
`permissions:` block. Now declares `contents: read` — the
|
||||
minimum required to checkout the repo and run `dotnet build` /
|
||||
`dotnet test`. No package writes, no release uploads, no PR
|
||||
comments.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Reusable workflow refs pinned to commit SHA.** `announce-release`,
|
||||
`notify-ci-failure`, and `notify-release-pipeline` callers now
|
||||
reference `poli0981/.github` via full commit SHA instead of `@main`.
|
||||
Dependabot bumps the SHA weekly via the existing `github-actions`
|
||||
ecosystem rule in `.github/dependabot.yml`. Avoids the supply-chain
|
||||
failure mode where a malicious or accidental push to ops-repo
|
||||
`main` would land in our release pipeline silently.
|
||||
- **Notify workflows no longer spam the Actions tab.**
|
||||
`notify-ci-failure` previously listened to `workflows: ["*"]` and
|
||||
fired on every workflow completion in the repo; now narrowed to
|
||||
the single workflow it monitors (`"CI"`) with a job-level
|
||||
conclusion gate so successful CI runs short-circuit before
|
||||
pulling in the reusable. `notify-release-pipeline` narrowed to
|
||||
`["Release"]` for the same reason. Roughly 50% fewer skipped
|
||||
notify-* runs in the Actions history; the remaining runs all
|
||||
correspond to events worth observing.
|
||||
|
||||
### Added
|
||||
|
||||
- **About → Connect with the developer** — 8 public-profile links
|
||||
(X, YouTube, Discord repo + game, Steam, Bluesky, Mastodon,
|
||||
Telegram) rendered as a vertical stack of `HyperlinkButton`s. Each
|
||||
uses `NavigateUri` so click opens the URL via the system shell.
|
||||
Email and PayPal are intentionally not surfaced here.
|
||||
- **About → Support the project** — short prose + 4 donate buttons
|
||||
(GitHub Sponsors accent-styled, Ko-fi, Buy Me a Coffee, Patreon).
|
||||
URLs are hardcoded in `AboutViewModel` and mirror
|
||||
`.github/FUNDING.yml`.
|
||||
- **About → Report a bug** — single low-friction button targeting
|
||||
the GitHub bug-report issue template
|
||||
(`.github/ISSUE_TEMPLATE/bug_report.yml`).
|
||||
- **`.github/FUNDING.yml`** — wires GitHub Sponsors, Ko-fi, Buy Me a
|
||||
Coffee, and Patreon into the repo's "Sponsor" button.
|
||||
- **`docs/pc_spec.md`** + **`docs/dev_env.md`** — public dev
|
||||
reference covering primary hardware, mobile test fleet, toolchain
|
||||
versions, IDE setup, Windows SDK, build/test/run commands, release
|
||||
tooling. Vietnamese mirrors at `docs/i18n/vi/`.
|
||||
- **README "Support the project" section** — preceding the License
|
||||
section, mirroring the four donate destinations and pointing at
|
||||
the in-app Report-a-bug button.
|
||||
- **`discussion-welcome.yml` workflow** — auto-posts a brief
|
||||
bilingual (Vietnamese + English) greeting the first time a
|
||||
non-maintainer opens a Discussion thread. The greeting points
|
||||
the poster at the right venue: bug reports → in-app
|
||||
Report-a-bug button or the bug-report issue template, security
|
||||
vulnerabilities → GitHub Security Advisories (not a public
|
||||
discussion), Q&A / ideas → the discussion they just opened. Skips
|
||||
OWNER / COLLABORATOR / MEMBER posts to avoid greeting the
|
||||
maintainer's own threads.
|
||||
|
||||
### Smoke checklist
|
||||
|
||||
1. Launch v1.5.0 → Update → install v1.5.1 → app restarts and
|
||||
shows "1.5.1" in the nav header.
|
||||
2. About → click each of the 8 social links → opens in the default
|
||||
browser.
|
||||
3. About → click each of the 4 donate buttons → opens the correct
|
||||
destination.
|
||||
4. About → Report a bug → GitHub opens with the bug-report template
|
||||
pre-filled.
|
||||
5. Switch language en → vi → ar (RTL) → the 3 new section headers
|
||||
(Connect, Support, Report) retranslate in place.
|
||||
6. Repo home → the "Sponsor" button appears at top right (near
|
||||
Watch / Fork).
|
||||
|
||||
## [1.5.0] - 2026-05-07
|
||||
|
||||
Bug-fix + feature cycle. Tackles a long-standing process-leak bug,
|
||||
|
||||
@@ -200,6 +200,22 @@ meaningful AI authorship carry a `Co-Authored-By` trailer naming the
|
||||
model. Full details in [`docs/CONTRIBUTORS.md`](docs/CONTRIBUTORS.md)
|
||||
and [`docs/legal/DISCLAIMER.md §3`](docs/legal/DISCLAIMER.md).
|
||||
|
||||
## Support the project
|
||||
|
||||
CaptureImage is free, open source, and developed solo. If it helps
|
||||
you, consider supporting development:
|
||||
|
||||
- [GitHub Sponsors](https://github.com/sponsors/poli0981)
|
||||
- [Ko-fi](https://ko-fi.com/skullmute)
|
||||
- [Buy Me a Coffee](https://buymeacoffee.com/skullmute)
|
||||
- [Patreon](https://patreon.com/skullmute)
|
||||
|
||||
The same destinations are wired into the repo's "Sponsor" button via
|
||||
[`.github/FUNDING.yml`](.github/FUNDING.yml).
|
||||
|
||||
Bug reports go through the in-app **About → Report a bug** button or
|
||||
[directly on GitHub](https://github.com/poli0981/captureimg/issues/new?template=bug_report.yml).
|
||||
|
||||
## License
|
||||
|
||||
CaptureImage is distributed under the **GNU General Public License
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
# Development environment
|
||||
|
||||
This document lists the toolchain versions used to build, test, and
|
||||
release CaptureImage. Hardware reference: [`docs/pc_spec.md`](pc_spec.md).
|
||||
Vietnamese mirror: [`docs/i18n/vi/dev_env.md`](i18n/vi/dev_env.md).
|
||||
|
||||
## Toolchains
|
||||
|
||||
| Toolchain | Version | Purpose |
|
||||
|-------------|----------------------------------------|-----------------------------------------------|
|
||||
| **.NET SDK**| 9.0 (exact version pinned in [`global.json`](../global.json)) | Primary build / test runtime |
|
||||
| **Python** | 3.12 | Release scripting, Discord notification helper (`.github/scripts/discord_notify.py`) |
|
||||
| **Node.js** | ≥ 22 LTS | Future docs site / web companion tooling |
|
||||
| **Rust** | stable, via `rustup` | Reserved for future native helpers (none in v1.5.x) |
|
||||
| **Git** | recent (≥ 2.40) | Source control |
|
||||
| **GPG** | any version supporting Ed25519 | Commit + tag signing — `commit.gpgsign=true` is set repo-wide; tag signing required per [`docs/RELEASING.md`](RELEASING.md) |
|
||||
|
||||
The CI runner uses `actions/setup-dotnet@v5` with `global-json-file:
|
||||
global.json`, so the local and CI .NET versions are guaranteed to
|
||||
match — see [`.github/workflows/ci.yml`](../.github/workflows/ci.yml).
|
||||
|
||||
## IDE setup
|
||||
|
||||
Primary: **JetBrains Rider 2026.x** (paid lineup). Recommended Rider
|
||||
plugins:
|
||||
|
||||
- *.NET Core User Secrets* (built in)
|
||||
- *Markdown* (built in)
|
||||
- *Resource Bundle Editor* — handy when editing the 11 `.resx`
|
||||
locale files at once
|
||||
([`src/CaptureImage.UI/Resources/Strings/`](../src/CaptureImage.UI/Resources/Strings/))
|
||||
|
||||
Sibling JetBrains IDEs used on adjacent projects: **PyCharm**,
|
||||
**WebStorm**, **RustRover**.
|
||||
|
||||
Secondary: **Visual Studio Code** with the C# Dev Kit extension for
|
||||
quick edits.
|
||||
|
||||
## Windows SDK
|
||||
|
||||
WinUI 3 + `Windows.Graphics.Capture` projections require the
|
||||
**Windows 11 22H2 SDK** (10.0.22621). Install via the Visual Studio
|
||||
Installer ("Windows 11 SDK (10.0.22621.x)") or directly from
|
||||
<https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/>.
|
||||
|
||||
## Build / test / run
|
||||
|
||||
```powershell
|
||||
git clone https://github.com/poli0981/captureimg.git
|
||||
cd captureimg
|
||||
dotnet restore
|
||||
dotnet build CaptureImage.sln -c Release
|
||||
dotnet test CaptureImage.sln -c Release
|
||||
dotnet run --project src/CaptureImage.App -c Release
|
||||
```
|
||||
|
||||
The CI commands are a literal mirror of the above plus
|
||||
`/p:TreatWarningsAsErrors=true /p:WarningsAsErrors=nullable` — run
|
||||
the same locally before opening a PR.
|
||||
|
||||
## Release tooling
|
||||
|
||||
- **Velopack** (`vpk` CLI) — packaging + delta updates.
|
||||
- **`gh`** (GitHub CLI) — creating Releases, uploading artifacts,
|
||||
fetching SHAs (the reusable-workflow pin lookup in
|
||||
[`docs/RELEASING.md`](RELEASING.md)).
|
||||
- See [`docs/RELEASING.md`](RELEASING.md) for the end-to-end cycle.
|
||||
|
||||
## Related documents
|
||||
|
||||
- [`docs/pc_spec.md`](pc_spec.md) — hardware reference.
|
||||
- [`docs/ARCHITECTURE.md`](ARCHITECTURE.md) — software architecture.
|
||||
- [`docs/CONTRIBUTORS.md`](CONTRIBUTORS.md) — contribution policy.
|
||||
- [`README.md`](../README.md) — project overview.
|
||||
@@ -0,0 +1,77 @@
|
||||
# Môi trường phát triển
|
||||
|
||||
Tài liệu này liệt kê các phiên bản toolchain dùng để build, test
|
||||
và release CaptureImage. Tham chiếu phần cứng:
|
||||
[`pc_spec.md`](pc_spec.md). Bản tiếng Anh:
|
||||
[`docs/dev_env.md`](../../dev_env.md).
|
||||
|
||||
## Toolchain
|
||||
|
||||
| Toolchain | Version | Purpose |
|
||||
|-------------|----------------------------------------|-----------------------------------------------|
|
||||
| **.NET SDK**| 9.0 (pin chính xác trong [`global.json`](../../../global.json)) | Build + test runtime chính |
|
||||
| **Python** | 3.12 | Release scripting, Discord notification helper (`.github/scripts/discord_notify.py`) |
|
||||
| **Node.js** | ≥ 22 LTS | Docs site / web companion tooling tương lai |
|
||||
| **Rust** | stable, qua `rustup` | Dự phòng cho native helper tương lai (chưa có trong v1.5.x) |
|
||||
| **Git** | mới (≥ 2.40) | Source control |
|
||||
| **GPG** | bất kỳ phiên bản nào hỗ trợ Ed25519 | Ký commit + tag — `commit.gpgsign=true` được bật repo-wide; tag signing là bắt buộc theo [`docs/RELEASING.md`](../../RELEASING.md) |
|
||||
|
||||
CI runner dùng `actions/setup-dotnet@v5` với `global-json-file:
|
||||
global.json`, nên phiên bản .NET local và CI đảm bảo khớp nhau —
|
||||
xem [`.github/workflows/ci.yml`](../../../.github/workflows/ci.yml).
|
||||
|
||||
## Cấu hình IDE
|
||||
|
||||
Chính: **JetBrains Rider 2026.x** (paid lineup). Plugin Rider khuyến
|
||||
nghị:
|
||||
|
||||
- *.NET Core User Secrets* (có sẵn)
|
||||
- *Markdown* (có sẵn)
|
||||
- *Resource Bundle Editor* — tiện khi edit 11 file `.resx` locale
|
||||
cùng lúc
|
||||
([`src/CaptureImage.UI/Resources/Strings/`](../../../src/CaptureImage.UI/Resources/Strings/))
|
||||
|
||||
JetBrains IDE anh em dùng trên các project lân cận: **PyCharm**,
|
||||
**WebStorm**, **RustRover**.
|
||||
|
||||
Phụ: **Visual Studio Code** với extension C# Dev Kit cho các edit
|
||||
nhanh.
|
||||
|
||||
## Windows SDK
|
||||
|
||||
WinUI 3 + projection của `Windows.Graphics.Capture` yêu cầu
|
||||
**Windows 11 22H2 SDK** (10.0.22621). Cài qua Visual Studio
|
||||
Installer ("Windows 11 SDK (10.0.22621.x)") hoặc trực tiếp từ
|
||||
<https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/>.
|
||||
|
||||
## Build / test / run
|
||||
|
||||
```powershell
|
||||
git clone https://github.com/poli0981/captureimg.git
|
||||
cd captureimg
|
||||
dotnet restore
|
||||
dotnet build CaptureImage.sln -c Release
|
||||
dotnet test CaptureImage.sln -c Release
|
||||
dotnet run --project src/CaptureImage.App -c Release
|
||||
```
|
||||
|
||||
Lệnh trên CI là mirror chính xác của các lệnh trên, có thêm
|
||||
`/p:TreatWarningsAsErrors=true /p:WarningsAsErrors=nullable` —
|
||||
chạy y hệt ở local trước khi mở PR.
|
||||
|
||||
## Release tooling
|
||||
|
||||
- **Velopack** (`vpk` CLI) — packaging + delta update.
|
||||
- **`gh`** (GitHub CLI) — tạo Release, upload artifact, fetch SHA
|
||||
(lookup SHA của reusable-workflow pin trong
|
||||
[`docs/RELEASING.md`](../../RELEASING.md)).
|
||||
- Xem [`docs/RELEASING.md`](../../RELEASING.md) cho chu trình end-to-end.
|
||||
|
||||
## Tài liệu liên quan
|
||||
|
||||
- [`pc_spec.md`](pc_spec.md) — tham chiếu phần cứng (bản VI).
|
||||
- [`docs/ARCHITECTURE.md`](../../ARCHITECTURE.md) — kiến trúc phần
|
||||
mềm (EN, chưa có bản VI).
|
||||
- [`docs/CONTRIBUTORS.md`](../../CONTRIBUTORS.md) — chính sách đóng
|
||||
góp (EN, chưa có bản VI).
|
||||
- [`README.md`](../../../README.md) — tổng quan project.
|
||||
@@ -0,0 +1,52 @@
|
||||
# Cấu hình máy phát triển
|
||||
|
||||
Tài liệu này mô tả phần cứng tham chiếu mà CaptureImage được phát
|
||||
triển và kiểm thử trên đó. Đây là snapshot của máy chính của
|
||||
maintainer — **không** phải yêu cầu runtime cho end-user. Yêu cầu
|
||||
cho người dùng cuối nằm trong
|
||||
[README § Requirements](../../../README.md#requirements).
|
||||
|
||||
Bản tiếng Anh: [`docs/pc_spec.md`](../../pc_spec.md).
|
||||
|
||||
## Máy phát triển chính
|
||||
|
||||
| Component | Details |
|
||||
|-------------|-------------------------------------------------------------------|
|
||||
| **OS** | Windows 11 Pro 25H2 Insider Preview (Dev Channel), build 26300.8376 |
|
||||
| **CPU** | Intel Core i7-14700KF |
|
||||
| **GPU** | NVIDIA GeForce RTX 5080 (16 GB VRAM) |
|
||||
| **RAM** | 32 GB DDR5 |
|
||||
| **Storage** | 1 TB SSD |
|
||||
| **IDE** | JetBrains 2026.x paid lineup (Rider cho repo này; PyCharm / WebStorm / RustRover cho các project anh em) + Visual Studio Code |
|
||||
|
||||
Việc dùng Windows Insider Dev Channel là có chủ đích — CaptureImage
|
||||
khai thác bề mặt API mới nhất của `Windows.Graphics.Capture` và
|
||||
hưởng lợi khi chạy trên build đi trước stable, nhờ vậy regression
|
||||
trên các phiên bản public sắp tới được phát hiện sớm.
|
||||
|
||||
## Thiết bị test mobile
|
||||
|
||||
Một số project lân cận / tương lai sẽ ship một web companion nhỏ.
|
||||
Khi phần đó được triển khai, browser test trên mobile sẽ chạy trên:
|
||||
|
||||
- **iPhone 14 Pro** (iOS 26.x)
|
||||
- **iPhone 13 Pro Max** (iOS 26.x)
|
||||
|
||||
Browser test trên iOS: **Chrome**, **Brave**.
|
||||
|
||||
> **Ghi chú.** Bản thân CaptureImage là một desktop application
|
||||
> Windows 11 (WinUI 3 / Windows App SDK), không có build iOS / web.
|
||||
> Các thiết bị mobile ở trên được liệt kê để minh bạch về test fleet
|
||||
> tổng thể của maintainer; không dùng để validate CaptureImage.
|
||||
|
||||
## Tài liệu liên quan
|
||||
|
||||
- [`dev_env.md`](dev_env.md) — phiên bản toolchain (Python, Node,
|
||||
Rust, Git) và cấu hình IDE (bản VI).
|
||||
- [`README.md` § Requirements](../../../README.md#requirements) —
|
||||
yêu cầu runtime cho người dùng cuối (Windows 11 22H2+, không yêu
|
||||
cầu GPU cụ thể).
|
||||
- [`docs/ARCHITECTURE.md`](../../ARCHITECTURE.md) — kiến trúc phần
|
||||
mềm (EN, chưa có bản VI).
|
||||
- [`docs/RELEASING.md`](../../RELEASING.md) — quy trình release
|
||||
(EN, chưa có bản VI).
|
||||
@@ -0,0 +1,49 @@
|
||||
# Developer machine specification
|
||||
|
||||
This document describes the reference hardware CaptureImage is
|
||||
developed and validated against. It is a snapshot of the maintainer's
|
||||
primary development box — not a runtime requirement. End-user
|
||||
requirements are listed in the project [README](../README.md#requirements).
|
||||
|
||||
A Vietnamese mirror of this document lives at
|
||||
[docs/i18n/vi/pc_spec.md](i18n/vi/pc_spec.md).
|
||||
|
||||
## Primary development machine
|
||||
|
||||
| Component | Details |
|
||||
|-------------|-------------------------------------------------------------------|
|
||||
| **OS** | Windows 11 Pro 25H2 Insider Preview (Dev Channel), build 26300.8376 |
|
||||
| **CPU** | Intel Core i7-14700KF |
|
||||
| **GPU** | NVIDIA GeForce RTX 5080 (16 GB VRAM) |
|
||||
| **RAM** | 32 GB DDR5 |
|
||||
| **Storage** | 1 TB SSD |
|
||||
| **IDE** | JetBrains 2026.x paid lineup (Rider for this repo; PyCharm / WebStorm / RustRover for sibling projects) + Visual Studio Code |
|
||||
|
||||
The Windows Insider Dev Channel build is intentional — CaptureImage
|
||||
exercises the latest `Windows.Graphics.Capture` surface area and
|
||||
benefits from running on builds ahead of stable so regressions on
|
||||
upcoming public releases are caught early.
|
||||
|
||||
## Mobile test devices
|
||||
|
||||
Some adjacent / future projects ship a small web companion. When that
|
||||
work lands, mobile browser testing is performed on:
|
||||
|
||||
- **iPhone 14 Pro** (iOS 26.x)
|
||||
- **iPhone 13 Pro Max** (iOS 26.x)
|
||||
|
||||
Browsers under test on iOS: **Chrome**, **Brave**.
|
||||
|
||||
> **Note.** CaptureImage itself is a Windows 11 desktop application
|
||||
> (WinUI 3 / Windows App SDK) and has no iOS / web build. The mobile
|
||||
> devices above are listed for transparency about the maintainer's
|
||||
> overall test fleet; they are not used to validate CaptureImage.
|
||||
|
||||
## Related documents
|
||||
|
||||
- [`docs/dev_env.md`](dev_env.md) — toolchain versions (Python, Node,
|
||||
Rust, Git) and IDE configuration.
|
||||
- [`README.md` § Requirements](../README.md#requirements) — end-user
|
||||
runtime requirements (Windows 11 22H2+, no specific GPU needed).
|
||||
- [`docs/ARCHITECTURE.md`](ARCHITECTURE.md) — software architecture.
|
||||
- [`docs/RELEASING.md`](RELEASING.md) — release process.
|
||||
@@ -16,7 +16,7 @@
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_MAIN</DefineConstants>
|
||||
<Version>1.5.0</Version>
|
||||
<Version>1.5.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>Third-party notices</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>Contributors</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>تواصل مع المطور</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>ادعم المشروع</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage مجاني ومفتوح المصدر. إذا ساعدك، فكر في دعم التطوير من خلال إحدى هذه الطرق:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>الإبلاغ عن خطأ</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>يفتح متعقب مشكلات GitHub مع نموذج تقرير الخطأ معبأ مسبقًا.</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>السجل في الوقت الفعلي</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>إيقاف مؤقت</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>Drittanbieterhinweise</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>Mitwirkende</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>Mit dem Entwickler verbinden</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>Projekt unterstützen</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage ist kostenlos und Open Source. Wenn es Ihnen hilft, ziehen Sie in Betracht, die Entwicklung über einen dieser Kanäle zu unterstützen:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>Fehler melden</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>Öffnet den GitHub Issue Tracker mit der vorausgefüllten Fehlerbericht-Vorlage.</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>Echtzeit-Protokoll</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>Pause</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>Avisos de terceros</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>Colaboradores</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>Conecta con el desarrollador</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>Apoyar el proyecto</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage es gratuito y de código abierto. Si te resulta útil, considera apoyar el desarrollo a través de cualquiera de estos canales:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>Reportar un error</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>Abre el rastreador de problemas de GitHub con la plantilla de informe de errores precargada.</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>Registro en tiempo real</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>Pausar</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>Avis tiers</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>Contributeurs</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>Contactez le développeur</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>Soutenir le projet</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage est gratuit et open source. S'il vous est utile, pensez à soutenir le développement via l'un de ces canaux :</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>Signaler un bug</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>Ouvre le suivi des problèmes GitHub avec le modèle de rapport de bug pré-rempli.</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>Journal en temps réel</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>Pause</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>サードパーティ通知</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>貢献者</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>開発者とつながる</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>プロジェクトを支援する</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage は無料のオープンソースソフトウェアです。お役に立てたなら、以下のいずれかで開発をサポートしていただけると幸いです:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>バグを報告</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>GitHub の issue トラッカーをバグレポートテンプレート入りで開きます。</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>リアルタイムログ</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>一時停止</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>타사 고지</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>기여자</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>개발자와 연결</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>프로젝트 후원하기</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage는 무료 오픈소스 소프트웨어입니다. 도움이 되셨다면 다음 중 하나로 개발을 지원해주세요:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>버그 신고</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>GitHub issue 트래커를 버그 신고 템플릿이 미리 입력된 상태로 엽니다.</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>실시간 로그</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>일시 중지</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>Avisos de terceiros</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>Colaboradores</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>Conecte-se com o desenvolvedor</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>Apoiar o projeto</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage é gratuito e de código aberto. Se for útil para você, considere apoiar o desenvolvimento através de qualquer um destes canais:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>Relatar um bug</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>Abre o rastreador de problemas do GitHub com o modelo de relatório de bug pré-preenchido.</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>Log em tempo real</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>Pausar</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>Third-party notices</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>Contributors</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>Connect with the developer</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>Support the project</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage is free and open source. If it helps you, consider supporting development through any of these:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>Report a bug</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>Opens the GitHub issue tracker with the bug report template pre-filled.</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>Real-time log</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>Pause</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>Уведомления о сторонних компонентах</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>Соавторы</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>Связаться с разработчиком</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>Поддержать проект</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage — бесплатное программное обеспечение с открытым исходным кодом. Если оно вам помогает, рассмотрите возможность поддержки разработки одним из следующих способов:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>Сообщить об ошибке</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>Открывает трекер задач GitHub с предзаполненным шаблоном отчета об ошибке.</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>Журнал в реальном времени</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>Пауза</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>Third-party notices</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>Contributors</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>Kết nối với nhà phát triển</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>Ủng hộ project</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage là phần mềm tự do, mã nguồn mở. Nếu công cụ này giúp ích, hãy cân nhắc ủng hộ qua một trong các kênh sau:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>Báo lỗi</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>Mở GitHub issue tracker với template báo lỗi đã điền sẵn.</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>Nhật ký thời gian thực</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>Tạm dừng</value></data>
|
||||
|
||||
@@ -133,6 +133,17 @@
|
||||
<data name="About_OpenThirdParty" xml:space="preserve"><value>第三方声明</value></data>
|
||||
<data name="About_OpenContributors" xml:space="preserve"><value>贡献者</value></data>
|
||||
|
||||
<!-- About — Social Dev / Donate / Report Bug (v1.5.1) -->
|
||||
<data name="About_SocialSection" xml:space="preserve"><value>与开发者联系</value></data>
|
||||
<data name="About_DonateSection" xml:space="preserve"><value>支持项目</value></data>
|
||||
<data name="About_DonateBody" xml:space="preserve"><value>CaptureImage 是免费的开源软件。如果它对您有帮助,请通过以下任一方式支持开发:</value></data>
|
||||
<data name="About_OpenGitHubSponsors" xml:space="preserve"><value>GitHub Sponsors</value></data>
|
||||
<data name="About_OpenKoFi" xml:space="preserve"><value>Ko-fi</value></data>
|
||||
<data name="About_OpenBuyMeACoffee" xml:space="preserve"><value>Buy Me a Coffee</value></data>
|
||||
<data name="About_OpenPatreon" xml:space="preserve"><value>Patreon</value></data>
|
||||
<data name="About_OpenBugReport" xml:space="preserve"><value>报告 Bug</value></data>
|
||||
<data name="About_OpenBugReportHint" xml:space="preserve"><value>打开 GitHub issue 跟踪器,预填 Bug 报告模板。</value></data>
|
||||
|
||||
<!-- Log viewer -->
|
||||
<data name="Log_Title" xml:space="preserve"><value>实时日志</value></data>
|
||||
<data name="Log_Pause" xml:space="preserve"><value>暂停</value></data>
|
||||
|
||||
@@ -67,6 +67,48 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Social Dev — vertical stack of HyperlinkButtons. NavigateUri
|
||||
opens the URL via Windows.System.Launcher (same shell-execute
|
||||
behaviour as the existing OpenUrl helper). -->
|
||||
<StackPanel Spacing="6">
|
||||
<TextBlock Text="{Binding Localization[About_SocialSection]}" FontWeight="SemiBold" />
|
||||
<ItemsControl ItemsSource="{Binding SocialLinks}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<HyperlinkButton NavigateUri="{Binding NavigateUri}"
|
||||
Content="{Binding Label}"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Left" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Donate -->
|
||||
<StackPanel Spacing="6">
|
||||
<TextBlock Text="{Binding Localization[About_DonateSection]}" FontWeight="SemiBold" />
|
||||
<TextBlock Text="{Binding Localization[About_DonateBody]}"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
FontSize="{StaticResource FontSizeSmall}" />
|
||||
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||
<Button Content="{Binding Localization[About_OpenGitHubSponsors]}"
|
||||
Command="{Binding OpenGitHubSponsorsCommand}"
|
||||
Style="{StaticResource AccentButtonStyle}" />
|
||||
<Button Content="{Binding Localization[About_OpenKoFi]}" Command="{Binding OpenKoFiCommand}" />
|
||||
<Button Content="{Binding Localization[About_OpenBuyMeACoffee]}" Command="{Binding OpenBuyMeACoffeeCommand}" />
|
||||
<Button Content="{Binding Localization[About_OpenPatreon]}" Command="{Binding OpenPatreonCommand}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Report Bug — single low-friction action targeting the GitHub
|
||||
bug-report issue template (`.github/ISSUE_TEMPLATE/bug_report.yml`). -->
|
||||
<StackPanel Spacing="4">
|
||||
<Button Content="{Binding Localization[About_OpenBugReport]}"
|
||||
Command="{Binding OpenBugReportCommand}"
|
||||
ToolTipService.ToolTip="{Binding Localization[About_OpenBugReportHint]}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- AI assistance disclosure -->
|
||||
<StackPanel Spacing="4">
|
||||
<TextBlock Text="{Binding Localization[About_AiSection]}" FontWeight="SemiBold" />
|
||||
|
||||
@@ -58,6 +58,20 @@ public sealed partial class AboutViewModel : ViewModelBase
|
||||
new("Stateless", "Apache-2.0", "https://github.com/dotnet-state-machine/stateless"),
|
||||
new("Velopack", "MIT", "https://github.com/velopack/velopack"),
|
||||
};
|
||||
|
||||
// Public-handle scope only — see v1.5.1 hotfix plan. Personal email and
|
||||
// PayPal real-name link are intentionally not surfaced here.
|
||||
SocialLinks = new ObservableCollection<SocialLink>
|
||||
{
|
||||
new("X (Twitter) · @SkullMute0011", new Uri("https://x.com/SkullMute0011")),
|
||||
new("YouTube · @SkullMute", new Uri("https://youtube.com/@SkullMute")),
|
||||
new("Discord (repo) · #general", new Uri("https://discord.gg/2aNR3aVt")),
|
||||
new("Discord (game) · #general", new Uri("https://discord.gg/kDM9GMu5vm")),
|
||||
new("Steam · profile", new Uri("https://steamcommunity.com/profiles/76561199544666292/")),
|
||||
new("Bluesky · @skullmute0011.bsky.social", new Uri("https://bsky.app/profile/skullmute0011.bsky.social")),
|
||||
new("Mastodon · @skullmute1122@mastodon.social", new Uri("https://mastodon.social/@skullmute1122")),
|
||||
new("Telegram · @SkullMute0011", new Uri("https://t.me/SkullMute0011")),
|
||||
};
|
||||
}
|
||||
|
||||
private void OnLocalizationChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
@@ -101,6 +115,8 @@ public sealed partial class AboutViewModel : ViewModelBase
|
||||
|
||||
public ObservableCollection<ThirdPartyItem> ThirdPartyItems { get; }
|
||||
|
||||
public ObservableCollection<SocialLink> SocialLinks { get; }
|
||||
|
||||
// -- legal document open commands ---------------------------------------
|
||||
|
||||
[RelayCommand]
|
||||
@@ -124,6 +140,25 @@ public sealed partial class AboutViewModel : ViewModelBase
|
||||
[RelayCommand]
|
||||
private void OpenRepository() => OpenUrl(RepositoryUrl);
|
||||
|
||||
// -- donate / report commands -------------------------------------------
|
||||
// URLs hardcoded here to match the existing Developer / RepositoryUrl
|
||||
// pattern (line ~80). Mirror of .github/FUNDING.yml — keep in sync.
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenGitHubSponsors() => OpenUrl("https://github.com/sponsors/poli0981");
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenKoFi() => OpenUrl("https://ko-fi.com/skullmute");
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenBuyMeACoffee() => OpenUrl("https://buymeacoffee.com/skullmute");
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenPatreon() => OpenUrl("https://patreon.com/skullmute");
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenBugReport() => OpenUrl("https://github.com/poli0981/captureimg/issues/new?template=bug_report.yml");
|
||||
|
||||
/// <summary>
|
||||
/// Resolve a doc path relative to the app's base directory and open it with the OS
|
||||
/// default handler (Markdown files open in whichever editor the user has associated,
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace CaptureImage.ViewModels.About;
|
||||
|
||||
/// <summary>
|
||||
/// Single entry in the About tab's "Connect with the developer" list. Rendered
|
||||
/// by an <c>ItemsControl</c> in <c>AboutPage.xaml</c>; the <c>HyperlinkButton</c>
|
||||
/// item template binds <see cref="NavigateUri"/> so WinUI 3 opens the URL via
|
||||
/// the system shell handler on click — same behaviour as the OpenUrl helper.
|
||||
/// </summary>
|
||||
/// <param name="Label">User-visible label, e.g. <c>X (Twitter) · @SkullMute0011</c>. Not localized — handles are universal.</param>
|
||||
/// <param name="NavigateUri">Absolute URL to the maintainer's public profile on the platform.</param>
|
||||
public sealed record SocialLink(string Label, Uri NavigateUri);
|
||||
Reference in new issue
Block a user