chore: rename project to github-to-gitea-mirror

The old name left the mirror direction open — it could just as well be read
as Gitea being the source. Naming source and target in that order removes the
ambiguity for anyone setting this up, and matches the title the README already
carried.

The name is not just internal: it is the install directory and the identifier
both APIs record in their request logs, so an inconsistent name would stay
visible in places that are awkward to correct after the fact.

Existing installations are not migrated. The old directory and its cron entry
survive an installer re-run and would sync a second time in parallel, so they
need to be removed by hand.
This commit is contained in:
Andre
2026-08-08 11:19:20 +02:00
parent ecc8aa1c1a
commit 6ff4da99e4
4 changed files with 16 additions and 16 deletions
+4 -4
View File
@@ -95,7 +95,7 @@ def api(url, token=None, scheme="token", method="GET", payload=None):
data = None
headers = {
"Accept": "application/json",
"User-Agent": "gitea-github-mirror/1.0",
"User-Agent": "github-to-gitea-mirror/1.0",
}
if payload is not None:
data = json.dumps(payload).encode("utf-8")
@@ -137,7 +137,7 @@ def download_github_asset(cfg, asset):
"""Download a release asset into a temporary file without buffering it in RAM."""
headers = {
"Accept": "application/octet-stream",
"User-Agent": "gitea-github-mirror/1.0",
"User-Agent": "github-to-gitea-mirror/1.0",
}
if cfg["GITHUB_TOKEN"]:
headers["Authorization"] = "Bearer %s" % cfg["GITHUB_TOKEN"]
@@ -169,7 +169,7 @@ def upload_release_asset(cfg, repo_name, release_id, asset, source, size):
% (cfg["GITEA_URL"], path_part(cfg["GITEA_OWNER"]), path_part(repo_name),
release_id, query))
parsed = urllib.parse.urlsplit(url)
boundary = "----gitea-github-mirror-%s" % uuid.uuid4().hex
boundary = "----github-to-gitea-mirror-%s" % uuid.uuid4().hex
safe_name = str(asset["name"]).replace("\\", "_").replace('"', "_")
safe_name = safe_name.replace("\r", "_").replace("\n", "_")
content_type = asset.get("content_type") or "application/octet-stream"
@@ -195,7 +195,7 @@ def upload_release_asset(cfg, repo_name, release_id, asset, source, size):
conn.putheader("Accept", "application/json")
conn.putheader("Content-Type", "multipart/form-data; boundary=%s" % boundary)
conn.putheader("Content-Length", str(len(preamble) + size + len(ending)))
conn.putheader("User-Agent", "gitea-github-mirror/1.0")
conn.putheader("User-Agent", "github-to-gitea-mirror/1.0")
conn.endheaders()
conn.send(preamble)
while True: