gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitc90daf19c90daf19Re-vendor gitoria to Hybriel set-day37 (f6b3d45b)mrec90daf19/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. '> *' {
  54. margin = '0'
  55. }
  56. }
  57. #addcode {
  58. padding = '1rem'
  59. background = 'var(--color-surface)'
  60. borderRadius = 'var(--radius-large)'
  61. pre {
  62. margin = '0'
  63. padding = '.6rem .8rem'
  64. overflowX = 'auto'
  65. font = '.875rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'
  66. color = 'var(--color-text-strong)'
  67. background = 'var(--color-background-sunken)'
  68. borderRadius = 'var(--radius-large)'
  69. whiteSpace = 'pre-wrap'
  70. overflowWrap = 'anywhere'
  71. }
  72. }
  73. }

Branches

Latest commits

  • c90daf19Re-vendor gitoria to Hybriel set-day37 (f6b3d45b)mre
  • 03b5bb08W39 report to reports/, drop scratch repro, mission + logmre
  • 154d333fMerge w39-create-api: POST /api/repos with a user token (#39)mre
  • 149dd512Rewrite W39 reportmre
  • e5385075Expect 401 for POST /api/repos without a tokenmre
  • 1a76055cDocument repository creation APImre
  • 4d779b3bAdd create-api gatemre
  • 88563122Add POST /api/repos for user tokensmre
  • b00860e3Create repositories with member checks in createRepoInmre
  • 0a38f236Report repository creation API blockermre
  • b5f72187Record malformed JSON blocker for repository creationmre
  • a2ae8302logmre
  • 6947cd58logmre
  • 2175e48clogmre
  • 40eb3ca1gitoria#38: review package, logmre
  • 06a5a50egitoria#38: deploy b8252ca, logmre
  • b8252ca0gitoria#46: W46b report, logmre
  • 50093aafgitoria#46: statuses keyed by app + context (merge w46b-keyed)mre
  • dd0267edgitoria#46: fix a label in the keyed gatemre
  • b1dcb580gitoria#46: statuses keyed by app + context, required = app + context, old rows still readmre