Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bannedbook committed May 25, 2020
1 parent 9a157ba commit 0604127
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 10 deletions.
4 changes: 2 additions & 2 deletions V2rayNG/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
minSdkVersion 17
targetSdkVersion Integer.parseInt("$targetSdkVer")
multiDexEnabled true
versionCode 219
versionName "2.0.5"
versionCode 220
versionName "2.0.6"
}

signingConfigs {
Expand Down
19 changes: 19 additions & 0 deletions V2rayNG/app/src/main/kotlin/SpeedUpVPN/VpnEncrypt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Build
import android.support.annotation.RequiresApi
import android.util.Log
import java.io.File
import java.util.*
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec
Expand All @@ -14,9 +15,27 @@ object VpnEncrypt{
const val vpnGroupName="SpeedUp.VPN"
@JvmField var builtinServersUpdated=false
@JvmField var builtinSubID="999"
@JvmField var freeSubID="1000"
@JvmField var testing="test..."
@JvmStatic fun aesEncrypt(v:String, secretKey:String=theKey) = AES256.encrypt(v, secretKey)
@JvmStatic fun aesDecrypt(v:String, secretKey:String=theKey) = AES256.decrypt(v, secretKey)
@JvmStatic fun readFileAsTextUsingInputStream(fileName: String) = File(fileName).inputStream().readBytes().toString(Charsets.UTF_8)
@JvmStatic fun getUniqueID(): Int {
var szDevIDShort = "168169"
try {
szDevIDShort+=Build.BOARD.length % 10 + Build.BRAND.length % 10 + Build.DEVICE.length % 10 + Build.MANUFACTURER.length % 10 + Build.MODEL.length % 10 + Build.PRODUCT.length % 10
} catch (exception: Exception) {}
var serial: String? = null
try {
serial = Build::class.java.getField("SERIAL")[null].toString()
// Go ahead and return the serial for api => 9
return UUID(szDevIDShort.hashCode() as Long, serial.hashCode() as Long).hashCode()
} catch (exception: Exception) { // String needs to be initialized
serial = "https://git.io/jww" // some value
}

return UUID(szDevIDShort.hashCode().toLong(), serial.hashCode().toLong()).hashCode()
}
}


Expand Down
3 changes: 1 addition & 2 deletions V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
/**
* import free sub
*/
fun importFreeSubs()
: Boolean {
fun importFreeSubs(): Boolean {
try {
toast(R.string.title_sub_update)
doAsync {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter<Mai
holder.layout_share.visibility = View.VISIBLE
}

if(VpnEncrypt.vpnRemark == remarks){
if(VpnEncrypt.builtinSubID == subid){
holder.statistics.text = address.toString().substring(0,5)+"..."
holder.layout_share.visibility=View.INVISIBLE
holder.layout_edit.visibility=View.INVISIBLE
Expand Down
27 changes: 23 additions & 4 deletions V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ object AngConfigManager {
}

val vmess = angConfig.vmess[index]
if (vmess.remarks== VpnEncrypt.vpnRemark)return ""
if (vmess.subid== VpnEncrypt.builtinSubID)return ""
if (angConfig.vmess[index].configType == AppConfig.EConfigType.Vmess) {

val vmessQRCode = VmessQRCode()
Expand Down Expand Up @@ -829,7 +829,6 @@ object AngConfigManager {
// servers = server.replace("\n", "")
// }

var count = 0
var limit = -1
var serverList=servers.trim().lines()
if (servers.indexOf("MAX=") == 0) {
Expand All @@ -839,11 +838,31 @@ object AngConfigManager {
}
//Log.e("------","limit is "+limit)
//Log.e("------","serverList1:"+serverList)

var limitProfiles:ArrayList<String> = arrayListOf()
if (limit != -1 && limit < serverList.size) {
serverList = serverList.shuffled().take(limit)
try {
val uqid=VpnEncrypt.getUniqueID()
//Log.e("uqid",uqid.toString())
val startPosition=uqid % serverList.size
for (k in 0 until limit) {
var thePosition=startPosition+k
if(thePosition>=serverList.size) thePosition -= serverList.size
limitProfiles.add(serverList[thePosition])
}
}
catch (ex: Exception) {
limitProfiles.clear()
limitProfiles.addAll(serverList.shuffled().take(limit))
}
if (limitProfiles.isEmpty())limitProfiles.addAll(serverList.shuffled().take(limit))
}
else
limitProfiles.addAll(serverList)

//Log.e("------","serverList2:"+serverList)
serverList.forEach {
var count = 0
limitProfiles.forEach {
val resId = importConfig(it, subid)
if (resId == 0) {
count++
Expand Down
2 changes: 1 addition & 1 deletion gitupdate.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ git pull origin master
git add -A
git commit -m "update"
git push origin master
git tag -a v2.0.5 -m "release v2.0.5"
git tag -a v2.0.6 -m "release v2.0.6"
git push origin --tags
pause

0 comments on commit 0604127

Please sign in to comment.