mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-29 15:51:17 +00:00
* Add script to update submodule * Update publish-release.sh * Add helper script to build syncthing submodule only * Enable HTTPS for REST/WebUI only if OS supports it (fixes #137) * Update ApiRequest to handle both http or https * Add Constants#osSupportsTLS12 * Update APK version to 0.14.54.2 / 4181 * Update README.md * Update whatsnew
This commit is contained in:
parent
1371f29c66
commit
7791787bbc
9 changed files with 51 additions and 10 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![License: MPLv2](https://img.shields.io/badge/License-MPLv2-blue.svg)](https://opensource.org/licenses/MPL-2.0)
|
||||
<a href="https://github.com/Catfriend1/syncthing-android/releases" alt="GitHub release"><img src="https://img.shields.io/github/release/Catfriend1/syncthing-android/all.svg" /></a>
|
||||
<a href="https://f-droid.org/de/packages/com.github.catfriend1.syncthingandroid" alt="F-Droid release"><img src="https://img.shields.io/badge/f--droid-4180-brightgreen.svg" /></a>
|
||||
<a href="https://f-droid.org/de/packages/com.github.catfriend1.syncthingandroid" alt="F-Droid release"><img src="https://img.shields.io/f-droid/v/com.github.catfriend1.syncthingandroid.svg" /></a>
|
||||
|
||||
# Major enhancements in this fork are:
|
||||
- Individual sync conditions can be applied per device and per folder (for expert users).
|
||||
|
|
|
@ -37,8 +37,8 @@ android {
|
|||
applicationId "com.github.catfriend1.syncthingandroid"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 26
|
||||
versionCode 4180
|
||||
versionName "0.14.54.1"
|
||||
versionCode 4181
|
||||
versionName "0.14.54.2"
|
||||
testApplicationId 'com.github.catfriend1.syncthingandroid.test'
|
||||
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
|
||||
playAccountConfig = playAccountConfigs.defaultAccountConfig
|
||||
|
|
|
@ -157,9 +157,12 @@ public abstract class ApiRequest {
|
|||
}
|
||||
@Override
|
||||
protected HttpURLConnection createConnection(URL url) throws IOException {
|
||||
HttpsURLConnection connection = (HttpsURLConnection) super.createConnection(url);
|
||||
connection.setHostnameVerifier((hostname, session) -> true);
|
||||
return connection;
|
||||
if (mUrl.toString().startsWith("https://")) {
|
||||
HttpsURLConnection connection = (HttpsURLConnection) super.createConnection(url);
|
||||
connection.setHostnameVerifier((hostname, session) -> true);
|
||||
return connection;
|
||||
}
|
||||
return super.createConnection(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.nutomic.syncthingandroid.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -164,4 +165,14 @@ public class Constants {
|
|||
static File getLogFile(Context context) {
|
||||
return new File(context.getExternalFilesDir(null), "syncthing.log");
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide if we should enforce HTTPS when accessing the Web UI and REST API.
|
||||
* Android 4.4 and earlier don't have support for TLS 1.2 requiring us to
|
||||
* fall back to an unencrypted HTTP connection to localhost. This applies
|
||||
* to syncthing core v0.14.53+.
|
||||
*/
|
||||
public static final Boolean osSupportsTLS12() {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,8 +119,9 @@ public class ConfigXml {
|
|||
}
|
||||
|
||||
public URL getWebGuiUrl() {
|
||||
String urlProtocol = Constants.osSupportsTLS12() ? "https" : "http";
|
||||
try {
|
||||
return new URL("https://" + getGuiElement().getElementsByTagName("address").item(0).getTextContent());
|
||||
return new URL(urlProtocol + "://" + getGuiElement().getElementsByTagName("address").item(0).getTextContent());
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException("Failed to parse web interface URL", e);
|
||||
}
|
||||
|
@ -166,9 +167,15 @@ public class ConfigXml {
|
|||
}
|
||||
|
||||
/* Section - GUI */
|
||||
// Enforce TLS.
|
||||
Element gui = getGuiElement();
|
||||
changed = setConfigElement(gui, "tls", "true") || changed;
|
||||
|
||||
// Platform-specific: Force REST API and Web UI access to use TLS 1.2 or not.
|
||||
Boolean forceHttps = Constants.osSupportsTLS12();
|
||||
if (!gui.hasAttribute("tls") ||
|
||||
Boolean.parseBoolean(gui.getAttribute("tls")) != forceHttps) {
|
||||
gui.setAttribute("tls", forceHttps ? "true" : "false");
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Set user to "syncthing"
|
||||
changed = setConfigElement(gui, "user", "syncthing") || changed;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
Maintenance
|
||||
* Updated syncthing core to v0.14.54
|
||||
* Fallback to http if https tls 1.2 is unavailable on Android 4.x
|
||||
Enhancements
|
||||
* Added "Recent changes" UI, click files to open [NEW]
|
||||
* Specify sync conditions differently for each folder, device [NEW]
|
||||
|
|
7
build_submodule.cmd
Normal file
7
build_submodule.cmd
Normal file
|
@ -0,0 +1,7 @@
|
|||
@echo off
|
||||
cls
|
||||
cd /d "%~dps0"
|
||||
REM
|
||||
gradlew buildNative
|
||||
REM
|
||||
pause
|
12
git_update_submodule.cmd
Normal file
12
git_update_submodule.cmd
Normal file
|
@ -0,0 +1,12 @@
|
|||
@echo off
|
||||
cls
|
||||
REM
|
||||
SET PATH=%PATH%;"%ProgramFiles%\Git\bin"
|
||||
SET DESIRED_SUBMODULE_VERSION=v0.14.54
|
||||
REM
|
||||
cd /d "%~dps0\syncthing\src\github.com\syncthing\syncthing"
|
||||
REM
|
||||
git fetch --all
|
||||
git checkout %DESIRED_SUBMODULE_VERSION%
|
||||
REM
|
||||
pause
|
|
@ -43,4 +43,4 @@ Release published!
|
|||
#"
|
||||
#ACCESS_TOKEN=""
|
||||
#api_json=$(printf '{"tag_name": "v%s","target_commitish": "master","name": "v%s","body": "%s","draft": false,"prerelease": false}' $version $version $changelog)
|
||||
#curl --data "$api_json" https://api.github.com/repos/syncthing/syncthing-android/releases?access_token=$ACCESS_TOKEN
|
||||
#curl --data "$api_json" https://api.github.com/repos/Catfriend1/syncthing-android/releases?access_token=$ACCESS_TOKEN
|
||||
|
|
Loading…
Reference in a new issue