gitoriaLog in with ident

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit8bb97ffd8bb97ffddeploy.sh: never send .git or .gitignore to Byrodinmre8bb97ffd/components/repohead.hl

3.6 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. slug = slugOfHost(host)
  11. repo = repoAt(slug)
  12. hasRepo = repo != null
  13. isMissing = repo == null
  14. mainHref = publicUrl + '/'
  15. // HOW TO ADD CODE (gitoria#7), on every repo page: the clone address and the exact git commands, for a new folder and
  16. // for an existing one; open by itself while nothing is pushed yet. The password is an access token (main page).
  17. cloneUrl = repo != null ? repo.address + repo.slug + '.git' : ''
  18. tokensHref = publicUrl + '/#tokens'
  19. sshKeysHref = publicUrl + '/#sshkeys'
  20. emptyRepo = repo != null && isEmptyNow(slug)
  21. 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'
  22. existingCommands = 'git remote add origin ' + cloneUrl + NL + 'git branch -M main' + NL + 'git push -u origin main'
  23. cloneCommand = 'git clone ' + cloneUrl
  24. // 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
  25. showSsh = sshEnabled && repo != null
  26. sshAddress = repo != null ? sshUrl(hostOnly, repo.slug) : ''
  27. sshCloneCommand = 'git clone ' + sshAddress
  28. sshCommands = 'git remote add origin ' + sshAddress + NL + 'git push -u origin main'
  29. View {
  30. repoHead {
  31. if (hasRepo) {
  32. h1 { id = "reponame" repo.slug }
  33. if (repo.described) { p { id = "repodescription" repo.description } }
  34. p { class = "muted" "All repositories: " a { id = "toall" href = mainHref "gitoria" } }
  35. repoNav { id = "reponav"
  36. a { id = "navhome" href = "/" "Readme" }
  37. a { id = "navcode" href = "/code" "Code" }
  38. a { id = "navpulls" href = "/pulls" "Pull requests" }
  39. a { id = "navreleases" href = "/releases" "Releases" }
  40. a { id = "navtickets" href = "/tickets" "Tickets" }
  41. a { id = "navsettings" href = "/settings" "Settings" }
  42. }
  43. }
  44. if (hasRepo) {
  45. details { id = "addcode" open = emptyRepo
  46. summary { "Add code to this repository" }
  47. addCode {
  48. h2 { "Clone it" }
  49. pre { id = "clonecommand" cloneCommand }
  50. h2 { "Push a new project" }
  51. pre { id = "newcommands" newCommands }
  52. h2 { "Push an existing project" }
  53. pre { id = "existingcommands" existingCommands }
  54. if (showSsh) {
  55. h2 { "Or over SSH" }
  56. pre { id = "sshclonecommand" sshCloneCommand }
  57. pre { id = "sshcommands" sshCommands }
  58. 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." }
  59. }
  60. 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." }
  61. }
  62. }
  63. }
  64. if (isMissing) {
  65. h1 { id = "missing" "No such repository" }
  66. p { class = "muted" "Nobody has created this address yet. " a { id = "toall" href = mainHref "All repositories" } }
  67. }
  68. }
  69. }

Branches

Latest commits

  • 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