diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala index a9b00af3..ec937831 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala @@ -116,6 +116,7 @@ class ShadowsocksNatService extends BaseService { } def startKcptunDaemon() { + if (profile.kcpcli == null) profile.kcpcli = "" val cmd = new ArrayBuffer[String] cmd += (getApplicationInfo.dataDir + "/kcptun" diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala index 324b7855..fe02b325 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala @@ -36,10 +36,8 @@ object ShadowsocksSettings { } def updateSummaryEditTextPreference(pref: Preference, value: String) { - if (value != null) { - pref.setSummary(value) - pref.asInstanceOf[SummaryEditTextPreference].setText(value) - } + pref.setSummary(value) + pref.asInstanceOf[SummaryEditTextPreference].setText(value) } def updateSwitchPreference(pref: Preference, value: Boolean) { diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala index c9902f56..479c8f11 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala @@ -204,6 +204,8 @@ class ShadowsocksVpnService extends VpnService with BaseService { } def startKcptunDaemon() { + if (profile.kcpcli == null) profile.kcpcli = "" + val cmd = new ArrayBuffer[String] cmd += (getApplicationInfo.dataDir + "/kcptun" , "-r", profile.host + ":" + profile.kcpPort diff --git a/src/main/scala/com/github/shadowsocks/database/DBHelper.scala b/src/main/scala/com/github/shadowsocks/database/DBHelper.scala index acaefebf..b590f5f0 100644 --- a/src/main/scala/com/github/shadowsocks/database/DBHelper.scala +++ b/src/main/scala/com/github/shadowsocks/database/DBHelper.scala @@ -64,7 +64,7 @@ object DBHelper { } class DBHelper(val context: Context) - extends OrmLiteSqliteOpenHelper(context, DBHelper.PROFILE, null, 18) { + extends OrmLiteSqliteOpenHelper(context, DBHelper.PROFILE, null, 19) { import DBHelper._ lazy val profileDao: Dao[Profile, Int] = getDao(classOf[Profile]) @@ -83,10 +83,11 @@ class DBHelper(val context: Context) } if (oldVersion < 8) { profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN udpdns SMALLINT;") - profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN route VARCHAR;") } 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) { profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN auth SMALLINT;") @@ -128,11 +129,13 @@ class DBHelper(val context: Context) if (oldVersion < 17) { 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) { - 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;") } } }