Some checks failed
ci / cargo test (agent-runtime) (push) Has been cancelled
ci / cargo test (context-passport) (push) Has been cancelled
ci / cargo test (game-economy) (push) Has been cancelled
ci / cargo test (ledgerline) (push) Has been cancelled
ci / cargo test (mint) (push) Has been cancelled
ci / cargo test (rago) (push) Has been cancelled
ci / cargo test (relay) (push) Has been cancelled
ci / cargo test (toolgate) (push) Has been cancelled
ci / cargo test (turnstile) (push) Has been cancelled
ci / cargo test (vend) (push) Has been cancelled
ci / cargo test (abacus) (push) Has been cancelled
ci / node suites (push) Has been cancelled
- applications.tmpl's "Agent tokens" intro paragraph was wrapped in .flex-list > .flex-item, which forces display:flex on a block containing mixed text + inline <code> elements -- each text run and <code> becomes its own anonymous flex item, scrambling the reading order into a columns-like mess at every viewport width (not just narrow ones). Moved the intro to a plain <p>, kept .flex-list only on the actual token-row container (correct usage there, matches every other such row on the page). - The "New agent token" result page (apps/rithub-approvals) showed the full ~700-char raw token in plain text with a separate "Copy" text button. Now masked by default (first 8 / last 6 chars), with icon-only show/hide (reusing the exact eye/eye-closed octicon pair already used by rithub-pw-toggle) and icon-only copy buttons -- the real value never leaves a data-token attribute; the masked text node is never clipboard- sourced. Live-verified via gstack screenshots at 1440 and 390: paragraph reads as one coherent sentence, token row aligns under its section header, masked token + reveal toggle + icon buttons all work, no console errors. QA account/token/marks created for this review fully purged after. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
188 lines
9.2 KiB
Cheetah
188 lines
9.2 KiB
Cheetah
{{/*
|
|
CUSTOM OVERRIDE (rithub.dev, 2026-11-18, extended 2026-12-01) -- byte-for-
|
|
byte upstream go-gitea/gitea v1.23.8 templates/user/settings/
|
|
applications.tmpl EXCEPT:
|
|
1. (2026-11-18) the "documentation" link in the scoped-token help text,
|
|
which pointed at third-party docs.gitea.com/development/
|
|
oauth2-provider#scopes -- now points at our own {{AppSubUrl}}/api/
|
|
swagger page instead (PH-launch-day QA sweep).
|
|
2. (2026-12-01, RIT-ACT "enforced, not opt-in") one new panel added
|
|
ABOVE the stock "Manage access tokens" segment below -- "Agent
|
|
tokens". Every token minted by `rit login`'s device sign-in (unless
|
|
the human ticks "this is me" on that page) or by this panel's own
|
|
"New agent token" button is already marked as an agent credential
|
|
the moment it is minted (apps/rithub-device-auth, apps/rithub-
|
|
approvals's `/approvals/agent-tokens/new` -- see
|
|
apps/rithub-approvals/src/agentSessionTokens.mjs's header comment for
|
|
the full "why"), server-side, whether or not that token is ever run
|
|
through `rit` at all. This panel lists those marks (fetched from
|
|
`/approvals/api/agent-tokens`, cookie-session only -- no token/hash
|
|
ever reaches this page) and lets the signed-in human revoke one in
|
|
one click. "Revoke" here means: apps/rithub-agent-gateway rejects
|
|
every push that credential makes from then on -- it does not (and,
|
|
by this service's own design, cannot) kill the underlying Rithub
|
|
session/token everywhere else; a stock OAuth2 app grant below (if
|
|
`.EnableOAuth2`) is the real full-kill lever for a `rit`-issued
|
|
token, unaffected by anything in this panel.
|
|
*/}}
|
|
{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings applications")}}
|
|
<div class="user-setting-content">
|
|
<h4 class="ui top attached header">
|
|
Agent tokens
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<p class="tw-mt-0">A device sign-in (<code>rit login</code>) or a token minted below defaults to an agent credential: a force-push, a branch delete, or a push to a protected branch made with it is held for a human to approve, even with plain <code>git</code>. Revoking one here stops it from pushing anything at all.</p>
|
|
<div id="rit-agent-tokens-list" class="flex-list"><p class="tw-my-2">Loading…</p></div>
|
|
</div>
|
|
<div class="ui bottom attached segment">
|
|
<a class="ui primary button" href="/approvals/agent-tokens/new">New agent token</a>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
(function () {
|
|
function esc(s) { return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]; }); }
|
|
var SOURCE_LABEL = { "device-login": "rit login (device sign-in)", "new-agent-token": "New agent token button", "rit-session": "rit CLI (session)" };
|
|
function row(t) {
|
|
var label = SOURCE_LABEL[t.source] || t.source;
|
|
var when = new Date(t.marked_at).toLocaleDateString();
|
|
if (t.revoked) {
|
|
return '<div class="flex-item"><div class="flex-item-main"><span class="flex-item-title">' + esc(label) + '</span><div class="flex-item-body">revoked</div></div></div>';
|
|
}
|
|
return '<div class="flex-item"><div class="flex-item-main"><span class="flex-item-title">' + esc(label) + '</span><div class="flex-item-body">marked ' + esc(when) + '</div></div>' +
|
|
'<div class="flex-item-trailing"><button class="ui red tiny button" data-short-id="' + esc(t.short_id) + '" type="button">Revoke</button></div></div>';
|
|
}
|
|
function load() {
|
|
var list = document.getElementById('rit-agent-tokens-list');
|
|
fetch('/approvals/api/agent-tokens', { headers: { accept: 'application/json' } })
|
|
.then(function (res) { return res.json().then(function (body) { return { status: res.status, body: body }; }); })
|
|
.then(function (r) {
|
|
if (r.status !== 200) { list.innerHTML = '<p class="tw-my-2">' + esc(r.body.error || ('HTTP ' + r.status)) + '</p>'; return; }
|
|
if (!r.body.tokens.length) { list.innerHTML = '<p class="tw-my-2">No agent tokens yet.</p>'; return; }
|
|
list.innerHTML = r.body.tokens.map(row).join('');
|
|
Array.prototype.forEach.call(list.querySelectorAll('button[data-short-id]'), function (btn) {
|
|
btn.addEventListener('click', function () {
|
|
fetch('/approvals/api/agent-tokens/' + encodeURIComponent(btn.getAttribute('data-short-id')) + '/revoke', { method: 'POST' })
|
|
.then(function () { load(); });
|
|
});
|
|
});
|
|
})
|
|
.catch(function (err) { list.innerHTML = '<p class="tw-my-2">' + esc(String(err)) + '</p>'; });
|
|
}
|
|
load();
|
|
})();
|
|
</script>
|
|
<div class="user-setting-content">
|
|
<h4 class="ui top attached header">
|
|
{{ctx.Locale.Tr "settings.manage_access_token"}}
|
|
</h4>
|
|
<div class="ui attached segment">
|
|
<div class="flex-list">
|
|
<div class="flex-item">
|
|
{{ctx.Locale.Tr "settings.tokens_desc"}}
|
|
</div>
|
|
{{range .Tokens}}
|
|
<div class="flex-item">
|
|
<div class="flex-item-leading">
|
|
<span class="text {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-tooltip-content="{{ctx.Locale.Tr "settings.token_state_desc"}}"{{end}}>
|
|
{{svg "fontawesome-send" 32}}
|
|
</span>
|
|
</div>
|
|
<div class="flex-item-main">
|
|
<details>
|
|
<summary><span class="flex-item-title">{{.Name}}</span></summary>
|
|
<p class="tw-my-1">
|
|
{{ctx.Locale.Tr "settings.repo_and_org_access"}}:
|
|
{{if .DisplayPublicOnly}}
|
|
{{ctx.Locale.Tr "settings.permissions_public_only"}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "settings.permissions_access_all"}}
|
|
{{end}}
|
|
</p>
|
|
<p class="tw-my-1">{{ctx.Locale.Tr "settings.permissions_list"}}</p>
|
|
<ul class="tw-my-1">
|
|
{{range .Scope.StringSlice}}
|
|
{{if (ne . $.AccessTokenScopePublicOnly)}}
|
|
<li>{{.}}</li>
|
|
{{end}}
|
|
{{end}}
|
|
</ul>
|
|
</details>
|
|
<div class="flex-item-body">
|
|
<i>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}} — {{svg "octicon-info"}} {{if .HasUsed}}{{ctx.Locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="text green"{{end}}>{{DateUtils.AbsoluteShort .UpdatedUnix}}</span>{{else}}{{ctx.Locale.Tr "settings.no_activity"}}{{end}}</i>
|
|
</div>
|
|
</div>
|
|
<div class="flex-item-trailing">
|
|
<button class="ui red tiny button delete-button" data-modal-id="delete-token" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
|
|
{{svg "octicon-trash" 16 "tw-mr-1"}}
|
|
{{ctx.Locale.Tr "settings.delete_token"}}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="ui bottom attached segment">
|
|
<h5 class="ui top header">
|
|
{{ctx.Locale.Tr "settings.generate_new_token"}}
|
|
</h5>
|
|
<form id="scoped-access-form" class="ui form ignore-dirty" action="{{.Link}}" method="post">
|
|
{{.CsrfTokenHtml}}
|
|
<div class="field {{if .Err_Name}}error{{end}}">
|
|
<label for="name">{{ctx.Locale.Tr "settings.token_name"}}</label>
|
|
<input id="name" name="name" value="{{.name}}" autofocus required maxlength="255">
|
|
</div>
|
|
<div class="field">
|
|
<label>{{ctx.Locale.Tr "settings.repo_and_org_access"}}</label>
|
|
<label class="tw-cursor-pointer">
|
|
<input class="enable-system tw-mt-1 tw-mr-1" type="radio" name="scope" value="{{$.AccessTokenScopePublicOnly}}">
|
|
{{ctx.Locale.Tr "settings.permissions_public_only"}}
|
|
</label>
|
|
<label class="tw-cursor-pointer">
|
|
<input class="enable-system tw-mt-1 tw-mr-1" type="radio" name="scope" value="" checked>
|
|
{{ctx.Locale.Tr "settings.permissions_access_all"}}
|
|
</label>
|
|
</div>
|
|
<details class="ui optional field">
|
|
<summary class="tw-pb-4 tw-pl-1">
|
|
{{ctx.Locale.Tr "settings.select_permissions"}}
|
|
</summary>
|
|
<p class="activity meta">
|
|
<i>{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl)}}</i>
|
|
</p>
|
|
<div id="scoped-access-token-selector"
|
|
data-is-admin="{{if .IsAdmin}}true{{else}}false{{end}}"
|
|
data-no-access-label="{{ctx.Locale.Tr "settings.permission_no_access"}}"
|
|
data-read-label="{{ctx.Locale.Tr "settings.permission_read"}}"
|
|
data-write-label="{{ctx.Locale.Tr "settings.permission_write"}}"
|
|
data-locale-component-failed-to-load="{{ctx.Locale.Tr "graphs.component_failed_to_load"}}"
|
|
>
|
|
</div>
|
|
</details>
|
|
<button id="scoped-access-submit" class="ui primary button">
|
|
{{ctx.Locale.Tr "settings.generate_token"}}
|
|
</button>
|
|
</form>{{/* Fomantic ".ui.form .warning.message" is hidden by default, so put the warning message out of the form*/}}
|
|
<div id="scoped-access-warning" class="ui warning message center tw-hidden">
|
|
{{ctx.Locale.Tr "settings.at_least_one_permission"}}
|
|
</div>
|
|
</div>
|
|
|
|
{{if .EnableOAuth2}}
|
|
{{template "user/settings/grants_oauth2" .}}
|
|
{{template "user/settings/applications_oauth2" .}}
|
|
{{end}}
|
|
</div>
|
|
|
|
<div class="ui g-modal-confirm delete modal" id="delete-token">
|
|
<div class="header">
|
|
{{svg "octicon-trash"}}
|
|
{{ctx.Locale.Tr "settings.access_token_deletion"}}
|
|
</div>
|
|
<div class="content">
|
|
<p>{{ctx.Locale.Tr "settings.access_token_deletion_desc"}}</p>
|
|
</div>
|
|
{{template "base/modal_actions_confirm"}}
|
|
</div>
|
|
|
|
{{template "user/settings/layout_footer" .}}
|