mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-22 19:01:30 +00:00
commit
3df114ea6f
5 changed files with 59 additions and 46 deletions
14
README.md
14
README.md
|
@ -5,8 +5,8 @@
|
|||
|
||||
A wrapper of [Syncthing](https://github.com/syncthing/syncthing) for Android.
|
||||
|
||||
<img src="src/fat/play/en-GB/listing/phoneScreenshots/screenshot_phone_1.png" alt="screenshot 1" width="200" />
|
||||
<img src="src/fat/play/en-GB/listing/phoneScreenshots/screenshot_phone_2.png" alt="screenshot 2" width="200" />
|
||||
<img src="src/fat/play/en-GB/listing/phoneScreenshots/screenshot_phone_1.png" alt="screenshot 1" width="200" />
|
||||
<img src="src/fat/play/en-GB/listing/phoneScreenshots/screenshot_phone_2.png" alt="screenshot 2" width="200" />
|
||||
<img src="src/fat/play/en-GB/listing/phoneScreenshots/screenshot_phone_3.png" alt="screenshot 3" width="200" />
|
||||
|
||||
[<img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" height="80">](https://play.google.com/store/apps/details?id=com.nutomic.syncthingandroid) [<img alt="Get it on F-Droid" src="https://f-droid.org/badge/get-it-on.png" height="80">](https://f-droid.org/app/com.nutomic.syncthingandroid)
|
||||
|
@ -39,9 +39,13 @@ To check for updated gradle dependencies, run `gradle dependencyUpdates`. Additi
|
|||
|
||||
### Building on Windows
|
||||
|
||||
To build the Syncthing app on Windows we need to include the native Syncthing binaries:
|
||||
- Download the `syncthing-linux-386` and `syncthing-linux-arm` archives from [Syncthing releases](https://github.com/syncthing/syncthing/releases) and extract them. In each there is a `syncthing` executable. Rename and place both of these to `libs/x86/libsyncthing.so` and `libs/armeabi/libsyncthing.so` respectively.
|
||||
Use `./gradlew assembleDebug` in the project directory to compile the APK.
|
||||
To build the Syncthing app on Windows we need to have cygwin installed.
|
||||
|
||||
From a cygwin shell in the project directory, build Go using `./make-go.bash [arch]`
|
||||
After Go is built, compile syncthing using `./make-syncthing.bash [arch]`
|
||||
|
||||
Lastly, use `./gradlew assembleDebug` in the project directory to compile the APK,
|
||||
or use Android Studio to build/deploy the APK.
|
||||
|
||||
# License
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 57e459e02b4b01567f92542f92cd9afde209e193
|
||||
Subproject commit 2f6557233c5a5c311547144c34b4045640ff9f71
|
12
make-go.bash
12
make-go.bash
|
@ -70,12 +70,20 @@ if [ ! -e ../VERSION ]; then
|
|||
echo "$(git describe --tags)" > ../VERSION
|
||||
fi
|
||||
|
||||
./make.bash --no-banner
|
||||
BUILDER_EXT=bash
|
||||
case "$(uname)" in
|
||||
*MINGW* | *WIN32* | *CYGWIN*)
|
||||
BUILDER_EXT=bat
|
||||
;;
|
||||
esac
|
||||
|
||||
./make.${BUILDER_EXT} --no-banner
|
||||
|
||||
cp -a ../bin "${GOROOT_FINAL}"/
|
||||
cp -a ../pkg "${GOROOT_FINAL}"/
|
||||
cp -a ../src "${GOROOT_FINAL}"/
|
||||
|
||||
if [[ -e ./make.bash ]]; then
|
||||
if [[ -e ./make.${BUILDER_EXT} ]]; then
|
||||
pushd ../
|
||||
git clean -f
|
||||
popd
|
||||
|
|
|
@ -35,6 +35,12 @@ unset GOPATH #Set by build.go
|
|||
export GOROOT=${MYDIR}/ext/golang/dist/go-${GOOS}-${GOARCH}
|
||||
export PATH=${GOROOT}/bin:${PATH}
|
||||
|
||||
case "$(uname)" in
|
||||
*CYGWIN*)
|
||||
export GOROOT=`cygpath -w $GOROOT`
|
||||
;;
|
||||
esac
|
||||
|
||||
pushd ext/syncthing/src/github.com/syncthing/syncthing
|
||||
|
||||
_GOOS=$GOOS
|
||||
|
|
|
@ -1,37 +1,22 @@
|
|||
diff --git a/net/dnsclient_unix.go b/net/dnsclient_unix.go
|
||||
index 17188f0..15a1663 100644
|
||||
--- a/net/dnsclient_unix.go
|
||||
+++ b/net/dnsclient_unix.go
|
||||
@@ -279,12 +279,6 @@ func (conf *resolverConfig) tryUpdate(name string) {
|
||||
return
|
||||
}
|
||||
conf.modTime = fi.ModTime()
|
||||
- } else {
|
||||
- // If modTime wasn't set prior, assume nothing has changed.
|
||||
- if conf.modTime.IsZero() {
|
||||
- return
|
||||
- }
|
||||
- conf.modTime = time.Time{}
|
||||
}
|
||||
|
||||
dnsConf := dnsReadConfig(name)
|
||||
diff --git a/net/dnsconfig_unix.go b/net/dnsconfig_unix.go
|
||||
index 6073fdb..bd6ca41 100644
|
||||
--- a/net/dnsconfig_unix.go
|
||||
+++ b/net/dnsconfig_unix.go
|
||||
@@ -8,7 +8,53 @@
|
||||
|
||||
--- /net/dnsconfig_unix.go 2016-08-20 08:14:05.763235602 -0400
|
||||
+++ /net/dnsconfig_unix.go 2016-08-20 08:14:05.763235602 -0400
|
||||
@@ -9,15 +9,58 @@
|
||||
package net
|
||||
|
||||
-var defaultNS = []string{"127.0.0.1", "::1"}
|
||||
+import (
|
||||
import (
|
||||
+ "fmt"
|
||||
"os"
|
||||
+ "os/exec"
|
||||
+ "strings"
|
||||
+)
|
||||
+
|
||||
+var currentNS []string
|
||||
+
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
- defaultNS = []string{"127.0.0.1:53", "[::1]:53"}
|
||||
+ currentNS []string
|
||||
getHostname = os.Hostname // variable for testing
|
||||
)
|
||||
|
||||
+func getDefaultNS() []string {
|
||||
+ var servers []string
|
||||
+ for _, prop := range []string{"net.dns1", "net.dns2"} {
|
||||
|
@ -42,12 +27,12 @@ index 6073fdb..bd6ca41 100644
|
|||
+ }
|
||||
+ output := strings.Trim(string(outputBytes), "\n")
|
||||
+ if ParseIP(output) != nil {
|
||||
+ servers = append(servers, output)
|
||||
+ servers = append(servers, output + ":53")
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if len(servers) == 0 {
|
||||
+ servers = []string{"8.8.8.8", "8.8.4.4", "4.2.2.1"}
|
||||
+ servers = []string{"8.8.8.8:53", "8.8.4.4:53", "4.2.2.1:53"}
|
||||
+ }
|
||||
+
|
||||
+ if !slicesEqual(currentNS, servers) {
|
||||
|
@ -71,24 +56,34 @@ index 6073fdb..bd6ca41 100644
|
|||
+
|
||||
+ return true
|
||||
+}
|
||||
|
||||
+
|
||||
type dnsConfig struct {
|
||||
servers []string // servers to use
|
||||
@@ -33,7 +79,7 @@ func dnsReadConfig(filename string) *dnsConfig {
|
||||
servers []string // server addresses (in host:port form) to use
|
||||
search []string // rooted suffixes to append to local name
|
||||
@@ -40,7 +83,7 @@
|
||||
}
|
||||
file, err := open(filename)
|
||||
if err != nil {
|
||||
- conf.servers = defaultNS
|
||||
+ conf.servers = getDefaultNS()
|
||||
conf.search = dnsDefaultSearch()
|
||||
conf.err = err
|
||||
return conf
|
||||
}
|
||||
@@ -110,7 +156,7 @@ func dnsReadConfig(filename string) *dnsConfig {
|
||||
@@ -49,7 +92,7 @@
|
||||
if fi, err := file.file.Stat(); err == nil {
|
||||
conf.mtime = fi.ModTime()
|
||||
} else {
|
||||
- conf.servers = defaultNS
|
||||
+ conf.servers = getDefaultNS()
|
||||
conf.search = dnsDefaultSearch()
|
||||
conf.err = err
|
||||
return conf
|
||||
@@ -126,7 +169,7 @@
|
||||
}
|
||||
}
|
||||
if len(conf.servers) == 0 {
|
||||
- conf.servers = defaultNS
|
||||
+ conf.servers = getDefaultNS()
|
||||
}
|
||||
return conf
|
||||
}
|
||||
if len(conf.search) == 0 {
|
||||
conf.search = dnsDefaultSearch()
|
||||
|
|
Loading…
Reference in a new issue