| 1 | {% extends "base.html" %} |
| 2 | |
| 3 | {% block title %}{{ site_name }}{% endblock %} |
| 4 | |
| 5 | {% block extra_css %} |
| 6 | .tagline { |
| 7 | color: #666; |
| 8 | font-size: 0.85rem; |
| 9 | margin-bottom: 2rem; |
| 10 | } |
| 11 | .stats { |
| 12 | display: flex; |
| 13 | gap: 2rem; |
| 14 | margin-bottom: 2.5rem; |
| 15 | font-size: 0.8rem; |
| 16 | } |
| 17 | .stat-val { color: #fff; font-size: 1.1rem; } |
| 18 | .stat-label { color: #555; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; } |
| 19 | pre { |
| 20 | background: #111; |
| 21 | border: 1px solid #222; |
| 22 | border-radius: 6px; |
| 23 | padding: 1rem; |
| 24 | overflow-x: auto; |
| 25 | font-size: 0.8rem; |
| 26 | line-height: 1.6; |
| 27 | color: #aaa; |
| 28 | } |
| 29 | pre .cmd { color: #e0e0e0; } |
| 30 | pre .comment { color: #555; } |
| 31 | .repos-list { |
| 32 | list-style: none; |
| 33 | font-size: 0.85rem; |
| 34 | line-height: 1.8; |
| 35 | } |
| 36 | .repos-list li { |
| 37 | border-bottom: 1px solid #181818; |
| 38 | padding: 0.5rem 0; |
| 39 | display: flex; |
| 40 | justify-content: space-between; |
| 41 | align-items: center; |
| 42 | } |
| 43 | .repos-list li:last-child { border-bottom: none; } |
| 44 | .repos-list .repo-name { color: #ccc; } |
| 45 | .repos-list .repo-owner { color: #555; } |
| 46 | .endpoints { |
| 47 | list-style: none; |
| 48 | font-size: 0.8rem; |
| 49 | line-height: 2; |
| 50 | } |
| 51 | .endpoints li { display: flex; gap: 0.75rem; } |
| 52 | .method { |
| 53 | color: #555; |
| 54 | min-width: 4rem; |
| 55 | text-align: right; |
| 56 | } |
| 57 | .path { color: #aaa; } |
| 58 | {% endblock %} |
| 59 | |
| 60 | {% block body %} |
| 61 | <h1>{{ site_name }}</h1> |
| 62 | <p class="tagline">minimal git hosting with ssh key auth</p> |
| 63 | |
| 64 | <div class="stats"> |
| 65 | <div><div class="stat-val">{{ user_count }}</div><div class="stat-label">users</div></div> |
| 66 | <div><div class="stat-val">{{ repo_count }}</div><div class="stat-label">repos</div></div> |
| 67 | </div> |
| 68 | |
| 69 | <div class="section"> |
| 70 | <h2>repositories</h2> |
| 71 | {% if repositories.is_empty() %} |
| 72 | <p class="empty">no repos yet</p> |
| 73 | {% else %} |
| 74 | <ul class="repos-list"> |
| 75 | {% for r in repositories %} |
| 76 | <li> |
| 77 | <span class="repo-name"><a href="/{{ r.owner }}"><span class="repo-owner">{{ r.owner }}/</span></a><a href="/{{ r.owner }}/{{ r.name }}">{{ r.name }}</a></span> |
| 78 | {% if let Some(h) = r.hash %} |
| 79 | <span class="repo-hash">{{ h }}</span> |
| 80 | {% endif %} |
| 81 | </li> |
| 82 | {% endfor %} |
| 83 | </ul> |
| 84 | {% endif %} |
| 85 | </div> |
| 86 | |
| 87 | <div class="section"> |
| 88 | <h2>quick start</h2> |
| 89 | <pre><span class="comment"># install cli, ssh config, and credential helper</span> |
| 90 | <span class="cmd">curl -fsSL https://{{ ssh_host }}/install.sh | sh</span> |
| 91 | |
| 92 | <span class="comment"># create account and authenticate</span> |
| 93 | <span class="cmd">openhub register</span> |
| 94 | <span class="cmd">openhub login</span> |
| 95 | |
| 96 | <span class="comment"># create a repo and push</span> |
| 97 | <span class="cmd">openhub repo new my-project</span> |
| 98 | <span class="cmd">openhub clone you/my-project</span></pre> |
| 99 | </div> |
| 100 | |
| 101 | <div class="section"> |
| 102 | <h2>ssh commands</h2> |
| 103 | {% if ssh_port == "22" %} |
| 104 | <pre><span class="comment"># clone and push over ssh</span> |
| 105 | <span class="cmd">git clone git@{{ ssh_host }}:you/repo.git</span> |
| 106 | |
| 107 | <span class="comment"># manage repos over ssh</span> |
| 108 | <span class="cmd">ssh git@{{ ssh_host }} repo new my-project</span> |
| 109 | <span class="cmd">ssh git@{{ ssh_host }} repo list</span> |
| 110 | <span class="cmd">ssh git@{{ ssh_host }} repo delete my-project</span> |
| 111 | |
| 112 | <span class="comment"># sign up interactively</span> |
| 113 | <span class="cmd">ssh git@{{ ssh_host }}</span></pre> |
| 114 | {% else %} |
| 115 | <pre><span class="comment"># clone and push over ssh</span> |
| 116 | <span class="cmd">git clone ssh://git@{{ ssh_host }}:{{ ssh_port }}/you/repo.git</span> |
| 117 | |
| 118 | <span class="comment"># manage repos over ssh</span> |
| 119 | <span class="cmd">ssh -p {{ ssh_port }} git@{{ ssh_host }} repo new my-project</span> |
| 120 | <span class="cmd">ssh -p {{ ssh_port }} git@{{ ssh_host }} repo list</span> |
| 121 | <span class="cmd">ssh -p {{ ssh_port }} git@{{ ssh_host }} repo delete my-project</span> |
| 122 | |
| 123 | <span class="comment"># sign up interactively</span> |
| 124 | <span class="cmd">ssh -p {{ ssh_port }} git@{{ ssh_host }}</span></pre> |
| 125 | {% endif %} |
| 126 | </div> |
| 127 | |
| 128 | <div class="section"> |
| 129 | <h2>api</h2> |
| 130 | <ul class="endpoints"> |
| 131 | <li><span class="method">POST</span> <span class="path">/api/signup</span></li> |
| 132 | <li><span class="method">POST</span> <span class="path">/api/login/challenge</span></li> |
| 133 | <li><span class="method">POST</span> <span class="path">/api/login/verify</span></li> |
| 134 | <li><span class="method">POST</span> <span class="path">/api/repos</span></li> |
| 135 | <li><span class="method">GET</span> <span class="path">/api/repos/:user</span></li> |
| 136 | <li><span class="method">DELETE</span> <span class="path">/api/repos/:user/:repo</span></li> |
| 137 | <li><span class="method">GET</span> <span class="path">/api/stats</span></li> |
| 138 | <li><span class="method">GIT</span> <span class="path">/:user/:repo.git</span></li> |
| 139 | <li><span class="method">SSH</span> <span class="path">git@host repo new/list/delete</span></li> |
| 140 | </ul> |
| 141 | </div> |
| 142 | {% endblock %} |