gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit54eec68754eec687Gate person approvals and merge alternativesmre54eec687/components/addcode.hl

3.2 KB

  1. // components/addcode.hl — "ADD CODE TO THIS REPOSITORY" (gitoria#7, gitoria#20): the clone address and the exact git commands, for a
  2. // new folder and for an existing one; plain text on the Code tab (code, branch, commit pages) while nothing is pushed yet. The
  3. // password is an access token (main page). Shown only for an EXISTING, EMPTY repo; never on Readme / Pull requests / Releases /
  4. // Tickets / Settings (those pages don't use it). It is the page's own (inside the repo level's slot), so it is read fresh on
  5. // every navigation.
  6. import { NL, publicUrl, hostOnly, cloneOrigin } from '../lib/util.hl'
  7. import { slugOfRequest } from '../lib/orgs.hl'
  8. import { repoAt } from '../lib/repos.hl'
  9. import { isEmptyNow } from '../lib/git.hl'
  10. import { sshEnabled, sshUrl } from '../lib/sshkeys.hl'
  11. host = null
  12. orepo = ''
  13. session = null
  14. slug = slugOfRequest(host, orepo)
  15. repo = repoAt(slug, session)
  16. cloneUrl = repo != null ? cloneOrigin(slug) : ''
  17. tokensHref = publicUrl + '/#tokens'
  18. sshKeysHref = publicUrl + '/#sshkeys'
  19. showAddCode = repo != null && isEmptyNow(slug)
  20. 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'
  21. existingCommands = 'git remote add origin ' + cloneUrl + NL + 'git branch -M main' + NL + 'git push -u origin main'
  22. cloneCommand = 'git clone ' + cloneUrl
  23. // 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
  24. showSsh = sshEnabled && repo != null
  25. sshAddress = repo != null ? sshUrl(hostOnly, repo.slug) : ''
  26. sshCloneCommand = 'git clone ' + sshAddress
  27. sshCommands = 'git remote add origin ' + sshAddress + NL + 'git push -u origin main'
  28. View {
  29. if (showAddCode) {
  30. addCode { id = "addcode"
  31. h2 { "Add code to this repository" }
  32. h2 { "Clone it" }
  33. pre { id = "clonecommand" cloneCommand }
  34. h2 { "Push a new project" }
  35. pre { id = "newcommands" newCommands }
  36. h2 { "Push an existing project" }
  37. pre { id = "existingcommands" existingCommands }
  38. if (showSsh) {
  39. h2 { "Or over SSH" }
  40. pre { id = "sshclonecommand" sshCloneCommand }
  41. pre { id = "sshcommands" sshCommands }
  42. 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." }
  43. }
  44. 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." }
  45. }
  46. }
  47. }
  48. Style {
  49. #addcode {
  50. display = 'grid'
  51. gap = '.5rem'
  52. minWidth = '0'
  53. padding = '1rem'
  54. background = 'var(--color-surface)'
  55. borderRadius = 'var(--radius-large)'
  56. // Direct-child universal selectors have no bare language form.
  57. '> *' {
  58. margin = '0'
  59. }
  60. pre {
  61. margin = '0'
  62. padding = '.6rem .8rem'
  63. overflowX = 'auto'
  64. font = '.875rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'
  65. color = 'var(--color-text-strong)'
  66. background = 'var(--color-background-sunken)'
  67. borderRadius = 'var(--radius-large)'
  68. whiteSpace = 'pre-wrap'
  69. overflowWrap = 'anywhere'
  70. }
  71. }
  72. }

Branches

Latest commits

  • 54eec687Gate person approvals and merge alternativesmre
  • 12b08829Add person approvals for pull request headsmre
  • 55c84779Merge branch 'gp-gate-ports' into mainGitoria
  • 57af42bbREADME: point to deploy.sh for the port listmre
  • d63375d2README: gate commands with explicit portsmre
  • feeaa701|||PR gates: explicit ports only, deploy.sh passes themmre
  • 6cc1f943Merge branch 'records-1112' into mainGitoria
  • 9448c438|||PR records: LOG, missions and reports since 11-09mre
  • 6dc08a8eMerge branch 'p51-public-pr-reads' into mainGitoria
  • 7b88cfe0Type publicReaderOfRequest parameters (L10)Gitoria
  • 2a4b3dc1|||PR Anonymous reads of public repos' pulls and statusesmre
  • 21b2c141Merge branch 's25-no-session-on-login-error' into mainGitoria
  • 698458e2|||PR No session for cookieless login errors: READMEmre
  • cce7b785|||PR No session for cookieless login errorsmre
  • 678d6303Merge branch 'v59' into mainGitoria
  • 5803cf4f|||PR vendor: Hybriel set-day59 and GC budget 32 MiBmre
  • 9eff6627Merge branch 'f2-api-bugs' into mainGitoria
  • 26117255|||PR apps API: review comments on files with spaces in their namemre
  • b8796cecMerge branch 'f1-broken-json' into mainGitoria
  • 2f2959c5|||PR apps API: broken JSON body gives 400 invalid_json, not 500mre