Packages: only private and public visibility (#21)
Container packages are now private or public, matching Diffinery dropping internal visibility. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ruyx3Qr4jYrZEpPi466deb
Canberk Demirci authored · GitHub committed signed1 parent 70b8cadcommit ec41a5a2dd670b8a2c78324b60891a5795f47eccBrowse files
5 files changed+11−12
Files (5)
modifiedapps/diffinery/src/registry/access.ts+4−4View file
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | * - A package linked to a repository shares its permissions: readers pull, writers push, |
| 11 | 11 | * admins delete. The owner (the user, or the organization's owners and admins) always |
| 12 | 12 | * administers its packages; organization members can push to unlinked ones. |
| 13 | - * - Packages are private unless made internal (any signed-in account pulls) or public. | |
| 13 | + * - Packages are private unless made public. | |
| 14 | 14 | * - A workflow's GITHUB_TOKEN follows the job's `packages` permission. It pulls packages |
| 15 | 15 | * of its own owner, pushes to its repository's packages (creating them, linked to the |
| 16 | 16 | * repository, on first push) and deletes their versions. |
| @@ -63,7 +63,7 @@ | ||
| 63 | 63 | let hint: string | undefined; |
| 64 | 64 | if (pkg) { |
| 65 | 65 | const linked = pkg.repo_id === repo.id; |
| 66 | - if (perm !== "none" && (linked || sameOwner || pkg.visibility !== "private")) role = "pull"; | |
| 66 | + if (perm !== "none" && (linked || sameOwner || pkg.visibility === "public")) role = "pull"; | |
| 67 | 67 | if (perm === "write" && linked) role = "admin"; |
| 68 | 68 | else if (perm === "write" && sameOwner && !pkg.repo_id) role = "push"; |
| 69 | 69 | else if (pkg.repo_id && !linked) hint = `${owner.login}/${pkg.name} belongs to the ${owner.login}/${pkg.repo_name ?? "?"} repository, so only its workflows can push to it`; |
| @@ -107,12 +107,12 @@ | ||
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - if (pkg && (pkg.visibility === "public" || pkg.visibility === "internal")) role = max(role, "pull"); | |
| 110 | + if (pkg?.visibility === "public") role = max(role, "pull"); | |
| 111 | 111 | |
| 112 | 112 | if (p.via === "token") { |
| 113 | 113 | if (p.repoIds) { |
| 114 | 114 | const rid = pkg ? pkg.repo_id : linkRepo?.id; |
| 115 | - if (!rid || !p.repoIds.includes(rid)) role = pkg && pkg.visibility !== "private" ? "pull" : "none"; | |
| 115 | + if (!rid || !p.repoIds.includes(rid)) role = pkg?.visibility === "public" ? "pull" : "none"; | |
| 116 | 116 | } |
| 117 | 117 | const cap = p.scopes.reduce<PackageRole>((best, s) => max(best, SCOPE_CAP[s]), "none"); |
| 118 | 118 | role = min(role, cap); |
modifiedapps/diffinery/src/registry/api.ts+1−1View file
| @@ -115,7 +115,7 @@ | ||
| 115 | 115 | const b = (await c.req.json().catch(() => ({}))) as { visibility?: string; repository?: string | null }; |
| 116 | 116 | const patch: Parameters<RegistryStore["updatePackage"]>[1] = {}; |
| 117 | 117 | if (b.visibility !== undefined) { |
| 118 | - if (!["private", "internal", "public"].includes(b.visibility)) throw new HttpError(422, "visibility must be private, internal or public"); | |
| 118 | + if (!["private", "public"].includes(b.visibility)) throw new HttpError(422, "visibility must be private or public"); | |
| 119 | 119 | patch.visibility = b.visibility as PackageRow["visibility"]; |
| 120 | 120 | } |
| 121 | 121 | if (b.repository !== undefined) { |
modifiedapps/diffinery/src/registry/store.ts+2−2View file
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | name: string; |
| 11 | 11 | repo_id: string | null; |
| 12 | 12 | repo_name: string | null; |
| 13 | - visibility: "private" | "internal" | "public"; | |
| 13 | + visibility: "private" | "public"; | |
| 14 | 14 | description: string | null; |
| 15 | 15 | created_by: string | null; |
| 16 | 16 | created_at: string; |
| @@ -108,7 +108,7 @@ | ||
| 108 | 108 | ors.push(`p.repo_id IN (${filter.repoIds.map(() => "?").join(",")})`); |
| 109 | 109 | params.push(...filter.repoIds); |
| 110 | 110 | } |
| 111 | - ors.push("p.visibility != 'private'"); | |
| 111 | + ors.push("p.visibility = 'public'"); | |
| 112 | 112 | where.push(`(${ors.join(" OR ")})`); |
| 113 | 113 | } |
| 114 | 114 | const q = `SELECT p.*, a.login AS owner_login, a.kind AS owner_kind, r.name AS repo_name, |
modifiedapps/diffinery/src/web/packages.tsx+2−3View file
| @@ -43,7 +43,7 @@ | ||
| 43 | 43 | return { store, pkg, access }; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -const VisIcon = ({ v }: { v: string }) => <span class="st faint">{raw(v === "public" ? ICONS.globe : v === "internal" ? ICONS.org : ICONS.lock)}</span>; | |
| 46 | +const VisIcon = ({ v }: { v: string }) => <span class="st faint">{raw(v === "public" ? ICONS.globe : ICONS.lock)}</span>; | |
| 47 | 47 | |
| 48 | 48 | const PackageList = ({ c, rows, showRepo, empty }: { c: AppContext; rows: Array<PackageRow & { version_count?: number; tag_count?: number }>; showRepo: boolean; empty: Child }) => |
| 49 | 49 | rows.length ? ( |
| @@ -246,7 +246,6 @@ | ||
| 246 | 246 | value={pkg.visibility} |
| 247 | 247 | options={[ |
| 248 | 248 | { value: "private", label: "Private: people with access to the linked repository or the owner" }, |
| 249 | - { value: "internal", label: "Internal: anyone signed in to Diffinery" }, | |
| 250 | 249 | { value: "public", label: "Public: anyone, without signing in" }, |
| 251 | 250 | ]} |
| 252 | 251 | /> |
| @@ -283,7 +282,7 @@ | ||
| 283 | 282 | pkgUrl({ owner_login: owner.login, name }), |
| 284 | 283 | async () => { |
| 285 | 284 | const { store, pkg, access } = await loadPackage(c, owner, name, "admin"); |
| 286 | - const visibility = (["private", "internal", "public"] as const).find((v) => v === f.s("visibility")); | |
| 285 | + const visibility = (["private", "public"] as const).find((v) => v === f.s("visibility")); | |
| 287 | 286 | const repoName = f.s("repository").trim(); |
| 288 | 287 | const repoId = repoName ? (await loadRepo(c, owner.login, repoName, "admin")).repo.id : null; |
| 289 | 288 | await store.updatePackage(pkg.id, { visibility, repoId }); |
modifieddocs/container-registry.md+2−2View file
| @@ -117,8 +117,8 @@ | ||
| 117 | 117 | an image with the label is pushed. |
| 118 | 118 | |
| 119 | 119 | The link can also be changed on the package's settings page or through the |
| 120 | -API. Packages are **private** by default. **Internal** lets every signed-in | |
| 121 | -account pull; **public** lets anyone pull without signing in. | |
| 120 | +API. Packages are **private** by default; **public** lets anyone pull without | |
| 121 | +signing in. | |
| 122 | 122 | |
| 123 | 123 | Pages: |
| 124 | 124 |