Bring the swap website (hosted on the phone) in line with new designs.
The website now also has icons which it needs to worry about copying across to the webroot, so I refactored the "symlink webroot to other folders - such as /fdroid and /fdroid/repo".
This commit is contained in:
parent
6d807793c2
commit
87b82a6751
@ -1,65 +1,114 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>{{REPO_URL}} local FDroid repo</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>F-Droid swap</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
||||
|
||||
<style>
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: "Trebuchet MS", Helvetica, sans-serif;
|
||||
color: #444;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: "Roboto Light", "Roboto Lt", Helvetica, sans-serif;
|
||||
color: #fff;
|
||||
background-color: #1c6bbc;
|
||||
}
|
||||
|
||||
#swap-icon {
|
||||
display: block;
|
||||
margin: 1em auto 0 auto;
|
||||
width: 25%;
|
||||
max-width: 400px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.tick {
|
||||
display: block;
|
||||
float: right;
|
||||
margin-right: 1em;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0 auto;
|
||||
padding-top: 10px;
|
||||
text-align: center;
|
||||
padding: 0 1.5em;
|
||||
text-align: center;
|
||||
font-size: 1.2em;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
ol {
|
||||
counter-reset:li;
|
||||
margin-left:0;
|
||||
padding-left:0;
|
||||
counter-reset: li;
|
||||
margin-left: 0;
|
||||
margin-bottom: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
ol > li {
|
||||
position: relative;
|
||||
padding-left: 35px;
|
||||
padding-top: 20px;
|
||||
border-bottom: solid 1px #333;
|
||||
height: 4em;
|
||||
box-sizing: border-box;
|
||||
ol > li, #download-from-web {
|
||||
padding: 1em 0;
|
||||
border-bottom: solid 1px rgba(245, 245, 245, 0.2);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
ol > li:first-child {
|
||||
border-top: solid 1px #333;
|
||||
border-top: solid 1px rgba(245, 245, 245, 0.2);
|
||||
}
|
||||
|
||||
ol > li:before {
|
||||
content: counter(li);
|
||||
counter-increment: li;
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
top: 10px;
|
||||
font: bold 2em Sans-Serif;
|
||||
content: counter(li);
|
||||
counter-increment: li;
|
||||
font: bold 1.4em Sans-Serif;
|
||||
margin-left: 1em;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>Kerplapp Bootstrap</h1>
|
||||
<ol>
|
||||
<li><del>Find a Kerplapp Repo</del></li>
|
||||
<li><a href="{{CLIENT_URL}}">Download F-Droid client</a></li>
|
||||
<li>Install F-Droid client</li>
|
||||
<li><a href="{{REPO_URL}}">Add Kerplapp Repo to F-Droid client</a></li>
|
||||
<li>Kerplapp an App!</li>
|
||||
</ol>
|
||||
</body>
|
||||
ol > li a {
|
||||
font-family: "Roboto", Helvetica, sans-serif;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#download-from-web {
|
||||
padding-left: 2em;
|
||||
padding-right: 2em;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<img id="swap-icon" src="swap-icon.png" />
|
||||
<h1>You're minutes away from having swap success!</h1>
|
||||
<ol>
|
||||
<li>
|
||||
Find a swap
|
||||
<img src="swap-tick-done.png" class="tick done" alt="Done"/>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{CLIENT_URL}}">Download F-Droid</a>
|
||||
<img src="swap-tick-not-done.png" class="tick not-done" alt="Not done" />
|
||||
</li>
|
||||
<li>
|
||||
Install F-Droid
|
||||
<img src="swap-tick-not-done.png" class="tick not-done" alt="Not done" />
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{REPO_URL}}">Add the swap to F-Droid</a>
|
||||
<img src="swap-tick-not-done.png" class="tick not-done" alt="Not done" />
|
||||
</li>
|
||||
<li>
|
||||
Install the apps you want
|
||||
<img src="swap-tick-not-done.png" class="tick not-done" alt="Not done" />
|
||||
</li>
|
||||
</ol>
|
||||
<div id="download-from-web">
|
||||
<!--<a href="https://f-droid.org/repository/browse/">-->
|
||||
Or, download apps from the web
|
||||
<!--</a>-->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
BIN
assets/swap-icon.png
Normal file
BIN
assets/swap-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
48
assets/swap-icon.svg
Normal file
48
assets/swap-icon.svg
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="210.73421"
|
||||
height="146.02573"
|
||||
id="svg4443">
|
||||
<defs
|
||||
id="defs4445" />
|
||||
<metadata
|
||||
id="metadata4448">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(-323.20433,-293.63503)"
|
||||
id="layer1">
|
||||
<g
|
||||
transform="matrix(1.0670994,0,0,-1.0670994,446.72215,312.16094)"
|
||||
id="g3936-3">
|
||||
<path
|
||||
d="M 0,0 C 21.057,0 41.224,-7.789 56.795,-21.933 L 68.468,-9.08 C 49.692,7.971 25.381,17.361 0,17.361 c -51.395,0 -93.991,-38.272 -100.862,-87.807 l -14.889,7.251 c 7.94,-11.334 14.688,-28.971 18.26,-42.987 3.422,6.887 7.947,14.579 12.955,21.692 l 0.045,0 c 0,0.022 0.006,0.045 0.006,0.07 4.396,6.236 9.159,12.027 13.896,16.413 l -12.839,-3.155 C -77.015,-30.885 -42.056,0 0,0"
|
||||
id="path3938-7"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
|
||||
</g>
|
||||
<g
|
||||
transform="matrix(1.0670994,0,0,-1.0670994,406.74135,394.21193)"
|
||||
id="g3940-3">
|
||||
<path
|
||||
d="m 0,0 c 0.406,1.264 0.864,2.497 1.38,3.706 6.838,16.143 22.842,27.496 41.442,27.496 22.372,0 40.921,-16.423 44.364,-37.831 l -13.394,4.844 c 9.088,-10.425 17.673,-27.247 22.707,-40.806 5.021,13.559 13.605,30.381 22.7,40.809 L 104.8,-6.993 c -3.397,31.195 -29.887,55.558 -61.978,55.558 -26.999,0 -50.053,-17.26 -58.697,-41.334"
|
||||
id="path3942-2"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
BIN
assets/swap-tick-done.png
Normal file
BIN
assets/swap-tick-done.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
assets/swap-tick-not-done.png
Normal file
BIN
assets/swap-tick-not-done.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -28,6 +28,14 @@ import org.fdroid.fdroid.data.App;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
@ -50,15 +58,6 @@ import java.util.Map.Entry;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
public class LocalRepoManager {
|
||||
private static final String TAG = "LocalRepoManager";
|
||||
|
||||
@ -74,6 +73,12 @@ public class LocalRepoManager {
|
||||
private String ipAddressString = "UNSET";
|
||||
private String uriString = "UNSET";
|
||||
|
||||
private static String[] WEB_ROOT_ASSET_FILES = {
|
||||
"swap-icon.png",
|
||||
"swap-tick-done.png",
|
||||
"swap-tick-not-done.png"
|
||||
};
|
||||
|
||||
private Map<String, App> apps = new HashMap<String, App>();
|
||||
|
||||
public final File xmlIndex;
|
||||
@ -159,30 +164,43 @@ public class LocalRepoManager {
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
for (String file : WEB_ROOT_ASSET_FILES) {
|
||||
Utils.copy(assetManager.open(file), new FileOutputStream(new File(webRoot, file)));
|
||||
}
|
||||
|
||||
// make symlinks/copies in each subdir of the repo to make sure that
|
||||
// the user will always find the bootstrap page.
|
||||
File fdroidDirIndex = new File(fdroidDir, "index.html");
|
||||
fdroidDirIndex.delete();
|
||||
Utils.symlinkOrCopyFile(new File("../index.html"), fdroidDirIndex);
|
||||
File repoDirIndex = new File(repoDir, "index.html");
|
||||
repoDirIndex.delete();
|
||||
Utils.symlinkOrCopyFile(new File("../../index.html"), repoDirIndex);
|
||||
symlinkIndexPageElsewhere("../", fdroidDir);
|
||||
symlinkIndexPageElsewhere("../../", repoDir);
|
||||
|
||||
// add in /FDROID/REPO to support bad QR Scanner apps
|
||||
File fdroidCAPS = new File(fdroidDir.getParentFile(), "FDROID");
|
||||
fdroidCAPS.mkdir();
|
||||
|
||||
File repoCAPS = new File(fdroidCAPS, "REPO");
|
||||
repoCAPS.mkdir();
|
||||
File fdroidCAPSIndex = new File(fdroidCAPS, "index.html");
|
||||
fdroidCAPSIndex.delete();
|
||||
Utils.symlinkOrCopyFile(new File("../index.html"), fdroidCAPSIndex);
|
||||
File repoCAPSIndex = new File(repoCAPS, "index.html");
|
||||
repoCAPSIndex.delete();
|
||||
Utils.symlinkOrCopyFile(new File("../../index.html"), repoCAPSIndex);
|
||||
|
||||
symlinkIndexPageElsewhere("../", fdroidCAPS);
|
||||
symlinkIndexPageElsewhere("../../", repoCAPS);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void symlinkIndexPageElsewhere(String symlinkPrefix, File directory) {
|
||||
File index = new File(directory, "index.html");
|
||||
index.delete();
|
||||
Utils.symlinkOrCopyFile(new File(symlinkPrefix + "index.html"), index);
|
||||
|
||||
for(String fileName : WEB_ROOT_ASSET_FILES) {
|
||||
File file = new File(directory, fileName);
|
||||
file.delete();
|
||||
Utils.symlinkOrCopyFile(new File(symlinkPrefix + fileName), file);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteContents(File path) {
|
||||
if (path.exists()) {
|
||||
for (File file : path.listFiles()) {
|
||||
@ -225,7 +243,7 @@ public class LocalRepoManager {
|
||||
public void addApp(Context context, String packageName) {
|
||||
App app;
|
||||
try {
|
||||
app = new App(context, pm, packageName);
|
||||
app = new App(context.getApplicationContext(), pm, packageName);
|
||||
if (!app.isValid())
|
||||
return;
|
||||
PackageInfo packageInfo = pm.getPackageInfo(packageName, PackageManager.GET_META_DATA);
|
||||
|
Loading…
x
Reference in New Issue
Block a user