Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11d827c6ba | ||
|
|
dc46cd971a | ||
|
|
876e92f275 | ||
|
|
41747c976b | ||
|
|
8277b07d24 | ||
|
|
b982867130 | ||
|
|
491710679a | ||
|
|
24c6aca85c | ||
|
|
293e9b5dff | ||
|
|
3ac77e1f8d | ||
|
|
fd2c67d0b8 | ||
|
|
684698c8e4 | ||
|
|
6a02d4b985 | ||
|
|
7219ce429c | ||
|
|
caf5731ff6 | ||
|
|
437d8c3026 | ||
|
|
44b47e6cd3 |
+2
-2
@@ -2,8 +2,8 @@ enablePlugins(AndroidApp)
|
||||
android.useSupportVectors
|
||||
|
||||
name := "shadowsocks"
|
||||
version := "4.0.1"
|
||||
versionCode := Some(176)
|
||||
version := "4.0.3"
|
||||
versionCode := Some(178)
|
||||
|
||||
proguardOptions ++=
|
||||
"-keep class com.github.shadowsocks.JniHelper { *; }" ::
|
||||
|
||||
Submodule mobile/src/main/jni/shadowsocks-libev updated: f4b1641636...46fa5de9e4
@@ -84,11 +84,6 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
|
||||
private var txRateText: TextView = _
|
||||
private var rxRateText: TextView = _
|
||||
|
||||
private var currentFragment: ToolbarFragment = _
|
||||
private lazy val profilesFragment = new ProfilesFragment()
|
||||
private lazy val customRulesFragment = new CustomRulesFragment()
|
||||
private lazy val globalSettingsFragment = new GlobalSettingsFragment()
|
||||
private lazy val aboutFragment = new AboutFragment()
|
||||
private lazy val customTabsIntent = new CustomTabsIntent.Builder()
|
||||
.setToolbarColor(ContextCompat.getColor(this, R.color.material_primary_500))
|
||||
.build()
|
||||
@@ -255,7 +250,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
|
||||
val tf = Typefaces.get(this, "fonts/Iceland.ttf")
|
||||
if (tf != null) title.setTypeface(tf)
|
||||
|
||||
if (savedInstanceState == null) displayFragment(profilesFragment)
|
||||
if (savedInstanceState == null) displayFragment(new ProfilesFragment)
|
||||
statusText = findViewById(R.id.status).asInstanceOf[TextView]
|
||||
txText = findViewById(R.id.tx).asInstanceOf[TextView]
|
||||
txRateText = findViewById(R.id.txRate).asInstanceOf[TextView]
|
||||
@@ -364,14 +359,13 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
|
||||
}
|
||||
|
||||
private def displayFragment(fragment: ToolbarFragment) {
|
||||
currentFragment = fragment
|
||||
getFragmentManager.beginTransaction().replace(R.id.fragment_holder, fragment).commitAllowingStateLoss()
|
||||
drawer.closeDrawer()
|
||||
}
|
||||
|
||||
override def onItemClick(view: View, position: Int, drawerItem: IDrawerItem[_, _ <: ViewHolder]): Boolean = {
|
||||
drawerItem.getIdentifier match {
|
||||
case DRAWER_PROFILES => displayFragment(profilesFragment)
|
||||
case DRAWER_PROFILES => displayFragment(new ProfilesFragment)
|
||||
case DRAWER_RECOVERY =>
|
||||
app.track("GlobalConfigFragment", "reset")
|
||||
if (bgService != null) bgService.use(-1)
|
||||
@@ -384,12 +378,12 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
|
||||
app.copyAssets()
|
||||
handler.sendEmptyMessage(0)
|
||||
}
|
||||
case DRAWER_GLOBAL_SETTINGS => displayFragment(globalSettingsFragment)
|
||||
case DRAWER_GLOBAL_SETTINGS => displayFragment(new GlobalSettingsFragment)
|
||||
case DRAWER_ABOUT =>
|
||||
app.track(TAG, "about")
|
||||
displayFragment(aboutFragment)
|
||||
displayFragment(new AboutFragment)
|
||||
case DRAWER_FAQ => launchUrl(getString(R.string.faq_url))
|
||||
case DRAWER_CUSTOM_RULES => displayFragment(customRulesFragment)
|
||||
case DRAWER_CUSTOM_RULES => displayFragment(new CustomRulesFragment)
|
||||
}
|
||||
true // unexpected cases will throw exception
|
||||
}
|
||||
@@ -408,12 +402,14 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
|
||||
setListeningForBandwidth(true)
|
||||
}
|
||||
|
||||
override def onBackPressed(): Unit =
|
||||
if (drawer.isDrawerOpen) drawer.closeDrawer() else if (!currentFragment.onBackPressed())
|
||||
if (currentFragment != profilesFragment) {
|
||||
displayFragment(profilesFragment)
|
||||
override def onBackPressed(): Unit = if (drawer.isDrawerOpen) drawer.closeDrawer() else {
|
||||
val currentFragment = getFragmentManager.findFragmentById(R.id.fragment_holder).asInstanceOf[ToolbarFragment]
|
||||
if (!currentFragment.onBackPressed())
|
||||
if (currentFragment.isInstanceOf[ProfilesFragment]) super.onBackPressed() else {
|
||||
displayFragment(new ProfilesFragment)
|
||||
drawer.setSelection(DRAWER_PROFILES)
|
||||
} else super.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
override def onStop() {
|
||||
setListeningForBandwidth(false)
|
||||
|
||||
@@ -251,6 +251,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
val subnet = Subnet.fromString(cidr)
|
||||
builder.addRoute(subnet.address.getHostAddress, subnet.prefixSize)
|
||||
})
|
||||
builder.addRoute(profile.remoteDns, 32)
|
||||
}
|
||||
|
||||
conn = builder.establish()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.shadowsocks.acl
|
||||
|
||||
import java.net.InetAddress
|
||||
import java.util.Objects
|
||||
|
||||
import com.github.shadowsocks.utils.Utils
|
||||
|
||||
@@ -26,6 +27,12 @@ class Subnet(val address: InetAddress, val prefixSize: Int) extends Comparable[S
|
||||
}
|
||||
prefixSize compare that.prefixSize
|
||||
}
|
||||
|
||||
override def equals(other: Any): Boolean = other match {
|
||||
case that: Subnet => address == that.address && prefixSize == that.prefixSize
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = Objects.hash(address, prefixSize: Integer)
|
||||
}
|
||||
|
||||
object Subnet {
|
||||
|
||||
@@ -34,7 +34,7 @@ object Parser {
|
||||
pattern.findAllMatchIn(if (data == null) "" else data).map(m => {
|
||||
val uri = Uri.parse(m.matched)
|
||||
uri.getUserInfo match {
|
||||
case null => uri.getHost match {
|
||||
case null => new String(Base64.decode(uri.getHost, Base64.NO_PADDING), "UTF-8") match {
|
||||
case legacyPattern(_, method, password, host, port) => // legacy uri
|
||||
val profile = new Profile
|
||||
profile.method = method.toLowerCase
|
||||
@@ -49,7 +49,7 @@ object Parser {
|
||||
null
|
||||
}
|
||||
case userInfo =>
|
||||
new String(Base64.decode(userInfo, Base64.NO_PADDING | Base64.NO_WRAP | Base64.URL_SAFE)) match {
|
||||
new String(Base64.decode(userInfo, Base64.NO_PADDING | Base64.NO_WRAP | Base64.URL_SAFE), "UTF-8") match {
|
||||
case userInfoPattern(method, password) =>
|
||||
val profile = new Profile
|
||||
profile.method = method
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
* 0.0.2:
|
||||
* Add `getOrDefault` to `PluginOptions`;
|
||||
* Update support library version to 25.1.1.
|
||||
* 0.0.1: Initial release.
|
||||
+3
-4
@@ -1,5 +1,7 @@
|
||||
# shadowsocks-android plugin framework
|
||||
|
||||
[Documentation](doc.md) | [Change log](CHANGES.md)
|
||||
|
||||
Support library for easier development on [shadowsocks
|
||||
plugin](https://github.com/shadowsocks/shadowsocks-org/issues/28) for Android. Also includes some
|
||||
useful resources to easily get consistent styling with the main app.
|
||||
@@ -19,9 +21,6 @@ This library is designed with Java interoperability in mind so theoretically you
|
||||
library with other languages and/or build tools but there isn't documentation for that yet. This
|
||||
guide is written for Scala + SBT. Contributions are welcome.
|
||||
|
||||
The following is just a simple guide to get you started, for more technical details, see
|
||||
[doc.md](https://github.com/shadowsocks/shadowsocks-android/blob/develop/plugin/doc.md).
|
||||
|
||||
### Package name
|
||||
|
||||
There are no arbitrary restrictions/requirements on package name, component name and content
|
||||
@@ -37,7 +36,7 @@ First you need to add this library to your dependencies. This library is written
|
||||
and it's most convenient to use it with SBT:
|
||||
|
||||
```scala
|
||||
libraryDependencies += "com.github.shadowsocks" %% "plugin" % "0.0.1"
|
||||
libraryDependencies += "com.github.shadowsocks" %% "plugin" % "0.0.2"
|
||||
```
|
||||
|
||||
### Native binary configuration
|
||||
|
||||
+2
-2
@@ -196,7 +196,7 @@ This feature hasn't been implemented yet.
|
||||
Plugins are certified using package signatures and shadowsocks-android will consider these
|
||||
signatures as trusted:
|
||||
|
||||
* Signatures by [trusted sources](https://github.com/shadowsocks/shadowsocks-android/blob/develop/mobile/src/main/scala/com/github/shadowsocks/plugin/PluginManager.scala#L22)
|
||||
* Signatures by [trusted sources](/mobile/src/main/scala/com/github/shadowsocks/plugin/PluginManager.scala#L22)
|
||||
which includes:
|
||||
- @madeye, i.e. the signer of the main repo;
|
||||
- The main repo doesn't contain any other trusted signatures. Third-party forks should add their
|
||||
@@ -226,5 +226,5 @@ Plugin app must include this in their application tag: (which should be automati
|
||||
|
||||
```
|
||||
<meta-data android:name="com.github.shadowsocks.plugin.version"
|
||||
android:value="0.0.1"/>
|
||||
android:value="0.0.2"/>
|
||||
```
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
<application
|
||||
android:theme="@style/Theme.Shadowsocks">
|
||||
<meta-data android:name="com.github.shadowsocks.plugin.version"
|
||||
android:value="0.0.1"/>
|
||||
android:value="0.0.2"/>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
Reference in New Issue
Block a user