This repository has been archived on 2026-09-17. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
nixos-config/hosts/pinix/localServices/gitserver/head.html
pijukka 3d8194fc7d host(pinix): show snapshot downloads and clone URL in cgit
cgit has no download tab; snapshot links only appear on the commit page
(hidden here) and for tags (none exist). A small inline script in
head.html adds tar.gz/zip for the selected branch to the tab bar and
shows the SSH clone URL from cgit's own vcs-git link.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JGodmgtRqahbT52gApsM8N
2026-09-14 13:39:28 +02:00

32 lines
1.3 KiB
HTML

<link rel="stylesheet" type="text/css" href="/pinix.css"/>
<script>
// cgit hat keinen Download-Tab: Snapshot-Links stehen nur auf der
// Commit-Seite und bei Tags. Hier kommen tar.gz/zip fuer den gewaehlten
// Branch direkt in die Tab-Leiste, dazu die Clone-URL aus cgits eigenem
// <link rel="vcs-git">.
document.addEventListener('DOMContentLoaded', function () {
var tabs = document.querySelector('table.tabs td');
var repo = location.pathname.split('/')[1];
if (!tabs || !repo) return;
var ref = new URLSearchParams(location.search).get('h') || 'HEAD';
var box = document.createElement('span');
box.className = 'pinix-download';
['tar.gz', 'zip'].forEach(function (ext) {
var a = document.createElement('a');
a.href = '/' + repo + '/snapshot/' + repo + '-' + ref + '.' + ext;
a.textContent = ext;
box.appendChild(a);
});
tabs.appendChild(box);
var clone = document.querySelector('link[rel="vcs-git"]');
if (clone) {
var row = document.createElement('div');
row.className = 'pinix-clone';
row.innerHTML = 'clone <code></code>';
row.querySelector('code').textContent = 'git clone ' + clone.getAttribute('href');
document.querySelector('table.tabs').insertAdjacentElement('afterend', row);
}
});
</script>