Skip to content

Commit 1bca321

Browse files
committed
Temporarily add option to allow insecure HTTP subscription address
#4526
1 parent 247e2b3 commit 1bca321

File tree

13 files changed

+41
-3
lines changed

13 files changed

+41
-3
lines changed

V2rayNG/app/src/main/java/com/v2ray/ang/dto/SubscriptionItem.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ data class SubscriptionItem(
1111
var prevProfile: String? = null,
1212
var nextProfile: String? = null,
1313
var filter: String? = null,
14+
var allowInsecureUrl: Boolean = false,
1415
)
1516

V2rayNG/app/src/main/java/com/v2ray/ang/handler/AngConfigManager.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,10 @@ object AngConfigManager {
419419
if (!Utils.isValidUrl(url)) {
420420
return 0
421421
}
422-
if (!Utils.isValidSubUrl(url)) {
423-
return 0
422+
if (!it.second.allowInsecureUrl) {
423+
if (!Utils.isValidSubUrl(url)) {
424+
return 0
425+
}
424426
}
425427
Log.i(AppConfig.TAG, url)
426428

V2rayNG/app/src/main/java/com/v2ray/ang/ui/SubEditActivity.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class SubEditActivity : BaseActivity() {
4646
binding.etFilter.text = Utils.getEditable(subItem.filter)
4747
binding.chkEnable.isChecked = subItem.enabled
4848
binding.autoUpdateCheck.isChecked = subItem.autoUpdate
49+
binding.allowInsecureUrl.isChecked = subItem.allowInsecureUrl
4950
binding.etPreProfile.text = Utils.getEditable(subItem.prevProfile)
5051
binding.etNextProfile.text = Utils.getEditable(subItem.nextProfile)
5152
return true
@@ -77,6 +78,7 @@ class SubEditActivity : BaseActivity() {
7778
subItem.autoUpdate = binding.autoUpdateCheck.isChecked
7879
subItem.prevProfile = binding.etPreProfile.text.toString()
7980
subItem.nextProfile = binding.etNextProfile.text.toString()
81+
subItem.allowInsecureUrl = binding.allowInsecureUrl.isChecked
8082

8183
if (TextUtils.isEmpty(subItem.remarks)) {
8284
toast(R.string.sub_setting_remarks)
@@ -90,7 +92,9 @@ class SubEditActivity : BaseActivity() {
9092

9193
if (!Utils.isValidSubUrl(subItem.url)) {
9294
toast(R.string.toast_insecure_url_protocol)
93-
return false
95+
if (!subItem.allowInsecureUrl) {
96+
return false
97+
}
9498
}
9599
}
96100

V2rayNG/app/src/main/res/layout/activity_sub_edit.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,28 @@
138138

139139
</LinearLayout>
140140

141+
<LinearLayout
142+
android:layout_width="match_parent"
143+
android:layout_height="wrap_content"
144+
android:layout_marginTop="@dimen/padding_spacing_dp16"
145+
android:orientation="horizontal">
146+
147+
<TextView
148+
android:layout_width="0dp"
149+
android:layout_height="wrap_content"
150+
android:layout_weight="1.0"
151+
android:text="@string/sub_allow_insecure_url" />
152+
153+
<androidx.appcompat.widget.SwitchCompat
154+
android:id="@+id/allow_insecure_url"
155+
android:layout_width="wrap_content"
156+
android:layout_height="wrap_content"
157+
android:paddingStart="@dimen/padding_spacing_dp16"
158+
android:paddingEnd="@dimen/padding_spacing_dp16"
159+
app:theme="@style/BrandedSwitch" />
160+
161+
</LinearLayout>
162+
141163
<LinearLayout
142164
android:layout_width="match_parent"
143165
android:layout_height="wrap_content"

V2rayNG/app/src/main/res/values-ar/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
<string name="sub_setting_filter">Remarks regular filter</string>
259259
<string name="sub_setting_enable">تفعيل التحديث</string>
260260
<string name="sub_auto_update">تفعيل التحديث التلقائي</string>
261+
<string name="sub_allow_insecure_url">Allow insecure HTTP address</string>
261262
<string name="sub_setting_pre_profile">Previous proxy configuration remarks</string>
262263
<string name="sub_setting_next_profile">Next proxy configuration remarks</string>
263264
<string name="sub_setting_pre_profile_tip">The configuration remarks exists and is unique</string>

V2rayNG/app/src/main/res/values-bn/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
<string name="sub_setting_filter">Remarks regular filter</string>
259259
<string name="sub_setting_enable">আপডেট সক্রিয় করুন</string>
260260
<string name="sub_auto_update">স্বয়ংক্রিয় আপডেট সক্রিয় করুন</string>
261+
<string name="sub_allow_insecure_url">Allow insecure HTTP address</string>
261262
<string name="sub_setting_pre_profile">Previous proxy configuration remarks</string>
262263
<string name="sub_setting_next_profile">Next proxy configuration remarks</string>
263264
<string name="sub_setting_pre_profile_tip">The configuration remarks exists and is unique</string>

V2rayNG/app/src/main/res/values-bqi-rIR/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
<string name="sub_setting_filter">نوم موستعار فیلتر</string>
259259
<string name="sub_setting_enable">فعال بیڌن ورۊ کردن</string>
260260
<string name="sub_auto_update">فعال بیڌن ورۊ کردن خوتکار</string>
261+
<string name="sub_allow_insecure_url">Allow insecure HTTP address</string>
261262
<string name="sub_setting_pre_profile">نوم موستعار پروکسی دیندایی</string>
262263
<string name="sub_setting_next_profile">نوم موستعار پروکسی نیایی</string>
263264
<string name="sub_setting_pre_profile_tip">موتمعن بۊ ک نوم موستعار هڌس وو جۊرس نی</string>

V2rayNG/app/src/main/res/values-fa/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@
255255
<string name="sub_setting_filter">نام مستعار فیلتر</string>
256256
<string name="sub_setting_enable">فعال کردن به‌روزرسانی</string>
257257
<string name="sub_auto_update">فعال سازی به‌روزرسانی خودکار</string>
258+
<string name="sub_allow_insecure_url">Allow insecure HTTP address</string>
258259
<string name="sub_setting_pre_profile">نام مستعار پروکسی قبلی</string>
259260
<string name="sub_setting_next_profile">نام مستعار پروکسی بعدی</string>
260261
<string name="sub_setting_pre_profile_tip">لطفاً مطمئن شوید که نام مستعار وجود دارد و منحصر به فرد است</string>

V2rayNG/app/src/main/res/values-ru/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@
257257
<string name="sub_setting_filter">Название фильтра</string>
258258
<string name="sub_setting_enable">Использовать обновление</string>
259259
<string name="sub_auto_update">Использовать автообновление</string>
260+
<string name="sub_allow_insecure_url">Allow insecure HTTP address</string>
260261
<string name="sub_setting_pre_profile">Предыдущая конфигурация прокси</string>
261262
<string name="sub_setting_next_profile">Следующая конфигурация прокси</string>
262263
<string name="sub_setting_pre_profile_tip">Конфигурация должна быть уникальной</string>

V2rayNG/app/src/main/res/values-vi/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
<string name="sub_setting_filter">Remarks regular filter</string>
259259
<string name="sub_setting_enable">Sử dụng gói đăng ký này</string>
260260
<string name="sub_auto_update">Bật tự động cập nhật</string>
261+
<string name="sub_allow_insecure_url">Allow insecure HTTP address</string>
261262
<string name="sub_setting_pre_profile">Previous proxy configuration remarks</string>
262263
<string name="sub_setting_next_profile">Next proxy configuration remarks</string>
263264
<string name="sub_setting_pre_profile_tip">The configuration remarks exists and is unique</string>

V2rayNG/app/src/main/res/values-zh-rCN/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@
255255
<string name="sub_setting_filter">别名正则过滤</string>
256256
<string name="sub_setting_enable">启用更新</string>
257257
<string name="sub_auto_update">启用自动更新</string>
258+
<string name="sub_allow_insecure_url">允许不安全的 HTTP 地址</string>
258259
<string name="sub_setting_pre_profile">前置代理配置文件别名</string>
259260
<string name="sub_setting_next_profile">落地代理配置文件別名</string>
260261
<string name="sub_setting_pre_profile_tip">请确保配置文件别名存在并唯一</string>

V2rayNG/app/src/main/res/values-zh-rTW/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@
256256
<string name="sub_setting_filter">別名正規過濾</string>
257257
<string name="sub_setting_enable">啟用更新</string>
258258
<string name="sub_auto_update">啟用自動更新</string>
259+
<string name="sub_allow_insecure_url">允許不安全的 HTTP 位址</string>
259260
<string name="sub_setting_pre_profile">前置代理設定檔别名</string>
260261
<string name="sub_setting_next_profile">落地代理設定檔別名</string>
261262
<string name="sub_setting_pre_profile_tip">请确保設定檔别名存在并唯一</string>

V2rayNG/app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@
259259
<string name="sub_setting_filter">Remarks regular filter</string>
260260
<string name="sub_setting_enable">Enable update</string>
261261
<string name="sub_auto_update">Enable automatic update</string>
262+
<string name="sub_allow_insecure_url">Allow insecure HTTP address</string>
262263
<string name="sub_setting_pre_profile">Previous proxy configuration remarks</string>
263264
<string name="sub_setting_next_profile">Next proxy configuration remarks</string>
264265
<string name="sub_setting_pre_profile_tip">The configuration remarks exists and is unique</string>

0 commit comments

Comments
 (0)