diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/landing.html | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/templates/landing.html b/templates/landing.html index 6d820c3..f44bdc3 100644 --- a/templates/landing.html +++ b/templates/landing.html | |||
| @@ -220,7 +220,7 @@ | |||
| 220 | 220 | ||
| 221 | <p class="subtitle">{relay_description}</p> | 221 | <p class="subtitle">{relay_description}</p> |
| 222 | 222 | ||
| 223 | <a href="https://gitworkshop.dev/relay/{domain}" class="browse-link" target="_blank"> | 223 | <a id="browse-link" href="https://gitworkshop.dev" class="browse-link" target="_blank"> |
| 224 | Browse Repositories on GitWorkshop.dev → | 224 | Browse Repositories on GitWorkshop.dev → |
| 225 | </a> | 225 | </a> |
| 226 | 226 | ||
| @@ -295,5 +295,18 @@ | |||
| 295 | Powered by <strong>ngit-grasp</strong> | 295 | Powered by <strong>ngit-grasp</strong> |
| 296 | </div> | 296 | </div> |
| 297 | </main> | 297 | </main> |
| 298 | <script> | ||
| 299 | // Detect protocol and construct gitworkshop relay link | ||
| 300 | const protocol = window.location.protocol; // 'http:' or 'https:' | ||
| 301 | const host = window.location.host; // 'domain.com' or 'domain.com:port' | ||
| 302 | |||
| 303 | // For http, use ws:// prefix and URL encode; for https, just use host (implies wss://) | ||
| 304 | let relayref = host; | ||
| 305 | if (protocol === 'http:') relayref = encodeURIComponent("ws://" + host); | ||
| 306 | |||
| 307 | // Update the browse link to point to the relay on gitworkshop | ||
| 308 | const browseLink = document.getElementById('browse-link'); | ||
| 309 | browseLink.setAttribute('href', 'https://gitworkshop.dev/relay/' + relayref); | ||
| 310 | </script> | ||
| 298 | </body> | 311 | </body> |
| 299 | </html> \ No newline at end of file | 312 | </html> \ No newline at end of file |