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
40447ce1
Commit
40447ce1
authored
Oct 10, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine fetching ACL from cloud
parent
4162057a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
14 deletions
+15
-14
build.sbt
build.sbt
+0
-1
src/main/scala/com/github/shadowsocks/BaseService.scala
src/main/scala/com/github/shadowsocks/BaseService.scala
+13
-11
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
+1
-1
No files found.
build.sbt
View file @
40447ce1
...
...
@@ -41,7 +41,6 @@ libraryDependencies ++= Seq(
"com.github.kevinsawicki"
%
"http-request"
%
"6.0"
,
"com.google.android.gms"
%
"play-services-ads"
%
"9.6.1"
,
"com.google.android.gms"
%
"play-services-analytics"
%
"9.6.1"
,
"com.google.firebase"
%
"firebase-core"
%
"9.6.1"
,
"com.google.firebase"
%
"firebase-storage"
%
"9.6.1"
,
"com.j256.ormlite"
%
"ormlite-android"
%
"5.0"
,
"com.twofortyfouram"
%
"android-plugin-api-for-locale"
%
"1.0.2"
,
...
...
src/main/scala/com/github/shadowsocks/BaseService.scala
View file @
40447ce1
...
...
@@ -39,8 +39,7 @@
package
com.github.shadowsocks
import
java.io.File
import
java.io.IOException
import
java.io.
{
File
,
IOException
}
import
java.util.
{
Timer
,
TimerTask
}
import
android.app.Service
...
...
@@ -51,13 +50,11 @@ import android.text.TextUtils
import
android.util.Log
import
android.widget.Toast
import
com.github.kevinsawicki.http.HttpRequest
import
com.github.shadowsocks.aidl.
{
IShadowsocksService
,
IShadowsocksServiceCallback
}
import
com.github.shadowsocks.utils._
import
com.github.shadowsocks.ShadowsocksApplication.app
import
com.github.shadowsocks.aidl.
{
IShadowsocksService
,
IShadowsocksServiceCallback
}
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.utils._
import
com.google.firebase.FirebaseApp
import
com.google.firebase.storage.FileDownloadTask
import
com.google.firebase.storage.FirebaseStorage
trait
BaseService
extends
Service
{
...
...
@@ -318,7 +315,7 @@ trait BaseService extends Service {
}
}
def
get
Acl
(
route
:
String
)
{
def
fetch
Acl
(
route
:
String
)
{
val
localAcl
=
route
match
{
case
Route
.
BYPASS_LAN
=>
"bypass_lan.acl"
case
Route
.
BYPASS_CHN
=>
"bypass_chn.acl"
...
...
@@ -334,11 +331,16 @@ trait BaseService extends Service {
val
aclRef
=
storageRef
.
child
(
localAcl
)
val
task
=
aclRef
.
getFile
(
tempFile
)
task
.
addOnSuccessListener
((
_
)
=>
{
tempFile
.
renameTo
(
cloudAclFile
)
task
.
addOnSuccessListener
(
_
=>
{
if
(!
tempFile
.
renameTo
(
cloudAclFile
))
{
Log
.
d
(
"shadowsocks"
,
"Failed to rename acl file"
)
if
(!
tempFile
.
delete
())
tempFile
.
deleteOnExit
()
}
return
})
task
.
addOnFailureListener
((
_
)
=>
Log
.
e
(
"shadowsocks"
,
"Unable to download "
+
localAcl
))
tempFile
.
deleteOnExit
()
task
.
addOnFailureListener
(
_
=>
{
Log
.
e
(
"shadowsocks"
,
"Unable to download "
+
localAcl
)
if
(!
tempFile
.
delete
())
tempFile
.
deleteOnExit
()
})
}
}
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
40447ce1
...
...
@@ -339,7 +339,7 @@ class ShadowsocksNatService extends BaseService {
handleConnection
()
// lazily get ACL from cloud
get
Acl
(
profile
.
route
)
fetch
Acl
(
profile
.
route
)
changeState
(
State
.
CONNECTED
)
notification
=
new
ShadowsocksNotification
(
this
,
profile
.
name
,
true
)
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
40447ce1
...
...
@@ -164,7 +164,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
changeState
(
State
.
CONNECTED
)
// lazily get ACL from cloud
get
Acl
(
profile
.
route
)
fetch
Acl
(
profile
.
route
)
notification
=
new
ShadowsocksNotification
(
this
,
profile
.
name
)
}
...
...
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