gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmainfe209ffeMerge branch 'w56-owner-members' into mainGitoriamain/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

  • fe209ffeMerge branch 'w56-owner-members' into mainGitoria
  • fa0754c8|||PR repository owner transfer and members API (#55)mre
  • 8862e537Merge branch 'w55-rename-org' into mainGitoria
  • 014d2b7fOne immutable readers snapshot per move for the left-organization event (#53)mre
  • 1859d506Decide who hears a repo left its organization by its readers before the move (#53)mre
  • 499f25f2Review fixes for the Settings organization move (#53)mre
  • ed3b922b|||PR move a repository into an organization in Settings (#53)mre
  • 74ec2af8Merge branch 'w54-repo-rename-pr' into mainGitoria
  • 9f7ce8d8Preserve rename compatibility and live page titlesmre
  • c3d95b6e|||PR separate names and addresses, rename repositories in Settings (#53)mre
  • ce08920dMerge branch 'w52c-header-phone' into mainGitoria
  • 0bab9e46|||PR header: ident status wraps on phones instead of clippingmre
  • e7af3eceMerge branch 'w52b-approval-followup' into mainGitoria
  • c01e66c6|||PR approvals follow-up: live Merge after status writes, helpers (#52)mre
  • 841da497Merge branch 'w53-pulls-speed-pr' into mainGitoria
  • 80307ae2|||PR pulls page cache: live PR numbers, complete scans onlymre
  • 69141f65|||PR pulls page: cache the git part per repo by branch tipsmre
  • 155861f6Merge branch 'w52-person-approval' into mainGitoria
  • b5435de8|||PR person approvals: second Kunibert round (#52)mre
  • 3a8b2fb8|||PR person approvals: Kunibert review fixes (#52)mre