lib/repos/index.jsView |
---|
181 | 181 … | |
182 | 182 … | R.renderRepoPage = function (req, repo, page, branch, titleTemplate, body) { |
183 | 183 … | var self = this |
184 | 184 … | var gitUrl = 'ssb://' + repo.id |
185 | | - var gitLink = '<input class="clone-url" readonly="readonly" ' + |
186 | | - 'value="' + gitUrl + '" size="45" ' + |
187 | | - 'onclick="this.select()"/>' |
| 185 … | + var host = req.headers.host || '127.0.0.1:7718' |
| 186 … | + var path = '/' + encodeURIComponent(repo.id) |
| 187 … | + var httpUrl = 'http://' + encodeURI(host) + path |
188 | 188 … | var digsPath = [repo.id, 'digs'] |
| 189 … | + var cloneUrls = '<span class="clone-urls">' + |
| 190 … | + '<select class="custom-dropdown clone-url-protocol" ' + |
| 191 … | + 'onchange="this.nextSibling.value=this.value;this.nextSibling.select()">' + |
| 192 … | + '<option selected="selected" value="' + gitUrl + '">SSB</option>' + |
| 193 … | + '<option class="http-clone-url" value="' + httpUrl + '">HTTP</option>' + |
| 194 … | + '</select>' + |
| 195 … | + '<input class="clone-url" readonly="readonly" ' + |
| 196 … | + 'value="ssb://' + repo.id + '" size="45" ' + |
| 197 … | + 'onclick="this.select()"/>' + |
| 198 … | + '<script>' + |
| 199 … | + 'var httpOpt = document.querySelector(".http-clone-url")\n' + |
| 200 … | + 'if (location.protocol === "https:") httpOpt.text = "HTTPS"\n' + |
| 201 … | + 'httpOpt.value = location.origin + "' + path + '"\n' + |
| 202 … | + '</script>' + |
| 203 … | + '</span>' |
189 | 204 … | |
190 | 205 … | var done = multicb({ pluck: 1, spread: true }) |
191 | 206 … | self.web.getRepoName(repo.feed, repo.id, done()) |
192 | 207 … | self.web.about.getName(repo.feed, done()) |
243 | 258 … | [[repo.id, 'activity'], req._t('Activity'), 'activity'], |
244 | 259 … | [[repo.id, 'commits', branch||''], req._t('Commits'), 'commits'], |
245 | 260 … | [[repo.id, 'issues'], req._t('Issues'), 'issues'], |
246 | 261 … | [[repo.id, 'pulls'], req._t('PullRequests'), 'pulls'] |
247 | | - ], page, gitLink)), |
| 262 … | + ], page, cloneUrls)), |
248 | 263 … | body |
249 | 264 … | ]))) |
250 | 265 … | }) |
251 | 266 … | }) |