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
5e4e82b3
Commit
5e4e82b3
authored
Apr 14, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine code style
parent
4315b91b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
33 deletions
+29
-33
core/src/main/java/com/github/shadowsocks/acl/Acl.kt
core/src/main/java/com/github/shadowsocks/acl/Acl.kt
+1
-2
core/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt
...rc/main/java/com/github/shadowsocks/bg/LocalDnsService.kt
+1
-1
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
+5
-5
core/src/main/java/com/github/shadowsocks/net/DefaultNetworkListener.kt
...java/com/github/shadowsocks/net/DefaultNetworkListener.kt
+1
-1
core/src/main/java/com/github/shadowsocks/preference/DataStore.kt
.../main/java/com/github/shadowsocks/preference/DataStore.kt
+1
-1
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
+4
-4
mobile/src/main/java/com/github/shadowsocks/QuickToggleShortcut.kt
...c/main/java/com/github/shadowsocks/QuickToggleShortcut.kt
+1
-1
plugin/src/main/java/com/github/shadowsocks/plugin/PluginOptions.kt
.../main/java/com/github/shadowsocks/plugin/PluginOptions.kt
+15
-18
No files found.
core/src/main/java/com/github/shadowsocks/acl/Acl.kt
View file @
5e4e82b3
...
...
@@ -121,8 +121,7 @@ class Acl {
val
blocks
=
(
line
as
java
.
lang
.
String
).
split
(
"#"
,
2
)
val
url
=
networkAclParser
.
matchEntire
(
blocks
.
getOrElse
(
1
)
{
""
})
?.
groupValues
?.
getOrNull
(
1
)
if
(
url
!=
null
)
urls
.
add
(
URL
(
url
))
val
input
=
blocks
[
0
].
trim
()
when
(
input
)
{
when
(
val
input
=
blocks
[
0
].
trim
())
{
"[outbound_block_list]"
->
{
hostnames
=
null
subnets
=
null
...
...
core/src/main/java/com/github/shadowsocks/bg/LocalDnsService.kt
View file @
5e4e82b3
...
...
@@ -40,7 +40,7 @@ object LocalDnsService {
.
lineSequence
().
map
(
Subnet
.
Companion
::
fromString
).
filterNotNull
().
toList
()
}
private
val
servers
=
WeakHashMap
<
LocalDnsService
.
Interface
,
LocalDnsServer
>()
private
val
servers
=
WeakHashMap
<
Interface
,
LocalDnsServer
>()
interface
Interface
:
BaseService
.
Interface
{
override
suspend
fun
startProcesses
()
{
...
...
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
View file @
5e4e82b3
...
...
@@ -129,11 +129,11 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
}
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
{
if
(
DataStore
.
serviceMode
==
Key
.
modeVpn
)
if
(
BaseVpnService
.
prepare
(
this
)
!=
null
)
startActivity
(
Intent
(
this
,
VpnRequestActivity
::
class
.
java
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
)
else
return
super
<
LocalDnsService
.
Interface
>.
onStartCommand
(
intent
,
flags
,
startId
)
if
(
DataStore
.
serviceMode
==
Key
.
modeVpn
)
{
if
(
prepare
(
this
)
!=
null
)
{
startActivity
(
Intent
(
this
,
VpnRequestActivity
::
class
.
java
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
))
}
else
return
super
<
LocalDnsService
.
Interface
>.
onStartCommand
(
intent
,
flags
,
startId
)
}
stopRunner
()
return
Service
.
START_NOT_STICKY
}
...
...
core/src/main/java/com/github/shadowsocks/net/DefaultNetworkListener.kt
View file @
5e4e82b3
...
...
@@ -62,7 +62,7 @@ object DefaultNetworkListener {
check
(
listeners
.
isNotEmpty
())
{
"Getting network without any listeners is not supported"
}
if
(
network
==
null
)
pendingRequests
+=
message
else
message
.
response
.
complete
(
network
)
}
is
NetworkMessage
.
Stop
->
if
(
!
listeners
.
is
Empty
()
&&
// was not empty
is
NetworkMessage
.
Stop
->
if
(
listeners
.
isNot
Empty
()
&&
// was not empty
listeners
.
remove
(
message
.
key
)
!=
null
&&
listeners
.
isEmpty
())
{
network
=
null
unregister
()
...
...
core/src/main/java/com/github/shadowsocks/preference/DataStore.kt
View file @
5e4e82b3
...
...
@@ -44,7 +44,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
override
fun
onPreferenceDataStoreChanged
(
store
:
PreferenceDataStore
,
key
:
String
?)
{
when
(
key
)
{
Key
.
id
->
if
(
DataStore
.
directBootAware
)
DirectBoot
.
update
()
Key
.
id
->
if
(
directBootAware
)
DirectBoot
.
update
()
}
}
...
...
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
View file @
5e4e82b3
...
...
@@ -69,7 +69,7 @@ class AppManager : AppCompatActivity() {
receiver
=
null
cachedApps
=
null
}
AppManager
.
instance
?.
loadApps
()
instance
?.
loadApps
()
}
// Labels and icons can change on configuration (locale, etc.) changes, therefore they are not cached.
val
cachedApps
=
cachedApps
?:
pm
.
getInstalledPackages
(
PackageManager
.
GET_PERMISSIONS
)
...
...
@@ -109,7 +109,7 @@ class AppManager : AppCompatActivity() {
}
fun
handlePayload
(
payloads
:
List
<
String
>)
{
if
(
payloads
.
contains
(
AppManager
.
SWITCH
))
itemView
.
itemcheck
.
isChecked
=
isProxiedApp
(
item
)
if
(
payloads
.
contains
(
SWITCH
))
itemView
.
itemcheck
.
isChecked
=
isProxiedApp
(
item
)
}
override
fun
onClick
(
v
:
View
?)
{
...
...
@@ -117,7 +117,7 @@ class AppManager : AppCompatActivity() {
DataStore
.
individual
=
apps
.
filter
{
isProxiedApp
(
it
)
}.
joinToString
(
"\n"
)
{
it
.
packageName
}
DataStore
.
dirty
=
true
appsAdapter
.
notifyItemRangeChanged
(
0
,
appsAdapter
.
itemCount
,
AppManager
.
SWITCH
)
appsAdapter
.
notifyItemRangeChanged
(
0
,
appsAdapter
.
itemCount
,
SWITCH
)
}
}
...
...
@@ -281,7 +281,7 @@ class AppManager : AppCompatActivity() {
DataStore
.
dirty
=
true
Snackbar
.
make
(
list
,
R
.
string
.
action_import_msg
,
Snackbar
.
LENGTH_LONG
).
show
()
initProxiedUids
(
apps
)
appsAdapter
.
notifyItemRangeChanged
(
0
,
appsAdapter
.
itemCount
,
AppManager
.
SWITCH
)
appsAdapter
.
notifyItemRangeChanged
(
0
,
appsAdapter
.
itemCount
,
SWITCH
)
return
true
}
catch
(
_
:
IllegalArgumentException
)
{
}
}
...
...
mobile/src/main/java/com/github/shadowsocks/QuickToggleShortcut.kt
View file @
5e4e82b3
...
...
@@ -41,7 +41,7 @@ class QuickToggleShortcut : Activity(), ShadowsocksConnection.Callback {
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
if
(
intent
.
action
==
Intent
.
ACTION_CREATE_SHORTCUT
)
{
setResult
(
Activity
.
RESULT_OK
,
ShortcutManagerCompat
.
createShortcutResultIntent
(
this
,
setResult
(
RESULT_OK
,
ShortcutManagerCompat
.
createShortcutResultIntent
(
this
,
ShortcutInfoCompat
.
Builder
(
this
,
"toggle"
)
.
setIntent
(
Intent
(
this
,
QuickToggleShortcut
::
class
.
java
).
setAction
(
Intent
.
ACTION_MAIN
))
.
setIcon
(
IconCompat
.
createWithResource
(
this
,
R
.
drawable
.
ic_qu_shadowsocks_launcher
))
...
...
plugin/src/main/java/com/github/shadowsocks/plugin/PluginOptions.kt
View file @
5e4e82b3
...
...
@@ -42,25 +42,22 @@ class PluginOptions : HashMap<String, String?> {
val
tokenizer
=
StringTokenizer
(
"$options;"
,
"\\=;"
,
true
)
val
current
=
StringBuilder
()
var
key
:
String
?
=
null
while
(
tokenizer
.
hasMoreTokens
())
{
val
nextToken
=
tokenizer
.
nextToken
()
when
(
nextToken
)
{
"\\"
->
current
.
append
(
tokenizer
.
nextToken
())
"="
->
if
(
key
==
null
)
{
key
=
current
.
toString
()
current
.
setLength
(
0
)
}
else
current
.
append
(
nextToken
)
";"
->
{
if
(
key
!=
null
)
{
put
(
key
,
current
.
toString
())
key
=
null
}
else
if
(
current
.
isNotEmpty
())
if
(
parseId
)
id
=
current
.
toString
()
else
put
(
current
.
toString
(),
null
)
current
.
setLength
(
0
)
parseId
=
false
}
else
->
current
.
append
(
nextToken
)
while
(
tokenizer
.
hasMoreTokens
())
when
(
val
nextToken
=
tokenizer
.
nextToken
())
{
"\\"
->
current
.
append
(
tokenizer
.
nextToken
())
"="
->
if
(
key
==
null
)
{
key
=
current
.
toString
()
current
.
setLength
(
0
)
}
else
current
.
append
(
nextToken
)
";"
->
{
if
(
key
!=
null
)
{
put
(
key
,
current
.
toString
())
key
=
null
}
else
if
(
current
.
isNotEmpty
())
if
(
parseId
)
id
=
current
.
toString
()
else
put
(
current
.
toString
(),
null
)
current
.
setLength
(
0
)
parseId
=
false
}
else
->
current
.
append
(
nextToken
)
}
}
...
...
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