mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-27 04:31:03 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f265a46cf | ||
|
|
a740690a08 | ||
|
|
d722a64d3c | ||
|
|
abe2674290 | ||
|
|
e5ec40f6fa | ||
|
|
96c43fc6f5 | ||
|
|
4e36d72c5c | ||
|
|
6197246e8e | ||
|
|
15a044cae1 | ||
|
|
ede60b994c |
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@@ -24,16 +24,12 @@ jobs:
|
|||||||
java-version: '17'
|
java-version: '17'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
cache: gradle
|
cache: gradle
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: "lts/*"
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v2
|
uses: android-actions/setup-android@v2
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: ./gradlew build clean generateReadme
|
run: ./gradlew build clean
|
||||||
- name: Install Android build-tools
|
- name: Install Android build-tools
|
||||||
run: sdkmanager "build-tools;32.0.0"
|
run: sdkmanager "build-tools;32.0.0"
|
||||||
- name: Setup semantic-release
|
- name: Setup semantic-release
|
||||||
|
|||||||
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,3 +1,31 @@
|
|||||||
|
# [2.45.0](https://github.com/revanced/revanced-patches/compare/v2.44.0...v2.45.0) (2022-08-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add JSON meta ([4c229d3](https://github.com/revanced/revanced-patches/commit/4c229d350859903a782c43b13457628739572f09))
|
||||||
|
|
||||||
|
# [2.44.0](https://github.com/revanced/revanced-patches/compare/v2.43.2...v2.44.0) (2022-08-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add debug switch ([#391](https://github.com/revanced/revanced-patches/issues/391)) ([ee4b776](https://github.com/revanced/revanced-patches/commit/ee4b7761d8bb4549f2f100f721c90c664eedfe4a))
|
||||||
|
|
||||||
|
## [2.43.2](https://github.com/revanced/revanced-patches/compare/v2.43.1...v2.43.2) (2022-08-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* package name for Vanced ([#390](https://github.com/revanced/revanced-patches/issues/390)) ([85206b9](https://github.com/revanced/revanced-patches/commit/85206b99e1399d00e5eaebded8aadc5fb982aaa4))
|
||||||
|
|
||||||
|
## [2.43.1](https://github.com/revanced/revanced-patches/compare/v2.43.0...v2.43.1) (2022-08-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* `Patch` annotation for `client-spoof` patch ([6a8af47](https://github.com/revanced/revanced-patches/commit/6a8af47f2dfb319a53db9b5f9deb0392f10f4185))
|
||||||
|
|
||||||
# [2.43.0](https://github.com/revanced/revanced-patches/compare/v2.42.1...v2.43.0) (2022-08-26)
|
# [2.43.0](https://github.com/revanced/revanced-patches/compare/v2.42.1...v2.43.0) (2022-08-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,72 @@
|
|||||||
# 🧩 ReVanced Patches
|
## 🧩 Patches
|
||||||
|
|
||||||
Official patches by ReVanced
|
The official Patch bundle provided by ReVanced and the community.
|
||||||
|
|
||||||
## 📜 List of available patches
|
> Looking for the JSON variant of this? [Click here](patches.json).
|
||||||
|
|
||||||
{{ table }}
|
{{ table }}
|
||||||
|
|
||||||
|
## 📝 JSON Format
|
||||||
|
|
||||||
|
This section explains the JSON format for the [patches.json](patches.json) file.
|
||||||
|
|
||||||
|
The file contains an array of objects, each object representing a patch. The object contains the following properties:
|
||||||
|
|
||||||
|
| key | description |
|
||||||
|
|-------------------------------|------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `name` | The name of the patch. |
|
||||||
|
| `description` | The description of the patch. |
|
||||||
|
| `version` | The version of the patch. |
|
||||||
|
| `excluded` | Whether a patch is excluded by default. If `true`, the patch must never be included by default. |
|
||||||
|
| `dependencies` | An array of dependencies, which are patch names. |
|
||||||
|
| `compatiblePackages` | An array of packages compatible with this patch. |
|
||||||
|
| `compatiblePackages.name` | The name of the package. |
|
||||||
|
| `compatiblePackages.versions` | An array of versions of the package compatible with this patch. If empty, all versions are seemingly compatible. |
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "remember-video-quality",
|
||||||
|
"description": "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"excluded": false,
|
||||||
|
"dependencies": [
|
||||||
|
"integrations",
|
||||||
|
"video-id-hook"
|
||||||
|
],
|
||||||
|
"compatiblePackages": [
|
||||||
|
{
|
||||||
|
"name": "com.google.android.youtube",
|
||||||
|
"versions": [
|
||||||
|
"17.22.36",
|
||||||
|
"17.24.35",
|
||||||
|
"17.26.35",
|
||||||
|
"17.27.39",
|
||||||
|
"17.28.34",
|
||||||
|
"17.29.34",
|
||||||
|
"17.32.35"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "client-spoof",
|
||||||
|
"description": "Spoofs the YouTube or Vanced client to prevent playback issues.",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"excluded": false,
|
||||||
|
"dependencies": [],
|
||||||
|
"compatiblePackages": [
|
||||||
|
{
|
||||||
|
"name": "com.google.android.youtube",
|
||||||
|
"versions": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.vanced.android.youtube",
|
||||||
|
"versions": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
@@ -84,6 +84,7 @@ Official patches by ReVanced
|
|||||||
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.32.35 |
|
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.32.35 |
|
||||||
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.32.35 |
|
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.32.35 |
|
||||||
| `minimized-playback` | Enables minimized and background playback. | 17.32.35 |
|
| `minimized-playback` | Enables minimized and background playback. | 17.32.35 |
|
||||||
|
| `client-spoof` | Spoofs the YouTube or Vanced client to prevent playback issues. | all |
|
||||||
| `custom-video-buffer` | Lets you change the buffers of videos. | 17.32.35 |
|
| `custom-video-buffer` | Lets you change the buffers of videos. | 17.32.35 |
|
||||||
| `always-autorepeat` | Always repeats the playing video again. | 17.32.35 |
|
| `always-autorepeat` | Always repeats the playing video again. | 17.32.35 |
|
||||||
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 17.32.35 |
|
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 17.32.35 |
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ dependencies {
|
|||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:3.3.3")
|
implementation("app.revanced:revanced-patcher:3.3.3")
|
||||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
|
|
||||||
|
// Required for meta
|
||||||
|
implementation("com.google.code.gson:gson:2.9.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
@@ -48,12 +51,12 @@ tasks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
register<JavaExec>("generateReadme") {
|
register<JavaExec>("generateMeta") {
|
||||||
description = "Generate README.md"
|
description = "Generate metadata for this bundle"
|
||||||
dependsOn(build)
|
dependsOn(build)
|
||||||
|
|
||||||
classpath = sourceSets["main"].runtimeClasspath
|
classpath = sourceSets["main"].runtimeClasspath
|
||||||
mainClass.set("app.revanced.meta.readme.Generator")
|
mainClass.set("app.revanced.meta.Meta")
|
||||||
}
|
}
|
||||||
// Dummy task to fix the Gradle semantic-release plugin.
|
// Dummy task to fix the Gradle semantic-release plugin.
|
||||||
// Remove this if you forked it to support building only.
|
// Remove this if you forked it to support building only.
|
||||||
@@ -61,6 +64,6 @@ tasks {
|
|||||||
register<DefaultTask>("publish") {
|
register<DefaultTask>("publish") {
|
||||||
group = "publish"
|
group = "publish"
|
||||||
description = "Dummy task"
|
description = "Dummy task"
|
||||||
dependsOn(named("generateBundle"), named("generateReadme"))
|
dependsOn(named("generateBundle"), named("generateMeta"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.43.0
|
version = 2.45.0
|
||||||
|
|||||||
27
src/main/kotlin/app/revanced/meta/Meta.kt
Normal file
27
src/main/kotlin/app/revanced/meta/Meta.kt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package app.revanced.meta
|
||||||
|
|
||||||
|
import app.revanced.meta.json.generateJson
|
||||||
|
import app.revanced.meta.readme.generateText
|
||||||
|
import app.revanced.patcher.data.Data
|
||||||
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import app.revanced.patcher.util.patch.impl.JarPatchBundle
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
typealias Bundle = List<Class<out Patch<Data>>>
|
||||||
|
|
||||||
|
object Meta {
|
||||||
|
@JvmStatic
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val patches = accumulatePatches()
|
||||||
|
if (patches.isEmpty()) throw IllegalStateException("No patches found")
|
||||||
|
|
||||||
|
generateText(patches)
|
||||||
|
generateJson(patches)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun accumulatePatches() = JarPatchBundle(
|
||||||
|
File("build/libs/").listFiles()!!.first {
|
||||||
|
it.name.startsWith("revanced-patches-") && it.name.endsWith(".jar")
|
||||||
|
}.absolutePath
|
||||||
|
).loadPatches()
|
||||||
33
src/main/kotlin/app/revanced/meta/json/Generator.kt
Normal file
33
src/main/kotlin/app/revanced/meta/json/Generator.kt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package app.revanced.meta.json
|
||||||
|
|
||||||
|
import app.revanced.meta.Bundle
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.dependencies
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.include
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.version
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
private val gson = Gson()
|
||||||
|
|
||||||
|
fun generateJson(bundle: Bundle) {
|
||||||
|
val patches = bundle.map {
|
||||||
|
JsonPatch(
|
||||||
|
it.patchName,
|
||||||
|
it.description ?: "This patch has no description.",
|
||||||
|
it.version ?: "0.0.0",
|
||||||
|
!it.include,
|
||||||
|
it.dependencies?.map { dep ->
|
||||||
|
dep.java.patchName
|
||||||
|
}?.toTypedArray() ?: emptyArray(),
|
||||||
|
it.compatiblePackages?.map { pkg ->
|
||||||
|
CompatiblePackage(pkg.name, pkg.versions)
|
||||||
|
}?.toTypedArray() ?: emptyArray()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
val json = File("patches.json")
|
||||||
|
json.writeText(gson.toJson(patches))
|
||||||
|
}
|
||||||
17
src/main/kotlin/app/revanced/meta/json/JsonPatch.kt
Normal file
17
src/main/kotlin/app/revanced/meta/json/JsonPatch.kt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@file:Suppress("ArrayInDataClass") // We don't need it here.
|
||||||
|
|
||||||
|
package app.revanced.meta.json
|
||||||
|
|
||||||
|
data class JsonPatch(
|
||||||
|
val name: String,
|
||||||
|
val description: String,
|
||||||
|
val version: String,
|
||||||
|
val excluded: Boolean,
|
||||||
|
val dependencies: Array<String>,
|
||||||
|
val compatiblePackages: Array<CompatiblePackage>,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class CompatiblePackage(
|
||||||
|
val name: String,
|
||||||
|
val versions: Array<String>,
|
||||||
|
)
|
||||||
@@ -4,8 +4,7 @@ import app.revanced.patcher.data.Data
|
|||||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
|
||||||
internal fun Class<out Patch<Data>>.getLatestVersion(): SemanticVersion? =
|
internal fun Class<out Patch<Data>>.getLatestVersion() =
|
||||||
this.compatiblePackages?.first()?.versions?.map { SemanticVersion.fromString(it) }
|
this.compatiblePackages?.first()?.versions?.map {
|
||||||
?.maxWithOrNull(
|
SemanticVersion.fromString(it)
|
||||||
SemanticVersionComparator
|
}?.maxWithOrNull(SemanticVersionComparator)
|
||||||
)
|
|
||||||
|
|||||||
@@ -1,55 +1,44 @@
|
|||||||
package app.revanced.meta.readme
|
package app.revanced.meta.readme
|
||||||
|
|
||||||
|
import app.revanced.meta.Bundle
|
||||||
import app.revanced.patcher.data.Data
|
import app.revanced.patcher.data.Data
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
import app.revanced.patcher.util.patch.impl.JarPatchBundle
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object Generator {
|
private const val TABLE_HEADER =
|
||||||
private const val TABLE_HEADER =
|
"| \uD83D\uDC8A Patch | \uD83D\uDCDC Description | \uD83C\uDFF9 Target Version |\n" + "|:--------:|:--------------:|:-----------------:|"
|
||||||
"| \uD83D\uDC8A Patch | \uD83D\uDCDC Description | \uD83C\uDFF9 Target Version |\n" +
|
|
||||||
"|:--------:|:--------------:|:-----------------:|"
|
|
||||||
|
|
||||||
@JvmStatic
|
private val TABLE_REGEX = Regex("\\{\\{\\s?table\\s?}}")
|
||||||
fun main(args: Array<String>) {
|
|
||||||
val buildDir = File("build/libs/")
|
|
||||||
val buildJar =
|
|
||||||
buildDir.listFiles()?.first { it.name.startsWith("revanced-patches-") && it.name.endsWith(".jar") }!!
|
|
||||||
|
|
||||||
val bundle = JarPatchBundle(buildJar.absolutePath).loadPatches()
|
fun generateText(bundle: Bundle) {
|
||||||
|
val output = StringBuilder()
|
||||||
|
val packages = mutableMapOf<String, MutableList<Class<out Patch<Data>>>>()
|
||||||
|
|
||||||
val output = StringBuilder()
|
bundle.map {
|
||||||
|
val packageName = it.compatiblePackages?.first()?.name!!
|
||||||
val packages = mutableMapOf<String, MutableList<Class<out Patch<Data>>>>()
|
if (!packages.contains(packageName)) {
|
||||||
|
packages[packageName] = mutableListOf()
|
||||||
bundle.map {
|
|
||||||
val packageName = it.compatiblePackages?.first()?.name!!
|
|
||||||
if (!packages.contains(packageName)) {
|
|
||||||
packages[packageName] = mutableListOf()
|
|
||||||
}
|
|
||||||
|
|
||||||
packages[packageName]?.add(it)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pkg in packages) {
|
packages[packageName]?.add(it)
|
||||||
output.appendLine("### \uD83D\uDCE6 `${pkg.key}`")
|
|
||||||
output.appendLine("<details>\n")
|
|
||||||
|
|
||||||
output.appendLine(TABLE_HEADER)
|
|
||||||
pkg.value.forEach { output.appendLine("| `${it.patchName}` | ${it.description} | ${it.getLatestVersion() ?: "all"} |") }
|
|
||||||
|
|
||||||
output.appendLine("</details>\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
val readMeTemplateFile = File("README-template.md")
|
|
||||||
val readmeTemplate = Template(readMeTemplateFile.readText())
|
|
||||||
|
|
||||||
readmeTemplate.replaceVariable("table", output.toString())
|
|
||||||
|
|
||||||
val readme = File("README.md")
|
|
||||||
readme.writeText(readmeTemplate.toString())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (pkg in packages) {
|
||||||
|
output.appendLine("### \uD83D\uDCE6 `${pkg.key}`")
|
||||||
|
output.appendLine("<details>\n")
|
||||||
|
|
||||||
|
output.appendLine(TABLE_HEADER)
|
||||||
|
pkg.value.forEach { output.appendLine("| `${it.patchName}` | ${it.description} | ${it.getLatestVersion() ?: "all"} |") }
|
||||||
|
|
||||||
|
output.appendLine("</details>\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
val readmeTemplate = Template(File("README-template.md").readText())
|
||||||
|
readmeTemplate.replaceVariable(TABLE_REGEX, output.toString())
|
||||||
|
|
||||||
|
val readme = File("README.md")
|
||||||
|
readme.writeText(readmeTemplate.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ package app.revanced.meta.readme
|
|||||||
data class SemanticVersion(val major: Int, val minor: Int, val patch: Int) {
|
data class SemanticVersion(val major: Int, val minor: Int, val patch: Int) {
|
||||||
companion object {
|
companion object {
|
||||||
fun fromString(version: String): SemanticVersion {
|
fun fromString(version: String): SemanticVersion {
|
||||||
var parts = version.split(".")
|
val parts = version.split(".")
|
||||||
|
|
||||||
if (parts.count() != 3) throw IllegalArgumentException("Invalid semantic version")
|
if (parts.count() != 3) throw IllegalArgumentException("Invalid semantic version")
|
||||||
|
|
||||||
val versionNumbers = parts.map { it.toInt() }
|
val versionNumbers = parts.map { it.toInt() }
|
||||||
return SemanticVersion(versionNumbers[0], versionNumbers[1], versionNumbers[2])
|
return SemanticVersion(versionNumbers[0], versionNumbers[1], versionNumbers[2])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package app.revanced.meta.readme
|
package app.revanced.meta.readme
|
||||||
|
|
||||||
class Template(template: String) {
|
class Template(template: String) {
|
||||||
val result: StringBuilder = StringBuilder(template)
|
val result = StringBuilder(template)
|
||||||
|
|
||||||
fun replaceVariable(name: String, value: String) {
|
fun replaceVariable(regex: Regex, value: String) {
|
||||||
val regex = Regex("\\{\\{\\s?$name\\s?}}")
|
|
||||||
val range = regex.find(result)!!.range
|
val range = regex.find(result)!!.range
|
||||||
|
|
||||||
result.replace(range.first, range.last + 1, value)
|
result.replace(range.first, range.last + 1, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import app.revanced.patcher.annotation.Package
|
|||||||
@Compatibility(
|
@Compatibility(
|
||||||
[
|
[
|
||||||
Package("com.google.android.youtube", arrayOf()),
|
Package("com.google.android.youtube", arrayOf()),
|
||||||
Package("com.vanced.android", arrayOf())
|
Package("com.vanced.android.youtube", arrayOf())
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class ClientSpoofCompatibility
|
internal annotation class ClientSpoofCompatibility
|
||||||
|
|||||||
@@ -4,20 +4,20 @@ import app.revanced.patcher.annotation.Description
|
|||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.impl.BytecodeData
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.clientspoof.annotations.ClientSpoofCompatibility
|
import app.revanced.patches.youtube.misc.clientspoof.annotations.ClientSpoofCompatibility
|
||||||
import app.revanced.patches.youtube.misc.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint
|
import app.revanced.patches.youtube.misc.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
@Name("client-spoof")
|
@Name("client-spoof")
|
||||||
@Description("Spoofs the YouTube or Vanced client to prevent playback issues.")
|
@Description("Spoofs the YouTube or Vanced client to prevent playback issues.")
|
||||||
@DependsOn([IntegrationsPatch::class])
|
|
||||||
@ClientSpoofCompatibility
|
@ClientSpoofCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ClientSpoofPatch : BytecodePatch(
|
class ClientSpoofPatch : BytecodePatch(
|
||||||
@@ -31,7 +31,7 @@ class ClientSpoofPatch : BytecodePatch(
|
|||||||
val packageNameRegister = (method.instruction(insertIndex) as FiveRegisterInstruction).registerD
|
val packageNameRegister = (method.instruction(insertIndex) as FiveRegisterInstruction).registerD
|
||||||
|
|
||||||
val originalPackageName = "com.google.android.youtube"
|
val originalPackageName = "com.google.android.youtube"
|
||||||
method.addInstructions(insertIndex, "const-string v$packageNameRegister, \"$originalPackageName\"")
|
method.addInstruction(insertIndex, "const-string v$packageNameRegister, \"$originalPackageName\"")
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,18 +6,34 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.data.impl.ResourceData
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.enabledebugging.annotations.EnableDebuggingCompatibility
|
import app.revanced.patches.youtube.misc.enabledebugging.annotations.EnableDebuggingCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
@Patch(false)
|
@Patch(false)
|
||||||
@Name("enable-debugging")
|
@Name("enable-debugging")
|
||||||
|
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||||
@Description("Enables app debugging by patching the manifest file.")
|
@Description("Enables app debugging by patching the manifest file.")
|
||||||
@EnableDebuggingCompatibility
|
@EnableDebuggingCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class EnableDebuggingPatch : ResourcePatch() {
|
class EnableDebuggingPatch : ResourcePatch() {
|
||||||
override fun execute(data: ResourceData): PatchResult {
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.MISC.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_debug_enabled",
|
||||||
|
StringResource("revanced_debug_title", "Debug"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_debug_on", "Debug logs are enabled"),
|
||||||
|
StringResource("revanced_debug_off", "Debug logs are disabled")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
// create an xml editor instance
|
// create an xml editor instance
|
||||||
data.xmlEditor["AndroidManifest.xml"].use { dom ->
|
data.xmlEditor["AndroidManifest.xml"].use { dom ->
|
||||||
// get the application node
|
// get the application node
|
||||||
|
|||||||
Reference in New Issue
Block a user