chore: remove unfinished /docs

This commit is contained in:
Ushie 2023-08-01 02:17:16 +03:00
parent ba67b0da2d
commit 8b67bbb7b8
No known key found for this signature in database
GPG Key ID: B3AAD18842E34632
18 changed files with 3 additions and 848 deletions

View File

@ -1,7 +1,6 @@
.DS_Store
node_modules
/build
/testing-docs
/public
/.svelte-kit
/package

View File

@ -2,12 +2,6 @@
The official ReVanced Website.
## Documentation
The documentation you see on the live website is generated from a collection of markup files found in [this git repository](https://github.com/revanced/revanced-documentation). The documentation "generator" currently supports asciidoc and markdown.
It looks for markup files in the `testing-docs` folder by default, but you can specify a different path by changing the `REVANCED_DOCS_FOLDER` environment variable.
## Developing
Install dependencies with `npm install` (or `pnpm install`).

View File

@ -1,20 +0,0 @@
#!/bin/bash
set -e
# CD to the directory of this script.
cd "$(dirname "$0")"
docs_git_repo="${REVANCED_DOCS_REPO:-https://github.com/revanced/revanced-documentation.git}"
git clone "$docs_git_repo" "_docs_src"
# TODO: transform a tag links so this works properly...
#export REVANCED_DOCS_FOLDER="_docs_src/docs"
#git clone --recurse-submodules "$docs_git_repo" "_docs_src"
# Copy assets from docs repo to here.
# mkdir -p static/docs
# cp -r "$REVANCED_DOCS_FOLDER"/assets static/docs/assets || true
npm run build

3
pnpm-lock.yaml generated
View File

@ -61,6 +61,9 @@ devDependencies:
sass:
specifier: ^1.55.0
version: 1.64.1
semver:
specifier: ^7.5.4
version: 7.5.4
sirv-cli:
specifier: ^2.0.2
version: 2.0.2

View File

@ -1,10 +0,0 @@
import type { LayoutServerLoad } from './$types';
import { index_content } from './documentation.server';
// The load function here used to get data from a json file created by a (prerendered) server route.
// This was because we could not prerender the documentation route before.
// If you can no longer prerender the docs, then you are going to have to move the load functions here to a prerendered server route like before and fetch them here.
export const prerender = true;
export const load: LayoutServerLoad = () => ({ tree: index_content() });

View File

@ -1,37 +0,0 @@
<script lang="ts">
import type { LayoutData } from './$types';
import DocsNavTree from './DocsNavTree.svelte';
import Footer from '$layout/Footer/FooterHost.svelte';
export let data: LayoutData;
</script>
<section id="doc-section-main">
<div class="menu">
<DocsNavTree tree={data.tree} />
</div>
<slot />
</section>
<Footer />
<style lang="scss">
#doc-section-main {
margin-inline: auto;
width: min(90%, 90rem);
margin-top: 8rem;
margin-bottom: 5rem;
}
.menu {
display: flex;
flex-direction: column;
gap: 1rem;
}
#doc-section-main {
display: grid;
grid-template-columns: 320px 3fr;
gap: 3rem;
}
</style>

View File

@ -1,56 +0,0 @@
<script lang="ts">
import type { DocumentInfo } from './documentation.shared';
export let info: DocumentInfo;
import { page } from '$app/stores';
</script>
<!-- Always part of a list -->
<li>
<a href="/docs/{info.slug}">
<div class="doc-section item" class:selected={$page.url.pathname === `/docs/${info.slug}`}>
<h5>{info.title}</h5>
</div>
</a>
</li>
<style>
a {
text-decoration: none;
}
li {
list-style: none;
}
.item {
padding: 0.6rem 1rem;
border-radius: 8px;
cursor: pointer;
display: flex;
align-items: center;
gap: 0.6rem;
width: 100%;
user-select: none;
transition: background-color 0.4s var(--bezier-one);
}
.item h5 {
color: var(--grey-five);
transition: color 0.3s var(--bezier-one);
}
.selected h5 {
color: var(--grey-four);
transition: color 0.3s var(--bezier-one);
}
.selected {
background-color: var(--accent-color);
}
.item:hover:not(.selected) {
background-color: var(--grey-six);
}
.item:not(.selected):hover h5 {
color: var(--white);
}
</style>

View File

@ -1,37 +0,0 @@
<script lang="ts">
import { is_tree, assert_is_info_node } from './documentation.shared';
import type { DocsTree } from './documentation.shared';
import DocsNavNode from './DocsNavNode.svelte';
export let tree: DocsTree;
// How deeply nested this is.
export let nested = 0;
</script>
{#if nested}
<!-- The index should be part of the `ul` above us. -->
<DocsNavNode info={tree.index} />
{/if}
<ul>
{#if !nested}
<!-- There is no `ul` above us, so index should go here instead. -->
<DocsNavNode info={tree.index} />
{/if}
{#each tree.nodes as node}
{#if is_tree(node)}
<!-- Recursion here is fine. We are not dealing with a tree the size of a linux root file system. -->
<svelte:self tree={node} nested={nested + 1} />
{:else}
<DocsNavNode info={assert_is_info_node(node)} />
{/if}
{/each}
</ul>
<style>
ul {
padding-left: 1rem;
}
</style>

View File

@ -1,17 +0,0 @@
import type { PageServerLoad } from './$types';
import { error } from '@sveltejs/kit';
import { get } from '../documentation.server';
// See also: ../+layout.server.ts
export const prerender = true;
export const load: PageServerLoad = ({ params }) => {
const document = get(params.slug);
if (document === null) {
error;
throw error(404);
}
return document;
};

View File

@ -1,17 +0,0 @@
<script lang="ts">
import Meta from '$lib/components/Meta.svelte';
import type { PageData } from './$types';
import '../documentation.scss';
// Data here comes from a trusted source.
// CSS comes from the layout.
export let data: PageData;
</script>
<Meta title="Docs" />
<div id="markup-content">
<h1 class="title">{data.title}</h1>
{@html data.content}
</div>

View File

@ -1,95 +0,0 @@
#markup-content {
/* Defaults for text */
color: var(--accent-color-two);
font-weight: 300;
font-size: 1rem;
line-height: 1.75rem;
letter-spacing: 0.03rem !important;
a {
text-decoration: none;
color: var(--accent-color);
border-bottom: 1.5px solid var(--accent-low-opacity);
padding: 0px ;
}
code {
background-color: var(--grey-one);
border-radius: 8px;
padding: 0.2rem 0.5rem;
font-size: 0.8rem;
font-family: var(--mono-font);
font-weight: 300;
flex-wrap: wrap;
line-height: 1.25rem;
}
pre code {
font-size: 0.75rem;
background-color: var(--grey-six);
white-space: pre;
display: block;
flex-wrap: wrap;
padding: 0.5rem 1rem;
margin: 1rem 0;
}
h5 {
margin-bottom: 0.5rem;
}
h5 {
color: var(--accent-color);
}
h1, h2, h3, h4, h5 {
margin-bottom: 1rem;
}
h1 {
font-size: 2.25rem;
font-weight: 600;
letter-spacing: -0.02rem;
color: var(--accent-color-two);
border-bottom: 1px solid var(--grey-three);
padding-bottom: 1rem;
margin-bottom: 1rem;
}
h2 {
font-size: 1.5rem;
letter-spacing: -0.02rem;
font-weight: 600;
color: var(--accent-color-two);
border-bottom: 1px solid var(--grey-three);
padding-bottom: 1rem;
margin-top: 2rem;
}
h3 {
margin-top: 1rem;
margin-bottom: 0.5rem;
}
li {
margin-left: 1rem;
margin-bottom: 0.5rem;
}
/* Markup processors output this for bold text, but css spec is goofy aah */
strong {
font-weight: bold;
letter-spacing: 0.01rem;
}
ul {
padding-left: 2rem;
}
}

View File

@ -1,207 +0,0 @@
import { is_tree } from './documentation.shared';
import type { Document, DocsTree, DocsTreeNode, DocumentInfo } from './documentation.shared';
import { browser } from '$app/environment';
import fs, { existsSync as exists } from 'fs';
import path from 'path';
import { marked } from 'marked';
import AsciiDocProcessor from 'asciidoctor';
// This file does not work in a browser.
if (browser) {
throw Error('SvelteKit has skill issues');
}
/// Constants
const supported_formats: Map<string, (markup: string) => Document> = new Map();
supported_formats.set('md', (markup: string) => {
let lines = markup.split('\n');
// Get and remove the first line.
const first_line = lines.splice(0, 1)[0];
// Remove `# `.
const title = first_line.substring(2);
// Convert the rest to html
const content = marked(lines.join('\n'));
return { title, content };
});
const asciidoctor = AsciiDocProcessor();
const adoc_fn = (markup: string) => {
// Get first line.
const first_line = markup.split('\n')[0];
// Remove `= `.
const title = first_line.substring(2);
// Convert it to html. Unlike markdown, we do not need to remove the first title heading.
// NOTE: Maybe consider change the safe mode value.
const content = asciidoctor.convert(markup, { doctype: 'book' }) as string;
return { title, content };
};
supported_formats.set('adoc', adoc_fn);
supported_formats.set('asciidoc', adoc_fn);
const supported_filetypes = [...supported_formats.keys()];
let docs_folder = process.env.REVANCED_DOCS_FOLDER ?? 'testing-docs';
const ignored_items = ['assets'];
/// Utility functions
function is_directory(item: string) {
return fs.lstatSync(item).isDirectory();
}
function get_ext(fname: string) {
// Get extname and remove the first dot.
return path.extname(fname).substring(1);
}
function get_slug_of_node(node: DocsTreeNode): string {
if (is_tree(node)) {
return (node as DocsTree).index.slug;
}
return (node as DocumentInfo).slug;
}
/// Important functions
// Get a document. Returns null if it does not exist.
export function get(slug: string): Document | null {
let target = path.join(docs_folder, slug);
// Handle index (readme) file for folder.
if (exists(target) && is_directory(target)) {
target += '/README';
}
const dir = path.dirname(target);
if (!exists(dir)) {
return null;
}
let full_path: string,
ext: string,
found = false;
// We are looking for the file `${target}.(any_supported_extension)`. Try to find it.
for (const item of fs.readdirSync(dir)) {
full_path = path.join(dir, item);
// Get file extension
ext = get_ext(item);
// Unsupported/unrelated file.
if (!supported_formats.has(ext)) {
continue;
}
const desired_path = `${target}.${ext}`; // Don't grab some other random supported file.
if (!is_directory(full_path) && desired_path == full_path) {
// We found it.
found = true;
break;
}
}
if (!found) {
return null;
}
// Process the file and return.
return supported_formats.get(ext!!)!!(fs.readFileSync(full_path!!, 'utf-8'));
}
// Get file information
function process_file(fname: string): DocumentInfo {
// Remove docs folder prefix and file extension suffix, then split it.
const parts = fname
.substring(`${docs_folder}/`.length, fname.length - (get_ext(fname).length + 1))
.split('/');
// Remove `README` suffix if present.
const last_part_index = parts.length - 1;
if (parts[last_part_index] == 'README') {
parts.pop();
}
const slug = parts.join('/');
const title = get(slug)!!.title;
return { slug, title };
}
// Returns a document tree.
function process_folder(dir: string): DocsTree | null {
let tree: DocsTree = {
index: null as any,
nodes: []
};
// List everything in the directory.
const items = fs.readdirSync(dir);
for (const item of items) {
if (ignored_items.includes(item) || ['.', '_'].includes(item[0])) {
continue;
}
const itemPath = path.join(dir, item);
const is_dir = is_directory(itemPath);
let is_index_file = false;
if (!is_dir) {
// Ignore files we cannot process.
if (!supported_formats.has(get_ext(item))) {
continue;
}
for (const ext of supported_filetypes) {
if (item == `README.${ext}`) {
is_index_file = true;
}
}
}
const node = is_dir ? process_folder(itemPath) : process_file(itemPath);
if (node === null) {
console.error(`The ${itemPath} directory does not have a README/index file! ignoring...`);
continue;
}
if (is_index_file) {
tree.index = node as DocumentInfo;
} else {
tree.nodes.push(node);
}
}
if (tree.index === null) {
return null;
}
// `numeric: true` because we want to be able to specify
// the order if necessary by prepending a number to the file name.
tree.nodes.sort((a, b) =>
get_slug_of_node(a).localeCompare(get_slug_of_node(b), 'en', { numeric: true })
);
return tree;
}
// Returns the document tree.
export function index_content(): DocsTree {
const tree = process_folder(docs_folder);
if (tree === null) {
throw new Error('Root must have index (README) file.');
}
return tree;
}

View File

@ -1,35 +0,0 @@
/// Types
export interface Document {
title: string;
// HTML
content: string;
}
export interface DocumentInfo {
title: string;
slug: string;
}
// A tree representing the `docs` folder.
export interface DocsTree {
// index.whatever
index: DocumentInfo;
// Everything except index.whatever
nodes: DocsTreeNode[];
}
export type DocsTreeNode = DocsTree | DocumentInfo;
/// Functions
export function is_tree(node: DocsTreeNode) {
return Object.prototype.hasOwnProperty.call(node, 'nodes');
}
export function assert_is_info_node(v: DocsTreeNode) {
if (is_tree(v)) {
throw new Error('Value is not an info node.');
}
return v as DocumentInfo;
}

View File

@ -1,16 +0,0 @@
# Prerequisites
##### docs/prerequisites
<br />
#### Requirements
- ADB
- x86/x86\_64 host architecture
- Zulu JDK 17
- Latest Android SDK if you plan to build the integrations from the source
- The APK file you want to patch (e.g. YouTube v17.36.37 or YouTube Music v5.23.50). If you want to mount patched applications as root, make sure the same version is installed on your device.
<br />
You can continue by either [building everything from source](https://github.com/revanced/revanced-documentation/wiki/Building-from-source) or [downloading the prebuilt packages](https://github.com/revanced/revanced-documentation/wiki/Downloading-prebuilt-packages).

View File

@ -1,19 +0,0 @@
# 🧩 Patching applications
1. Tap the `Patcher` button in the bottom navigation bar.
2. Tap the `Select an application` card.
3. Here, you have the option to choose between selecting an app from on-device or selecting an APK file directly from storage.
* For selecting on-device applications, tap on the desired app from the shown menu. For an app to show up in this list, the app must be already installed on the device.
> **Warning**: This feature is incomplete for non-root users as ReVanced has yet to add split APK support. We suggest you pick your APK from storage for now.
* To select from storage, click on the `Storage` button and select the APK normally through the file picker.
> **Note**: We recommend downloading APK files from [APKMirror](https://www.apkmirror.com/) as a temporary solution as `.apkm` and `.apks` files are not supported at the moment.
* Verify that the selected application is a version supported by ReVanced. [See the list of supported versions for apps here.](https://github.com/revanced/revanced-patches#-patches)
4. After selecting an application, you will be brought back to the `Patcher` screen again. Tap the `Select patches` card.
5. Select your desired patches. Note that certain patches are required for non-root installations. (e.g. *MicroG Support* patch for YouTube)
6. Tap the `Done` button.
7. After selecting your patches, you will be brought back to the `Patcher` screen again. Tap the `Patch` button.
8. The app is now patching. This process can range from 2-10 minutes depending on your device. Refrain from closing the Manager.
9. When patching is complete, tap on the `Install` button. You may also tap on the three vertical dots in the top right to share logs or the patched APK.
> **Warning**: If you close the Manager after patching, the patched APK file will be **automatically deleted from your device**!
## ⏭️ Whats next
The next section will guide you through managing your installed patched applications.

View File

@ -1,16 +0,0 @@
# Prerequisites
##### docs/prerequisites
<br />
#### Requirements
- ADB
- x86/x86\_64 host architecture
- Zulu JDK 17
- Latest Android SDK if you plan to build the integrations from the source
- The APK file you want to patch (e.g. YouTube v17.36.37 or YouTube Music v5.23.50). If you want to mount patched applications as root, make sure the same version is installed on your device.
<br />
You can continue by either [building everything from source](https://github.com/revanced/revanced-documentation/wiki/Building-from-source) or [downloading the prebuilt packages](https://github.com/revanced/revanced-documentation/wiki/Downloading-prebuilt-packages).

View File

@ -1,243 +0,0 @@
# 🔎 Fingerprinting
Fingerprinting is the process of creating uniquely identifyable data about something arbitrarily large. In the context of ReVanced, fingerprinting is essential to be able to find classes, methods and fields without knowing their original names or certain other attributes, which would be used to identify them under normal circumstances.
## ⛳️ Example fingerprint
This page works with the following fingerprint as an example:
```kt
package app.revanced.patches.ads.fingerprints
// Imports
object LoadAdsFingerprint : MethodFingerprint(
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("Z"),
opcodes = listOf(Opcode.RETURN),
strings = listOf("pro"),
customFingerprint = { it.definingClass == "Lcom/some/app/ads/Loader;"}
)
```
## 🆗 Understanding the example fingerprint
The example fingerprint called `LoadAdsFingerprint` which extends on [`MethodFingerprint`](https://github.com/revanced/revanced-patcher/blob/main/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt#L28) is made to uniquely identify a certain method by capturing various attributes of the method such as the return type, access flags, an opcode pattern and more. The following code can be inferred just from the fingerprint:
```kt
package com.some.app.ads
// Imports
4 <attributes> class Loader {
5 public final Boolean <methodName>(<field>: Boolean) {
// ...
8 val userStatus = "pro";
// ...
12 return <returnValue>
}
}
```
## 🚀 How it works
Each attribute of the fingerprint is responsible to describe a specific but distinct part of the method. The combination out of those should be and ideally remain unique to all methods in all classes. In the case of the example fingerprint, the `customFingerprint` attribute is responsible to find the class the method is defined in. This greatly increases the uniqueness of the fingerprint, because now the possible methods reduce down to that class. Adding the signature of the method and a string the method implementation refers to in combination now creates a unique fingerprint in the current example:
- Package & class (Line 4)
```kt
customFingerprint = { it.definingClass == "Lcom/some/app/ads/Loader;"}
```
- Method signature (Line 5)
```kt
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("Z"),
```
- Method implementation (Line 8 & 12)
```kt
strings = listOf("pro"),
opcodes = listOf(Opcode.RETURN)
```
## 🔨 How to use fingerprints
After creating a fingerprint, add it to the constructor of the `BytecodePatch`:
```kt
class DisableAdsPatch : BytecodePatch(
listOf(LoadAdsFingerprint)
) { /* .. */ }
```
The ReVanced patcher will try to [resolve the fingerprint](https://github.com/revanced/revanced-patcher/blob/main/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt#L63) **before** it calls the `execute` method of the patch.
The fingerprint can now be used in the patch by accessing [`MethodFingerprint.result`](https://github.com/revanced/revanced-patcher/blob/d2f91a8545567429d64a1bcad6ca1dab62ec95bf/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt#L227):
```kt
class DisableAdsPatch : BytecodePatch(
listOf(LoadAdsFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
val result = LoadAdsFingerprint.result
?: return PatchResultError("LoadAdsFingerprint not found")
// ...
}
}
```
> **Note**: `MethodFingerprint.result` **can be null** if the fingerprint does not match any method. In such case, the fingerprint needs to be fixed and made more resilient if the error is caused by a later version of an app which the fingerprint was not tested on. A fingerprint is good, if it is _light_, but still resilient - like Carbon fiber-reinforced polymers.
If the fingerprint resolved to a method, the following properties are now available:
```kt
data class MethodFingerprintResult(
val method: Method,
val classDef: ClassDef,
val scanResult: MethodFingerprintScanResult,
// ...
) {
val mutableClass
val mutableMethod
// ...
}
```
> Details on how to use them in a patch and what exactly these are will be introduced properly later on this page.
## 🏹 Different ways to resolve a fingerprint
Usually, fingerprints are mostly resolved by the patcher, but it is also possible to manually resolve a fingerprint in a patch. This can be quite useful in lots of situations. To resolve a fingerprint you need a context to resolve it on. The context contains classes and thus methods to which the fingerprint can be resolved against. Example: _You have a fingerprint which you manually want to resolve **without** the help of the patcher._
> **Note**: A fingerprint should not be added to the constructor of `BytecodePatch` if manual resolution is intended, because the patcher would try resolve it before manual resolution.
- On a **list of classes** using [`MethodFingerprint.resolve`](https://github.com/revanced/revanced-patcher/blob/main/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt#L49)
This can be useful, if a fingerprint should be resolved to a smaller subset of classes, otherwise the fingerprint can be resolved by the patcher automatically.
```kt
class DisableAdsPatch : BytecodePatch(
/* listOf(LoadAdsFingerprint) */
) {
override fun execute(context: BytecodeContext): PatchResult {
val result = LoadAdsFingerprint.also { it.resolve(context, context.classes) }.result
?: return PatchResultError("LoadAdsFingerprint not found")
// ...
}
}
```
- On a **single class** using [`MethodFingerprint.resolve`](https://github.com/revanced/revanced-patcher/blob/main/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt#L63)
Sometimes you know a class but you need certain methods. In such case, you can resolve fingerprints on a class.
```kt
class DisableAdsPatch : BytecodePatch(
listOf(LoadAdsFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
val adsLoaderClass = context.classes.single { it.name == "Lcom/some/app/ads/Loader;" }
val result = LoadAdsFingerprint.also { it.resolve(context, adsLoaderClass) }.result
?: return PatchResultError("LoadAdsFingerprint not found")
// ...
}
}
```
- On a **method** using [`MethodFingerprint.resolve`](https://github.com/revanced/revanced-patcher/blob/main/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt#L78)
Resolving a fingerprint on a method is mostly only useful if the fingerprint is used to resolve certain information about a method such as `MethodFingerprintResult.scanResult`. Example: _A fingerprint should be used to resolve the method which loads ads. For that the fingerprint is added to the constructor of `BytecodePatch`. An additional fingerprint is responsible for finding the indices of the instructions with certain string references in the implementation of the method the first fingerprint resolved to._
```kt
class DisableAdsPatch : BytecodePatch(
/* listOf(LoadAdsFingerprint) */
) {
override fun execute(context: BytecodeContext): PatchResult {
// Make sure this fingerprint succeeds as the result is required
val adsFingerprintResult = LoadAdsFingerprint.result
?: return PatchResultError("LoadAdsFingerprint not found")
// Additional fingerprint to get the indices of two strings
val proStringsFingerprint = object : MethodFingerprint(
strings = listOf("free", "trial")
) {}
proStringsFingerprint.also {
// Resolve the fingerprint on the first fingerprints method
it.resolve(context, adsFingerprintResult.method)
}.result?.let { result ->
// Use the fingerprints result
result.scanResult.stringsScanResult!!.matches.forEach { match ->
println("The index of the string '${match.string}' is {match.index}")
}
} ?: return PatchResultError("pro strings fingerprint not found")
return PatchResultSuccess
}
}
```
## 🎯 The result of a fingerprint
After a `MethodFingerprint` resolves successfully, its result can be used. The result contains mutable and immutable references to the method and the class it is defined in.
> **Warning**: By default the immutable references **should be used** to prevent a mutable copy of the immutable references. For a patch to properly use a fingerprint though, usually write access is required. For that the mutable references can be used.
Among them, the result also contains [MethodFingerprintResult.scanResult](https://github.com/revanced/revanced-patcher/blob/main/src/main/kotlin/app/revanced/patcher/fingerprint/method/impl/MethodFingerprint.kt#L239) which contains additional useful properties:
```kt
data class MethodFingerprintScanResult(
val patternScanResult: PatternScanResult?,
val stringsScanResult: StringsScanResult?
) {
data class PatternScanResult(
val startIndex: Int,
val endIndex: Int,
var warnings: List<Warning>? = null
)
data class StringsScanResult(val matches: List<StringMatch>){
data class StringMatch(val string: String, val index: Int)
}
// ...
}
```
The following properties are utilized by bytecode patches:
- The `MethodFingerprint.strings` allows patches to know the indices of the instructions which hold references to the strings.
- If a fingerprint defines `MethodFingerprint.opcodes`, the start and end index of the first instructions matching that pattern will be available. These are useful to patch the implementation of methods relative to the pattern. Ideally the pattern contains the instructions opcodes pattern which is to be patched, in order to guarantee a successfull patch.
> **Note**: Sometimes long patterns might be necessary, but the bigger the pattern list, the higher the chance it mutates if the app updates. For that reason the annotation `FuzzyPatternScanMethod` can be used on a fingerprint. The `FuzzyPatternScanMethod.threshold` will define, how many opcodes can remain unmatched. `PatternScanResult.warnings` can then be used if necessary, if it is necessary to know where pattern missmatches occured.
## ⭐ Closely related code examples
### 🧩 Patches
- [CommentsPatch](https://github.com/revanced/revanced-patches/blob/main/src/main/kotlin/app/revanced/patches/youtube/layout/comments/bytecode/patch/CommentsPatch.kt)
- [MusicVideoAdsPatch](https://github.com/revanced/revanced-patches/blob/main/src/main/kotlin/app/revanced/patches/music/ad/video/patch/MusicVideoAdsPatch.kt)
### Fingerprints
- [LoadVideoAdsFingerprint](https://github.com/revanced/revanced-patches/blob/main/src/main/kotlin/app/revanced/patches/youtube/ad/video/fingerprints/LoadVideoAdsFingerprint.kt)
- [SeekbarTappingParentFingerprint](https://github.com/revanced/revanced-patches/blob/main/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/fingerprints/SeekbarTappingParentFingerprint.kt)
## ⏭️ Whats next
The next section will give a suggestion on coding conventions and on the file structure of a patch.

View File

@ -1,16 +0,0 @@
# Prerequisites
##### docs/prerequisites
<br />
#### Requirements
- ADB
- x86/x86\_64 host architecture
- Zulu JDK 17
- Latest Android SDK if you plan to build the integrations from the source
- The APK file you want to patch (e.g. YouTube v17.36.37 or YouTube Music v5.23.50). If you want to mount patched applications as root, make sure the same version is installed on your device.
<br />
You can continue by either [building everything from source](https://github.com/revanced/revanced-documentation/wiki/Building-from-source) or [downloading the prebuilt packages](https://github.com/revanced/revanced-documentation/wiki/Downloading-prebuilt-packages).