-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
181 lines (155 loc) · 6.99 KB
/
Copy pathindex.html
File metadata and controls
181 lines (155 loc) · 6.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>APT Repository — Utile OS</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&family=Ubuntu+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap" />
<link rel="icon" href="favicon.ico" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="logo192.png" />
<link rel="stylesheet" href="frontend.css">
<!-- Embed Data -->
<!-- Twitter, not X -->
<meta content="summary" property="twitter:card" />
<meta content="APT Repository — Utile OS" property="twitter:title" />
<meta content="https://raw.githubusercontent.com/Proman4713/Utile-OS/refs/heads/main/resources/Utile%20Transparent%20Lockup.png" property="twitter:image" />
<!-- Open Graph -->
<meta content="Utile OS" property="og:site_name" />
<meta content="APT Repository" property="og:title" />
<meta property="og:description" content="APT repository hosting all Utile OS-specific packages." />
<meta content="https://raw.githubusercontent.com/Proman4713/Utile-OS/refs/heads/main/resources/Utile%20Transparent%20Logo.png" property="og:image" />
<meta name="theme-color" content="#1A5E63" />
<meta content="https://github.com/Proman4713/Utile-OS-apt" property="og:url" />
<meta property="og:type" content="website" />
<!-- Miscellaneous -->
<meta name="description" content="APT repository hosting all Utile OS-specific packages." />
<meta name="author" content="Utile OS" />
<!-- End Embed Data -->
</head>
<body>
<div id="main" class="flex-container" style="gap: 30px; padding: 50px 0px;">
<div class="flex-cmn-centre" style="gap: 10px; width: 100%">
<h1 style="font-family: Ubuntu, sans-serif; color: var(--primary-colour); text-align: center">Utile OS APT Repository</h1>
<h3 style="text-align: center">Browse the APT repository that hosts all Utile OS-specific Debian packages</h3>
<div class="codeblock-container">
<button class="copy-to-clip" onclick="copyCode(this)">
<i class="fa-regular fa-copy"></i>
COPY
</button>
<div class="codeblock non-str language-bash"></div>
</div>
</div>
<div class="flex justify-center" style="width: 50%; gap: 50px">
<button class="arch-btn active-arch" onclick="selectArch(this)">
AMD64
</button>
</div>
<div
id="repository-list"
class="flex-container space-between"
style="width: 100%; height: fit-content; gap: 10px"
>
</div>
</div>
</body>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://kit.fontawesome.com/8e0cd6ed4d.js" crossorigin="anonymous"></script>
<script>
const code = `# UNNECESSARY IN Utile OS (for non-Utile systems, download packages from this page)
curl -fsSL "https://proman4713.github.io/Utile-OS-apt/public.key" | sudo gpg --dearmour -o "/etc/apt/keyrings/utile.gpg"
echo "deb [signed-by=/etc/apt/keyrings/utile.gpg] https://proman4713.github.io/Utile-OS-apt/ abstract main upstream universe" |
sudo tee /etc/apt/sources.list.d/utile.list
sudo apt update`;
const LATEST_UTILE_CODENAME = "abstract";
const REPO_COMPONENTS = ["main", "upstream", "universe"];
const isString = false;
const codeblock = document.querySelector(".codeblock");
const processedCode = code
.split("\n")
.map(line => line.length <= 160 ? line : line.slice(0, 150) + " { ... } " + line.slice(-10))
.join("\n");
codeblock.textContent = processedCode;
if (!isString) {
hljs.highlightElement(codeblock);
}
loadPackages('amd64');
function copyCode(btn) {
navigator.clipboard?.writeText(code).catch(console.warn);
btn.innerHTML = `<i class="fa-solid fa-check"></i> COPIED`;
setTimeout(() => {
btn.innerHTML = `<i class="fa-regular fa-copy"></i> COPY`;
}, 2000);
}
function selectArch(btn) {
document.querySelectorAll(".arch-btn").forEach(b => b.classList.remove("active-arch"));
btn.classList.add("active-arch");
const arch = btn.textContent.toLowerCase();
loadPackages(arch);
}
async function fetchComponent(arch, component) {
try {
const response = await fetch(`./dists/${LATEST_UTILE_CODENAME}/${component}/binary-${arch}/Packages`);
if (!response.ok) return [];
const text = await response.text();
return text.split('\n\n').map(block => {
const lines = block.split('\n');
const obj = { _component: component };
lines.forEach(line => {
const [key, ...val] = line.split(': ');
if (key) obj[key] = val.join(': ');
});
return obj;
}).filter(p => p.Package);
} catch (error) {
console.error(`Error loading component ${component}:`, error);
return [];
}
}
async function loadPackages(arch) {
const repoList = document.querySelector("#repository-list");
const promises = REPO_COMPONENTS.map(comp => fetchComponent(arch, comp));
const componentResults = await Promise.all(promises);
const packages = componentResults.flat();
if (packages.length === 0) {
repoList.innerHTML = `<div style="color: #ff6b6b; padding: 20px;">No packages found for architecture: ${arch}</div>`;
return;
}
repoList.innerHTML = packages.map(p => {
return `
<div
class="flex-centre space-between package-item"
data-filename="${p.Filename}"
onclick='downloadPackage("${p.Filename}")'
>
<h3 style="font-family: Ubuntu Mono, monospace, sans-serif;">${p.Package}<span style="opacity: 0.5;">@${p.Version}</span> — ${p._component} <span style="opacity: 0.5;">(${p.Section || "Unknown Section"})</span></h3>
<p style="font-weight: 600; font-size: 15px">${p.Description} <span style="opacity: 0.5; font-weight: bold;">(~${Math.round(parseInt(p.Size) / (1024)).toLocaleString("en-US")} KiB)</span></p>
</div>`
}).join('');
document.querySelectorAll(".package-item").forEach(e => {
e.addEventListener("mousedown", ev => {
if (ev.button !== 1) return;
ev.preventDefault();
const url = e.dataset.filename;
downloadPackage(url, true);
});
})
}
async function downloadPackage(filename, openInNewTab = false) {
if (!filename) {
window.alert("This package is not available for download");
return;
}
if (openInNewTab) {
console.log('opening in new tab');
window.open(`./${filename}`, '_blank');
return;
}
window.location.href = `./${filename}`
}
</script>
</html>