You've already forked revanced-cli
mirror of
https://github.com/revanced/revanced-cli
synced 2025-11-19 15:33:27 +01:00
Compare commits
147 Commits
v3.0.0-dev
...
v4.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86b8415ac6 | ||
|
|
8f4aebc60b | ||
|
|
bd3171c7c5 | ||
|
|
6481ba68db | ||
|
|
799882e6a6 | ||
|
|
616d14f009 | ||
|
|
b2055ce07d | ||
|
|
4fc42089a5 | ||
|
|
0139dfe0bf | ||
|
|
7d1c0e663f | ||
|
|
6cc6960493 | ||
|
|
9f15ac6ec5 | ||
|
|
6670d89c74 | ||
|
|
a60d07fc5d | ||
|
|
362e6f5904 | ||
|
|
51402ab8a7 | ||
|
|
a8c8682116 | ||
|
|
a86919eb71 | ||
|
|
8b04b6790b | ||
|
|
59dfc988e3 | ||
|
|
b01fef730a | ||
|
|
a564aaa1b5 | ||
|
|
f315485713 | ||
|
|
28648a1c53 | ||
|
|
daac98817f | ||
|
|
9328475e11 | ||
|
|
6507b5fe8a | ||
|
|
349ff5749a | ||
|
|
495735f44c | ||
|
|
f48da18e37 | ||
|
|
cf58f55b38 | ||
|
|
da4469f402 | ||
|
|
df2c137ae9 | ||
|
|
8a2f219f8b | ||
|
|
719d9fcfa3 | ||
|
|
6c44a730c3 | ||
|
|
ba573f73d0 | ||
|
|
e95a392016 | ||
|
|
fc62f7f475 | ||
|
|
ff2e10dbe6 | ||
|
|
7ff433860d | ||
|
|
7121e5fa4c | ||
|
|
23b5e8b7f9 | ||
|
|
d1c4d8df3e | ||
|
|
89acffe788 | ||
|
|
64d9127291 | ||
|
|
e3c55507cf | ||
|
|
64afc95a81 | ||
|
|
022fd230f6 | ||
|
|
a177693ece | ||
|
|
4b6dbffd7b | ||
|
|
78e89dd3bf | ||
|
|
a08530d47b | ||
|
|
eec2234226 | ||
|
|
d5ea5a0ab1 | ||
|
|
6fc3eebc21 | ||
|
|
c84041f942 | ||
|
|
995f2ec99b | ||
|
|
84b24f1b6f | ||
|
|
95a974a5ac | ||
|
|
ee6d883777 | ||
|
|
b65e4083d6 | ||
|
|
e46d855643 | ||
|
|
80a8d88406 | ||
|
|
50c0f98ce5 | ||
|
|
77d91735ff | ||
|
|
3846f721ca | ||
|
|
f199298317 | ||
|
|
592dc1c64a | ||
|
|
8da0c2bdfe | ||
|
|
e8e69aaf5a | ||
|
|
157278c9ba | ||
|
|
049a385473 | ||
|
|
e7c9da7c33 | ||
|
|
67bf8c1849 | ||
|
|
075f6ad565 | ||
|
|
6942b22a68 | ||
|
|
ac5742dd6c | ||
|
|
a022febd0c | ||
|
|
978032cce1 | ||
|
|
52c5259451 | ||
|
|
43fc20d90e | ||
|
|
e3851d58c8 | ||
|
|
3e13fb5d56 | ||
|
|
db50cee12c | ||
|
|
578e16b099 | ||
|
|
1319ab7629 | ||
|
|
2a08af3cb9 | ||
|
|
7794327a11 | ||
|
|
2b77608651 | ||
|
|
d09aca65df | ||
|
|
c8d4f56d61 | ||
|
|
c67e3c70c7 | ||
|
|
05878a6e06 | ||
|
|
29bc0e8df8 | ||
|
|
c4a89e39b9 | ||
|
|
847e384d9e | ||
|
|
96c196dcb1 | ||
|
|
dfd535c201 | ||
|
|
2b6051e7f3 | ||
|
|
0304988733 | ||
|
|
ca809f0948 | ||
|
|
5d50d1a622 | ||
|
|
83c28d9f71 | ||
|
|
93cbcc28aa | ||
|
|
3b3f7c7a7a | ||
|
|
bbb1a63abd | ||
|
|
f7fcbc55bb | ||
|
|
9fe5a0b6d9 | ||
|
|
4f2d2568d3 | ||
|
|
a3d8f004ec | ||
|
|
41ffc99ad0 | ||
|
|
1121376018 | ||
|
|
48e1689223 | ||
|
|
7580f5c2fc | ||
|
|
dd6c1392eb | ||
|
|
2a3dbafd17 | ||
|
|
9e39a6f8e4 | ||
|
|
2d5a7fdf1e | ||
|
|
be5d812dff | ||
|
|
c93186fb97 | ||
|
|
3a198052bb | ||
|
|
0f3e090418 | ||
|
|
6aed946183 | ||
|
|
924c1f80ec | ||
|
|
8dd709b6ef | ||
|
|
139e7facac | ||
|
|
1d26e572f7 | ||
|
|
2c7fcaf4ad | ||
|
|
52c3be23f2 | ||
|
|
3dd875d14c | ||
|
|
0350b7f1a2 | ||
|
|
a3d8705e89 | ||
|
|
a536c9f815 | ||
|
|
11c3a6cfd4 | ||
|
|
a5851f0c1a | ||
|
|
963ae3a5fa | ||
|
|
93f338a731 | ||
|
|
7dcf15e03b | ||
|
|
41898d7547 | ||
|
|
45dd15f679 | ||
|
|
c2da04a834 | ||
|
|
f556909b9e | ||
|
|
1fa3dd7b8c | ||
|
|
1fcc591222 | ||
|
|
1fd3b83d46 | ||
|
|
7ec9040d41 |
73
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
73
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
@@ -1,73 +0,0 @@
|
||||
name: 🐞 Bug report
|
||||
description: Report a very clearly broken issue.
|
||||
title: 'bug: <title>'
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# ReVanced bug report
|
||||
|
||||
Important to note that your issue may have already been reported before. Please check for existing issues [here](https://github.com/revanced/revanced-cli/labels/bug).
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Type
|
||||
options:
|
||||
- Error while running the CLI
|
||||
- Error at runtime
|
||||
- Cosmetic
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Bug description
|
||||
description: How did you find the bug? Any additional details that might help?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Add the steps to reproduce this bug including your environment.
|
||||
placeholder: Step 1. Download some files. Step 2. ...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Screenshots or videos
|
||||
description: Add screenshots or videos that show the bug here.
|
||||
placeholder: Drag and drop the screenshots/videos into this box.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Solution
|
||||
description: If applicable, add a possible solution.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add additional context here.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
description: Your issue will be closed if you haven't done these steps.
|
||||
options:
|
||||
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
|
||||
required: true
|
||||
- label: I have written a short but informative title.
|
||||
required: true
|
||||
- label: I filled out all of the requested information in this issue properly.
|
||||
required: true
|
||||
49
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
49
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
name: 🐞 Bug report
|
||||
description: Report a bug or an issue.
|
||||
title: 'bug: '
|
||||
labels: ['Bug report']
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# ReVanced CLI bug report
|
||||
|
||||
Please check for existing bug reports
|
||||
[here](https://github.com/ReVanced/revanced-cli/labels/Bug%20report)
|
||||
before creating a new one.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Bug description
|
||||
description: |
|
||||
- Describe your bug in detail
|
||||
- Add steps to reproduce the bug if possible (Step 1. ... Step 2. ...)
|
||||
- Add images and videos if possible
|
||||
- List used patches if applicable
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Error logs
|
||||
description: Exceptions can be captured by running `logcat | grep AndroidRuntime` in a shell.
|
||||
render: shell
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Solution
|
||||
description: If applicable, add a possible solution to the bug.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add additional context here.
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
description: Your issue will be closed if you don't follow the checklist below.
|
||||
options:
|
||||
- label: This request is not a duplicate of an existing issue.
|
||||
required: true
|
||||
- label: I have chosen an appropriate title.
|
||||
required: true
|
||||
- label: All requested information has been provided properly.
|
||||
required: true
|
||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,8 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 📃 Documentation
|
||||
url: https://github.com/revanced/revanced-documentation/
|
||||
about: Don't know how or where to start? Check out our documentation!
|
||||
- name: 🗨 Discussions
|
||||
url: https://github.com/revanced/revanced-suggestions/discussions
|
||||
about: Got something you think should change or be added? Search for or start a new discussion!
|
||||
about: Have something unspecific to ReVanced CLI in mind? Search for or start a new discussion!
|
||||
58
.github/ISSUE_TEMPLATE/feature-issue.yml
vendored
58
.github/ISSUE_TEMPLATE/feature-issue.yml
vendored
@@ -1,58 +0,0 @@
|
||||
name: ⭐ Feature request
|
||||
description: Create a detailed feature request.
|
||||
title: 'feat: <title>'
|
||||
labels: [feature-request]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# ReVanced feature request
|
||||
|
||||
Do not submit requests for patches here. Please submit them [here](https://github.com/orgs/revanced/discussions/categories/patches) instead.
|
||||
Important to note that your feature request may have already been made before. Please check for existing feature requests [here](https://github.com/revanced/revanced-cli/labels/feature-request).
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Type
|
||||
options:
|
||||
- Functionality
|
||||
- Cosmetic
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Issue
|
||||
description: What is the current problem. Why does it require a feature request?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Feature
|
||||
description: Describe your feature in detail. How does it solve the issue?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Motivation
|
||||
description: Why should your feature should be considered?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add additional context here.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
description: Your issue will be closed if you haven't done these steps.
|
||||
options:
|
||||
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
|
||||
required: true
|
||||
- label: I have written a short but informative title.
|
||||
required: true
|
||||
- label: I filled out all of the requested information in this issue properly.
|
||||
required: true
|
||||
45
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
45
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
name: ⭐ Feature request
|
||||
description: Create a detailed request for a new feature.
|
||||
title: 'feat: '
|
||||
labels: ['Feature request']
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# ReVanced CLI feature request
|
||||
|
||||
Please check for existing feature requests
|
||||
[here](https://github.com/ReVanced/revanced-cli/labels/Feature%20request)
|
||||
before creating a new one.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Feature description
|
||||
description: |
|
||||
- Describe your feature in detail
|
||||
- Add images, videos, links, examples, references, etc. if possible
|
||||
- Add the target application name in case you request a new patch
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Motivation
|
||||
description: |
|
||||
A strong motivation is necessary for a feature request to be considered.
|
||||
|
||||
- Why should this feature be implemented?
|
||||
- What is the explicit use case?
|
||||
- What are the benefits?
|
||||
- What makes this feature important?
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
description: Your issue will be closed if you don't follow the checklist below.
|
||||
options:
|
||||
- label: This request is not a duplicate of an existing issue.
|
||||
required: true
|
||||
- label: I have chosen an appropriate title.
|
||||
required: true
|
||||
- label: All requested information has been provided properly.
|
||||
required: true
|
||||
6
.github/workflows/pull_request.yml
vendored
6
.github/workflows/pull_request.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: PR to main
|
||||
name: Open a PR to main
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -7,7 +7,7 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
MESSAGE: merge branch `${{ github.head_ref || github.ref_name }}` to `main`
|
||||
MESSAGE: Merge branch `${{ github.head_ref || github.ref_name }}` to `main`
|
||||
|
||||
jobs:
|
||||
pull-request:
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Open pull request
|
||||
uses: repo-sync/pull-request@v2
|
||||
with:
|
||||
|
||||
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Make sure the release step uses its own credentials:
|
||||
# https://github.com/cycjimmy/semantic-release-action#private-packages
|
||||
@@ -33,9 +33,10 @@ jobs:
|
||||
build
|
||||
node_modules
|
||||
key: ${{ runner.os }}-gradle-npm-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'package-lock.json') }}
|
||||
- name: Build with Gradle
|
||||
- name: Build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Cleaning is necessary to avoid uploading two identical artifacts with different versions
|
||||
run: ./gradlew clean --no-daemon
|
||||
- name: Setup semantic-release
|
||||
run: npm install
|
||||
|
||||
354
CHANGELOG.md
354
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
79
CONTRIBUTING.md
Normal file
79
CONTRIBUTING.md
Normal file
@@ -0,0 +1,79 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source
|
||||
width="256px"
|
||||
media="(prefers-color-scheme: dark)"
|
||||
srcset="assets/revanced-headline/revanced-headline-vertical-dark.svg"
|
||||
>
|
||||
<img
|
||||
src="assets/revanced-headline/revanced-headline-vertical-light.svg"
|
||||
>
|
||||
</picture>
|
||||
<br>
|
||||
<a href="https://revanced.app/">
|
||||
<img height="24px" src="assets/revanced-logo/revanced-logo-round.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/revanced">
|
||||
<picture>
|
||||
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://i.ibb.co/dMMmCrW/Git-Hub-Mark.png" />
|
||||
<img height="24px" src="https://i.ibb.co/9wV3HGF/Git-Hub-Mark-Light.png" />
|
||||
</picture>
|
||||
</a>
|
||||
<a href="http://revanced.app/discord">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
|
||||
</a>
|
||||
<a href="https://reddit.com/r/revancedapp">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
|
||||
</a>
|
||||
<a href="https://t.me/app_revanced">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
|
||||
</a>
|
||||
<a href="https://twitter.com/revancedapp">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032018-6da37214-7474-4641-a1da-7af7db3a31cd.png" />
|
||||
</a>
|
||||
<a href="https://www.youtube.com/@ReVanced">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
Continuing the legacy of Vanced
|
||||
</p>
|
||||
|
||||
# 👋 Contribution guidelines
|
||||
|
||||
This document describes how to contribute to ReVanced CLI.
|
||||
|
||||
## 📖 Resources to help you get started
|
||||
|
||||
* The [documentation](/docs) explains how to use ReVanced CLI
|
||||
* [Our backlog](https://github.com/orgs/ReVanced/projects/12) is where we keep track of what we're working on
|
||||
* [Issues](https://github.com/ReVanced/revanced-cli/issues) are where we keep track of bugs and feature requests
|
||||
|
||||
## 🙏 Submitting a feature request
|
||||
|
||||
Features can be requested by opening an issue using the
|
||||
[Feature request issue template](https://github.com/ReVanced/revanced-cli/issues/new?assignees=&labels=Feature+request&projects=&template=feature-request.yml&title=feat%3A+).
|
||||
|
||||
> **Note**
|
||||
> Requests can be accepted or rejected at the discretion of maintainers of ReVanced CLI.
|
||||
> Good motivation has to be provided for a request to be accepted.
|
||||
|
||||
## 🐞 Submitting a bug report
|
||||
|
||||
If you encounter a bug while using ReVanced CLI, open an issue using the
|
||||
[Bug report issue template](https://github.com/ReVanced/revanced-cli/issues/new?assignees=&labels=Bug+report&projects=&template=bug-report.yml&title=bug%3A+).
|
||||
|
||||
## 📝 How to contribute
|
||||
|
||||
1. Before contributing, it is recommended to open an issue to discuss your change
|
||||
with the maintainers of ReVanced CLI. This will help you determine whether your change is acceptable
|
||||
and whether it is worth your time to implement it
|
||||
2. Development happens on the `dev` branch. Fork the repository and create your branch from `dev`
|
||||
3. Commit your changes.
|
||||
4. Submit a pull request to the `dev` branch of the repository and reference issues
|
||||
that your pull request closes in the description of your pull request
|
||||
5. Our team will review your pull request and provide feedback. Once your pull request is approved,
|
||||
it will be merged into the `dev` branch and will be included in the next release of ReVanced CLI
|
||||
|
||||
❤️ Thank you for considering contributing to ReVanced CLI,
|
||||
ReVanced
|
||||
75
README.md
75
README.md
@@ -1,3 +1,78 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source
|
||||
width="256px"
|
||||
media="(prefers-color-scheme: dark)"
|
||||
srcset="assets/revanced-headline/revanced-headline-vertical-dark.svg"
|
||||
>
|
||||
<img
|
||||
src="assets/revanced-headline/revanced-headline-vertical-light.svg"
|
||||
>
|
||||
</picture>
|
||||
<br>
|
||||
<a href="https://revanced.app/">
|
||||
<img height="24px" src="assets/revanced-logo/revanced-logo-round.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/revanced">
|
||||
<picture>
|
||||
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://i.ibb.co/dMMmCrW/Git-Hub-Mark.png" />
|
||||
<img height="24px" src="https://i.ibb.co/9wV3HGF/Git-Hub-Mark-Light.png" />
|
||||
</picture>
|
||||
</a>
|
||||
<a href="http://revanced.app/discord">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
|
||||
</a>
|
||||
<a href="https://reddit.com/r/revancedapp">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
|
||||
</a>
|
||||
<a href="https://t.me/app_revanced">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
|
||||
</a>
|
||||
<a href="https://x.com/revancedapp">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/93124920/270180600-7c1b38bf-889b-4d68-bd5e-b9d86f91421a.png">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/93124920/270108715-d80743fa-b330-4809-b1e6-79fbdc60d09c.png" />
|
||||
<picture/>
|
||||
</a>
|
||||
<a href="https://www.youtube.com/@ReVanced">
|
||||
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
Continuing the legacy of Vanced
|
||||
</p>
|
||||
|
||||
|
||||
# 💻 ReVanced CLI
|
||||
|
||||

|
||||

|
||||
|
||||
Command line application to use ReVanced.
|
||||
|
||||
## ❓ About
|
||||
|
||||
ReVanced CLI is a command line application to patch apps using ReVanced.
|
||||
ReVanced CLI also comes with commands to uninstall or install patched apps and list patches from supplied patch bundles.
|
||||
|
||||
## 🚀 Download
|
||||
|
||||
You can download the most recent version of ReVanced CLI from
|
||||
[here](https://github.com/ReVanced/revanced-cli/releases/latest). Learn how to use ReVanced CLI by following the [documentation](/docs).
|
||||
|
||||
## 📚 Everything else
|
||||
|
||||
### 📙 Contributing
|
||||
|
||||
Thank you for considering contributing to ReVanced CLI.
|
||||
You can find the contribution guidelines [here](CONTRIBUTING.md).
|
||||
|
||||
### 🛠️ Building
|
||||
|
||||
In order to build ReVanced CLI, you can follow the [documentation](/docs).
|
||||
|
||||
## 📜 Licence
|
||||
|
||||
ReVanced CLI is licensed under the GPLv3 licence. Please see the [licence file](LICENSE) for more information.
|
||||
[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and modify ReVanced CLI as long as you track changes/dates in source files.
|
||||
Any modifications to ReVanced CLI must also be made available under the GPL along with build & install instructions.
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 11 KiB |
1
assets/revanced-logo/revanced-logo-round.svg
Normal file
1
assets/revanced-logo/revanced-logo-round.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 2.8 KiB |
@@ -1,19 +1,23 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "1.8.20"
|
||||
kotlin("jvm") version "1.9.10"
|
||||
alias(libs.plugins.shadow)
|
||||
}
|
||||
|
||||
group = "app.revanced"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
google()
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.revanced.patcher)
|
||||
implementation(libs.kotlin.reflect)
|
||||
implementation(libs.revanced.library)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.picocli)
|
||||
implementation(libs.jadb) // Updated fork
|
||||
implementation(libs.apksig)
|
||||
implementation(libs.bcpkix.jdk15on)
|
||||
implementation(libs.jackson.module.kotlin)
|
||||
|
||||
testImplementation(libs.kotlin.test)
|
||||
}
|
||||
|
||||
@@ -31,13 +35,9 @@ tasks {
|
||||
expand("projectVersion" to project.version)
|
||||
}
|
||||
|
||||
build {
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
manifest {
|
||||
attributes("Main-Class" to "app.revanced.cli.main.MainKt")
|
||||
attributes("Main-Class" to "app.revanced.cli.command.MainCommandKt")
|
||||
}
|
||||
minimize {
|
||||
exclude(dependency("org.jetbrains.kotlin:.*"))
|
||||
@@ -46,11 +46,25 @@ tasks {
|
||||
}
|
||||
}
|
||||
|
||||
// Dummy task to fix the Gradle semantic-release plugin.
|
||||
// Remove this if you forked it to support building only.
|
||||
// Tracking issue: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
||||
build {
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
|
||||
/*
|
||||
Dummy task to hack gradle-semantic-release-plugin to release this project.
|
||||
|
||||
Explanation:
|
||||
SemVer is a standard for versioning libraries.
|
||||
For that reason the semantic-release plugin uses the "publish" task to publish libraries.
|
||||
However, this subproject is not a library, and the "publish" task is not available for this subproject.
|
||||
Because semantic-release is not designed to handle this case, we need to hack it.
|
||||
|
||||
RE: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
||||
*/
|
||||
|
||||
register<DefaultTask>("publish") {
|
||||
group = "publish"
|
||||
description = "Dummy task"
|
||||
group = "publishing"
|
||||
description = "Dummy task to hack gradle-semantic-release-plugin to release ReVanced CLI"
|
||||
dependsOn(build)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
# 💼 Prerequisites
|
||||
|
||||
To use ReVanced CLI, you will need to fulfil specific requirements.
|
||||
To use ReVanced CLI, you will need to fulfill specific requirements.
|
||||
|
||||
## 🤝 Requirements
|
||||
|
||||
- Java SDK 11 (Azul Zulu JDK or OpenJDK)
|
||||
- [Android Debug Bridge (adb)](https://developer.android.com/studio/command-line/adb) if you want to install the patched APK file on your device
|
||||
- An ABI other than ARMv7 such as x86 or x86-64 (or a custom AAPT binary that supports ARMv7)
|
||||
- ReVanced Patches
|
||||
- ReVanced Integrations, if the patches require it
|
||||
|
||||
## ⏭️ Whats next
|
||||
|
||||
|
||||
167
docs/1_usage.md
167
docs/1_usage.md
@@ -2,36 +2,17 @@
|
||||
|
||||
Learn how to ReVanced CLI.
|
||||
|
||||
## ⚡ Setup ADB
|
||||
## 🔨 Usage
|
||||
|
||||
1. Ensure that ADB is working
|
||||
ReVanced CLI is divided into the following fundamental commands:
|
||||
|
||||
```bash
|
||||
adb shell exit
|
||||
```
|
||||
|
||||
Optionally, you can install the patched APK file on your device by mounting it on top of the original APK file.
|
||||
You will need root permissions for this. Check if you have root permissions by running the following command:
|
||||
|
||||
```bash
|
||||
adb shell su -c exit
|
||||
```
|
||||
|
||||
2. Get your device serial
|
||||
|
||||
```bash
|
||||
adb devices
|
||||
```
|
||||
|
||||
## 🔨 Using ReVanced CLI
|
||||
|
||||
- ### ⚙️ Show all available options for ReVanced CLI
|
||||
- ### 🚀 Show all available options for ReVanced CLI
|
||||
|
||||
```bash
|
||||
java -jar revanced-cli.jar -h
|
||||
```
|
||||
|
||||
- ### 📃 List patches from supplied patch bundles
|
||||
- ### 📃 List patches
|
||||
|
||||
```bash
|
||||
java -jar revanced-cli.jar list-patches \
|
||||
@@ -41,59 +22,117 @@ Learn how to ReVanced CLI.
|
||||
revanced-patches.jar [<patch-bundle> ...]
|
||||
```
|
||||
|
||||
- ### ⚙️ Generate options from patches using ReVanced CLI
|
||||
- ### ⚙️ Generate options
|
||||
|
||||
This will generate an `options.json` file for the patches from a list of supplied patch bundles.
|
||||
The file can be supplied to ReVanced CLI later on.
|
||||
|
||||
- ```bash
|
||||
```bash
|
||||
java -jar revanced-cli.jar options \
|
||||
--path options.json \
|
||||
--overwrite \
|
||||
revanced-patches.jar [<patch-bundle> ...]
|
||||
```
|
||||
|
||||
> **Note**: A default `options.json` file will be automatically generated, if it does not exist
|
||||
without any need of intervention when using the `patch` command.
|
||||
> [!NOTE]
|
||||
> A default `options.json` file will be automatically created, if it does not exist
|
||||
without any need for intervention when using the `patch` command.
|
||||
|
||||
- ### 💉 Patch an app
|
||||
|
||||
You can patch apps by supplying patch bundles and the app to patch.
|
||||
After patching, ReVanced CLI can install the patched app on your device using two methods:
|
||||
|
||||
> [!NOTE]
|
||||
> For ReVanced CLI to be able to install the patched app on your device, make sure ADB is working:
|
||||
>
|
||||
> ```bash
|
||||
> adb shell exit
|
||||
> ```
|
||||
>
|
||||
> To get your device's serial, run the following command:
|
||||
>
|
||||
> ```bash
|
||||
> adb devices
|
||||
> ```
|
||||
>
|
||||
> If you want to mount the patched app on top of the un-patched app, make sure you have root permissions:
|
||||
>
|
||||
> ```bash
|
||||
> adb shell su -c exit
|
||||
> ```
|
||||
>
|
||||
|
||||
> [!WARNING]
|
||||
> Some patches may require integrations
|
||||
> such as [ReVanced Integrations](https://github.com/revanced/revanced-integrations).
|
||||
> Supply them with the option `--merge`. ReVanced Patcher will automatically determine if they are necessary.
|
||||
|
||||
- #### 👾 Patch an app and install it on your device regularly
|
||||
|
||||
```bash
|
||||
java -jar revanced-cli.jar patch \
|
||||
--patch-bundle revanced-patches.jar \
|
||||
--out patched-app.apk \
|
||||
--device-serial <device-serial> \
|
||||
input.apk
|
||||
```
|
||||
|
||||
- #### 👾 Patch an app and mount it on top of the un-patched app with root permissions
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Ensure sure the same app you are patching and mounting over is installed on your device:
|
||||
>
|
||||
> ```bash
|
||||
> adb install app.apk
|
||||
> ```
|
||||
|
||||
> [!NOTE]
|
||||
> You can use the option `--ii` to include or `--ie` to exclude
|
||||
> patches by their index in relation to supplied patch bundles,
|
||||
> similarly to the option `--include` and `--exclude`.
|
||||
>
|
||||
> This is useful in case two patches have the same name, and you need to include or exclude one of them.
|
||||
> The index of a patch is calculated by the position of the patch in the list of patches
|
||||
> from patch bundles supplied using the option `--patch-bundle`.
|
||||
>
|
||||
> You can list all patches with their indices using the command `list-patches`.
|
||||
>
|
||||
> Keep in mind, that the indices can change based on the order of the patch bundles supplied,
|
||||
> as well if the patch bundles are updated, because patches can be added or removed.
|
||||
|
||||
```bash
|
||||
java -jar revanced-cli.jar patch \
|
||||
--patch-bundle revanced-patches.jar \
|
||||
--include "Some patch" \
|
||||
--ii 123 \
|
||||
--exclude "Some other patch" \
|
||||
--out patched-app.apk \
|
||||
--device-serial <device-serial> \
|
||||
--mount \
|
||||
app.apk
|
||||
```
|
||||
|
||||
- ### 🗑️ Uninstall an app
|
||||
|
||||
```bash
|
||||
|
||||
- ### 💉 Use ReVanced CLI to patch an APK file but install without root permissions
|
||||
|
||||
This will install the patched APK file regularly on your device.
|
||||
|
||||
```bash
|
||||
java -jar revanced-cli.jar patch \
|
||||
--patch-bundle revanced-patches.jar \
|
||||
--out output.apk \
|
||||
--device-serial <device-serial> \
|
||||
input.apk
|
||||
```
|
||||
|
||||
- ### 👾 Use ReVanced CLI to patch an APK file but install with root permissions
|
||||
|
||||
This will install the patched APK file on your device by mounting it on top of the original APK file.
|
||||
|
||||
```bash
|
||||
adb install input.apk
|
||||
java -jar revanced-cli.jar patch \
|
||||
--patch-bundle revanced-patches.jar \
|
||||
--include some-other-patch \
|
||||
--exclude some-patch \
|
||||
--out patched-output.apk \
|
||||
--device-serial <device-serial> \
|
||||
--mount \
|
||||
input.apk
|
||||
```
|
||||
|
||||
> **Note**: Some patches may require integrations
|
||||
such as [ReVanced Integrations](https://github.com/revanced/revanced-integrations).
|
||||
Supply them with the option `-m`. If any patches accepted by ReVanced Patcher require ReVanced Integrations,
|
||||
they will be merged into the APK file automatically.
|
||||
|
||||
- ### 🗑️ Uninstall a patched
|
||||
```bash
|
||||
java -jar revanced-cli.jar uninstall \
|
||||
java -jar revanced-cli.jar utility uninstall \
|
||||
--package-name <package-name> \
|
||||
<device-serial>
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> You can unmount an APK file
|
||||
by adding the option `--unmount`.
|
||||
|
||||
- ### ️ 📦 Install an app
|
||||
|
||||
```bash
|
||||
java -jar revanced-cli.jar utility install \
|
||||
-a input.apk \
|
||||
<device-serial>
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> You can mount an APK file
|
||||
> by supplying the package name of the app to mount the supplied APK file to over the option `--mount`.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 3.0.0-dev.1
|
||||
version = 4.1.0
|
||||
|
||||
@@ -1,25 +1,17 @@
|
||||
[versions]
|
||||
shadow = "8.1.1"
|
||||
apksig = "8.1.0"
|
||||
bcpkix-jdk15on = "1.70"
|
||||
jackson-module-kotlin = "2.14.3"
|
||||
jadb = "2531a28109"
|
||||
kotlin-reflect = "1.9.0"
|
||||
kotlin-test = "1.8.20-RC"
|
||||
kotlinx-coroutines-core = "1.7.1"
|
||||
kotlinx-coroutines-core = "1.7.3"
|
||||
picocli = "4.7.3"
|
||||
revanced-patcher = "14.0.0"
|
||||
revanced-patcher = "19.0.0"
|
||||
revanced-library = "1.2.0"
|
||||
|
||||
[libraries]
|
||||
apksig = { module = "com.android.tools.build:apksig", version.ref = "apksig" }
|
||||
bcpkix-jdk15on = { module = "org.bouncycastle:bcpkix-jdk15on", version.ref = "bcpkix-jdk15on" }
|
||||
jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson-module-kotlin" }
|
||||
jadb = { module = "com.github.revanced:jadb", version.ref = "jadb" }
|
||||
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin-reflect" }
|
||||
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin-test" }
|
||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
|
||||
picocli = { module = "info.picocli:picocli", version.ref = "picocli" }
|
||||
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
|
||||
revanced-library = { module = "app.revanced:revanced-library", version.ref = "revanced-library" }
|
||||
|
||||
[plugins]
|
||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||
|
||||
@@ -1,23 +1 @@
|
||||
val githubUsername: String = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
|
||||
val githubPassword: String = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
google()
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
listOf("revanced-patcher", "jadb").forEach { repo ->
|
||||
maven {
|
||||
url = uri("https://maven.pkg.github.com/revanced/$repo")
|
||||
credentials {
|
||||
username = githubUsername
|
||||
password = githubPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "revanced-cli"
|
||||
@@ -1,94 +1,123 @@
|
||||
package app.revanced.cli.command
|
||||
|
||||
import app.revanced.patcher.PatchBundleLoader
|
||||
import app.revanced.patcher.annotation.Package
|
||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||
import app.revanced.patcher.extensions.PatchExtensions.options
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.patch.PatchClass
|
||||
import app.revanced.patcher.patch.PatchOption
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption
|
||||
import picocli.CommandLine.*
|
||||
import picocli.CommandLine.Help.Visibility.ALWAYS
|
||||
import java.io.File
|
||||
import java.util.logging.Logger
|
||||
|
||||
|
||||
@Command(name = "list-patches", description = ["List patches from supplied patch bundles"])
|
||||
@Command(name = "list-patches", description = ["List patches from supplied patch bundles."])
|
||||
internal object ListPatchesCommand : Runnable {
|
||||
private val logger = Logger.getLogger(ListPatchesCommand::class.java.name)
|
||||
|
||||
@Parameters(
|
||||
description = ["Paths to patch bundles"],
|
||||
arity = "1..*"
|
||||
description = ["Paths to patch bundles."], arity = "1..*"
|
||||
)
|
||||
lateinit var patchBundles: Array<File>
|
||||
private lateinit var patchBundles: Array<File>
|
||||
|
||||
@Option(
|
||||
names = ["-d", "--with-descriptions"],
|
||||
description = ["List their descriptions"],
|
||||
showDefaultValue = ALWAYS
|
||||
names = ["-d", "--with-descriptions"], description = ["List their descriptions."], showDefaultValue = ALWAYS
|
||||
)
|
||||
var withDescriptions: Boolean = true
|
||||
private var withDescriptions: Boolean = true
|
||||
|
||||
@Option(
|
||||
names = ["-p", "--with-packages"],
|
||||
description = ["List the packages the patches are compatible with"],
|
||||
description = ["List the packages the patches are compatible with."],
|
||||
showDefaultValue = ALWAYS
|
||||
)
|
||||
var withPackages: Boolean = false
|
||||
private var withPackages: Boolean = false
|
||||
|
||||
@Option(
|
||||
names = ["-v", "--with-versions"],
|
||||
description = ["List the versions of the packages the patches are compatible with"],
|
||||
description = ["List the versions of the apps the patches are compatible with."],
|
||||
showDefaultValue = ALWAYS
|
||||
)
|
||||
var withVersions: Boolean = false
|
||||
private var withVersions: Boolean = false
|
||||
|
||||
@Option(
|
||||
names = ["-o", "--with-options"],
|
||||
description = ["List the options of the patches"],
|
||||
names = ["-o", "--with-options"], description = ["List the options of the patches."], showDefaultValue = ALWAYS
|
||||
)
|
||||
private var withOptions: Boolean = false
|
||||
|
||||
@Option(
|
||||
names = ["-u", "--with-universal-patches"],
|
||||
description = ["List patches which are compatible with any app."],
|
||||
showDefaultValue = ALWAYS
|
||||
)
|
||||
var withOptions: Boolean = false
|
||||
private var withUniversalPatches: Boolean = true
|
||||
|
||||
@Option(
|
||||
names = ["-i", "--index"],
|
||||
description = ["List the index of of each patch in relation to the supplied patch bundles."],
|
||||
showDefaultValue = ALWAYS
|
||||
)
|
||||
private var withIndex: Boolean = true
|
||||
|
||||
@Option(
|
||||
names = ["-f", "--filter-package-name"], description = ["Filter patches by package name."]
|
||||
)
|
||||
private var packageName: String? = null
|
||||
|
||||
override fun run() {
|
||||
fun Package.buildString() = buildString {
|
||||
if (withVersions && versions.isNotEmpty()) {
|
||||
fun Patch.CompatiblePackage.buildString() = buildString {
|
||||
if (withVersions && versions != null) {
|
||||
appendLine("Package name: $name")
|
||||
appendLine("Compatible versions:")
|
||||
append(versions.joinToString("\n") { version -> version }.prependIndent("\t"))
|
||||
} else
|
||||
append("Package name: $name")
|
||||
append(versions!!.joinToString("\n") { version -> version }.prependIndent("\t"))
|
||||
} else append("Package name: $name")
|
||||
}
|
||||
|
||||
fun PatchOption<*>.buildString() = buildString {
|
||||
appendLine("Title: $title")
|
||||
appendLine("Description: $description")
|
||||
|
||||
value?.let {
|
||||
description?.let { appendLine("Description: $it") }
|
||||
default?.let {
|
||||
appendLine("Key: $key")
|
||||
append("Value: $it")
|
||||
append("Default: $it")
|
||||
} ?: append("Key: $key")
|
||||
}
|
||||
|
||||
fun PatchClass.buildString() = buildString {
|
||||
append("Name: $patchName")
|
||||
|
||||
if (withDescriptions) append("\nDescription: $description")
|
||||
|
||||
if (withOptions && options != null) {
|
||||
appendLine("\nOptions:")
|
||||
append(
|
||||
options!!.joinToString("\n\n") { option -> option.buildString() }.prependIndent("\t")
|
||||
)
|
||||
}
|
||||
|
||||
if (withPackages && compatiblePackages != null) {
|
||||
appendLine("\nCompatible packages:")
|
||||
append(
|
||||
compatiblePackages!!.joinToString("\n") { it.buildString() }.prependIndent("\t")
|
||||
)
|
||||
values?.let { values ->
|
||||
appendLine("\nValid values:")
|
||||
append(values.map { "${it.value} (${it.key})" }.joinToString("\n").prependIndent("\t"))
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(PatchBundleLoader.Jar(*patchBundles).joinToString("\n\n") { it.buildString() })
|
||||
fun IndexedValue<Patch<*>>.buildString() = let { (index, patch) ->
|
||||
buildString {
|
||||
if (withIndex) appendLine("Index: $index")
|
||||
|
||||
append("Name: ${patch.name}")
|
||||
|
||||
if (withDescriptions) append("\nDescription: ${patch.description}")
|
||||
|
||||
if (withOptions && patch.options.isNotEmpty()) {
|
||||
appendLine("\nOptions:")
|
||||
append(
|
||||
patch.options.values.joinToString("\n\n") { option ->
|
||||
option.buildString()
|
||||
}.prependIndent("\t")
|
||||
)
|
||||
}
|
||||
|
||||
if (withPackages && patch.compatiblePackages != null) {
|
||||
appendLine("\nCompatible packages:")
|
||||
append(patch.compatiblePackages!!.joinToString("\n") {
|
||||
it.buildString()
|
||||
}.prependIndent("\t"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Patch<*>.filterCompatiblePackages(name: String) = compatiblePackages?.any { it.name == name }
|
||||
?: withUniversalPatches
|
||||
|
||||
val patches = PatchBundleLoader.Jar(*patchBundles).withIndex().toList()
|
||||
|
||||
val filtered =
|
||||
packageName?.let { patches.filter { (_, patch) -> patch.filterCompatiblePackages(it) } } ?: patches
|
||||
|
||||
if (filtered.isNotEmpty()) logger.info(filtered.joinToString("\n\n") { it.buildString() })
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package app.revanced.cli.command
|
||||
|
||||
import app.revanced.cli.logging.impl.DefaultCliLogger
|
||||
import app.revanced.patcher.patch.PatchClass
|
||||
import picocli.CommandLine
|
||||
import picocli.CommandLine.Command
|
||||
import picocli.CommandLine.IVersionProvider
|
||||
import java.util.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
CommandLine(Main).execute(*args)
|
||||
}
|
||||
|
||||
internal typealias PatchList = List<PatchClass>
|
||||
|
||||
internal val logger = DefaultCliLogger()
|
||||
|
||||
object CLIVersionProvider : IVersionProvider {
|
||||
override fun getVersion(): Array<String> {
|
||||
Properties().apply {
|
||||
load(Main::class.java.getResourceAsStream("/app/revanced/cli/version.properties"))
|
||||
}.let {
|
||||
return arrayOf("ReVanced CLI v${it.getProperty("version")}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "revanced-cli",
|
||||
description = ["Command line application to use ReVanced"],
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = CLIVersionProvider::class,
|
||||
subcommands = [
|
||||
ListPatchesCommand::class,
|
||||
PatchCommand::class,
|
||||
UninstallCommand::class,
|
||||
OptionsCommand::class,
|
||||
]
|
||||
)
|
||||
internal object Main
|
||||
39
src/main/kotlin/app/revanced/cli/command/MainCommand.kt
Normal file
39
src/main/kotlin/app/revanced/cli/command/MainCommand.kt
Normal file
@@ -0,0 +1,39 @@
|
||||
package app.revanced.cli.command
|
||||
|
||||
import app.revanced.cli.command.utility.UtilityCommand
|
||||
import app.revanced.library.logging.Logger
|
||||
import picocli.CommandLine
|
||||
import picocli.CommandLine.Command
|
||||
import picocli.CommandLine.IVersionProvider
|
||||
import java.util.*
|
||||
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
Logger.setDefault()
|
||||
CommandLine(MainCommand).execute(*args)
|
||||
}
|
||||
|
||||
private object CLIVersionProvider : IVersionProvider {
|
||||
override fun getVersion() = arrayOf(
|
||||
MainCommand::class.java.getResourceAsStream(
|
||||
"/app/revanced/cli/version.properties"
|
||||
)?.use { stream ->
|
||||
Properties().apply { load(stream) }.let {
|
||||
"ReVanced CLI v${it.getProperty("version")}"
|
||||
}
|
||||
} ?: "ReVanced CLI")
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "revanced-cli",
|
||||
description = ["Command line application to use ReVanced."],
|
||||
mixinStandardHelpOptions = true,
|
||||
versionProvider = CLIVersionProvider::class,
|
||||
subcommands = [
|
||||
ListPatchesCommand::class,
|
||||
PatchCommand::class,
|
||||
OptionsCommand::class,
|
||||
UtilityCommand::class,
|
||||
]
|
||||
)
|
||||
private object MainCommand
|
||||
@@ -1,50 +1,54 @@
|
||||
package app.revanced.cli.command
|
||||
|
||||
import app.revanced.library.Options
|
||||
import app.revanced.library.Options.setOptions
|
||||
import app.revanced.patcher.PatchBundleLoader
|
||||
import app.revanced.utils.Options
|
||||
import app.revanced.utils.Options.setOptions
|
||||
import picocli.CommandLine
|
||||
import picocli.CommandLine.Help.Visibility.ALWAYS
|
||||
import java.io.File
|
||||
import java.util.logging.Logger
|
||||
|
||||
@CommandLine.Command(
|
||||
name = "options",
|
||||
description = ["Generate options file from patches"],
|
||||
description = ["Generate options file from patches."],
|
||||
)
|
||||
internal object OptionsCommand : Runnable {
|
||||
private val logger = Logger.getLogger(OptionsCommand::class.java.name)
|
||||
|
||||
@CommandLine.Parameters(
|
||||
description = ["Paths to patch bundles"],
|
||||
arity = "1..*"
|
||||
description = ["Paths to patch bundles."], arity = "1..*"
|
||||
)
|
||||
lateinit var patchBundles: Array<File>
|
||||
private lateinit var patchBundles: Array<File>
|
||||
|
||||
@CommandLine.Option(
|
||||
names = ["-p", "--path"],
|
||||
description = ["Path to patch options JSON file"],
|
||||
showDefaultValue = ALWAYS
|
||||
names = ["-p", "--path"], description = ["Path to patch options JSON file."], showDefaultValue = ALWAYS
|
||||
)
|
||||
var path: File = File("options.json")
|
||||
private var filePath: File = File("options.json")
|
||||
|
||||
@CommandLine.Option(
|
||||
names = ["-o", "--overwrite"],
|
||||
description = ["Overwrite existing options file"],
|
||||
showDefaultValue = ALWAYS
|
||||
names = ["-o", "--overwrite"], description = ["Overwrite existing options file."], showDefaultValue = ALWAYS
|
||||
)
|
||||
var overwrite: Boolean = false
|
||||
private var overwrite: Boolean = false
|
||||
|
||||
@CommandLine.Option(
|
||||
names = ["-u", "--update"],
|
||||
description = ["Update existing options by adding missing and removing non-existent options"],
|
||||
description = ["Update existing options by adding missing and removing non-existent options."],
|
||||
showDefaultValue = ALWAYS
|
||||
)
|
||||
var update: Boolean = false
|
||||
private var update: Boolean = false
|
||||
|
||||
override fun run() = if (!path.exists() || overwrite)
|
||||
with(PatchBundleLoader.Jar(*patchBundles)) {
|
||||
if (update) setOptions(path, logger)
|
||||
override fun run() = try {
|
||||
PatchBundleLoader.Jar(*patchBundles).let { patches ->
|
||||
val exists = filePath.exists()
|
||||
if (!exists || overwrite) {
|
||||
if (exists && update) patches.setOptions(filePath)
|
||||
|
||||
Options.serialize(this, prettyPrint = true)
|
||||
.let(path::writeText)
|
||||
Options.serialize(patches, prettyPrint = true).let(filePath::writeText)
|
||||
} else throw OptionsFileAlreadyExistsException()
|
||||
}
|
||||
else logger.error("Options file already exists, use --override to override it")
|
||||
} catch (ex: OptionsFileAlreadyExistsException) {
|
||||
logger.severe("Options file already exists, use --overwrite to override it")
|
||||
}
|
||||
|
||||
class OptionsFileAlreadyExistsException : Exception()
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,44 +0,0 @@
|
||||
package app.revanced.cli.command
|
||||
|
||||
import app.revanced.utils.adb.AdbManager
|
||||
import picocli.CommandLine.*
|
||||
import picocli.CommandLine.Help.Visibility.ALWAYS
|
||||
|
||||
|
||||
@Command(
|
||||
name = "uninstall",
|
||||
description = ["Uninstall a patched APK file from the devices with the supplied ADB device serials"]
|
||||
)
|
||||
internal object UninstallCommand : Runnable {
|
||||
@Parameters(
|
||||
description = ["ADB device serials"],
|
||||
arity = "1..*"
|
||||
)
|
||||
lateinit var deviceSerials: Array<String>
|
||||
|
||||
@Option(
|
||||
names = ["-p", "--package-name"],
|
||||
description = ["Package name to uninstall"],
|
||||
required = true
|
||||
)
|
||||
lateinit var packageName: String
|
||||
|
||||
@Option(
|
||||
names = ["-u", "--unmount"],
|
||||
description = ["Uninstall by unmounting the patched package"],
|
||||
showDefaultValue = ALWAYS
|
||||
)
|
||||
var unmount: Boolean = false
|
||||
|
||||
override fun run() = try {
|
||||
deviceSerials.forEach {deviceSerial ->
|
||||
if (unmount) {
|
||||
AdbManager.RootAdbManager(deviceSerial, logger)
|
||||
} else {
|
||||
AdbManager.UserAdbManager(deviceSerial, logger)
|
||||
}.uninstall(packageName)
|
||||
}
|
||||
} catch (e: AdbManager.DeviceNotFoundException) {
|
||||
logger.error(e.toString())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package app.revanced.cli.command.utility
|
||||
|
||||
import app.revanced.library.adb.AdbManager
|
||||
import picocli.CommandLine.*
|
||||
import java.io.File
|
||||
import java.util.logging.Logger
|
||||
|
||||
|
||||
@Command(
|
||||
name = "install", description = ["Install an APK file to devices with the supplied ADB device serials"]
|
||||
)
|
||||
internal object InstallCommand : Runnable {
|
||||
private val logger = Logger.getLogger(InstallCommand::class.java.name)
|
||||
|
||||
@Parameters(
|
||||
description = ["ADB device serials"], arity = "1..*"
|
||||
)
|
||||
private lateinit var deviceSerials: Array<String>
|
||||
|
||||
@Option(
|
||||
names = ["-a", "--apk"], description = ["APK file to be installed"], required = true
|
||||
)
|
||||
private lateinit var apk: File
|
||||
|
||||
@Option(
|
||||
names = ["-m", "--mount"],
|
||||
description = ["Mount the supplied APK file over the app with the supplied package name"],
|
||||
)
|
||||
private var packageName: String? = null
|
||||
|
||||
override fun run() = deviceSerials.forEach { deviceSerial ->
|
||||
try {
|
||||
AdbManager.getAdbManager(deviceSerial, packageName != null).install(AdbManager.Apk(apk, packageName))
|
||||
} catch (e: AdbManager.DeviceNotFoundException) {
|
||||
logger.severe(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package app.revanced.cli.command.utility
|
||||
|
||||
import app.revanced.library.adb.AdbManager
|
||||
import picocli.CommandLine.*
|
||||
import picocli.CommandLine.Help.Visibility.ALWAYS
|
||||
import java.util.logging.Logger
|
||||
|
||||
|
||||
@Command(
|
||||
name = "uninstall",
|
||||
description = ["Uninstall a patched app from the devices with the supplied ADB device serials"]
|
||||
)
|
||||
internal object UninstallCommand : Runnable {
|
||||
private val logger = Logger.getLogger(UninstallCommand::class.java.name)
|
||||
|
||||
@Parameters(description = ["ADB device serials"], arity = "1..*")
|
||||
private lateinit var deviceSerials: Array<String>
|
||||
|
||||
@Option(names = ["-p", "--package-name"], description = ["Package name of the app to uninstall"], required = true)
|
||||
private lateinit var packageName: String
|
||||
|
||||
@Option(
|
||||
names = ["-u", "--unmount"],
|
||||
description = ["Uninstall by unmounting the patched APK file"],
|
||||
showDefaultValue = ALWAYS
|
||||
)
|
||||
private var unmount: Boolean = false
|
||||
|
||||
override fun run() = deviceSerials.forEach { deviceSerial ->
|
||||
try {
|
||||
AdbManager.getAdbManager(deviceSerial, unmount).uninstall(packageName)
|
||||
} catch (e: AdbManager.DeviceNotFoundException) {
|
||||
logger.severe(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.revanced.cli.command.utility
|
||||
|
||||
import picocli.CommandLine
|
||||
|
||||
@CommandLine.Command(
|
||||
name = "utility",
|
||||
description = ["Commands for utility purposes"],
|
||||
subcommands = [InstallCommand::class, UninstallCommand::class],
|
||||
)
|
||||
internal object UtilityCommand
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.revanced.cli.logging
|
||||
|
||||
internal interface CliLogger {
|
||||
fun error(msg: String)
|
||||
fun info(msg: String)
|
||||
fun trace(msg: String)
|
||||
fun warn(msg: String)
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package app.revanced.cli.logging.impl
|
||||
|
||||
import app.revanced.cli.command.Main
|
||||
import app.revanced.cli.logging.CliLogger
|
||||
import java.util.logging.Logger
|
||||
import java.util.logging.SimpleFormatter
|
||||
|
||||
internal class DefaultCliLogger(
|
||||
private val logger: Logger = Logger.getLogger(Main::class.java.name),
|
||||
private val errorLogger: Logger = Logger.getLogger(logger.name + "Err")
|
||||
) : CliLogger {
|
||||
|
||||
init {
|
||||
logger.useParentHandlers = false
|
||||
if (logger.handlers.isEmpty()) {
|
||||
logger.addHandler(FlushingStreamHandler(System.out, SimpleFormatter()))
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
init {
|
||||
System.setProperty("java.util.logging.SimpleFormatter.format", "%4\$s: %5\$s %n")
|
||||
}
|
||||
}
|
||||
|
||||
override fun error(msg: String) = errorLogger.severe(msg)
|
||||
override fun info(msg: String) = logger.info(msg)
|
||||
override fun trace(msg: String) = logger.finest(msg)
|
||||
override fun warn(msg: String) = errorLogger.warning(msg)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package app.revanced.cli.logging.impl
|
||||
|
||||
import java.io.OutputStream
|
||||
import java.util.logging.Formatter
|
||||
import java.util.logging.LogRecord
|
||||
import java.util.logging.StreamHandler
|
||||
|
||||
internal class FlushingStreamHandler(out: OutputStream, format: Formatter) : StreamHandler(out, format) {
|
||||
override fun publish(record: LogRecord) {
|
||||
super.publish(record)
|
||||
flush()
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package app.revanced.cli.patcher.logging.impl
|
||||
|
||||
import app.revanced.cli.logging.impl.DefaultCliLogger
|
||||
import java.util.logging.Logger
|
||||
|
||||
internal object PatcherLogger : app.revanced.patcher.logging.Logger{
|
||||
private val logger = DefaultCliLogger(Logger.getLogger(app.revanced.patcher.Patcher::class.java.name))
|
||||
|
||||
override fun error(msg: String) = logger.error(msg)
|
||||
override fun info(msg: String) = logger.info(msg)
|
||||
override fun warn(msg: String)= logger.warn(msg)
|
||||
override fun trace(msg: String)= logger.trace(msg)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user