diff --git a/V2rayNG/app/src/main/assets/mmkv/SUB b/V2rayNG/app/src/main/assets/mmkv/SUB index b2d799e9..af1993ee 100644 Binary files a/V2rayNG/app/src/main/assets/mmkv/SUB and b/V2rayNG/app/src/main/assets/mmkv/SUB differ diff --git a/add_key_subscription.kt b/add_key_subscription.kt new file mode 100644 index 00000000..f135b561 --- /dev/null +++ b/add_key_subscription.kt @@ -0,0 +1,44 @@ +import com.google.gson.Gson +import java.io.File +import java.util.UUID + +data class SubscriptionItem( + val remarks: String, + val url: String, + val enabled: Boolean, + val addedTime: Long, + val lastUpdated: Long, + val autoUpdate: Boolean, + val filter: String, + val allowInsecureUrl: Boolean, + val userAgent: String +) + +fun main() { + val subFile = File("V2rayNG/app/src/main/assets/mmkv/SUB") + val guid = UUID.randomUUID().toString().replace("-", "") + + val subscription = SubscriptionItem( + remarks = "KEY", + url = "https://key.zarazaex.xyz/sub", + enabled = true, + addedTime = System.currentTimeMillis(), + lastUpdated = -1, + autoUpdate = true, + filter = "", + allowInsecureUrl = false, + userAgent = "" + ) + + val json = Gson().toJson(subscription) + val guidBytes = guid.toByteArray(Charsets.UTF_8) + val jsonBytes = json.toByteArray(Charsets.UTF_8) + + subFile.appendBytes(byteArrayOf( + 0x00, 0x00, 0x00, guidBytes.size.toByte() + ) + guidBytes + byteArrayOf( + 0x00, 0x00, 0x00, jsonBytes.size.toByte() + ) + jsonBytes) + + println("Добавлена подписка KEY с GUID: $guid") +} diff --git a/src/main/kotlin/AddSubscription.kt b/src/main/kotlin/AddSubscription.kt index defc8004..af599e1a 100644 --- a/src/main/kotlin/AddSubscription.kt +++ b/src/main/kotlin/AddSubscription.kt @@ -136,9 +136,17 @@ fun main() { ) println("Добавлена подписка БЕЛЫЕ W: $guid2") + val guid3 = manager.addSubscription( + remarks = "KEY", + url = "https://key.zarazaex.xyz/sub", + autoUpdate = true + ) + println("Добавлена подписка KEY: $guid3") + println("\nОбновление подписок...") manager.updateSubscription(guid1, "https://raw.githubusercontent.com/zieng2/wl/refs/heads/main/vless_universal.txt") manager.updateSubscription(guid2, "https://raw.githubusercontent.com/whoahaow/rjsxrd/refs/heads/main/githubmirror/bypass/bypass-all.txt") + manager.updateSubscription(guid3, "https://key.zarazaex.xyz/sub") println("\nПодписки успешно добавлены и обновлены в $mmkvPath") }