gitoriaLog in with ident

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit68dcb60368dcb603deploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre68dcb603/components/repohead.hl

3.8 KB

  1. // components/repohead.hl — THE HEAD OF EVERY REPO VIEW (gitoria#16): the repo's name, description and the
  2. // nav (Readme · Code · Pull requests · Releases · Tickets · Settings), or "No such repository". Composed into each repo
  3. // page (readme, code, branch, commit, pulls, releases, tickets). The repo comes from the request's host
  4. // (`host = null`, hybriel#74) on the SERVER: this is in the first HTML and follows every hl:web navigation.
  5. import { repoAt, NL } from '../repos.hl'
  6. import { isEmptyNow } from '../git.hl'
  7. import { slugOfHost, publicUrl, hostOnly } from '../users.hl'
  8. import { sshEnabled, sshUrl } from '../sshkeys.hl'
  9. host = null
  10. // onCodePage (gitoria#20): only code.hl sets this true — the "Add code" help stands only on the Code page of an
  11. // empty repository, never on Readme / Pull requests / Releases / Tickets / Settings, and never once there is a commit.
  12. onCodePage = false
  13. slug = slugOfHost(host)
  14. repo = repoAt(slug)
  15. hasRepo = repo != null
  16. isMissing = repo == null
  17. mainHref = publicUrl + '/'
  18. // HOW TO ADD CODE (gitoria#7, gitoria#20): the clone address and the exact git commands, for a new folder and for an
  19. // existing one; plain text on the Code page while nothing is pushed yet. The password is an access token (main page).
  20. cloneUrl = repo != null ? repo.address + repo.slug + '.git' : ''
  21. tokensHref = publicUrl + '/#tokens'
  22. sshKeysHref = publicUrl + '/#sshkeys'
  23. emptyRepo = repo != null && isEmptyNow(slug)
  24. showAddCode = onCodePage && emptyRepo
  25. newCommands = 'echo "# ' + slug + '" >> README.md' + NL + 'git init -b main' + NL + 'git add README.md' + NL + 'git commit -m "first commit"' + NL + 'git remote add origin ' + cloneUrl + NL + 'git push -u origin main'
  26. existingCommands = 'git remote add origin ' + cloneUrl + NL + 'git branch -M main' + NL + 'git push -u origin main'
  27. cloneCommand = 'git clone ' + cloneUrl
  28. // SSH (only when the sshd container is set up, sshkeys.hl): the same commands with the ssh address; the key comes from the main page
  29. showSsh = sshEnabled && repo != null
  30. sshAddress = repo != null ? sshUrl(hostOnly, repo.slug) : ''
  31. sshCloneCommand = 'git clone ' + sshAddress
  32. sshCommands = 'git remote add origin ' + sshAddress + NL + 'git push -u origin main'
  33. View {
  34. repoHead {
  35. if (hasRepo) {
  36. h1 { id = "reponame" repo.slug }
  37. if (repo.described) { p { id = "repodescription" repo.description } }
  38. p { class = "muted" "All repositories: " a { id = "toall" href = mainHref "gitoria" } }
  39. repoNav { id = "reponav"
  40. a { id = "navhome" href = "/" "Readme" }
  41. a { id = "navcode" href = "/code" "Code" }
  42. a { id = "navpulls" href = "/pulls" "Pull requests" }
  43. a { id = "navreleases" href = "/releases" "Releases" }
  44. a { id = "navtickets" href = "/tickets" "Tickets" }
  45. a { id = "navsettings" href = "/settings" "Settings" }
  46. }
  47. }
  48. if (showAddCode) {
  49. addCode { id = "addcode"
  50. h2 { "Add code to this repository" }
  51. h2 { "Clone it" }
  52. pre { id = "clonecommand" cloneCommand }
  53. h2 { "Push a new project" }
  54. pre { id = "newcommands" newCommands }
  55. h2 { "Push an existing project" }
  56. pre { id = "existingcommands" existingCommands }
  57. if (showSsh) {
  58. h2 { "Or over SSH" }
  59. pre { id = "sshclonecommand" sshCloneCommand }
  60. pre { id = "sshcommands" sshCommands }
  61. p { class = "muted" "Add your public key under " a { id = "tosshkeys" href = sshKeysHref "SSH keys" } " on the main page after you log in; only the owner can push." }
  62. }
  63. p { class = "muted" "Reading needs no login. To push you must be the owner of this repository: git asks for a user name (anything) and a password — that is an access token, made under " a { id = "totokens" href = tokensHref "Access tokens" } " on the main page after you log in." }
  64. }
  65. }
  66. if (isMissing) {
  67. h1 { id = "missing" "No such repository" }
  68. p { class = "muted" "Nobody has created this address yet. " a { id = "toall" href = mainHref "All repositories" } }
  69. }
  70. }
  71. }

Branches

Latest commits

  • 68dcb603deploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • e2deed6dgitoria#20: "Add code" only on the Code page of an empty repository, no collapsiblemre
  • 8bb97ffddeploy.sh: never send .git or .gitignore to Byrodinmre
  • fd981932State of 2026-09-27; bin/ no longer tracked (Hybriel commit is in README)mre
  • 4a2d7125initial commitmre