mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-14 00:07:00 +01:00
Backend, scripts, docs and their tests take main's newer code where both sides changed the same lines (the shared blob cache, GitHubStream and markdown fixes landed on main after the Go migration branch was cut). The Dockerfile keeps the Go build from the migration, plus main's owner-alert-protocol label; .gitignore keeps both sides' entries. Frontend keeps the redesign and folds in main's features: Stripe billing in the New anonymization submit bar, GitHub access repair, redaction syntax help, the preview expand toggle, configurable redaction mask, folder counts, reviewer-route header rules, link expiry (now in the viewer's snapshot details) and the explorer error card. main's narrow-only wrap logic is dropped because the redesign wraps on desktop and scrolls sideways on phones. Tests: 1534 passing with SESSION_SECRET set (as in CI). Three main tests were updated for the agreed viewer design (no site header in the viewer, no repository-wide file count). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
68 lines
8.2 KiB
HTML
68 lines
8.2 KiB
HTML
<div class="container paper-page connections-page">
|
|
<div class="paper-crumbs"><a href="/dashboard">My work</a> / <span class="here">GitHub connections</span></div>
|
|
<header class="connections-heading">
|
|
<h1 class="paper-page-title">GitHub <em>connections</em></h1>
|
|
<p class="paper-page-lede">Manage how GitHub shares your code. Your anonymizations and URLs stay the same.</p>
|
|
</header>
|
|
<p class="paper-inline-alert paper-inline-alert-error" role="alert" v-if="connectionError">{{ connectionError }}</p>
|
|
<p role="status" v-if="!connections && !connectionError">Loading your connections…</p>
|
|
<button class="btn btn-outline-ink" v-if="!connections && connectionError" :disabled="busy" @click="loadConnections()">Try again</button>
|
|
<div v-if="connections">
|
|
<section class="connection-resources" v-if="connections.emailNotificationsEnabled">
|
|
<h2>Email alerts</h2>
|
|
<p>We will email you if your GitHub connection stops working or a repository becomes inaccessible. Your address is never shown on anonymous pages.</p>
|
|
<form @submit.prevent="saveNotificationEmail()">
|
|
<label for="notification-email">Email address</label>
|
|
<input id="notification-email" class="form-control" type="email" autocomplete="email" maxlength="254" required v-model="notificationEmail" :disabled="busy" />
|
|
<button class="btn btn-ink mt-2" type="submit" :disabled="busy">Save email address</button>
|
|
<p v-if="emailSaved" role="status">Email address saved.</p>
|
|
</form>
|
|
</section>
|
|
<div class="connections-grid">
|
|
<section v-if="connections.appEnabled">
|
|
<div class="connection-top"><i class="fab fa-github" aria-hidden="true"></i><span class="connection-badge">Recommended</span></div>
|
|
<div class="connection-title"><h2>GitHub App</h2><span class="connection-status" :class="{'is-connected': connections.appConnected && !connections.appError}">{{ connections.appError ? 'Needs attention' : connections.appConnected ? 'Connected' : 'Not connected' }}</span></div>
|
|
<p>Read-only access to gists and the repositories you choose.</p>
|
|
<p class="paper-inline-alert paper-inline-alert-error" v-if="connections.appError" role="alert">{{ connections.appError }}. Reconnect to restore access.</p>
|
|
<div class="connection-actions">
|
|
<a class="btn btn-ink" v-if="connections.appConnected && !connections.appError" target="_self" href="/github/app/install">Manage repository access <svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-external-link"></use></svg></a>
|
|
<a :class="connections.appConnected && !connections.appError ? 'connection-link' : 'btn btn-ink'" target="_self" href="/github/app/login">{{ connections.appConnected ? 'Reconnect account' : 'Connect GitHub account' }}</a>
|
|
<button class="connection-link connection-refresh" title="Refresh access" v-if="connections.appConnected" :disabled="busy" @click="loadConnections()"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-refresh"></use></svg><span class="sr-only">Refresh access</span></button>
|
|
</div>
|
|
<p class="connection-help">Choose repositories on GitHub. Organization access may need an administrator's approval.</p>
|
|
<ul class="connection-installations" v-if="connections.installations?.length">
|
|
<li v-for="installation in connections.installations" :key="installation.id"><div><span class="connection-label">Installed on</span> <strong>{{ installation.account }}</strong><span v-if="installation.suspended"> · Suspended</span></div><a v-if="connections.installations.length > 1" target="_self" :href="'/github/app/install?installationId=' + installation.id">Manage access <span class="sr-only">for {{ installation.account }}</span> →</a></li>
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<div class="connection-top"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-key"></use></svg><span class="connection-badge connection-badge-muted">Legacy</span></div>
|
|
<div class="connection-title"><h2>GitHub OAuth</h2><span class="connection-status" :class="{'is-connected': connections.oauthConnected}">{{ connections.oauthConnected ? 'Connected' : 'Not connected' }}</span></div>
|
|
<p>For existing OAuth anonymizations.</p>
|
|
<p class="connection-help">This connection uses GitHub's broader repository permissions. Existing work keeps using it until you switch below.</p>
|
|
<a v-if="connections.oauthEnabled" target="_self" href="/github/login" class="btn btn-outline-ink">{{ connections.oauthConnected ? 'Reconnect OAuth' : 'Connect legacy OAuth' }}</a>
|
|
<div class="connection-revoke" v-if="connections.oauthConnected">
|
|
<p v-if="connections.gistCount">{{ connections.gistCount }} gist(s) use your GitHub App connection when available.</p>
|
|
<p>Switch all dependent repositories before revoking access. Gists can use your GitHub App connection.</p>
|
|
<button v-if="connections.appConnected" class="btn btn-sm btn-outline-danger connection-danger" :disabled="busy || connections.resources.some(r => r.connection === 'oauth')" @click="disconnectOAuth()">Revoke OAuth access</button>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<section class="connection-resources">
|
|
<div class="connection-title"><h2>Repository connections</h2><span class="connection-count">{{ connections.resources?.length || 0 }} {{ (connections.resources?.length || 0) === 1 ? 'resource' : 'resources' }}</span></div>
|
|
<p>Check access, then switch each resource to the GitHub App. After reinstalling the App, reconnect existing resources here to keep their anonymous URLs and published snapshots.</p>
|
|
<div class="connection-empty" v-if="!connections.resources?.length"><svg class="ui-icon" aria-hidden="true"><use href="#project-type-repo"></use></svg><div><h3>No repository connections yet</h3><p>Your repositories and pull requests will appear here once you anonymize them.</p></div><a class="connection-link" href="/anonymize">New anonymization →</a></div>
|
|
<div class="connection-resource" v-for="resource in connections.resources" :key="resource.type + resource.id">
|
|
<div class="connection-resource-name"><strong>{{ resource.name || resource.id }}</strong><small>{{ resource.type }} · {{ resource.id }}</small></div>
|
|
<span class="connection-badge" :class="{'connection-badge-muted': resource.connection === 'oauth'}">{{ resource.connection === 'github-app' ? 'Read-only App' : 'Legacy OAuth' }}</span>
|
|
<div class="connection-resource-actions" v-if="!['archived', 'removed', 'preparing', 'queue', 'removing', 'expiring'].includes(resource.status) && (resource.status !== 'download' || (resource.type === 'pull-request' && (!resource.statusDate || new Date(resource.statusDate).getTime() <= Date.now() - 300000))) && connections.appEnabled && connections.appConnected">
|
|
<button class="btn btn-outline-ink" :disabled="busy" @click="changeConnection(resource, 'github-app', true)">Check read-only access</button>
|
|
<button v-if="resource.eligible" class="btn btn-ink" :disabled="busy" @click="changeConnection(resource, 'github-app', false)">{{ resource.connection === 'github-app' ? 'Reconnect read-only access' : 'Switch to read-only access' }}</button>
|
|
<span class="connection-help" role="status" v-if="resource.eligible === false">Access unavailable. Allow this repository on GitHub, then check again.</span>
|
|
</div>
|
|
<button v-if="!['archived', 'removed', 'preparing', 'queue', 'removing', 'expiring'].includes(resource.status) && (resource.status !== 'download' || (resource.type === 'pull-request' && (!resource.statusDate || new Date(resource.statusDate).getTime() <= Date.now() - 300000))) && resource.connection === 'github-app' && connections.oauthConnected" class="connection-link" :disabled="busy" @click="changeConnection(resource, 'oauth', false)">Use OAuth</button>
|
|
</div>
|
|
<p class="connection-footnote"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-info"></use></svg> Removing access stops new fetches from GitHub. Published content keeps its current expiration and removal settings.</p>
|
|
</section>
|
|
</div>
|
|
</div>
|