Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
56121d5b
Unverified
Commit
56121d5b
authored
Jan 15, 2019
by
Max Lv
Committed by
GitHub
Jan 15, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2072 from shadowsocks/plugin-1.1.0
Plugin library 1.1.0
parents
e6416253
9f037d2a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
4 deletions
+33
-4
mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt
...main/java/com/github/shadowsocks/ProfileConfigFragment.kt
+1
-1
mobile/src/main/res/xml/pref_profile.xml
mobile/src/main/res/xml/pref_profile.xml
+1
-0
plugin/CHANGES.md
plugin/CHANGES.md
+4
-0
plugin/build.gradle
plugin/build.gradle
+2
-2
plugin/src/main/java/com/github/shadowsocks/plugin/PluginOptions.kt
.../main/java/com/github/shadowsocks/plugin/PluginOptions.kt
+9
-0
plugin/src/test/java/com/github/shadowsocks/plugin/PluginOptionsTest.kt
...t/java/com/github/shadowsocks/plugin/PluginOptionsTest.kt
+16
-1
No files found.
mobile/src/main/java/com/github/shadowsocks/ProfileConfigFragment.kt
View file @
56121d5b
...
...
@@ -149,7 +149,7 @@ class ProfileConfigFragment : PreferenceFragmentCompat(),
DataStore
.
plugin
=
pluginConfiguration
.
toString
()
DataStore
.
dirty
=
true
true
}
catch
(
exc
:
IllegalArgument
Exception
)
{
}
catch
(
exc
:
Runtime
Exception
)
{
(
activity
as
MainActivity
).
snackbar
(
exc
.
localizedMessage
).
show
()
false
}
...
...
mobile/src/main/res/xml/pref_profile.xml
View file @
56121d5b
...
...
@@ -84,6 +84,7 @@
android:key=
"plugin.configure"
android:icon=
"@drawable/ic_action_settings"
android:persistent=
"false"
android:singleLine=
"true"
app:pref_summaryHasText=
"%s"
android:title=
"@string/plugin_configure"
/>
<Preference
...
...
plugin/CHANGES.md
View file @
56121d5b
*
1.1.0:
*
Having control characters in plugin options is no longer allowed.
If this breaks your plugin, you are doing it wrong.
*
New helper method:
`PluginOptions.putWithDefault`
.
*
1.0.0:
*
BREAKING CHANGE: Plugins developed using this version and forward require shadowsocks-android 4.6.5 or higher.
*
`PathProvider`
now takes
`Int`
instead of
`String`
for file modes;
...
...
plugin/build.gradle
View file @
56121d5b
...
...
@@ -10,8 +10,8 @@ android {
defaultConfig
{
minSdkVersion
rootProject
.
minSdkVersion
targetSdkVersion
rootProject
.
sdkVersion
versionCode
7
versionName
"1.
0
.0"
versionCode
8
versionName
"1.
1
.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
...
...
plugin/src/main/java/com/github/shadowsocks/plugin/PluginOptions.kt
View file @
56121d5b
...
...
@@ -38,6 +38,7 @@ class PluginOptions : HashMap<String, String?> {
@Suppress
(
"NAME_SHADOWING"
)
var
parseId
=
parseId
if
(
options
.
isNullOrEmpty
())
return
check
(
options
.
all
{
!
it
.
isISOControl
()
})
{
"No control characters allowed."
}
val
tokenizer
=
StringTokenizer
(
"$options;"
,
"\\=;"
,
true
)
val
current
=
StringBuilder
()
var
key
:
String
?
=
null
...
...
@@ -68,6 +69,14 @@ class PluginOptions : HashMap<String, String?> {
this
.
id
=
id
}
/**
* Put but if value is null or default, the entry is deleted.
*
* @return Old value before put.
*/
fun
putWithDefault
(
key
:
String
,
value
:
String
?,
default
:
String
?
=
null
)
=
if
(
value
==
null
||
value
==
default
)
remove
(
key
)
else
put
(
key
,
value
)
private
fun
append
(
result
:
StringBuilder
,
str
:
String
)
=
(
0
until
str
.
length
)
.
map
{
str
[
it
]
}
.
forEach
{
...
...
plugin/src/test/java/com/github/shadowsocks/plugin/PluginOptionsTest.kt
View file @
56121d5b
...
...
@@ -25,7 +25,7 @@ import org.junit.Test
class
PluginOptionsTest
{
@Test
fun
equal
()
{
fun
basic
()
{
val
o1
=
PluginOptions
(
"obfs-local;obfs=http;obfs-host=localhost"
)
val
o2
=
PluginOptions
(
"obfs-local"
,
"obfs-host=localhost;obfs=http"
)
Assert
.
assertEquals
(
o1
.
hashCode
(),
o2
.
hashCode
())
...
...
@@ -35,4 +35,19 @@ class PluginOptionsTest {
val
o4
=
PluginOptions
(
o2
.
id
,
o2
.
toString
())
Assert
.
assertEquals
(
true
,
o3
==
o4
)
}
@Test
fun
escape
()
{
val
options
=
PluginOptions
(
"escapeTest"
)
options
[
"subject"
]
=
"value;semicolon"
Assert
.
assertEquals
(
true
,
options
==
PluginOptions
(
options
.
toString
(
false
)))
options
[
"key;semicolon"
]
=
"object"
Assert
.
assertEquals
(
true
,
options
==
PluginOptions
(
options
.
toString
(
false
)))
options
[
"subject"
]
=
"value=equals"
Assert
.
assertEquals
(
true
,
options
==
PluginOptions
(
options
.
toString
(
false
)))
options
[
"key=equals"
]
=
"object"
Assert
.
assertEquals
(
true
,
options
==
PluginOptions
(
options
.
toString
(
false
)))
options
[
"advanced\\=;test"
]
=
"in;=\\progress"
Assert
.
assertEquals
(
true
,
options
==
PluginOptions
(
options
.
toString
(
false
)))
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment