Skip to content

[Chore]: Extract hardcoded owner/repo strings to a shared constant #46

Description

@shivanshshrivas

Description

The GitHub repository owner and repo name appear hardcoded in two separate locations in src/main/updater.ts:

// src/main/updater.ts — line ~50-51
const owner = "shivanshshrivas";
const repo = "tempdlm";

// src/main/updater.ts — line ~127 (shell:open-external allowlist)
url.startsWith("https://github.com/shivanshshrivas/tempdlm/")

These strings also appear in package.json's build.publish config. If the repository is ever transferred, renamed, or forked, these values silently diverge. Specifically:

  • Auto-update checks would continue hitting the original repo's release feed.
  • The shell:open-external URL allowlist would silently reject links from the new repo URL.

Recommended fix:

Add a single REPO constant to src/shared/types.ts:

// ── Repository ────────────────────────────────────────────────────────────────
/**
 * GitHub repository coordinates. Single source of truth for owner, repo name,
 * and origin URL — used by the updater and the shell:open-external allowlist.
 */
export const REPO = {
  owner: "shivanshshrivas",
  repo: "tempdlm",
  origin: "https://github.com/shivanshshrivas/tempdlm/",
} as const;

Then in src/main/updater.ts, replace the two hardcoded occurrences:

import { REPO } from "../shared/types";

// Line ~50-51:
const owner = REPO.owner;
const repo = REPO.repo;

// Line ~127:
url.startsWith(REPO.origin)

Files to modify:

  • src/shared/types.ts — add REPO constant export in a new // ── Repository sub-section.
  • src/main/updater.ts — import REPO and replace the two hardcoded string sites.

Docs to update as part of this fix:

  • docs/security.md §7 "Auto-Update Security" — update the code snippet showing the shell:open-external allowlist check to reference the REPO.origin constant, and note that the allowlist value is the canonical REPO constant from src/shared/types.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreMaintenance, refactoring, CI/CD, or other non-feature workp3Non-critical improvement; work on when higher priorities are clear.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions