upleb.uk

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

summaryrefslogtreecommitdiff
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
parent774d237fec608dd60773b4d88e5893323b79ed24 (diff)
landing page - use correct gitworkshop link
-rw-r--r--src/http/landing.rs16
-rw-r--r--templates/landing.html15
2 files changed, 28 insertions, 3 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(),
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 &rarr; 224 Browse Repositories on GitWorkshop.dev &rarr;
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