Compare commits

..

3 Commits

Author SHA1 Message Date
semantic-release-bot
7ea5d87fa2 chore(release): 2.12.1 [skip ci]
## [2.12.1](https://github.com/revanced/revanced-patches/compare/v2.12.0...v2.12.1) (2022-07-10)
2022-07-10 16:14:45 +00:00
TheJeterLP
471a3d3263 build: fix readme autogeneration not working 2022-07-10 18:12:52 +02:00
bogadana
b95fe30c78 docs: templated readme (#138) 2022-07-10 15:28:18 +02:00
8 changed files with 71 additions and 28 deletions

View File

@@ -33,7 +33,7 @@ jobs:
- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build clean
run: ./gradlew build clean generateReadme
- name: Install Android build-tools
run: sdkmanager "build-tools;32.0.0"
- name: Setup semantic-release

View File

@@ -1,3 +1,5 @@
## [2.12.1](https://github.com/revanced/revanced-patches/compare/v2.12.0...v2.12.1) (2022-07-10)
# [2.12.0](https://github.com/revanced/revanced-patches/compare/v2.11.0...v2.12.0) (2022-07-10)

8
README-template.md Normal file
View File

@@ -0,0 +1,8 @@
# ReVanced Patches
🧩 Official patches by ReVanced
# Patch list
| 💊 Patch | 📜 Description | 🎯 Target Package | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|:-----------------:|
{{ table }}

View File

@@ -1,2 +1,35 @@
# ReVanced Patches
🧩 Official patches by ReVanced
# Patch list
| 💊 Patch | 📜 Description | 🎯 Target Package | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|:-----------------:|
|Fenster Swipe Controls|Adds volume and brightness swipe controls.|`com.google.android.youtube`|17.26.35|
|Seekbar Tapping|Enables tapping on the seekbar of the YouTube player.|`com.google.android.youtube`|17.26.35|
|General Ads|Removes general ads in bytecode.|`com.google.android.youtube`|17.26.35|
|Video Ads|Removes ads in the YouTube video player.|`com.google.android.youtube`|17.26.35|
|Hide Infocard Suggestions|Hides infocards in videos.|`com.google.android.youtube`|17.26.35|
|Autorepeat By Default|Enables auto repeating of videos by default.|`com.google.android.youtube`|17.26.35|
|Custom Branding|Changes the branding of YouTube.|`com.google.android.youtube`|all|
|Premium Heading|Shows premium branding on the YouTube home screen.|`com.google.android.youtube`|all|
|Minimized Playback|Enables minimized and background playback.|`com.google.android.youtube`|17.26.35|
|Enable Wide Searchbar|Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.|`com.google.android.youtube`|17.26.35|
|Disable Fullscreen Panels|Disables comments panel in fullscreen view.|`com.google.android.youtube`|17.26.35|
|Old Quality Layout|Enables the original quality flyout menu.|`com.google.android.youtube`|17.26.35|
|Hide Autoplay Button|Disables the autoplay button.|`com.google.android.youtube`|17.26.35|
|Disable Create Button|Disables the create button.|`com.google.android.youtube`|17.26.35|
|Amoled|Enables pure black theme.|`com.google.android.youtube`|17.26.35|
|Hide Shorts Button|Hides the shorts button.|`com.google.android.youtube`|17.26.35|
|Hide Cast Button|Hides the cast button.|`com.google.android.youtube`|all|
|Hide Watermark|Hides the creator's watermark on videos.|`com.google.android.youtube`|17.26.35|
|Microg Support|Allows YouTube ReVanced to run without root and under a different package name.|`com.google.android.youtube`|17.26.35|
|Custom Playback Speed|Allows to change the default playback speed options.|`com.google.android.youtube`|17.26.35|
|Hdr Max Brightness|Sets brightness to max for HDR videos in fullscreen mode.|`com.google.android.youtube`|17.26.35|
|Enable Debugging|Enables app debugging by patching the manifest file.|`com.google.android.youtube`|all|
|Background Play|Enables playing music in the background.|`com.google.android.apps.youtube.music`|5.03.50|
|Exclusive Audio Playback|Adds the option to play music without video.|`com.google.android.apps.youtube.music`|5.03.50|
|Codecs Unlock|Enables more audio codecs. Usually results in better audio quality but may depend on song and device.|`com.google.android.apps.youtube.music`|5.03.50|
|Upgrade Button Remover|Removes the upgrade tab from the pivot bar in YouTube music.|`com.google.android.apps.youtube.music`|5.03.50|
|TasteBuilder Remover|Removes the "Tell us which artists you like" card from the Home screen. The same functionality can be triggered from the settings anyway.|`com.google.android.apps.youtube.music`|5.03.50|

View File

@@ -54,7 +54,7 @@ tasks {
dependsOn(build)
classpath = sourceSets["main"].runtimeClasspath
mainClass.set("app.revanced.patches.meta.ReadmeGenerator")
mainClass.set("app.revanced.patches.meta.readme.Generator")
}
// Dummy task to fix the Gradle semantic-release plugin.
// Remove this if you forked it to support building only.

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.12.0
version = 2.12.1

View File

@@ -1,4 +1,4 @@
package app.revanced.patches.meta
package app.revanced.patches.meta.readme
import java.io.File
import kotlin.io.writeText
@@ -8,36 +8,16 @@ import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.extensions.PatchExtensions.description
class ReadmeGenerator {
class Generator {
companion object {
@JvmStatic
fun main(args: Array<String>) {
//should be moved to a file?
val generalReadme =
"""
# ReVanced Patches
🧩 Official patches by ReVanced
# Patch list
""".trimIndent()
val tableHeader =
"""
| 💊 Patch | 📜 Description | 🎯 Target Package | 🏹 Target Version |
|:-----:|:-----------:|:--------------:|:----------------------:|
""".trimIndent()
val readmeFile = File("README.md")
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()
val builder = StringBuilder()
builder.appendLine(generalReadme)
builder.appendLine(tableHeader)
val table = StringBuilder()
for (patch in bundle) {
val humanName =
@@ -46,10 +26,16 @@ class ReadmeGenerator {
val compatiblePackage = patch.compatiblePackages?.first()
val latestVersion = compatiblePackage?.versions?.maxByOrNull { it.replace(".", "").toInt() } ?: "all"
builder.appendLine("|$humanName|${patch.description}|`${compatiblePackage?.name}`|$latestVersion|")
table.appendLine("|$humanName|${patch.description}|`${compatiblePackage?.name}`|$latestVersion|")
}
readmeFile.writeText(builder.toString())
val readMeTemplateFile = File("README-template.md")
val readMeTemplate = Template(readMeTemplateFile.readText())
readMeTemplate.replaceVariable("table", table.toString())
val readMeFile = File("README.md")
readMeFile.writeText(readMeTemplate.toString())
}
}
}

View File

@@ -0,0 +1,14 @@
package app.revanced.patches.meta.readme
class Template(val template: String) {
val result: StringBuilder = StringBuilder(template)
fun replaceVariable(name: String, value: String) {
val regex = Regex("\\{\\{\\s?$name\\s?\\}\\}")
val range = regex.find(result)!!.range
result.replace(range.start, range.endInclusive + 1, value)
}
override fun toString(): String = result.toString()
}