caelum0x 6801c08af9
Some checks failed
ci / cargo test (abacus) (push) Has been cancelled
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 / node suites (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
feat(RIT-OPS,RIT-BRD): rename gitea -> rit everywhere we control, deployed + live-verified
apps/gitea -> apps/rithub-server; compose services/containers renamed
(rithub-server-app/postgres/act-runner) with explicit project name and
volume names pinned to the exact existing Docker volumes (no data loss);
our own GITEA_* compose/env var names -> RIT_*; new rit-admin CLI wrapper
on railyard-box; giteaSession.mjs/giteaOAuth.mjs/giteaInfo.mjs ->
ritSession/ritOAuth/ritInfo across 6 apps; GiteaForgeAdapter -> RitForgeAdapter
+ giteaSyncService/importGiteaRepos/syncGiteaRepos -> rit* in ritgram
(tsc clean); apps/console/lib/gitea.ts -> lib/ritProvision.ts; Go
internal/giteaclient -> internal/ritclient in rithub-async-import (go
build/test clean); new /auth/rit + /forges/rit/connect routes with
/gitea back-compat aliases; locale/swagger/footer/captcha template text
scrubbed of remaining "Gitea" strings.

Deployed to railyard-box: old containers stopped/removed, /srv/railyard-gitea
renamed to /srv/rithub-server with a symlink kept, docker compose up -d from
the new path, act_runner network-alias fix for its persisted instance URL.
Live-verified: docker compose config diff showed zero unintended value
changes, DB row counts unchanged (19 users, 635 repos), full route
regression 200/expected, 0 "gitea" in headers/bodies on every checked page,
real git clone+push over HTTPS and SSH with a disposable account (deleted
after). Deferred on purpose (documented in plans/railyard.md): the forge
discriminator / DB column names / Postgres role+volume names (data
migrations, not a naming change) and the upstream GITEA__ env-to-ini keys
and X-Gitea-* wire headers (hardcoded in the vendored engine binary).

See plans/railyard.md RIT-OPS/RIT-BRD entry for the full old->new map and
live evidence.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-12-01 16:34:39 +03:00

211 lines
13 KiB
Cheetah

{{/*
Rithub "Bring your code" — the real fix for the 0-repo funnel gap found
2026-11-19 (plans/railyard.md): both real external signups (harish via
email, blenderwebservices via Google OAuth) landed with 0 repos and no
next step. New shared partial, included from two places so the content
only lives once:
- templates/user/dashboard/dashboard.tmpl — replaces the whole
(otherwise empty) dashboard for a signed-in user with 0 repos.
- templates/user/profile.tmpl — replaces the empty "Repositories" tab
when viewing your OWN profile with 0 repos (strangers viewing your
empty profile still see the stock "no repos" message, unchanged).
2026-11-30 (RIT-ACT, owner correction mid-pass): rebuilt as THREE EQUAL
one-tap paths, icon-led, GitHub never the only or primary one — real
gap found live in plans/railyard.md: erslylmz0 (HomePlan partner, a
known collaborator, not an outside signup) never imported because he
has no GitHub account at all, so a GitHub-first screen has zero path
for him. All three paths below are plain `/repo/create` or `/repo/
migrate` POSTs with the normal required fields filled in by a few lines
of inline JS — still no Go fork, no new routes, every field name and
default verified live against this box's own `/repo/create` form and
Gitea 1.23.8's real behaviour (not assumed from docs) before shipping:
1. "Start new" — one tap submits `/repo/create` with `auto_init`
UNSET (a truly empty repo) and a collision-safe generated
`repo_name`. Gitea's own stock empty-repo guide (verified live:
"Quick Guide" / "git remote add origin ..." / "git push -u origin
main") is the single next step — not rebuilt here, just reached in
one click instead of a multi-field form.
2. "Import from URL" — one visible field (any git clone URL) + one
button, same `service=1` (structs.PlainGitService) mirror import
as before. Works identically for github.com, gitlab.com,
codeberg.org, bitbucket.org or a bare `https://.../x.git` — this
is the one path that was already host-agnostic and needed no
behaviour change, only copy that says so instead of implying
GitHub. "Import from GitHub" (the richer service_type=2 importer:
private repos + issues/wiki/releases/labels/milestones, needs a
GitHub token) is kept as a small secondary link under this tile,
never a same-weight button — satisfies "GitHub can stay as one
option, never the only one."
3. "Upload files" — one tap. A generic git URL has no "upload a zip"
equivalent, and an uninitialised repo has no branch to upload
into, so this path does two real things in one click via a tiny
fetch (confirmed live, Gitea 1.23.8): POST `/repo/create` with
`auto_init=on` (creates a real default branch + README, verified
the ONLY way `_upload/<branch>` renders — tested an auto_init=off
empty repo's `_upload` page 404s, a plain link could not have
reached this), then navigate straight to that new repo's own
native `_upload/<branch>` page — Gitea's stock drag-and-drop
multi-file uploader, `[repository.upload]` confirmed enabled on
this box (no `ENABLED=false` override). Honest limit, not fixed
here: Gitea's uploader stores a `.zip` as one binary file, it does
not auto-extract it — true "drag a zip, get its contents as
files" would need a new upload-time unzip route (a real Go fork),
out of scope for this template-only pass; flagged in
plans/railyard.md instead of oversold in the UI copy.
2026-11-19 (real user feedback, PremAnjwani via the Product Hunt forum,
relayed by the owner): the thing that decides whether someone actually
imports is knowing it's reversible -- what moves, what doesn't, whether
the source stays untouched. Kept below the three paths, reworded so it
no longer claims GitHub-only metadata (issues/PRs/wiki/releases/labels/
milestones) for the generic mirror path, which Gitea's plain-git
downloader never actually copies -- that richer copy is real only for
the dedicated "Import from GitHub" link (service_type=2's GitHub API
downloader), so it now says so explicitly instead of overclaiming for
a GitLab/Codeberg/Bitbucket/bare-URL import. "Not copied" (CI secrets,
webhooks, Actions settings) is true by omission: none of those fields
exist in the migrate request body, and Gitea's migrate API never
touches them. "Only read, never changed" is true because every call to
the source host in this flow is a read (git fetch / API GET); nothing
here ever pushes or writes back. "Switch to a normal repo later in
Settings" was verified against the live container's own bundled
template: repo/settings/options.tmpl's convert-mirror-repo-modal is
gated by `{{if .Permission.IsOwner}}{{if .Repository.IsMirror}}`, a
real self-service repo-owner action, not a site-admin-only control.
2026-11-30 (RIT-ACT/RET first-run review): kept the one-line CLI
alternative for anyone migrating more than one GitHub repo at once --
`github-backup-cli --to rithub` (published npm package, real
/api/v1/repos/migrate calls under the hood, see "Free tool
(Resend-rule-1)" in plans/railyard.md). The shipped `rit`/`rithub` CLI
(packages/rithub-cli) still has no bulk-import subcommand -- flagged in
plans/railyard.md, not invented here.
*/}}
<section class="rithub-bring-code">
<div class="rithub-bring-code-icon">{{svg "octicon-repo" 28}}</div>
<h2 class="rithub-bring-code-title">Bring your code to Rithub</h2>
<p class="rithub-bring-code-sub">Three ways in. Pick one.</p>
<div class="rithub-bring-code-paths">
<form class="rithub-bring-code-path" method="post" action="{{AppSubUrl}}/repo/create"
onsubmit="(function(f){var n=f.querySelector('[name=repo_name]');n.value='new-repo-'+Date.now().toString(36);var b=f.querySelector('button');if(b)b.disabled=true;return true;})(this)">
{{.CsrfTokenHtml}}
<input type="hidden" name="uid" value="{{.SignedUser.ID}}">
<input type="hidden" name="repo_name" value="">
<input type="hidden" name="default_branch" value="main">
<input type="hidden" name="object_format_name" value="sha1">
<input type="hidden" name="private" value="on">
<button type="submit" class="rithub-bring-code-tile" title="Start a new empty repo" aria-label="Start a new empty repo"
data-umami-event="import_started" data-umami-event-method="new">
<span class="rithub-bring-code-tile-icon">{{svg "octicon-plus" 22}}</span>
<span class="rithub-bring-code-tile-label">Start new</span>
</button>
</form>
<div class="rithub-bring-code-tile rithub-bring-code-tile-import">
<span class="rithub-bring-code-tile-icon">{{svg "octicon-repo-clone" 22}}</span>
<span class="rithub-bring-code-tile-label">Import from URL</span>
<form class="rithub-bring-code-url-form" action="{{AppSubUrl}}/repo/migrate" method="post"
onsubmit="(function(f){var b=f.querySelector('.rithub-cta-btn');var p=document.getElementById('rithub-bring-code-progress');if(b){b.disabled=true;}if(p){p.hidden=false;}return true;})(this)">
{{.CsrfTokenHtml}}
<input type="hidden" name="service" value="1">
<input type="hidden" name="uid" value="{{.SignedUser.ID}}">
<input type="hidden" name="mirror" value="true">
<input type="hidden" name="repo_name" id="rithub-bring-code-repo-name" value="imported-repo">
<div class="rithub-bring-code-url-row">
<input id="rithub-bring-code-url" name="clone_addr" type="text" required
aria-label="Git clone URL" title="Git clone URL"
placeholder="Paste a git repo URL" autocomplete="off" autocapitalize="off" spellcheck="false"
oninput="(function(i){var n=document.getElementById('rithub-bring-code-repo-name');if(!n)return;var v=i.value.trim().replace(/\.git$/i,'');var seg=v.split('/').filter(Boolean).pop()||'';seg=seg.replace(/[^A-Za-z0-9_.-]/g,'-').slice(0,100);n.value=seg||'imported-repo';})(this)">
<button class="rithub-cta-btn" type="submit" aria-label="Import" title="Import"
data-umami-event="import_started" data-umami-event-method="url">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>
</button>
</div>
<!-- Shown only after submit (hidden by default, no flash-of-content):
the form POST itself blocks until the clone finishes (a few
seconds for a typical first repo), then the browser navigates
straight to the new repo page — the single next step, already
rendering Rithub's native clone-URL box, not rebuilt here. -->
<p id="rithub-bring-code-progress" class="rithub-bring-code-progress" hidden>
<span class="rithub-spinner" aria-hidden="true"></span>
Importing — a few seconds, then you'll land right in it.
</p>
</form>
<a class="rithub-bring-code-github-link" href="{{AppSubUrl}}/repo/migrate?service_type=2" title="Import from GitHub with issues, wiki, releases and private repos" aria-label="Import from GitHub with issues, wiki, releases and private repos"
data-umami-event="import_started" data-umami-event-method="github">
{{svg "octicon-mark-github" 14}}<span>Private repo, issues &amp; wiki? Import from GitHub</span>
</a>
</div>
<button type="button" class="rithub-bring-code-tile" id="rithub-upload-tile" title="Upload files into a new repo" aria-label="Upload files into a new repo"
data-umami-event="import_started" data-umami-event-method="upload">
<span class="rithub-bring-code-tile-icon">{{svg "octicon-upload" 22}}</span>
<span class="rithub-bring-code-tile-label">Upload files</span>
</button>
</div>
<p id="rithub-upload-progress" class="rithub-bring-code-progress" hidden>
<span class="rithub-spinner" aria-hidden="true"></span>
Setting up your repo — a few seconds, then drop your files in.
</p>
<p class="rithub-bring-code-cli">Importing more than one repo? From a terminal: <code>npx github-backup-cli &lt;github-user&gt; --to rithub --rithub-token &lt;token&gt;</code></p>
<div class="rithub-import-preview">
<div class="rithub-import-preview-title">What moves, what doesn't</div>
<div class="rithub-import-preview-row">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><polyline points="20 6 9 17 4 12"/></svg>
<span><b>Copied</b> — full code history; GitHub import also adds wiki, issues, PRs and releases</span>
</div>
<div class="rithub-import-preview-row">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg>
<span><b>Synced</b> — re-syncs every 8 hours; the source is only read, never changed</span>
</div>
<div class="rithub-import-preview-row">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
<span><b>Not copied</b> — CI secrets, webhooks, Actions settings</span>
</div>
<div class="rithub-import-preview-row">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg>
<span><b>Reversible</b> — delete anytime; source stays untouched, switch to a normal repo later</span>
</div>
</div>
</section>
<script>
(function(){
var btn = document.getElementById('rithub-upload-tile');
if (!btn) return;
btn.addEventListener('click', function(){
if (btn.disabled) return;
btn.disabled = true;
var prog = document.getElementById('rithub-upload-progress');
if (prog) prog.hidden = false;
var params = new URLSearchParams();
params.set('_csrf', '{{.CsrfToken}}');
params.set('uid', '{{.SignedUser.ID}}');
params.set('repo_name', 'upload-' + Date.now().toString(36));
params.set('default_branch', 'main');
params.set('object_format_name', 'sha1');
params.set('private', 'on');
params.set('auto_init', 'on');
params.set('readme', 'Default');
fetch('{{AppSubUrl}}/repo/create', {
method: 'POST',
body: params,
credentials: 'same-origin',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).then(function(res){
if (!res.ok) { throw new Error('create failed: ' + res.status); }
window.location.href = res.url.replace(/\/$/, '') + '/_upload/main';
}).catch(function(){
btn.disabled = false;
if (prog) prog.hidden = true;
window.location.href = '{{AppSubUrl}}/repo/create';
});
});
})();
</script>