upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-12-02 13:59:08 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-12-02 13:59:08 +0000
commit96a75dedeedb448c3284d74215a5debc06e5ddcd (patch)
treed5c39e744ae701ce4691d3c3069a5b717883968a /src/http
parent774d237fec608dd60773b4d88e5893323b79ed24 (diff)
landing page - use correct gitworkshop link
Diffstat (limited to 'src/http')
-rw-r--r--src/http/landing.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/http/landing.rs b/src/http/landing.rs
index 6f2bfdd..df69a9d 100644
--- a/src/http/landing.rs
+++ b/src/http/landing.rs
@@ -51,7 +51,6 @@ pub fn get_html(config: &Config) -> String {
51 base_css = get_base_css(), 51 base_css = get_base_css(),
52 relay_name = config.relay_name, 52 relay_name = config.relay_name,
53 relay_description = config.relay_description, 53 relay_description = config.relay_description,
54 domain = config.domain,
55 ) 54 )
56} 55}
57 56
@@ -323,7 +322,7 @@ pub fn get_repo_html(config: &Config, npub: &str, identifier: &str) -> String {
323 <span class="client-name">gitworkshop.dev</span> 322 <span class="client-name">gitworkshop.dev</span>
324 <span class="client-desc">Web-based repository browser</span> 323 <span class="client-desc">Web-based repository browser</span>
325 </div> 324 </div>
326 <a href="https://gitworkshop.dev" target="_blank">Visit &rarr;</a> 325 <a id="gitworkshop-link" href="https://gitworkshop.dev" target="_blank">Visit &rarr;</a>
327 </div> 326 </div>
328 <div class="card client-card"> 327 <div class="card client-card">
329 <div class="client-info"> 328 <div class="client-info">
@@ -342,6 +341,19 @@ pub fn get_repo_html(config: &Config, npub: &str, identifier: &str) -> String {
342 </div> 341 </div>
343 <div class="footer">Powered by <strong>ngit-grasp</strong></div> 342 <div class="footer">Powered by <strong>ngit-grasp</strong></div>
344 </div> 343 </div>
344 <script>
345 // Detect protocol and construct gitworkshop link
346 const protocol = window.location.protocol; // 'http:' or 'https:'
347 const host = window.location.host; // 'domain.com' or 'domain.com:port'
348
349 // For http, use ws:// prefix and URL encode; for https, just use host (implies wss://)
350 let relayref = host;
351 if (protocol === 'http:') relayref = encodeURIComponent("ws://" + host);
352
353 // Construct gitworkshop link: gitworkshop.dev/npub/relayref/identifier
354 const gitworkshopLink = document.getElementById('gitworkshop-link');
355 gitworkshopLink.setAttribute('href', 'https://gitworkshop.dev/{npub}/' + relayref + '/{identifier}');
356 </script>
345</body> 357</body>
346</html>"##, 358</html>"##,
347 base_css = get_base_css(), 359 base_css = get_base_css(),