add clickable list of APKs to the swap HTML index page

This allows for rapid, direct download of APKs.  It is sometimes useful, as
long as it doesn't get in the way.
This commit is contained in:
Hans-Christoph Steiner 2018-08-09 23:53:40 +02:00
parent ab8948eb5a
commit 6db0fa6387
2 changed files with 43 additions and 0 deletions

View File

@ -147,10 +147,24 @@ public final class LocalRepoManager {
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(indexHtml)));
StringBuilder builder = new StringBuilder();
for (App app : apps.values()) {
builder.append("<li><a href=\"/fdroid/repo/")
.append(app.installedApk.apkName)
.append("\"><img width=\"32\" height=\"32\" src=\"/fdroid/repo/icons/")
.append(app.packageName)
.append("_")
.append(app.installedApk.versionCode)
.append(".png\">")
.append(app.name)
.append("</a></li>\n");
}
String line;
while ((line = in.readLine()) != null) {
line = line.replaceAll("\\{\\{REPO_URL\\}\\}", repoAddress);
line = line.replaceAll("\\{\\{CLIENT_URL\\}\\}", fdroidClientURL);
line = line.replaceAll("\\{\\{APP_LIST\\}\\}", builder.toString());
out.write(line);
}
in.close();

View File

@ -71,6 +71,28 @@
color: #fff;
}
details {
margin-left: 1em;
}
ul {
list-style-type: none;
}
ul > li {
padding: 1em 0;
}
ul > li a {
font-size: xx-large;
text-decoration: none;
color: #fff;
}
ul > li a img {
padding-right: 0.5em;
}
#download-from-web {
padding-left: 2em;
padding-right: 2em;
@ -105,5 +127,12 @@
<img src="swap-tick-not-done.png" class="tick not-done" alt="Not done" />
</li>
</ol>
<br/><br/><br/><br/>
<details>
<summary>Available Apps</summary>
<ul>
{{APP_LIST}}
</ul>
</details>
</body>
</html>