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
f9e504b0
Commit
f9e504b0
authored
Dec 24, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine profile name display
parent
eae97bc1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
14 additions
and
17 deletions
+14
-17
src/main/scala/com/github/shadowsocks/BaseService.scala
src/main/scala/com/github/shadowsocks/BaseService.scala
+1
-1
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
+3
-9
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+1
-1
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+2
-2
src/main/scala/com/github/shadowsocks/TaskerActivity.scala
src/main/scala/com/github/shadowsocks/TaskerActivity.scala
+1
-1
src/main/scala/com/github/shadowsocks/database/Profile.scala
src/main/scala/com/github/shadowsocks/database/Profile.scala
+4
-0
src/main/scala/com/github/shadowsocks/utils/Parser.scala
src/main/scala/com/github/shadowsocks/utils/Parser.scala
+1
-2
src/main/scala/com/github/shadowsocks/utils/TaskerSettings.scala
...n/scala/com/github/shadowsocks/utils/TaskerSettings.scala
+1
-1
No files found.
src/main/scala/com/github/shadowsocks/BaseService.scala
View file @
f9e504b0
...
@@ -78,7 +78,7 @@ trait BaseService extends Service {
...
@@ -78,7 +78,7 @@ trait BaseService extends Service {
state
state
}
}
override
def
getProfileName
:
String
=
if
(
profile
==
null
)
null
else
profile
.
n
ame
override
def
getProfileName
:
String
=
if
(
profile
==
null
)
null
else
profile
.
getN
ame
override
def
unregisterCallback
(
cb
:
IShadowsocksServiceCallback
)
{
override
def
unregisterCallback
(
cb
:
IShadowsocksServiceCallback
)
{
if
(
cb
!=
null
&&
callbacks
.
unregister
(
cb
))
{
if
(
cb
!=
null
&&
callbacks
.
unregister
(
cb
))
{
...
...
src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
View file @
f9e504b0
...
@@ -23,7 +23,7 @@ package com.github.shadowsocks
...
@@ -23,7 +23,7 @@ package com.github.shadowsocks
import
java.util.GregorianCalendar
import
java.util.GregorianCalendar
import
android.content._
import
android.content._
import
android.os.
{
Bu
ild
,
Bundle
,
Handler
,
UserManag
er
}
import
android.os.
{
Bu
ndle
,
Handl
er
}
import
android.support.v4.content.LocalBroadcastManager
import
android.support.v4.content.LocalBroadcastManager
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.support.v7.widget.RecyclerView.ViewHolder
import
android.support.v7.widget.Toolbar.OnMenuItemClickListener
import
android.support.v7.widget.Toolbar.OnMenuItemClickListener
...
@@ -69,12 +69,8 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
...
@@ -69,12 +69,8 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
def
updateText
(
txTotal
:
Long
=
0
,
rxTotal
:
Long
=
0
)
{
def
updateText
(
txTotal
:
Long
=
0
,
rxTotal
:
Long
=
0
)
{
val
tx
=
item
.
tx
+
txTotal
val
tx
=
item
.
tx
+
txTotal
val
rx
=
item
.
rx
+
rxTotal
val
rx
=
item
.
rx
+
rxTotal
var
title
=
if
(
isDemoMode
)
"Profile #"
+
item
.
id
else
item
.
name
val
title
=
item
.
getName
var
address
=
(
if
(
item
.
host
.
contains
(
":"
))
"[%s]:%d"
else
"%s:%d"
).
format
(
item
.
host
,
item
.
remotePort
)
val
address
=
if
(
item
.
nameIsEmpty
)
""
else
item
.
formattedAddress
if
((
title
==
null
||
title
.
isEmpty
)
&&
address
.
nonEmpty
)
{
title
=
address
address
=
""
}
val
traffic
=
getString
(
R
.
string
.
stat_profiles
,
val
traffic
=
getString
(
R
.
string
.
stat_profiles
,
TrafficMonitor
.
formatTraffic
(
tx
),
TrafficMonitor
.
formatTraffic
(
rx
))
TrafficMonitor
.
formatTraffic
(
tx
),
TrafficMonitor
.
formatTraffic
(
rx
))
...
@@ -214,8 +210,6 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
...
@@ -214,8 +210,6 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
private
var
undoManager
:
UndoSnackbarManager
[
Profile
]
=
_
private
var
undoManager
:
UndoSnackbarManager
[
Profile
]
=
_
private
lazy
val
clipboard
=
getActivity
.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
).
asInstanceOf
[
ClipboardManager
]
private
lazy
val
clipboard
=
getActivity
.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
).
asInstanceOf
[
ClipboardManager
]
private
lazy
val
isDemoMode
=
Build
.
VERSION
.
SDK_INT
>=
25
&&
getActivity
.
getSystemService
(
classOf
[
UserManager
]).
isDemoUser
private
def
startConfig
(
id
:
Int
)
=
startActivity
(
new
Intent
(
getActivity
,
classOf
[
ProfileConfigActivity
])
private
def
startConfig
(
id
:
Int
)
=
startActivity
(
new
Intent
(
getActivity
,
classOf
[
ProfileConfigActivity
])
.
putExtra
(
Action
.
EXTRA_PROFILE_ID
,
id
))
.
putExtra
(
Action
.
EXTRA_PROFILE_ID
,
id
))
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
f9e504b0
...
@@ -315,7 +315,7 @@ class ShadowsocksNatService extends BaseService {
...
@@ -315,7 +315,7 @@ class ShadowsocksNatService extends BaseService {
AclSyncJob
.
schedule
(
profile
.
route
)
AclSyncJob
.
schedule
(
profile
.
route
)
changeState
(
State
.
CONNECTED
)
changeState
(
State
.
CONNECTED
)
notification
=
new
ShadowsocksNotification
(
this
,
profile
.
n
ame
,
true
)
notification
=
new
ShadowsocksNotification
(
this
,
profile
.
getN
ame
,
true
)
}
}
override
def
stopRunner
(
stopService
:
Boolean
,
msg
:
String
=
null
)
{
override
def
stopRunner
(
stopService
:
Boolean
,
msg
:
String
=
null
)
{
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
f9e504b0
...
@@ -148,7 +148,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -148,7 +148,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
if
(
profile
.
route
!=
Route
.
ALL
)
if
(
profile
.
route
!=
Route
.
ALL
)
AclSyncJob
.
schedule
(
profile
.
route
)
AclSyncJob
.
schedule
(
profile
.
route
)
notification
=
new
ShadowsocksNotification
(
this
,
profile
.
n
ame
)
notification
=
new
ShadowsocksNotification
(
this
,
profile
.
getN
ame
)
}
}
/** Called when the activity is first created. */
/** Called when the activity is first created. */
...
@@ -318,7 +318,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -318,7 +318,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
val
builder
=
new
Builder
()
val
builder
=
new
Builder
()
builder
builder
.
setSession
(
profile
.
n
ame
)
.
setSession
(
profile
.
getN
ame
)
.
setMtu
(
VPN_MTU
)
.
setMtu
(
VPN_MTU
)
.
addAddress
(
PRIVATE_VLAN
.
formatLocal
(
Locale
.
ENGLISH
,
"1"
),
24
)
.
addAddress
(
PRIVATE_VLAN
.
formatLocal
(
Locale
.
ENGLISH
,
"1"
),
24
)
...
...
src/main/scala/com/github/shadowsocks/TaskerActivity.scala
View file @
f9e504b0
...
@@ -52,7 +52,7 @@ class TaskerActivity extends AppCompatActivity {
...
@@ -52,7 +52,7 @@ class TaskerActivity extends AppCompatActivity {
}
}
def
bind
(
item
:
Profile
)
{
def
bind
(
item
:
Profile
)
{
this
.
item
=
item
this
.
item
=
item
text
.
setText
(
item
.
n
ame
)
text
.
setText
(
item
.
getN
ame
)
text
.
setChecked
(
taskerOption
.
profileId
==
item
.
id
)
text
.
setChecked
(
taskerOption
.
profileId
==
item
.
id
)
}
}
...
...
src/main/scala/com/github/shadowsocks/database/Profile.scala
View file @
f9e504b0
...
@@ -97,6 +97,10 @@ class Profile {
...
@@ -97,6 +97,10 @@ class Profile {
@DatabaseField
@DatabaseField
var
kcpcli
:
String
=
"--crypt none --mode normal --mtu 1200 --nocomp --dscp 46 --parityshard 0"
var
kcpcli
:
String
=
"--crypt none --mode normal --mtu 1200 --nocomp --dscp 46 --parityshard 0"
def
formattedAddress
:
String
=
(
if
(
host
.
contains
(
":"
))
"[%s]:%d"
else
"%s:%d"
).
format
(
host
,
remotePort
)
def
nameIsEmpty
:
Boolean
=
name
==
null
||
name
.
isEmpty
def
getName
:
String
=
if
(
nameIsEmpty
)
formattedAddress
else
name
override
def
toString
:
String
=
"ss://"
+
Base64
.
encodeToString
(
"%s%s:%s@%s:%d"
.
formatLocal
(
Locale
.
ENGLISH
,
override
def
toString
:
String
=
"ss://"
+
Base64
.
encodeToString
(
"%s%s:%s@%s:%d"
.
formatLocal
(
Locale
.
ENGLISH
,
method
,
if
(
auth
)
"-auth"
else
""
,
password
,
host
,
remotePort
).
getBytes
,
Base64
.
NO_PADDING
|
Base64
.
NO_WRAP
)
+
method
,
if
(
auth
)
"-auth"
else
""
,
password
,
host
,
remotePort
).
getBytes
,
Base64
.
NO_PADDING
|
Base64
.
NO_WRAP
)
+
'#'
+
URLEncoder
.
encode
(
name
,
"utf-8"
)
'#'
+
URLEncoder
.
encode
(
name
,
"utf-8"
)
...
...
src/main/scala/com/github/shadowsocks/utils/Parser.scala
View file @
f9e504b0
...
@@ -38,8 +38,7 @@ object Parser {
...
@@ -38,8 +38,7 @@ object Parser {
profile
.
method
=
ss
.
group
(
2
).
toLowerCase
profile
.
method
=
ss
.
group
(
2
).
toLowerCase
if
(
ss
.
group
(
3
)
!=
null
)
profile
.
auth
=
true
if
(
ss
.
group
(
3
)
!=
null
)
profile
.
auth
=
true
profile
.
password
=
ss
.
group
(
4
)
profile
.
password
=
ss
.
group
(
4
)
profile
.
name
=
ss
.
group
(
5
)
profile
.
host
=
ss
.
group
(
5
)
profile
.
host
=
profile
.
name
profile
.
remotePort
=
ss
.
group
(
6
).
toInt
profile
.
remotePort
=
ss
.
group
(
6
).
toInt
if
(
m
.
group
(
2
)
!=
null
)
profile
.
name
=
URLDecoder
.
decode
(
m
.
group
(
3
),
"utf-8"
)
if
(
m
.
group
(
2
)
!=
null
)
profile
.
name
=
URLDecoder
.
decode
(
m
.
group
(
3
),
"utf-8"
)
profile
profile
...
...
src/main/scala/com/github/shadowsocks/utils/TaskerSettings.scala
View file @
f9e504b0
...
@@ -46,7 +46,7 @@ class TaskerSettings(bundle: Bundle) {
...
@@ -46,7 +46,7 @@ class TaskerSettings(bundle: Bundle) {
if
(
profileId
>=
0
)
bundle
.
putInt
(
KEY_PROFILE_ID
,
profileId
)
if
(
profileId
>=
0
)
bundle
.
putInt
(
KEY_PROFILE_ID
,
profileId
)
new
Intent
().
putExtra
(
ApiIntent
.
EXTRA_BUNDLE
,
bundle
).
putExtra
(
ApiIntent
.
EXTRA_STRING_BLURB
,
new
Intent
().
putExtra
(
ApiIntent
.
EXTRA_BUNDLE
,
bundle
).
putExtra
(
ApiIntent
.
EXTRA_STRING_BLURB
,
app
.
profileManager
.
getProfile
(
profileId
)
match
{
app
.
profileManager
.
getProfile
(
profileId
)
match
{
case
Some
(
p
)
=>
context
.
getString
(
if
(
switchOn
)
R
.
string
.
start_service
else
R
.
string
.
stop_service
,
p
.
n
ame
)
case
Some
(
p
)
=>
context
.
getString
(
if
(
switchOn
)
R
.
string
.
start_service
else
R
.
string
.
stop_service
,
p
.
getN
ame
)
case
None
=>
context
.
getString
(
if
(
switchOn
)
R
.
string
.
start_service_default
else
R
.
string
.
stop
)
case
None
=>
context
.
getString
(
if
(
switchOn
)
R
.
string
.
start_service_default
else
R
.
string
.
stop
)
})
})
}
}
...
...
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