Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1d135ccdd | ||
|
|
a28303ee76 | ||
|
|
2b09ebcd2c | ||
|
|
59ede2586a | ||
|
|
abd1d0220c | ||
|
|
5427e00012 | ||
|
|
7f226d3f0c | ||
|
|
ee3f3c2338 | ||
|
|
6ac90abbf7 | ||
|
|
2f553b156a |
@@ -14,6 +14,8 @@ ndkJavah in Android := List()
|
||||
|
||||
ndkBuild in Android := List()
|
||||
|
||||
typedResources in Android := false
|
||||
|
||||
resolvers += "JRAF" at "http://JRAF.org/static/maven/2"
|
||||
|
||||
resolvers += "madeye private releases" at "http://madeye-maven-repository.googlecode.com/git/"
|
||||
@@ -27,12 +29,13 @@ libraryDependencies ++= Seq(
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"net.simonvt.menudrawer" % "menudrawer" % "3.0.6",
|
||||
"com.google.android.gms" % "play-services" % "6.1.71",
|
||||
"com.google.android.gms" % "play-services-base" % "6.5.87",
|
||||
"com.google.android.gms" % "play-services-ads" % "6.5.87",
|
||||
"com.android.support" % "support-v4" % "21.0.3"
|
||||
)
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"de.keyboardsurfer.android.widget" % "crouton" % "1.8.4" exclude("com.google.android", "support-v4"),
|
||||
"com.github.mrengineer13" % "snackbar" % "0.5.0",
|
||||
"com.nostra13.universalimageloader" % "universal-image-loader" % "1.8.4",
|
||||
"com.j256.ormlite" % "ormlite-core" % "4.47",
|
||||
"com.j256.ormlite" % "ormlite-android" % "4.47"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.github.shadowsocks"
|
||||
android:versionCode="95"
|
||||
android:versionName="2.5.5">
|
||||
android:versionCode="98"
|
||||
android:versionName="2.6.0">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
@@ -59,7 +59,8 @@ static void
|
||||
ev_arc4random_buf(void *buf, size_t n)
|
||||
{
|
||||
#if defined(_EVENT_HAVE_ARC4RANDOM_BUF) && !defined(__APPLE__)
|
||||
return arc4random_buf(buf, n);
|
||||
arc4random_buf(buf, n);
|
||||
return;
|
||||
#else
|
||||
unsigned char *b = buf;
|
||||
|
||||
@@ -71,7 +72,8 @@ ev_arc4random_buf(void *buf, size_t n)
|
||||
* trickery.)
|
||||
*/
|
||||
if (arc4random_buf != NULL) {
|
||||
return arc4random_buf(buf, n);
|
||||
arc4random_buf(buf, n);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* Make sure that we start out with b at a 4-byte alignment; plenty
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
|
||||
* major minor fix final patch/beta)
|
||||
*/
|
||||
#define OPENSSL_VERSION_NUMBER 0x1000103fL
|
||||
#define OPENSSL_VERSION_NUMBER 0x100010afL
|
||||
#ifdef OPENSSL_FIPS
|
||||
#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c-fips 10 May 2012"
|
||||
#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1j-fips 15 Oct 2014"
|
||||
#else
|
||||
#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c 10 May 2012"
|
||||
#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1j 15 Oct 2014"
|
||||
#endif
|
||||
#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<string name="service_failed">无法连接远程服务器</string>
|
||||
<string name="stop">停止服务</string>
|
||||
<string name="stopping">正在关闭...</string>
|
||||
<string name="vpn_error">后台服务启动失败:\"%s\"。</string>
|
||||
<string name="vpn_error">后台服务启动失败:%s</string>
|
||||
<string name="ok_iknow">确定</string>
|
||||
<string name="port_alert">端口号应大于1024</string>
|
||||
<string name="port_empty">端口号不能为空</string>
|
||||
@@ -94,5 +94,6 @@
|
||||
<string name="action_export_err">导出失败</string>
|
||||
<string name="action_import_msg">导入成功</string>
|
||||
<string name="action_import_err">导入失败</string>
|
||||
<string name="error">错误</string>
|
||||
|
||||
</resources>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -58,9 +58,10 @@
|
||||
<string name="service_failed">Failed to connect the remote server</string>
|
||||
<string name="stop">Stop the service</string>
|
||||
<string name="stopping">Shutting down...</string>
|
||||
<string name="vpn_error">Error: \"%s\".</string>
|
||||
<string name="vpn_error">%s</string>
|
||||
<string name="enable_nat">Turn on NAT mode.</string>
|
||||
<string name="disable_nat">Turn off NAT mode.</string>
|
||||
<string name="error">ERROR</string>
|
||||
|
||||
<!-- alert category -->
|
||||
<string name="ok_iknow">OK</string>
|
||||
|
||||
@@ -227,8 +227,9 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext)
|
||||
item.getItemId match {
|
||||
case R.id.action_export =>
|
||||
val bypass = prefs.getBoolean(Key.isBypassApps, false)
|
||||
val proxiedAppString = prefs.getString(Key.proxied, "")
|
||||
val clip = ClipData.newPlainText(Key.proxied, proxiedAppString)
|
||||
val clip = ClipData.newPlainText(Key.proxied, bypass + " " + proxiedAppString)
|
||||
clipboard.setPrimaryClip(clip)
|
||||
Toast.makeText(this, R.string.action_export_msg, Toast.LENGTH_SHORT).show()
|
||||
return true
|
||||
@@ -241,8 +242,12 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe
|
||||
if (proxiedAppSequence != null) {
|
||||
val proxiedAppString = proxiedAppSequence.toString
|
||||
if (!proxiedAppString.isEmpty) {
|
||||
val array = proxiedAppString.split(" ")
|
||||
val bypass = array(0).toBoolean
|
||||
val apps = if (array.size > 1) array(1) else ""
|
||||
prefs.edit.putBoolean(Key.isBypassApps, bypass).commit()
|
||||
prefs.edit.putString(Key.proxied, apps).commit()
|
||||
Toast.makeText(this, R.string.action_import_msg, Toast.LENGTH_SHORT).show()
|
||||
prefs.edit.putString(Key.proxied, proxiedAppString).commit()
|
||||
// Restart activity
|
||||
val intent = getIntent
|
||||
finish()
|
||||
|
||||
@@ -56,6 +56,7 @@ import android.view.View.OnLongClickListener
|
||||
import android.view._
|
||||
import android.webkit.{WebView, WebViewClient}
|
||||
import android.widget._
|
||||
import com.github.mrengineer13.snackbar._
|
||||
import com.github.shadowsocks.aidl.{IShadowsocksService, IShadowsocksServiceCallback}
|
||||
import com.github.shadowsocks.database._
|
||||
import com.github.shadowsocks.preferences.{PasswordEditTextPreference, ProfileEditTextPreference, SummaryEditTextPreference}
|
||||
@@ -64,7 +65,6 @@ import com.google.android.gms.ads.{AdRequest, AdSize, AdView}
|
||||
import com.google.android.gms.analytics.HitBuilders
|
||||
import com.google.zxing.integration.android.IntentIntegrator
|
||||
import com.nostra13.universalimageloader.core.download.BaseImageDownloader
|
||||
import de.keyboardsurfer.android.widget.crouton.{Configuration, Crouton, Style}
|
||||
import net.simonvt.menudrawer.MenuDrawer
|
||||
|
||||
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
|
||||
@@ -205,7 +205,6 @@ class Shadowsocks
|
||||
// Update the UI
|
||||
if (switchButton != null) switchButton.setEnabled(true)
|
||||
if (State.isAvailable(bgService.getState)) {
|
||||
Crouton.cancelAllCroutons()
|
||||
setPreferenceEnabled(enabled = true)
|
||||
} else {
|
||||
changeSwitch(checked = true)
|
||||
@@ -367,7 +366,7 @@ class Shadowsocks
|
||||
|
||||
def isTextEmpty(s: String, msg: String): Boolean = {
|
||||
if (s == null || s.length <= 0) {
|
||||
Crouton.makeText(this, msg, Style.ALERT).show()
|
||||
new SnackBar.Builder(this).withMessage(msg).withStyle(SnackBar.Style.ALERT).show()
|
||||
return true
|
||||
}
|
||||
false
|
||||
@@ -828,7 +827,6 @@ class Shadowsocks
|
||||
override def onDestroy() {
|
||||
super.onDestroy()
|
||||
deattachService()
|
||||
Crouton.cancelAllCroutons()
|
||||
unregisterReceiver(preferenceReceiver)
|
||||
new BackupManager(this).dataChanged()
|
||||
if (handler != null) {
|
||||
@@ -927,12 +925,12 @@ class Shadowsocks
|
||||
try {
|
||||
val port: Int = Integer.valueOf(text)
|
||||
if (!low && port <= 1024) {
|
||||
Crouton.makeText(this, R.string.port_alert, Style.ALERT).show()
|
||||
new SnackBar.Builder(this).withMessageId(R.string.port_alert).withStyle(SnackBar.Style.ALERT).show()
|
||||
return false
|
||||
}
|
||||
} catch {
|
||||
case ex: Exception =>
|
||||
Crouton.makeText(this, R.string.port_alert, Style.ALERT).show()
|
||||
new SnackBar.Builder(this).withMessageId(R.string.port_alert).withStyle(SnackBar.Style.ALERT).show()
|
||||
return false
|
||||
}
|
||||
true
|
||||
@@ -1014,15 +1012,12 @@ class Shadowsocks
|
||||
case State.STOPPED =>
|
||||
clearDialog()
|
||||
changeSwitch(checked = false)
|
||||
Crouton.cancelAllCroutons()
|
||||
if (m != null) {
|
||||
val style = new Style.Builder().setBackgroundColorValue(Style.holoRedLight).build()
|
||||
val config = new Configuration.Builder()
|
||||
.setDuration(Configuration.DURATION_LONG)
|
||||
.build()
|
||||
Crouton
|
||||
.makeText(Shadowsocks.this, getString(R.string.vpn_error).formatLocal(Locale.ENGLISH, m), style)
|
||||
.setConfiguration(config)
|
||||
new SnackBar.Builder(Shadowsocks.this)
|
||||
.withMessage(getString(R.string.vpn_error).formatLocal(Locale.ENGLISH, m))
|
||||
.withActionMessageId(R.string.error)
|
||||
.withStyle(SnackBar.Style.ALERT)
|
||||
.withDuration(SnackBar.LONG_SNACK)
|
||||
.show()
|
||||
}
|
||||
setPreferenceEnabled(enabled = true)
|
||||
|
||||
@@ -263,8 +263,9 @@ class ShadowsocksNatService extends Service with BaseService {
|
||||
|
||||
val conf = if (config.route == Route.BYPASS_CHN) {
|
||||
val reject = ConfigUtils.getRejectList(getContext, application)
|
||||
val blackList = ConfigUtils.getBlackList(getContext, application)
|
||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, "127.0.0.1", 8153,
|
||||
Path.BASE + "pdnsd-nat.pid", reject, reject, 8163)
|
||||
Path.BASE + "pdnsd-nat.pid", reject, blackList, reject, blackList, 8163)
|
||||
} else {
|
||||
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, "127.0.0.1", 8153,
|
||||
Path.BASE + "pdnsd-nat.pid", 8163)
|
||||
|
||||
@@ -155,8 +155,9 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
val conf = {
|
||||
if (Utils.isLollipopOrAbove && config.route == Route.BYPASS_CHN) {
|
||||
val reject = ConfigUtils.getRejectList(getContext, application)
|
||||
val blackList = ConfigUtils.getBlackList(getContext, application)
|
||||
ConfigUtils.PDNSD_DIRECT.formatLocal(Locale.ENGLISH, "0.0.0.0", 8153,
|
||||
Path.BASE + "pdnsd-vpn.pid", reject, reject, 8163)
|
||||
Path.BASE + "pdnsd-vpn.pid", reject, blackList, reject, blackList, 8163)
|
||||
} else {
|
||||
ConfigUtils.PDNSD_LOCAL.formatLocal(Locale.ENGLISH, "0.0.0.0", 8153,
|
||||
Path.BASE + "pdnsd-vpn.pid", 8163)
|
||||
|
||||
@@ -161,6 +161,8 @@ object ConfigUtils {
|
||||
| reject = %s;
|
||||
| reject_policy = fail;
|
||||
| reject_recursively = on;
|
||||
| exclude = %s;
|
||||
| policy = included;
|
||||
| uptest = none;
|
||||
| preset = on;
|
||||
|}
|
||||
@@ -173,6 +175,8 @@ object ConfigUtils {
|
||||
| reject = %s;
|
||||
| reject_policy = fail;
|
||||
| reject_recursively = on;
|
||||
| exclude = %s;
|
||||
| policy = included;
|
||||
| uptest = none;
|
||||
| preset = on;
|
||||
|}
|
||||
@@ -218,6 +222,17 @@ object ConfigUtils {
|
||||
}
|
||||
}
|
||||
|
||||
def getBlackList(context: Context, app: ShadowsocksApplication): String = {
|
||||
val default = context.getString(R.string.black_list)
|
||||
try {
|
||||
val container = app.containerHolder.getContainer
|
||||
val update = container.getString("black_list")
|
||||
if (update == null || update.isEmpty) default else update
|
||||
} catch {
|
||||
case ex: Exception => default
|
||||
}
|
||||
}
|
||||
|
||||
def getPublicConfig(context: Context, container: Container, config: Config): Config = {
|
||||
val url = container.getString("proxy_url")
|
||||
val sig = Utils.getSignature(context)
|
||||
|
||||
Reference in New Issue
Block a user