diff --git a/V2rayNG/app/build.gradle b/V2rayNG/app/build.gradle index e025b84a8..085b77a8b 100644 --- a/V2rayNG/app/build.gradle +++ b/V2rayNG/app/build.gradle @@ -12,7 +12,7 @@ android { } defaultConfig { - applicationId "com.v2ray.ang" + applicationId "free.v2ray.proxy.VPN" minSdkVersion 17 targetSdkVersion Integer.parseInt("$targetSdkVer") multiDexEnabled true @@ -85,6 +85,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion" // Android support library + implementation "com.google.android.gms:play-services-ads:12.0.1" implementation "com.android.support:support-v4:$supportLibVersion" implementation "com.android.support:appcompat-v7:$supportLibVersion" implementation "com.android.support:design:$supportLibVersion" diff --git a/V2rayNG/app/src/androidTest/java/com/v2ray/ang/ApplicationTest.java b/V2rayNG/app/src/androidTest/java/com/v2ray/ang/ApplicationTest.java deleted file mode 100644 index e221e7142..000000000 --- a/V2rayNG/app/src/androidTest/java/com/v2ray/ang/ApplicationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.v2ray.ang; - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/V2rayNG/app/src/main/AndroidManifest.xml b/V2rayNG/app/src/main/AndroidManifest.xml index 3fe099409..0fd5f3981 100644 --- a/V2rayNG/app/src/main/AndroidManifest.xml +++ b/V2rayNG/app/src/main/AndroidManifest.xml @@ -119,7 +119,9 @@ - + \ No newline at end of file diff --git a/V2rayNG/app/src/main/kotlin/SpeedUpVPN/VpnEncrypt.kt b/V2rayNG/app/src/main/kotlin/SpeedUpVPN/VpnEncrypt.kt new file mode 100644 index 000000000..2ecbb97bf --- /dev/null +++ b/V2rayNG/app/src/main/kotlin/SpeedUpVPN/VpnEncrypt.kt @@ -0,0 +1,65 @@ +package SpeedUpVPN + +import android.os.Build +import android.support.annotation.RequiresApi +import android.util.Log +import java.io.File +import javax.crypto.Cipher +import javax.crypto.spec.IvParameterSpec +import javax.crypto.spec.SecretKeySpec + + +object VpnEncrypt{ + private const val theKey="your key" + const val vpnRemark="v2ray.vpn" + val vpnGroupName="SpeedUp.VPN" + @JvmField var builtinServersUpdated=false + @JvmField var builtinSubID="999" + @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) +} + + +private object AES256{ + private fun cipher(opmode:Int, secretKey:String):Cipher{ + if(secretKey.length != 32) throw RuntimeException("SecretKey length is not 32 chars") + val c = Cipher.getInstance("AES/CBC/PKCS5Padding") + val sk = SecretKeySpec(secretKey.toByteArray(Charsets.UTF_8), "AES") + val iv = IvParameterSpec(secretKey.substring(0, 16).toByteArray(Charsets.UTF_8)) + c.init(opmode, sk, iv) + return c + } + fun encrypt(str:String, secretKey:String):String{ + val encrypted = cipher(Cipher.ENCRYPT_MODE, secretKey).doFinal(str.toByteArray(Charsets.UTF_8)) + var encstr: String + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O || isWindows()) + encstr = java.util.Base64.getEncoder().encodeToString(encrypted) + else + encstr = android.util.Base64.encodeToString(encrypted, android.util.Base64.DEFAULT) + + return encstr + } + fun decrypt(str:String, secretKey:String):String{ + try { + val byteStr: ByteArray; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O || isWindows()) + byteStr = java.util.Base64.getDecoder().decode(str.toByteArray(Charsets.UTF_8)) + else + byteStr = android.util.Base64.decode(str.toByteArray(Charsets.UTF_8), android.util.Base64.DEFAULT) + + return String(cipher(Cipher.DECRYPT_MODE, secretKey).doFinal(byteStr)) + } catch (e: Exception) { + Log.e("VpnEncrypt","decrypt failed",e) + return "" + } + } + fun isWindows(): Boolean { + var os= System.getProperty("os.name") + if(os.isNullOrEmpty()) + return false + else + return os.contains("Windows") + } +} + diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt index 9f2278db6..4ccf244ea 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AppConfig.kt @@ -5,7 +5,7 @@ package com.v2ray.ang * App Config Const */ object AppConfig { - const val ANG_PACKAGE = "com.v2ray.ang" + const val ANG_PACKAGE = "free.v2ray.proxy.VPN" const val ANG_CONFIG = "ang_config" const val PREF_CURR_CONFIG = "pref_v2ray_config" const val PREF_CURR_CONFIG_GUID = "pref_v2ray_config_guid" @@ -14,6 +14,7 @@ object AppConfig { const val PREF_INAPP_BUY_IS_PREMIUM = "pref_inapp_buy_is_premium" const val VMESS_PROTOCOL: String = "vmess://" const val SS_PROTOCOL: String = "ss://" + const val SSR_PROTOCOL: String = "ssr://" const val SOCKS_PROTOCOL: String = "socks://" const val BROADCAST_ACTION_SERVICE = "com.v2ray.ang.action.service" const val BROADCAST_ACTION_ACTIVITY = "com.v2ray.ang.action.activity" @@ -34,8 +35,9 @@ object AppConfig { const val androidpackagenamelistUrl = "https://raw.githubusercontent.com/2dust/androidpackagenamelist/master/proxy.txt" const val v2rayCustomRoutingListUrl = "https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/" - const val v2rayNGIssues = "https://github.com/2dust/v2rayNG/issues" - const val promotionUrl = "https://1.2345345.xyz/ads.html" + const val v2rayNGIssues = "https://github.com/bannedbook/v2ray.vpn/issues" + const val promotionUrl = "https://lihi1.com/mWZJL" + const val abloutUrl = "https://github.com/bannedbook/v2ray.vpn" const val DNS_AGENT = "1.1.1.1" const val DNS_DIRECT = "223.5.5.5" diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt index 045f681e9..66ddb2229 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt @@ -1,5 +1,6 @@ package com.v2ray.ang.ui +import SpeedUpVPN.VpnEncrypt import android.Manifest import android.content.* import android.net.Uri @@ -22,6 +23,7 @@ import org.jetbrains.anko.* import java.lang.ref.SoftReference import java.net.URL import android.content.IntentFilter +import android.graphics.Color import android.support.design.widget.NavigationView import android.support.v4.view.GravityCompat import android.support.v7.app.ActionBarDrawerToggle @@ -33,6 +35,7 @@ import rx.android.schedulers.AndroidSchedulers import java.util.concurrent.TimeUnit import com.v2ray.ang.helper.SimpleItemTouchHelperCallback import com.v2ray.ang.util.AngConfigManager.configs +import com.google.android.gms.ads.* class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedListener { companion object { @@ -58,10 +61,14 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList private val adapter by lazy { MainRecyclerAdapter(this) } private var mItemTouchHelper: ItemTouchHelper? = null - + lateinit var mAdView : AdView override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + MobileAds.initialize(this) + mAdView = findViewById(R.id.adView) + val adRequest = AdRequest.Builder().build() + mAdView.loadAd(adRequest) title = getString(R.string.title_server) setSupportActionBar(toolbar) @@ -93,6 +100,10 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList } } + var recsite1= getResources().getString(R.string.recommended_site_1) + recommended_site_1.setBackgroundColor(Color.TRANSPARENT); + recommended_site_1.loadData(recsite1,"text/html; charset=utf-8", "UTF-8") + recycler_view.setHasFixedSize(true) recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.adapter = adapter @@ -107,6 +118,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList drawer_layout.addDrawerListener(toggle) toggle.syncState() nav_view.setNavigationItemSelectedListener(this) + importConfigViaBuildinSub() } fun startV2Ray() { @@ -305,13 +317,15 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList return true } - fun importBatchConfig(server: String?, subid: String = "") { + fun importBatchConfig(server: String?, subid: String = "") : Boolean { val count = AngConfigManager.importBatchConfig(server, subid) if (count > 0) { toast(R.string.toast_success) adapter.updateConfigList() + return true } else { toast(R.string.toast_failure) + return false } } @@ -380,7 +394,38 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList } return true } - + /** + * import config from BuildinSub + */ + fun importConfigViaBuildinSub(){ + toast(R.string.update_builtin_servers) + var builtinSubUrls = getResources().getStringArray(R.array.builtinSubUrls) + doAsync { + for (i in 0 until builtinSubUrls.size) { + try { + val url = builtinSubUrls.get(i) + //Log.d("Main", url) + val configText = URL(url).readText() + //if (configText.isNotEmpty()&&configText.isNotBlank())VpnEncrypt.builtinServersUpdated=true + uiThread { + // builtinSub set id 999 + VpnEncrypt.builtinServersUpdated = importBatchConfig(VpnEncrypt.aesDecrypt(configText), VpnEncrypt.builtinSubID) + } + Thread.sleep(10_000) + Log.d("VpnEncrypt", VpnEncrypt.builtinServersUpdated.toString()) + if(VpnEncrypt.builtinServersUpdated){ + Log.d("VpnEncrypt", "VpnEncrypt builtinServersUpdated,break") + break + } + } + catch (e: Exception) { + //Log.e("VpnEncrypt","",e) + //Log.e("VpnEncrypt",e.toString()) //with url + Log.e("VpnEncrypt",e.stackTrace.first().toString()) + } + } + } + } /** * import config from sub */ @@ -561,6 +606,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList Utils.openUri(this, AppConfig.promotionUrl) } R.id.donate -> { + Utils.openUri(this, AppConfig.abloutUrl) // startActivity() } R.id.logcat -> { diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt index 4ae5aadd4..7707fc3a3 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt @@ -1,5 +1,6 @@ package com.v2ray.ang.ui +import SpeedUpVPN.VpnEncrypt import android.graphics.Color import android.support.v7.widget.RecyclerView import android.text.TextUtils @@ -85,6 +86,12 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter try { diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt index 217e3573d..fc82163a5 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/AngConfigManager.kt @@ -1,5 +1,6 @@ package com.v2ray.ang.util +import SpeedUpVPN.VpnEncrypt import android.graphics.Bitmap import android.text.TextUtils import android.util.Log @@ -11,6 +12,7 @@ import com.v2ray.ang.AppConfig.PREF_CURR_CONFIG import com.v2ray.ang.AppConfig.PREF_CURR_CONFIG_GUID import com.v2ray.ang.AppConfig.PREF_CURR_CONFIG_NAME import com.v2ray.ang.AppConfig.SOCKS_PROTOCOL +import com.v2ray.ang.AppConfig.SSR_PROTOCOL import com.v2ray.ang.AppConfig.SS_PROTOCOL import com.v2ray.ang.AppConfig.VMESS_PROTOCOL import com.v2ray.ang.R @@ -326,6 +328,30 @@ object AngConfigManager { vmess.port = match.groupValues[4].toInt() vmess.subid = subid + addShadowsocksServer(vmess, -1) + } else if (server.startsWith(SSR_PROTOCOL)) { + var server = server.replace(SSR_PROTOCOL, "") + server = Utils.decode(server) + val decodedPattern_ssr = "(?i)^((.+):(\\d+?):(.*):(.+):(.*):(.+)/(.*))".toRegex() + val match = decodedPattern_ssr.matchEntire(server) + //Log.e("------","match="+match.toString()) + if (match == null) { + return R.string.toast_incorrect_protocol + } + + vmess.remarks="" + val decodedPattern_ssr_groupparam = "(?i)(.*)[?&]group=([A-Za-z0-9_=-]*)(.*)".toRegex() + val match4 = decodedPattern_ssr_groupparam.matchEntire(match.groupValues[8]) + if (match4 != null) vmess.remarks = Utils.decode(match4.groupValues[2]) + if (vmess.remarks==VpnEncrypt.vpnGroupName)vmess.remarks=VpnEncrypt.vpnRemark + vmess.security = match.groupValues[5].toLowerCase(Locale.ENGLISH) + vmess.id = Utils.decode(match.groupValues[7]) //is passwd? + vmess.address = match.groupValues[2].toLowerCase(Locale.ENGLISH) + if (vmess.address.firstOrNull() == '[' && vmess.address.lastOrNull() == ']') + vmess.address = vmess.address.substring(1, vmess.address.length - 1) + vmess.port = match.groupValues[3].toInt() + vmess.subid = subid + addShadowsocksServer(vmess, -1) } else if (server.startsWith(SOCKS_PROTOCOL)) { var result = server.replace(SOCKS_PROTOCOL, "") @@ -413,6 +439,7 @@ object AngConfigManager { } val vmess = angConfig.vmess[index] + if (vmess.remarks== VpnEncrypt.vpnRemark)return "" if (angConfig.vmess[index].configType == AppConfig.EConfigType.Vmess) { val vmessQRCode = VmessQRCode() @@ -725,7 +752,7 @@ object AngConfigManager { fun importBatchConfig(servers: String?, subid: String): Int { try { - if (servers == null) { + if (servers == null || servers =="") { return 0 } removeServerViaSubid(subid) @@ -736,8 +763,20 @@ object AngConfigManager { // } var count = 0 - servers.lines() - .forEach { + var limit = -1 + var serverList=servers.trim().lines() + if (servers.indexOf("MAX=") == 0) { + limit = servers.split("\n")[0].split("MAX=")[1] + .replace("\\D+".toRegex(), "").toInt() + serverList=serverList.drop(1) + } + //Log.e("------","limit is "+limit) + //Log.e("------","serverList1:"+serverList) + if (limit != -1 && limit < serverList.size) { + serverList = serverList.shuffled().take(limit) + } + //Log.e("------","serverList2:"+serverList) + serverList.forEach { val resId = importConfig(it, subid) if (resId == 0) { count++ diff --git a/V2rayNG/app/src/main/res/layout/activity_main.xml b/V2rayNG/app/src/main/res/layout/activity_main.xml index 054ba3ba6..6763c65a9 100644 --- a/V2rayNG/app/src/main/res/layout/activity_main.xml +++ b/V2rayNG/app/src/main/res/layout/activity_main.xml @@ -35,6 +35,7 @@ tools:context=".ui.MainActivity"> @@ -51,6 +52,7 @@ android:layout_weight="1" /> - - + @@ -78,7 +88,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="24dp" - android:layout_gravity="bottom|end"> + android:layout_gravity="bottom|center"> + app:layout_anchorGravity="bottom|center" /> + + diff --git a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml index 36fc90aa1..d6dad21ed 100644 --- a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml @@ -1,6 +1,5 @@ - v2rayNG 开关 开关 初次使用此功能请先用APP激活VPN @@ -99,7 +98,7 @@ 路由模式 自定义路由 - 捐赠 + 关于 支持开发者 陆续增加一些试验性的进阶功能 @@ -120,7 +119,7 @@ 加入Telegram Group 未找到Telegram app - 推广 + 翻墙服务 一些推广,点击查看详情(捐赠可去除) 版本 @@ -186,4 +185,25 @@ 代理共享已启用,请确保处于受信网络 配置格式错误 + + + 动态网  禁闻网   + + + ]]> + + + 看禁闻 + + + ]]> + + https://gitlab.com/bobmolen/cloud/raw/master/v2.py + https://bannedbook.github.io/fanqiang/v2.py + https://storage.googleapis.com/jwnews/v2.py + https://raw.githubusercontent.com/bannedbook/fanqiang/master/docs/v2.py + + 更新内置VPN服务器 diff --git a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml index 09b6ba66c..02c4b433a 100644 --- a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml @@ -1,6 +1,5 @@ - v2rayNG 切換 切換 首次使用此功能,請使用此應用程式來啟用 VPN @@ -100,7 +99,7 @@ 路由模式 自訂路由 - 捐款 + 關於 向開發人員捐款 新增一些實驗性進階功能 @@ -187,4 +186,24 @@ 其他設備可以使用socks/http協議通過您的IP地址連接到代理\nHttp 代理: http://您的ip:10809\nSocks 代理: socks(4/5)://您的ip:10808\n僅在受信任的網絡中啟用以避免未經授權的連接 代理共享已啟用,請確保處於受信網絡 配置格式錯誤 + + + 禁聞網  禁書網   + + + ]]> + + + 禁書網 + + + ]]> + + https://bannedbook.github.io/fanqiang/v2.py + https://raw.githubusercontent.com/bannedbook/fanqiang/master/docs/v2.py + https://gitlab.com/bobmolen/cloud/raw/master/v2.py + + 更新內置VPN伺服器 diff --git a/V2rayNG/app/src/main/res/values/strings.xml b/V2rayNG/app/src/main/res/values/strings.xml index 29c03bf9e..4a6a042e1 100644 --- a/V2rayNG/app/src/main/res/values/strings.xml +++ b/V2rayNG/app/src/main/res/values/strings.xml @@ -1,6 +1,6 @@ - v2rayNG + V2ray VPN Switch Switch First use of this feature, please use the app to activate VPN @@ -100,7 +100,7 @@ Routing mode Custom routing - Donate + About Donate developer Add some experimental advanced features @@ -187,4 +187,12 @@ Proxy sharing enabled\nMake sure you are in a trusted network Config malformed + + + + https://bannedbook.github.io/fanqiang/v2.py + https://raw.githubusercontent.com/bannedbook/fanqiang/master/docs/v2.py + https://gitlab.com/bobmolen/cloud/raw/master/v2.py + + Update builtin servers diff --git a/V2rayNG/dpreference/src/main/AndroidManifest.xml b/V2rayNG/dpreference/src/main/AndroidManifest.xml index 8ca570608..5a131c657 100644 --- a/V2rayNG/dpreference/src/main/AndroidManifest.xml +++ b/V2rayNG/dpreference/src/main/AndroidManifest.xml @@ -8,7 +8,7 @@ diff --git a/V2rayNG/dpreference/src/main/java/me/dozen/dpreference/PreferenceProvider.java b/V2rayNG/dpreference/src/main/java/me/dozen/dpreference/PreferenceProvider.java index f8bf2a944..ec3cb8813 100644 --- a/V2rayNG/dpreference/src/main/java/me/dozen/dpreference/PreferenceProvider.java +++ b/V2rayNG/dpreference/src/main/java/me/dozen/dpreference/PreferenceProvider.java @@ -19,7 +19,7 @@ public class PreferenceProvider extends ContentProvider { private static final String TAG = PreferenceProvider.class.getSimpleName(); - private static final String AUTHORITY = "com.v2ray.ang.dpreference"; + private static final String AUTHORITY = "free.v2ray.proxy.VPN.dpreference"; public static final String CONTENT_PREF_BOOLEAN_URI = "content://" + AUTHORITY + "/boolean/"; public static final String CONTENT_PREF_STRING_URI = "content://" + AUTHORITY + "/string/"; diff --git a/V2rayNG/gradle/wrapper/gradle-wrapper.jar b/V2rayNG/gradle/wrapper/gradle-wrapper.jar index 13372aef5..f6b961fd5 100644 Binary files a/V2rayNG/gradle/wrapper/gradle-wrapper.jar and b/V2rayNG/gradle/wrapper/gradle-wrapper.jar differ diff --git a/V2rayNG/gradlew b/V2rayNG/gradlew index 9d82f7891..cccdd3d51 100644 --- a/V2rayNG/gradlew +++ b/V2rayNG/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,26 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -85,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -150,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/V2rayNG/gradlew.bat b/V2rayNG/gradlew.bat index 8a0b282aa..f9553162f 100644 --- a/V2rayNG/gradlew.bat +++ b/V2rayNG/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/gitupdate.bat b/gitupdate.bat new file mode 100644 index 000000000..f8e89e2fd --- /dev/null +++ b/gitupdate.bat @@ -0,0 +1,6 @@ +git config --global core.autocrlf true +git pull origin master +git add -A +git commit -m "update" +git push origin master +pause \ No newline at end of file