gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit0db272000db27200gitoria#32: share character checks and environment lookupmre0db27200/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

  • 0db27200gitoria#32: share character checks and environment lookupmre
  • 452f6a1amission W60: logic clean-upsmre
  • 1448c899log: cleanup, #49 GPTBot, tracker mentions on #36mre
  • fcf95936log: v1.5.1 provenmre
  • 22105420log: W51b livemre
  • 7e8aabeareport: W51b pull source verificationmre
  • 6c18de76fix: preserve pull sources across containing branchesmre
  • fc36fa2elog: W51b pull source bugmre
  • 56bc1220log: v1.5.1 livemre
  • 845fc0aareport: W51mre
  • 83127391fix: return v1.5.1 app and merge error detailsmre
  • b07d0e97log: W51 v1.5.1 startedmre
  • 0b417d06docs: apps-api v1.5 user tokens (#48, W49)mre
  • d046940alog: vinzenz contract note sentmre
  • db443456log: vinzenz note retry 2mre
  • 802f229alog: kunibert repo ping provenmre
  • 2d2eaa92log: Kunibert connected to kunibert repomre
  • 65d5f80alogmre
  • dab74b0dW49 report, logmre
  • fd4fc028Exercise member status reads with a populated check statemre