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
984e75ae
Commit
984e75ae
authored
Aug 09, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix incorrect handling of default values on database upgrade
parent
3cc1a160
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
+13
-9
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+1
-0
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
...in/scala/com/github/shadowsocks/ShadowsocksSettings.scala
+2
-4
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+2
-0
src/main/scala/com/github/shadowsocks/database/DBHelper.scala
...main/scala/com/github/shadowsocks/database/DBHelper.scala
+8
-5
No files found.
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
984e75ae
...
@@ -116,6 +116,7 @@ class ShadowsocksNatService extends BaseService {
...
@@ -116,6 +116,7 @@ class ShadowsocksNatService extends BaseService {
}
}
def
startKcptunDaemon
()
{
def
startKcptunDaemon
()
{
if
(
profile
.
kcpcli
==
null
)
profile
.
kcpcli
=
""
val
cmd
=
new
ArrayBuffer
[
String
]
val
cmd
=
new
ArrayBuffer
[
String
]
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/kcptun"
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/kcptun"
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
View file @
984e75ae
...
@@ -36,10 +36,8 @@ object ShadowsocksSettings {
...
@@ -36,10 +36,8 @@ object ShadowsocksSettings {
}
}
def
updateSummaryEditTextPreference
(
pref
:
Preference
,
value
:
String
)
{
def
updateSummaryEditTextPreference
(
pref
:
Preference
,
value
:
String
)
{
if
(
value
!=
null
)
{
pref
.
setSummary
(
value
)
pref
.
setSummary
(
value
)
pref
.
asInstanceOf
[
SummaryEditTextPreference
].
setText
(
value
)
pref
.
asInstanceOf
[
SummaryEditTextPreference
].
setText
(
value
)
}
}
}
def
updateSwitchPreference
(
pref
:
Preference
,
value
:
Boolean
)
{
def
updateSwitchPreference
(
pref
:
Preference
,
value
:
Boolean
)
{
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
984e75ae
...
@@ -204,6 +204,8 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -204,6 +204,8 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}
}
def
startKcptunDaemon
()
{
def
startKcptunDaemon
()
{
if
(
profile
.
kcpcli
==
null
)
profile
.
kcpcli
=
""
val
cmd
=
new
ArrayBuffer
[
String
]
val
cmd
=
new
ArrayBuffer
[
String
]
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/kcptun"
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/kcptun"
,
"-r"
,
profile
.
host
+
":"
+
profile
.
kcpPort
,
"-r"
,
profile
.
host
+
":"
+
profile
.
kcpPort
...
...
src/main/scala/com/github/shadowsocks/database/DBHelper.scala
View file @
984e75ae
...
@@ -64,7 +64,7 @@ object DBHelper {
...
@@ -64,7 +64,7 @@ object DBHelper {
}
}
class
DBHelper
(
val
context
:
Context
)
class
DBHelper
(
val
context
:
Context
)
extends
OrmLiteSqliteOpenHelper
(
context
,
DBHelper
.
PROFILE
,
null
,
1
8
)
{
extends
OrmLiteSqliteOpenHelper
(
context
,
DBHelper
.
PROFILE
,
null
,
1
9
)
{
import
DBHelper._
import
DBHelper._
lazy
val
profileDao
:
Dao
[
Profile
,
Int
]
=
getDao
(
classOf
[
Profile
])
lazy
val
profileDao
:
Dao
[
Profile
,
Int
]
=
getDao
(
classOf
[
Profile
])
...
@@ -83,10 +83,11 @@ class DBHelper(val context: Context)
...
@@ -83,10 +83,11 @@ class DBHelper(val context: Context)
}
}
if
(
oldVersion
<
8
)
{
if
(
oldVersion
<
8
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN udpdns SMALLINT;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN udpdns SMALLINT;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN route VARCHAR;"
)
}
}
if
(
oldVersion
<
9
)
{
if
(
oldVersion
<
9
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN route VARCHAR;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN route VARCHAR DEFAULT 'all';"
)
}
else
if
(
oldVersion
<
19
)
{
profileDao
.
executeRawNoArgs
(
"UPDATE `profile` SET route = 'all' WHERE route IS NULL;"
)
}
}
if
(
oldVersion
<
10
)
{
if
(
oldVersion
<
10
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN auth SMALLINT;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN auth SMALLINT;"
)
...
@@ -128,11 +129,13 @@ class DBHelper(val context: Context)
...
@@ -128,11 +129,13 @@ class DBHelper(val context: Context)
if
(
oldVersion
<
17
)
{
if
(
oldVersion
<
17
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN kcp SMALLINT;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN kcp SMALLINT;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN kcpcli VARCHAR;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN kcpcli VARCHAR
DEFAULT ''
;"
)
}
}
if
(
oldVersion
<
18
)
{
if
(
oldVersion
<
18
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN kcpPort INTEGER;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN kcpPort INTEGER DEFAULT 8399;"
)
}
else
if
(
oldVersion
<
19
)
{
profileDao
.
executeRawNoArgs
(
"UPDATE `profile` SET kcpPort = 8399 WHERE kcpPort = 0;"
)
}
}
}
}
}
}
...
...
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