Improvements

This commit is contained in:
Jacob 2023-08-27 21:45:32 +02:00
parent 8e6c508bab
commit 0b87d91485
6 changed files with 135 additions and 11 deletions

0
aurmake Normal file → Executable file
View file

View file

@ -5,7 +5,7 @@ function getShellString($file, $string) {
$output = array();
// Rather lazy, but convenient
exec("./output_data.sh $file $string", $output);
exec("./viewer/output_data.sh $file $string", $output);
if (empty($output[0])) {
return NULL;
@ -14,12 +14,20 @@ function getShellString($file, $string) {
return $output[0];
}
function printHead() {
function printHead($title, $desc) {
print "<!DOCTYPE html>\n";
print "<head>\n";
print "\t<meta name=\"description\" content=\"Browse speedie-aur Arch Linux packages\">\n";
print "\t<title>speedie-aur</title>\n";
print "\t\t<form class=\"bar\" method=\"post\" action=\"$self?action=search\"><input type=\"text\" name=\"q\" placeholder=\"search for packages..\"></form>\n";
print "\t<meta name=\"description\" content=\"$desc\">\n";
print "\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n";
print "\t<link rel=\"icon\" href=\"/viewer/fav.svg\"/>\n";
print "\t<link type=\"text/css\" rel=\"stylesheet\" href=\"/viewer/index.css\"/>\n";
print "\t<title>$title</title>\n";
print "\t<div class=\"bar\">\n";
print "\t\t\t<span class=\"title\">$title</span>\n";
print "\t\t\t\t<a href=\"$self?action=view\"><img src=\"/viewer/home.svg\" width=\"16\" height=\"16\">Home</a>\n";
print "\t\t\t\t<a href=\"$self?action=all\"><img src=\"/viewer/all.svg\" width=\"16\" height=\"16\">All</a>\n";
print "\t\t<form method=\"post\" action=\"$self?action=search\"><input type=\"text\" name=\"q\" placeholder=\"search for packages..\"></form>\n";
print "\t</div>\n";
print "</head>\n";
print "<body>\n";
print "\t<div class=\"content\">\n";
@ -29,6 +37,14 @@ function printFoot() {
print "\t</div>\n";
print "</body>\n";
print "\t<footer>\n";
print "\t\t<div class=\"column\">\n";
print "\t\t\t<span class=\"links\">\n";
print "\t\t\t\t<a class=\"links\" href=\"https://git.speedie.site\">Git</a>\n";
print "\t\t\t\t<a class=\"links\" href=\"https://ls.speedie.site\">Downloads</a>";
print "\t\t\t\t<a class=\"links\" href=\"https://git.speedie.site/speedie/speedie-aur\">Source code</a>\n";
print "\t\t\t\t<p>Licensed under the GNU Affero General Public License v3</p>\n";
print "\t\t\t</span>\n";
print "\t\t</div>\n";
print "\t</footer>\n";
print "</html>\n";
}
@ -43,7 +59,7 @@ function main() {
$packageNames = array();
$packageDescs = array();
printHead();
printHead("speedie-aur", "speedie-aur Arch Linux repository");
foreach(scandir(".") as $f) {
$path = pathinfo($f);
@ -56,7 +72,7 @@ function main() {
}
// Return results
if ($request == "search" && $query != '') {
if ($request == "search") {
$validPkgs = 0;
$matches = array();
$matchingDescs = array();
@ -82,7 +98,7 @@ function main() {
}
print "\t\t\t\t</ul>\n";
} else if ($request == "view" && $query == '') {
} else if ($request == "all") {
print "\t\t\t<p>Total number of packages: $packageCount</p>\n";
print "\t\t\t\t<ul class=\"pkglist\">\n";
@ -91,12 +107,26 @@ function main() {
}
print "\t\t\t\t</ul>\n";
} else if ($request == "view" && $query == '') {
print "\t\t<h1>speedie-aur</h1>\n";
print "\t\t\t<p>Welcome to aur.speedie.site. This is just my Arch Linux repository.</p>\n";
print "\t\t<h2>Installation</h2>\n";
print "\t\t\t<p>Add the following lines to <code>/etc/pacman.conf</code> on your Arch Linux based operating system:</p>\n";
print "\t\t\t\t<pre><code>\n";
print "\t[speedie-aur]\n";
print "\tServer = https://aur.speedie.site\n";
print "\t\t\t\t</code></pre>\n";
print "\t\t\t\t<p>Now run <code>pacman-key --recv-keys CEB863B830D1318A && pacman-key --lsign-key CEB863B830D1318A</code> to add my PGP key.</p>\n";
print "\t\t\t\t<p>Then simply <code>pacman -Syu</code> to sync the repositories. Then you can install any of my packages in the same way you install official packages.</p>\n";
print "\t\t<h2>How do I use this site?</h2>\n";
print "\t\t\t<p>You can search for packages using the input box in the navbar. Then you can select a package to view details about it. You can press 'Home' in the navbar to go back to this page, or 'All' to display all available packages.</p>\n";
} else if ($request == "view" && $query != '') {
$packageCount = 0;
$packageVersions = array();
$packageUrls = array();
$packageDepends = array();
$packageFilenames = array();
$packageLicenses = array();
$packageSizes = array();
$packageGPG = array();
$packageMD5 = array();
@ -116,6 +146,7 @@ function main() {
$packageMD5[$packageCount] = getShellString($f, "md5");
$packageSHA256[$packageCount] = getShellString($f, "sha256");
$packageSources[$packageCount] = getShellString($f, "source");
$packageLicenses[$packageCount] = getShellString($f, "license");
}
}
@ -136,6 +167,7 @@ function main() {
$pkgMD5 = $packageMD5[$i];
$pkgSHA256 = $packageSHA256[$i];
$pkgSource = $packageSources[$i];
$pkgLicense = $packageLicenses[$i];
print "\t\t<h1>$pkgName</h1>\n";
@ -152,6 +184,11 @@ function main() {
print "\t\t\t\t\t\t<td>$pkgVer</td>\n";
print "\t\t\t\t</tr>\n";
print "\t\t\t\t\t<tr>\n";
print "\t\t\t\t\t<th>License</th>\n";
print "\t\t\t\t\t\t<td>$pkgLicense</td>\n";
print "\t\t\t\t</tr>\n";
print "\t\t\t\t\t<tr>\n";
print "\t\t\t\t\t<th>URL</th>\n";
print "\t\t\t\t\t\t<td>$pkgUrl</td>\n";

8
packages/viewer/all.svg Executable file
View file

@ -0,0 +1,8 @@
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
color:#eff0f1;
}</style>
</defs>
<path class="ColorScheme-Text" d="m2 2v12h12v-12zm1 1h10v10h-10zm1 1v1h8v-1zm0 3v1h8v-1zm0 3v1h8v-1z" fill="#f0f0f0"/>
</svg>

After

Width:  |  Height:  |  Size: 329 B

8
packages/viewer/home.svg Executable file
View file

@ -0,0 +1,8 @@
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
color:#eff0f1;
}</style>
</defs>
<path class="ColorScheme-Text" d="m8 2-0.707 0.6992 0.003906 0.003906-5.297 5.295v0.001953 1h1.008v4h-0.007812v1h10v-1-4h1v-1-0.001953l-1.143-1.143-0.7012 0.7012 0.4434 0.4434h-0.5996v5h-3v-3h-2v3h-3v-4-1h-0.5996l4.598-4.596 0.001953 0.001953 0.001953-0.001953 1.441 1.439 0.7012-0.7012-1.441-1.439 0.003906-0.003906-0.707-0.6992zm3 1v3h1.008v-3h-1.008z" fill="#f0f0f0"/>
</svg>

After

Width:  |  Height:  |  Size: 582 B

67
packages/viewer/index.css Normal file
View file

@ -0,0 +1,67 @@
.bar {
position: sticky;
top: 0px;
z-index: 6;
background-color: #363636;
margin: 0px;
padding: 0px;
width: 100%;
}
.bar img {
transform: translate(0, +30%);
padding-right: 5px;
}
.bar input {
padding-top: 2px;
padding-bottom: 2px;
border-color: #363636;
border-width: 0px;
background-color: #363636;
color: #f0eee4;
width: 100%
}
.title {
color: #f0eee4;
padding-left: 2px;
}
body {
margin: 0px;
padding: 0px;
background-color: #212121;
font-family: Monospace;
}
footer {
padding: 5px;
font-size: 8pt;
font-weight: normal;
background-color: transparent;
text-align: center;
}
.links {
color: #66667d;
padding: 5px;
padding-left: 2px;
}
.content {
color: #f0eee4;
padding: 5px;
max-width: 1000px;
margin: auto;
}
a {
color: #89bfff;
text-decoration: none;
transition: 0.1s;
}
a:hover {
color: #ccccff;
text-decoration: underline;
}

View file

@ -37,15 +37,15 @@ case "$2" in
exit
;;
"source")
printf "${source[*]}"
printf "%s" "${source[*]}"
exit
;;
"sha256")
printf "${sha256sums[*]}"
printf "%s" "${sha256sums[*]}"
exit
;;
"md5")
printf "${md5sums[*]}"
printf "%s" "${md5sums[*]}"
exit
;;
"gpg")
@ -53,6 +53,10 @@ case "$2" in
[ -f "$package.sig" ] && printf "%s" "$package.sig" || printf "Unknown"
exit
;;
"license")
printf "%s" "${license}"
exit
;;
"size")
package="$pkgname-$pkgver-$pkgrel-$arch.pkg.tar.zst"