mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-12 21:58:57 +02:00
Merge pull request #820 from tdurieux/codex/github-dashboard-actions
style: clarify GitHub sign-in and connection management
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"core.min.js": "core.c5bd53363a.min.js",
|
||||
"vendor.min.js": "vendor.cbc8c2964d.min.js",
|
||||
"vendor.min.js": "vendor.0155114e4b.min.js",
|
||||
"mermaid.min.js": "mermaid.f848a72d16.min.js",
|
||||
"all.min.css": "all.7ac8730b9a.min.css",
|
||||
"all.min.css": "all.6a5e0ae79b.min.css",
|
||||
"markdown.min.js": "markdown.ad7b1d71c3.min.js",
|
||||
"pdf.min.js": "pdf.eaa7573247.min.js",
|
||||
"notebook.min.js": "notebook.8844e2735f.min.js",
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+127
-2
@@ -5049,7 +5049,7 @@ textarea::selection {
|
||||
text-align: center;
|
||||
border-top: 1px solid var(--border-soft, var(--border-color));
|
||||
}
|
||||
.paper-table .paper-table-empty i { font-size: 1.6rem; color: var(--ink-faint); }
|
||||
.paper-table .paper-table-empty > i { font-size: 1.6rem; color: var(--ink-faint); }
|
||||
.paper-table .paper-table-empty-actions { display: flex; gap: 8px; margin-top: 8px; }
|
||||
|
||||
.bulk-bar {
|
||||
@@ -5268,7 +5268,7 @@ textarea::selection {
|
||||
gap: 8px;
|
||||
border-top: 1px solid var(--border-soft, var(--border-color));
|
||||
}
|
||||
.paper-table-empty i { font-size: 1.6rem; }
|
||||
.paper-table-empty > i { font-size: 1.6rem; }
|
||||
|
||||
/* ===== Queue dashboard (redesigned) ===== */
|
||||
.q-header {
|
||||
@@ -7030,3 +7030,128 @@ body {
|
||||
.overview-page .ov-kpi-row { grid-template-columns: 1fr 1fr; }
|
||||
.overview-page .ov-services-grid { grid-template-columns: 1fr 1fr; }
|
||||
}
|
||||
|
||||
/* Keep account access secondary to creating an anonymization. */
|
||||
.dashboard-heading-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-bottom: 12px; }
|
||||
.dashboard-heading-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
|
||||
.dashboard-connections-link { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; color: var(--ink-muted); font-size: 12px; line-height: 1.5; }
|
||||
.dashboard-connections-link:hover { color: var(--accent); text-decoration: none; }
|
||||
.dashboard-connections-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
|
||||
@media (max-width: 767px) {
|
||||
.dashboard-heading-actions { align-items: flex-start; padding-bottom: 0; gap: 4px; }
|
||||
.dashboard-connections-link { min-height: 44px; }
|
||||
}
|
||||
|
||||
.paper-settings-connection-link { display: flex; align-items: center; gap: 12px; padding: 18px 0; color: var(--color); font-size: 14px; }
|
||||
.paper-settings-connection-link > i { color: var(--ink-muted); font-size: 18px; }
|
||||
.paper-settings-connection-link > span:first-of-type { flex: 1; }
|
||||
.paper-settings-connection-link small { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 12px; }
|
||||
.paper-settings-connection-link:hover { color: var(--accent); text-decoration: none; }
|
||||
.paper-settings-connection-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
|
||||
|
||||
/* GitHub connections use the same open sections as account settings. */
|
||||
.connections-heading { margin-bottom: 36px; }
|
||||
.connections-heading .paper-page-title { font-size: clamp(38px, 4.5vw, 56px); margin-bottom: 12px; }
|
||||
.connections-heading .paper-page-lede { font-size: 15px; }
|
||||
.connections-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; align-items: start; border-top: 1px solid var(--border-color); padding-top: 28px; }
|
||||
.connections-grid > section { min-width: 0; }
|
||||
.connection-top, .connection-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
|
||||
.connection-top { margin-bottom: 24px; min-height: 28px; }
|
||||
.connection-top > i { color: var(--ink-muted); font-size: 24px; }
|
||||
.connection-top > .fa-key { font-size: 18px; }
|
||||
.connection-title { margin-bottom: 10px; }
|
||||
.connections-page h2 { font-family: inherit; font-size: 21px; font-weight: 600; letter-spacing: -.5px; margin: 0; }
|
||||
.connections-page p { font-size: 14px; line-height: 1.65; color: var(--ink-muted); }
|
||||
.connection-badge { background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; border-radius: 5px; padding: 4px 8px; white-space: nowrap; }
|
||||
.connection-badge-muted { background: var(--paper-bg-alt); color: var(--ink-muted); }
|
||||
.connection-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-muted); }
|
||||
.connection-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
|
||||
.connection-status.is-connected { color: var(--status-ready); }
|
||||
.connection-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 22px 0 16px; }
|
||||
.connections-page .btn { font-size: 13px; padding: 9px 13px; white-space: normal; }
|
||||
.connections-page .connection-help, .connection-revoke p { font-size: 12px; }
|
||||
.connection-link { display: inline-flex; align-items: center; gap: 8px; border: 0; padding: 0; background: transparent; color: var(--accent); font-size: 13px; line-height: 1.6; font-weight: 500; text-align: left; cursor: pointer; }
|
||||
.connection-link:hover { color: var(--link-hover-color); text-decoration: underline; }
|
||||
.connection-link:disabled { color: var(--ink-muted); opacity: .65; cursor: not-allowed; text-decoration: none; }
|
||||
.connection-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
|
||||
.connection-installations { list-style: none; padding: 0; margin: 18px 0; border-top: 1px solid var(--border-soft); }
|
||||
.connection-installations li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 0; font-size: 12px; border-bottom: 1px solid var(--border-soft); }
|
||||
.connection-revoke { border-top: 1px solid var(--border-soft); padding-top: 18px; margin-top: 24px; }
|
||||
.connection-danger { color: var(--status-error); }
|
||||
.connection-resources { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--border-color); }
|
||||
.connection-count { color: var(--ink-muted); font-size: 12px; }
|
||||
.connection-empty { display: flex; align-items: center; gap: 18px; padding: 20px 0; margin: 22px 0; }
|
||||
.connection-empty > i { font-size: 22px; color: var(--ink-muted); }
|
||||
.connection-empty h3 { font-size: 14px; font-weight: 600; margin: 0 0 5px; }
|
||||
.connection-empty p { font-size: 12px; margin: 0; }
|
||||
.connection-empty > a { margin-left: auto; flex-shrink: 0; }
|
||||
.connection-resource { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px 0; border-bottom: 1px solid var(--border-color); }
|
||||
.connection-resource-name { flex: 1; min-width: 180px; overflow-wrap: anywhere; font-size: 14px; }
|
||||
.connection-resource-name small { display: block; color: var(--ink-muted); font-size: 11px; margin-top: 5px; }
|
||||
.connection-resource-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
||||
.connection-resource-actions .connection-help { flex-basis: 100%; }
|
||||
.connections-page .connection-footnote { display: flex; align-items: baseline; gap: 10px; margin-top: 22px; font-size: 12px; }
|
||||
@media (max-width: 767px) {
|
||||
.connections-grid { grid-template-columns: 1fr; gap: 28px; }
|
||||
.connections-grid > section + section { border-top: 1px solid var(--border-color); padding-top: 28px; }
|
||||
.connection-empty { flex-wrap: wrap; }
|
||||
.connection-empty > div { flex: 1; min-width: 180px; }
|
||||
.connection-empty > a { margin-left: 40px; }
|
||||
.connection-resource-actions { flex-basis: 100%; }
|
||||
}
|
||||
|
||||
.paper-table-empty-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
|
||||
.paper-table-empty-actions .btn > i { font-size: 1em; line-height: 1; color: inherit; margin-right: 0 !important; }
|
||||
.auth-back { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-muted); margin-bottom: 48px; }
|
||||
.auth-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
|
||||
.auth-intro, .auth-options { padding-top: 28px; }
|
||||
.auth-title-mobile { display: none; }
|
||||
.auth-intro .paper-page-title { font-size: clamp(48px, 5vw, 76px); line-height: 1.06; margin: 18px 0 24px; }
|
||||
.auth-intro .paper-page-lede { max-width: 330px; }
|
||||
.auth-options { display: grid; gap: 28px; }
|
||||
.auth-options h2 { font-family: inherit; font-size: 21px; font-weight: 600; margin: 0 0 10px; }
|
||||
.auth-options p { font-size: 14px; line-height: 1.65; color: var(--ink-muted); }
|
||||
.auth-options .auth-existing { font-size: 12px; border-left: 2px solid var(--accent); padding-left: 14px; margin: 0; }
|
||||
.auth-permissions { padding: 6px 0 12px; list-style: none; font-size: 13px; line-height: 1.6; }
|
||||
.auth-permissions li { display: flex; gap: 10px; margin: 12px 0; }
|
||||
.auth-permissions i { color: var(--status-ready); margin-top: 4px; }
|
||||
.auth-continue { display: flex !important; align-items: center; justify-content: space-between; min-height: 48px; padding: 12px 16px !important; }
|
||||
.auth-options small { display: block; font-size: 12px; text-align: center; color: var(--ink-muted); margin-top: 12px; }
|
||||
.auth-legacy { border-top: 1px solid var(--border-color); padding-top: 24px; }
|
||||
.auth-legacy h2 { font-size: 16px; margin: 0; }
|
||||
.auth-legacy p { font-size: 13px; }
|
||||
.repo-access { max-width: 1036px; margin: 24px auto 0; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
|
||||
.repo-access-main { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 0; flex-wrap: wrap; }
|
||||
.repo-access-heading { display: flex; align-items: center; gap: 12px; }
|
||||
.repo-access-heading > i { font-size: 22px; color: var(--ink-muted); }
|
||||
.repo-access-heading h2 { font-family: inherit; font-size: 13px; font-weight: 600; margin: 0 0 4px; }
|
||||
.repo-access-heading p { font-size: 12px; color: var(--ink-muted); margin: 0; }
|
||||
.repo-access-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
|
||||
.repo-access-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--border-color); border-radius: 7px; flex-wrap: wrap; }
|
||||
.repo-access-switch button { border: 0; border-radius: 4px; background: transparent; color: var(--ink-muted); padding: 7px 10px; font: inherit; font-size: 12px; cursor: pointer; }
|
||||
.repo-access-switch button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); opacity: 1; cursor: default; font-weight: 600; }
|
||||
.repo-access-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
.repo-access .btn { font-size: 12px; padding: 8px 12px; }
|
||||
.repo-access-note { display: flex; gap: 6px 16px; flex-wrap: wrap; padding: 0 0 14px; color: var(--ink-muted); font-size: 11px; line-height: 1.6; }
|
||||
@media (max-width: 1100px) { .repo-access { margin-left: 24px; margin-right: 24px; } }
|
||||
@media (max-width: 767px) {
|
||||
.auth-page { max-width: 480px; }
|
||||
.auth-back, .auth-intro .paper-eyebrow, .auth-title-desktop { display: none; }
|
||||
.auth-title-mobile { display: inline; }
|
||||
.auth-layout { grid-template-columns: 1fr; gap: 24px; }
|
||||
.auth-intro, .auth-options { padding-top: 0; }
|
||||
.auth-intro .paper-page-title { font-size: 40px; line-height: 1.15; margin: 6px 0 12px; }
|
||||
.auth-intro .paper-page-lede { max-width: none; font-size: 14px; margin: 0; }
|
||||
.auth-options { gap: 24px; }
|
||||
.auth-options .connection-top { margin-bottom: 16px; }
|
||||
.auth-options h2 { font-size: 18px; }
|
||||
.auth-options p { font-size: 13px; margin-bottom: 12px; }
|
||||
.auth-permissions { padding: 0; margin: 14px 0 20px; font-size: 12px; }
|
||||
.auth-permissions li { margin: 8px 0; }
|
||||
.auth-continue { font-size: 14px; }
|
||||
.auth-legacy { padding-top: 20px; }
|
||||
.auth-legacy h2 { font-size: 15px; }
|
||||
.auth-legacy .connection-link { min-height: 44px; }
|
||||
.repo-access { margin: 16px 18px 0; }
|
||||
.repo-access-controls { width: 100%; gap: 12px; }
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
<div class="anonymize-page h-100">
|
||||
<div class="container py-3" v-if="githubConnections?.appEnabled">
|
||||
<span v-if="isUpdate">Connection: {{ githubConnection === 'github-app' ? 'GitHub App (read-only)' : 'Legacy OAuth' }}. <a href="/connections">Change connection</a></span>
|
||||
<span v-if="!isUpdate">Repository access:
|
||||
<button class="btn" :disabled="githubConnection === 'github-app'" @click="chooseGitHubConnection('github-app')">Read-only GitHub App</button>
|
||||
<button v-if="githubConnections?.oauthConnected" class="btn" :disabled="githubConnection === 'oauth'" @click="chooseGitHubConnection('oauth')">Use existing OAuth access</button>
|
||||
</span>
|
||||
<button class="btn btn-ink" @click="grantGitHubAccess()">{{ githubConnections?.appConnected ? 'Allow repository access on GitHub' : 'Connect read-only GitHub access' }}</button>
|
||||
<p class="mb-0"><small>Return here after confirming access on GitHub. Anonymization publishes the configured content, including content from private repositories. Gists currently use OAuth.</small></p>
|
||||
</div>
|
||||
<aside class="repo-access" aria-label="GitHub access" v-if="githubConnections?.appEnabled && githubConnections.appConnected && githubConnections.oauthConnected">
|
||||
<div class="repo-access-main">
|
||||
<div class="repo-access-heading"><i class="fab fa-github" aria-hidden="true"></i><div><h2>{{ detectedType === 'gist' ? 'Gist access' : 'Repository access' }}</h2><p>{{ detectedType === 'gist' ? 'Gists use your OAuth connection.' : 'Choose how we read your source code.' }}</p></div></div>
|
||||
<div class="repo-access-controls">
|
||||
<div class="repo-access-switch" role="group" aria-label="Repository connection" v-if="!isUpdate && detectedType !== 'gist'">
|
||||
<button type="button" :aria-pressed="githubConnection === 'github-app'" :disabled="githubConnection === 'github-app'" @click="chooseGitHubConnection('github-app')"><i class="fas fa-shield-alt" aria-hidden="true"></i> Read-only GitHub App</button>
|
||||
<button type="button" :aria-pressed="githubConnection === 'oauth'" :disabled="githubConnection === 'oauth'" @click="chooseGitHubConnection('oauth')">Legacy OAuth</button>
|
||||
</div>
|
||||
<span class="connection-badge" v-if="isUpdate || detectedType === 'gist'">{{ detectedType !== 'gist' && githubConnection === 'github-app' ? 'Read-only GitHub App' : 'Legacy OAuth' }}</span>
|
||||
<button type="button" class="btn btn-outline-ink" v-if="detectedType !== 'gist' && githubConnection !== 'oauth'" @click="grantGitHubAccess()">Manage access <i class="fas fa-external-link-alt" aria-hidden="true"></i></button>
|
||||
<a class="connection-link" href="/connections" v-if="isUpdate || detectedType === 'gist' || githubConnection === 'oauth'">{{ isUpdate ? 'Change connection' : 'Manage connections' }} →</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="repo-access-note"><span v-if="detectedType !== 'gist' && githubConnection !== 'oauth'">Select repositories on GitHub, then return here.</span><span><i class="fas fa-info-circle" aria-hidden="true"></i> Selected content will be published, including content from private repositories.</span></div>
|
||||
</aside>
|
||||
<!-- ===== STATE 1: No URL — centered input ===== -->
|
||||
<div class="anonymize-landing" v-show="!(sourceUrl)">
|
||||
<div class="anonymize-landing-inner">
|
||||
|
||||
@@ -1,44 +1,57 @@
|
||||
<div class="container page paper-page">
|
||||
<div class="paper-crumbs"><a href="/dashboard">My work</a> / GitHub connections</div>
|
||||
<h1 class="paper-page-title">GitHub <em>connections</em></h1>
|
||||
<p>Connect the GitHub account you use here. Your anonymizations and URLs stay the same.</p>
|
||||
<p class="alert alert-danger" role="alert" v-if="connectionError">{{ connectionError }}</p>
|
||||
<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="paper-settings-section" v-if="connections.appEnabled">
|
||||
<h2>Read-only GitHub App</h2>
|
||||
<p v-if="connections.appError" role="alert">{{ connections.appError }}. Reconnect to restore access.</p>
|
||||
<a class="btn btn-ink" target="_self" href="/github/app/login">{{ connections.appConnected ? 'Reconnect GitHub account' : 'Connect GitHub account' }}</a>
|
||||
<a class="btn" v-if="connections.appConnected" target="_self" href="/github/app/install">Allow repositories on GitHub</a>
|
||||
<p class="mt-2">GitHub opens directly to the access screen. Select repositories and confirm. Organization access may require an administrator's approval.</p>
|
||||
<ul>
|
||||
<li v-for="installation in connections.installations" :key="installation.id">
|
||||
{{ installation.account }} {{ installation.suspended ? '(suspended)' : '' }} —
|
||||
<a target="_self" :href="'/github/app/install?installationId=' + installation.id">Add or remove repository access</a>
|
||||
</li>
|
||||
</ul>
|
||||
<button class="btn" :disabled="busy" @click="loadConnections()">Refresh access after approval</button>
|
||||
</section>
|
||||
<section class="paper-settings-section">
|
||||
<h2>Legacy OAuth</h2>
|
||||
<p>{{ connections.oauthConnected ? 'Connected' : 'Not connected' }}. Existing OAuth anonymizations continue to use this connection.</p>
|
||||
<a v-if="connections.oauthEnabled" target="_self" href="/github/login" class="btn">Connect legacy OAuth</a>
|
||||
<p v-if="connections.gistCount">{{ connections.gistCount }} gist(s) still require OAuth.</p>
|
||||
<button v-if="connections.oauthConnected && connections.appConnected" class="btn" :disabled="busy || connections.gistCount || connections.resources.some(r => r.connection === 'oauth')" @click="disconnectOAuth()">Revoke OAuth access</button>
|
||||
<p>Migrate all dependent resources before revoking OAuth. Revocation removes GitHub's broad OAuth repository grant.</p>
|
||||
</section>
|
||||
<section class="paper-settings-section">
|
||||
<h2>Repository connections</h2>
|
||||
<p>Check read-only access, then switch each resource. Connecting the App alone does not change existing resources.</p>
|
||||
<p>Removing GitHub access stops fetching new source content. Already published anonymized content follows its existing expiration and removal settings.</p>
|
||||
<div v-for="resource in connections.resources" :key="resource.type + resource.id" class="mb-3">
|
||||
<strong>{{ resource.id }}</strong> — {{ resource.name }} ({{ resource.type }})<br>
|
||||
Connection: {{ resource.connection === 'github-app' ? 'GitHub App (read-only)' : 'Legacy OAuth' }}
|
||||
<div v-if="resource.connection === 'oauth' && connections.appEnabled && connections.appConnected">
|
||||
<button class="btn" :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)">Switch to read-only access</button>
|
||||
<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 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 <i class="fas fa-external-link-alt" aria-hidden="true"></i></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>
|
||||
</div>
|
||||
<button v-if="resource.connection === 'github-app' && connections.oauthConnected" class="btn" :disabled="busy" @click="changeConnection(resource, 'oauth', false)">Switch to existing OAuth access</button>
|
||||
<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><strong>{{ installation.account }}</strong><span v-if="installation.suspended"> · Suspended</span></div><a target="_self" :href="'/github/app/install?installationId=' + installation.id">Manage access <span class="sr-only">for {{ installation.account }}</span> →</a></li>
|
||||
</ul>
|
||||
<button class="connection-link" :disabled="busy" @click="loadConnections()"><i class="fas fa-sync-alt" aria-hidden="true"></i> Refresh access</button>
|
||||
</section>
|
||||
<section>
|
||||
<div class="connection-top"><i class="fas fa-key" aria-hidden="true"></i><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 and gists.</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) still require OAuth.</p>
|
||||
<p>Switch all dependent repositories before revoking access. Gists still require OAuth.</p>
|
||||
<button v-if="connections.appConnected" class="connection-link connection-danger" :disabled="busy || connections.gistCount || 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 }} resources</span></div>
|
||||
<p>Check access, then switch each resource to the GitHub App.</p>
|
||||
<div class="connection-empty" v-if="!connections.resources?.length"><i class="fas fa-code-branch" aria-hidden="true"></i><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="resource.connection === 'oauth' && 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)">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="resource.connection === 'github-app' && connections.oauthConnected" class="connection-link" :disabled="busy" @click="changeConnection(resource, 'oauth', false)">Use OAuth</button>
|
||||
</div>
|
||||
<p class="connection-footnote"><i class="fas fa-info-circle" aria-hidden="true"></i> Removing access stops new fetches from GitHub. Published content keeps its current expiration and removal settings.</p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,13 +7,16 @@
|
||||
<h1 class="paper-page-title">Your <em>anonymizations</em></h1>
|
||||
<p class="paper-page-lede">Every repository, pull request, and gist you’ve mirrored, with live status and stats.</p>
|
||||
</div>
|
||||
<a href="/anonymize" class="btn btn-ink">
|
||||
<i class="fa fa-plus-circle mr-1" aria-hidden="true"></i> New anonymization
|
||||
</a>
|
||||
<div class="dashboard-heading-actions">
|
||||
<a href="/anonymize" class="btn btn-ink">
|
||||
<i class="fa fa-plus-circle" aria-hidden="true"></i> New anonymization
|
||||
</a>
|
||||
<a href="/connections" class="dashboard-connections-link">
|
||||
<i class="fab fa-github" aria-hidden="true"></i> GitHub connections <span aria-hidden="true">→</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="mt-3"><a href="/connections">Manage GitHub connections and read-only access</a></p>
|
||||
|
||||
<!-- Quota -->
|
||||
<div class="quota-row" v-if="quota">
|
||||
<div class="quota-item" v-for="(q, index) in [
|
||||
|
||||
@@ -75,11 +75,14 @@
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right user-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<h6 class="dropdown-header">Signed in as @{{ user?.username }}</h6>
|
||||
<a class="dropdown-item" href="/connections">GitHub connections</a>
|
||||
<a class="dropdown-item" href="/profile">
|
||||
<i class="fas fa-sliders-h" aria-hidden="true"></i>
|
||||
<span>Settings<small>Defaults, quotas, account</small></span>
|
||||
</a>
|
||||
<a class="dropdown-item" href="/connections">
|
||||
<i class="fab fa-github" aria-hidden="true"></i>
|
||||
<span>GitHub connections<small>Repository access and OAuth</small></span>
|
||||
</a>
|
||||
<a class="dropdown-item" href="/claim">
|
||||
<i class="fas fa-link" aria-hidden="true"></i>
|
||||
<span>Claim an anonymization<small>Attach an existing mirror to your account</small></span>
|
||||
|
||||
@@ -165,6 +165,12 @@ jane.smith@example.org" v-field="{ state: viewState, set: value => { terms =
|
||||
<a class="btn btn-outline-ink" href="/api/user/logout" target="_self">Sign out</a>
|
||||
</div>
|
||||
|
||||
<a class="paper-settings-connection-link" href="/connections">
|
||||
<i class="fab fa-github" aria-hidden="true"></i>
|
||||
<span>GitHub connections<small>Manage repository access and legacy OAuth.</small></span>
|
||||
<span aria-hidden="true">→</span>
|
||||
</a>
|
||||
|
||||
<div class="paper-danger-zone">
|
||||
<div class="paper-danger-head">Delete account</div>
|
||||
<p class="paper-danger-copy">
|
||||
|
||||
+29
-12
@@ -1,13 +1,30 @@
|
||||
<div class="container page paper-page">
|
||||
<h1 class="paper-page-title">Connect to <em>GitHub</em></h1>
|
||||
<p>Sign in to manage your anonymizations. Both connections use the same Anonymous GitHub account.</p>
|
||||
<p class="alert alert-warning" role="note" v-if="site_options?.GITHUB_APP_ENABLED && site_options?.GITHUB_OAUTH_ENABLED">
|
||||
If you already have an Anonymous GitHub account, sign in with
|
||||
<a class="alert-link" target="_self" href="/github/login">legacy GitHub OAuth</a>
|
||||
to keep access to your existing anonymizations. You can connect the read-only GitHub App from GitHub connections after signing in.
|
||||
</p>
|
||||
<p v-if="site_options?.GITHUB_APP_ENABLED"><a class="btn btn-ink" target="_self" href="/github/app/login">Continue with read-only GitHub App</a></p>
|
||||
<p v-if="site_options?.GITHUB_APP_ENABLED">Choose which repositories to allow after signing in. Private repositories are accessed with read-only permissions.</p>
|
||||
<p v-if="site_options?.GITHUB_OAUTH_ENABLED"><a class="btn" target="_self" href="/github/login">Continue with legacy GitHub OAuth</a></p>
|
||||
<p v-if="site_options?.GITHUB_OAUTH_ENABLED">OAuth supports existing connections and gists. GitHub's private repository OAuth scope includes write access.</p>
|
||||
<div class="container paper-page auth-page">
|
||||
<a class="auth-back" href="/"><i class="fas fa-arrow-left" aria-hidden="true"></i> Anonymous GitHub</a>
|
||||
<div class="auth-layout">
|
||||
<header class="auth-intro">
|
||||
<div class="paper-eyebrow">Your research, ready for review</div>
|
||||
<h1 class="paper-page-title"><span class="auth-title-desktop">Your code.<br>Your identity,<br><em>protected.</em></span><span class="auth-title-mobile">Sign in to <em>GitHub</em></span></h1>
|
||||
<p class="paper-page-lede">Sign in to create and manage your anonymizations.</p>
|
||||
</header>
|
||||
<div class="auth-options">
|
||||
<p class="auth-existing" role="note" v-if="site_options?.GITHUB_APP_ENABLED && site_options?.GITHUB_OAUTH_ENABLED">Already have an account? Sign in with <a target="_self" href="/github/login">legacy GitHub OAuth</a> to keep access to your anonymizations. You can connect the read-only App from GitHub connections after signing in.</p>
|
||||
<section v-if="site_options?.GITHUB_APP_ENABLED">
|
||||
<div class="connection-top"><i class="fab fa-github" aria-hidden="true"></i><span class="connection-badge">Read-only access</span></div>
|
||||
<h2>Continue with GitHub</h2>
|
||||
<p>Connect through the GitHub App with read-only repository access.</p>
|
||||
<ul class="auth-permissions">
|
||||
<li><i class="fas fa-check" aria-hidden="true"></i> You choose which repositories to share</li>
|
||||
<li><i class="fas fa-check" aria-hidden="true"></i> No permission to write to your code</li>
|
||||
</ul>
|
||||
<a class="btn btn-ink auth-continue" target="_self" href="/github/app/login">Sign in with GitHub <i class="fas fa-arrow-right" aria-hidden="true"></i></a>
|
||||
<small>Select your repositories after signing in.</small>
|
||||
</section>
|
||||
<section class="auth-legacy" v-if="site_options?.GITHUB_OAUTH_ENABLED">
|
||||
<div class="connection-title"><h2>Legacy OAuth</h2><span class="connection-badge connection-badge-muted">For gists & existing accounts</span></div>
|
||||
<p>Use this connection for gists or your existing OAuth setup. GitHub's private repository scope includes write access.</p>
|
||||
<a class="connection-link" target="_self" href="/github/login">Continue with OAuth <i class="fas fa-arrow-right" aria-hidden="true"></i></a>
|
||||
</section>
|
||||
<p role="status" v-if="site_options && !site_options.GITHUB_APP_ENABLED && !site_options.GITHUB_OAUTH_ENABLED">GitHub sign-in is currently unavailable. Please try again later.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Vendored
+13
-13
File diff suppressed because one or more lines are too long
+6
-1
@@ -243,7 +243,12 @@ app.get("/api/user", (req, res) =>
|
||||
? res.status(401).json({ error: "not_connected" })
|
||||
: res.json({ username: "tdurieux", photo: "https://avatars.githubusercontent.com/u/5577568?v=4", isAdmin: false })
|
||||
);
|
||||
app.get("/api/options", (req, res) => res.json({ MAX_REPO_SIZE: 8 * 1024, ANONYMIZATION_MASK: "XXXX" }));
|
||||
// Local connection fixtures keep the account screens usable without GitHub.
|
||||
app.get("/github/connections", (req, res) => res.json({
|
||||
appEnabled: true, appConnected: true, oauthEnabled: true, oauthConnected: true,
|
||||
installations: [], gistCount: 0, resources: [], csrf: "local-preview-only",
|
||||
}));
|
||||
app.get("/api/options", (req, res) => res.json({ MAX_REPO_SIZE: 8 * 1024, ANONYMIZATION_MASK: "XXXX", GITHUB_APP_ENABLED: true, GITHUB_OAUTH_ENABLED: true }));
|
||||
app.get("/api/message", (req, res) => res.status(404).end());
|
||||
app.get("/api/user/quota", (req, res) => res.json(quota));
|
||||
app.get("/api/user/anonymized_repositories", (req, res) => res.json(repositories));
|
||||
|
||||
+9
-1
@@ -121,9 +121,17 @@ describe("Vue 3 UI", function () {
|
||||
});
|
||||
|
||||
|
||||
for (const [appConnected, oauthConnected] of [[true, false], [false, true], [false, false], [true, true]]) {
|
||||
it(`shows the access chooser only for two connections: ${appConnected}/${oauthConnected}`, async () => {
|
||||
ui = await browser("/anonymize", { "/github/connections": { appEnabled: true, appConnected, oauthConnected } });
|
||||
expect(Boolean(ui.window.document.querySelector(".repo-access"))).to.equal(appConnected && oauthConnected);
|
||||
expect(ui.errors).to.deep.equal([]);
|
||||
});
|
||||
}
|
||||
|
||||
it("preserves redactions, identifiers and pinned commits when switching connections", async () => {
|
||||
ui = await browser("/anonymize", {
|
||||
"/github/connections": { appEnabled: true, oauthConnected: true },
|
||||
"/github/connections": { appEnabled: true, appConnected: true, oauthConnected: true },
|
||||
"/api/repo/owner/repo/": { defaultBranch: "main", repo: "repo" },
|
||||
"/api/repo/owner/repo/branches": [{ name: "main", commit: "abcdef123" }],
|
||||
"/api/repo/owner/repo/readme": "",
|
||||
|
||||
Reference in New Issue
Block a user