Creates an IntentService subclass for scanning removable "external
storage" for F-Droid package repos, e.g. SD Cards. This is intented to
support sharable package repos, so it ignores non-removable storage,
like the fake emulated sdcard from devices with only built-in storage.
This method will only ever allow for reading repos, never writing. It
also will not work for removeable storage devices plugged in via USB,
since do not show up as "External Storage"
* https://stackoverflow.com/a/40201333
* https://commonsware.com/blog/2017/11/14/storage-situation-external-storage.htmlcloses#1377
This uses the new Storage Access Framework, which was required for
accessing files on the SD Card starting in android-19. But the API
was really limited until android-21, and not really complete until
android-23 or even android-26. So the levels of usability will vary a
lot based on how new the version of Android is.
java.lang.Throwable: Explicit termination method 'end' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:180)
at java.util.zip.Deflater.<init>(Deflater.java:171)
at kellinwood.zipio.ZioEntryOutputStream.<init>(ZioEntryOutputStream.java:35)
at kellinwood.zipio.ZioEntry.getOutputStream(ZioEntry.java:482)
at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:759)
at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:664)
at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:213)
at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:492)
at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:759)
at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:709)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
E StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
NanoHTTPD has issues with HTTP Keep-Alive, especially when other requests
are mixed in, like the /request-swap POST or perhaps the F-Droid HEAD to
fetch the ETag before the GET.
This disables gzip encoding and sets a Content Security Policy while I'm at
it. APKs, PNGs, and JARs are already compressed, so gzip would only ever
cause problems. And the index page is meant to be viewed by browsers, so
having a CSP will limit potential malicious swap activity.
The webserver was totally broken since nanohttpd had changed so much since
the swap webserver was implemented. This syncs up with the sample file and
gets rid of our hacks. The only differences now are the stuff that is
removed since it is totally unused in F-Droid. This also adds a full test
suite.
this actually closes#248
The MIME Types only need to be set on files that we are actually using to
display in the browser. All others should not be set so that they cannot
be abused.
This is a quick hack to reuse the Latest view with a slightly simpler
layout. It makes the "basic" flavor fully functional as an fdroid client.
The goal here is just to have something simpler with as little new code as
possible. It is essential that the whitelabeling and "Light" aka "basic"
flavor does not increase the maintenance load.
closesfdroid/fdroidclient#48fdroid/fdroidclient!692fdroid/fdroidclient!695
java.lang.IllegalArgumentException: Could not parse [null/24]
at org.apache.commons.net.util.SubnetUtils.calculate(SubnetUtils.java:275)
at org.apache.commons.net.util.SubnetUtils.<init>(SubnetUtils.java:51)
at org.fdroid.fdroid.net.WifiStateChangeService.setIpInfoFromNetworkInterface(WifiStateChangeService.java:261)
at org.fdroid.fdroid.net.WifiStateChangeService.access$100(WifiStateChangeService.java:50)
at org.fdroid.fdroid.net.WifiStateChangeService$WifiInfoThread.run(WifiStateChangeService.java:132)
"full" is the original F-Droid app with all the features. It should still
build the exact same app after this change. "basic" is the smallest
version of F-Droid possible. It does not yet build, nor work.