1
mirror of https://github.com/revanced/revanced-cli synced 2025-11-19 15:33:27 +01:00

Compare commits

...

186 Commits

Author SHA1 Message Date
semantic-release-bot
e7815819ff chore(release): 2.21.0-dev.1 [skip ci]
# [2.21.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.2-dev.1...v2.21.0-dev.1) (2023-05-04)

### Bug Fixes

* **tests:** set order of tests ([816f9d6](816f9d668c))
* use working JADB dependency version ([#222](https://github.com/revanced/revanced-cli/issues/222)) ([33c6565](33c65655a4))

### Features

* add appreciation message for new contributors ([a78d646](a78d646afc))
2023-05-04 00:27:08 +00:00
oSumAtrIX
816f9d668c fix(tests): set order of tests 2023-05-04 02:24:49 +02:00
bogadana
33c65655a4 fix: use working JADB dependency version (#222)
This fixes a current issue with CI/CD failing
2023-05-04 02:24:48 +02:00
oSumAtrIX
7a4bba0203 fix!: support null as option value (#221)
BREAKING-CHANGE: serialize options as JSON instead of TOML
2023-05-04 02:24:48 +02:00
oSumAtrIX
5b7f44ffe9 chore: update gradle and dependencies 2023-05-04 02:24:48 +02:00
oSumAtrIX
a78d646afc feat: add appreciation message for new contributors 2023-04-30 03:14:38 +02:00
bitingsock
90368405ad docs: update name of example patch (#218) 2023-04-30 02:55:27 +02:00
oSumAtrIX
26967959e2 ci: only dispatch documentation update event if on branch main 2023-04-30 02:53:24 +02:00
oSumAtrIX
eac6f6fbe3 docs: fix spelling (#213) 2023-04-21 17:14:09 +02:00
EvadeMaster
af4ec43352 docs: fix misspelling word 2023-04-21 21:23:41 +07:00
semantic-release-bot
4f5644b62c chore(release): 2.20.2-dev.1 [skip ci]
## [2.20.2-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.1...v2.20.2-dev.1) (2023-04-03)

### Bug Fixes

* correct spelling mistake ([31fb316](31fb3166d9))
2023-04-03 03:08:42 +00:00
oSumAtrIX
31fb3166d9 fix: correct spelling mistake 2023-04-03 05:07:45 +02:00
oSumAtrIX
a76bd0ad35 chore: bump dependencies 2023-04-03 03:04:07 +02:00
oSumAtrIX
ba07ab1ac2 build: update Kotlin to 1.8.10 2023-03-31 17:20:15 +02:00
oSumAtrIX
92bf57f279 docs: remove unnecessary option 2023-03-19 22:48:37 +01:00
semantic-release-bot
886d501026 chore(release): 2.20.1 [skip ci]
## [2.20.1](https://github.com/revanced/revanced-cli/compare/v2.20.0...v2.20.1) (2023-03-14)

### Bug Fixes

* correctly word option descriptions ([ac3a8f6](ac3a8f66f7))
2023-03-14 15:00:44 +00:00
oSumAtrIX
4b04cc4b59 chore: merge branch dev to main (#205) 2023-03-14 15:59:14 +01:00
semantic-release-bot
75d237058f chore(release): 2.20.1-dev.1 [skip ci]
## [2.20.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.0...v2.20.1-dev.1) (2023-03-05)

### Bug Fixes

* correctly word option descriptions ([ac3a8f6](ac3a8f66f7))
2023-03-05 01:06:31 +00:00
oSumAtrIX
40026fe300 docs: fix output file name 2023-03-05 02:05:40 +01:00
semantic-release-bot
dbec559ed7 chore(release): 2.20.1-dev.1 [skip ci]
## [2.20.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.0...v2.20.1-dev.1) (2023-03-03)

### Bug Fixes

* correctly word option descriptions ([ac3a8f6](ac3a8f66f7))
2023-03-03 13:09:06 +00:00
Professsional
00e49719ca docs: fix invalid grammar (#206)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-03-03 14:08:13 +01:00
semantic-release-bot
df276846e1 chore(release): 2.20.1-dev.1 [skip ci]
## [2.20.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.20.0...v2.20.1-dev.1) (2023-03-02)

### Bug Fixes

* correctly word option descriptions ([ac3a8f6](ac3a8f66f7))
2023-03-02 19:39:20 +00:00
oSumAtrIX
ac3a8f66f7 fix: correctly word option descriptions
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-03-02 20:38:02 +01:00
oSumAtrIX
e900ce8486 chore: remove project files 2023-03-02 20:37:57 +01:00
oSumAtrIX
ee6dd5a57c docs: update options usage
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-27 01:07:57 +01:00
oSumAtrIX
23d9e1e841 ci: fix usage of backmergeBranches option
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-27 00:57:46 +01:00
oSumAtrIX
3718b7992c build: update dependencies
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-27 00:53:27 +01:00
oSumAtrIX
bce5e86874 ci: fix backmerge direction
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 16:39:51 +01:00
oSumAtrIX
cda6df6238 ci: add backmerge target branch
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 06:46:23 +01:00
oSumAtrIX
0dc230292a ci: use new semantic-release-backmerge option
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-18 21:55:41 +01:00
oSumAtrIX
695cd1ba41 docs: correct note on excluding patches 2023-02-14 23:27:28 +01:00
Palm
d08bbf8664 ci: update actions (#204) 2023-02-13 22:35:05 +01:00
oSumAtrIX
d55dd0a1fc chore: merge branch dev to main (#201) 2023-02-10 05:36:19 +01:00
oSumAtrIX
a53d3482de build: bump patcher dependency version
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-10 05:28:35 +01:00
semantic-release-bot
7a3d0420f7 chore(release): 2.20.0 [skip ci]
# [2.20.0](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0) (2023-01-18)

### Bug Fixes

* bump patcher dependency version ([51c04b7](51c04b7b16))
* do not list compatible packages if patches do not define them ([31e4a41](31e4a41dd2))

### Features

* connect to first device if given device was not found ([6485e47](6485e477a1))
* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-18 20:36:39 +00:00
semantic-release-bot
5cddf5004e chore(release): 2.20.0 [skip ci]
# [2.20.0](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0) (2023-01-17)

### Bug Fixes

* bump patcher dependency version ([51c04b7](51c04b7b16))
* do not list compatible packages if patches do not define them ([31e4a41](31e4a41dd2))

### Features

* connect to first device if given device was not found ([6485e47](6485e477a1))
* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-17 23:48:27 +00:00
oSumAtrIX
6393a5016a chore: merge branch dev to main (#196) 2023-01-18 00:47:01 +01:00
oSumAtrIX
cad38ca3bd ci: use PAT in step Release 2023-01-18 00:44:39 +01:00
oSumAtrIX
6c1169b433 chore: merge branch dev to main (#195) 2023-01-18 00:39:15 +01:00
oSumAtrIX
bf2bb72ce0 build: update dependencies
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-01-18 00:33:00 +01:00
oSumAtrIX
567bdee887 chore: merge branch dev to main (#194) 2023-01-15 06:16:46 +01:00
semantic-release-bot
9888b0e08e chore(release): 2.20.0-dev.3 [skip ci]
# [2.20.0-dev.3](https://github.com/revanced/revanced-cli/compare/v2.20.0-dev.2...v2.20.0-dev.3) (2023-01-15)

### Bug Fixes

* bump patcher dependency version ([51c04b7](51c04b7b16))
2023-01-15 04:36:31 +00:00
oSumAtrIX
51c04b7b16 fix: bump patcher dependency version
This commit addresses https://github.com/revanced/multidexlib2/issues/2.
2023-01-15 05:34:52 +01:00
semantic-release-bot
a39cf893d6 chore(release): 2.20.0-dev.2 [skip ci]
# [2.20.0-dev.2](https://github.com/revanced/revanced-cli/compare/v2.20.0-dev.1...v2.20.0-dev.2) (2023-01-15)

### Features

* connect to first device if given device was not found ([6485e47](6485e477a1))
2023-01-15 04:25:04 +00:00
oSumAtrIX
6485e477a1 feat: connect to first device if given device was not found 2023-01-15 05:17:38 +01:00
oSumAtrIX
f99d340534 chore: merge branch dev to main (#193) 2023-01-13 22:33:19 +01:00
oSumAtrIX
4edc325978 ci: use PAT in step Release 2023-01-13 22:31:11 +01:00
oSumAtrIX
cffa1ea3a4 chore: merge branch dev to main (#192) 2023-01-13 16:04:32 +01:00
oSumAtrIX
d15505adaa ci: downgrade semantic release and plugins to v19 2023-01-13 15:50:39 +01:00
oSumAtrIX
aaf452a103 refactor: fix formatting 2023-01-13 14:41:38 +01:00
oSumAtrIX
1753a1aa3e ci: give jobs names 2023-01-13 14:41:18 +01:00
oSumAtrIX
f4e74cb4f2 docs: improve CLI usage commands 2023-01-13 00:13:45 +01:00
oSumAtrIX
50df4e117e docs: improve wording and accuracy 2023-01-09 10:11:15 +01:00
oSumAtrIX
9fcd2b4cd1 Merge branch 'main' into dev 2023-01-08 16:43:59 +01:00
oSumAtrIX
e6bb05c0b9 docs: init (#191) 2023-01-08 16:43:19 +01:00
oSumAtrIX
6bd7d42e32 ci: dispatch event to revanced/revanced-documentation on push to /docs 2023-01-08 14:46:13 +01:00
oSumAtrIX
19200eacc1 docs: init 2023-01-08 14:37:41 +01:00
semantic-release-bot
666738ee57 chore(release): 2.20.0 [skip ci]
# [2.20.0](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0) (2023-01-02)

### Bug Fixes

* do not list compatible packages if patches do not define them ([31e4a41](31e4a41dd2))

### Features

* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-02 08:15:31 +00:00
oSumAtrIX
961267b8cd chore: merge branch dev to main (#190) 2023-01-02 09:13:55 +01:00
oSumAtrIX
6b7314a399 build: bump patcher dependency version (#189) 2023-01-02 09:11:19 +01:00
semantic-release-bot
c8a47c51df chore(release): 2.20.0 [skip ci]
# [2.20.0](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0) (2023-01-01)

### Bug Fixes

* do not list compatible packages if patches do not define them ([31e4a41](31e4a41dd2))

### Features

* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-01 17:15:28 +00:00
oSumAtrIX
72d8f73d7f chore: merge branch dev to main (#188) 2023-01-01 18:14:36 +01:00
semantic-release-bot
1957a2c4ff chore(release): 2.20.0-dev.1 [skip ci]
# [2.20.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.19.0...v2.20.0-dev.1) (2023-01-01)

### Bug Fixes

* do not list compatible packages if patches do not define them ([31e4a41](31e4a41dd2))

### Features

* remove option `--with-descriptions` ([07a423b](07a423b19e))
2023-01-01 17:12:07 +00:00
oSumAtrIX
07a423b19e feat: remove option --with-descriptions 2023-01-01 18:11:10 +01:00
oSumAtrIX
31e4a41dd2 fix: do not list compatible packages if patches do not define them 2023-01-01 18:11:10 +01:00
semantic-release-bot
8284c1048f chore(release): 2.19.0 [skip ci]
# [2.19.0](https://github.com/revanced/revanced-cli/compare/v2.18.2...v2.19.0) (2022-12-31)

### Features

* improve description of options ([#185](https://github.com/revanced/revanced-cli/issues/185)) ([b69e784](b69e784785))
2022-12-31 18:22:25 +00:00
oSumAtrIX
9c64f5ec3e chore: merge branch dev to main (#184) 2022-12-31 19:20:26 +01:00
semantic-release-bot
f4c447e71b chore(release): 2.19.0-dev.1 [skip ci]
# [2.19.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.18.2...v2.19.0-dev.1) (2022-12-31)

### Features

* improve description of options ([#185](https://github.com/revanced/revanced-cli/issues/185)) ([b69e784](b69e784785))
2022-12-31 18:19:03 +00:00
oSumAtrIX
b69e784785 feat: improve description of options (#185) 2022-12-31 19:17:57 +01:00
oSumAtrIX
ccce9c926d ci: do not escape in environment variable MESSAGE 2022-12-29 19:07:33 +01:00
oSumAtrIX
dc4ab22f41 chore: bump patcher dependency version 2022-12-18 22:20:20 +01:00
semantic-release-bot
25d8ad4aaf chore(release): 2.18.2 [skip ci]
## [2.18.2](https://github.com/revanced/revanced-cli/compare/v2.18.1...v2.18.2) (2022-12-16)

### Bug Fixes

* exclude patcher dependency from minimizing ([d5794b9](d5794b94ca))
2022-12-16 16:10:17 +00:00
oSumAtrIX
3d9436e691 chore: merge branch dev to main (#180) 2022-12-16 17:08:38 +01:00
semantic-release-bot
ee70423527 chore(release): 2.18.2-dev.1 [skip ci]
## [2.18.2-dev.1](https://github.com/revanced/revanced-cli/compare/v2.18.1...v2.18.2-dev.1) (2022-12-16)

### Bug Fixes

* exclude patcher dependency from minimizing ([d5794b9](d5794b94ca))
2022-12-16 15:54:28 +00:00
oSumAtrIX
d5794b94ca fix: exclude patcher dependency from minimizing 2022-12-16 16:53:01 +01:00
oSumAtrIX
3160d894da chore: merge branch dev to main (#179) 2022-12-16 01:25:15 +01:00
oSumAtrIX
545597959a refactor: remove unused class ZipFileUtils 2022-12-16 01:23:37 +01:00
semantic-release-bot
a6db0edc70 chore(release): 2.18.1 [skip ci]
## [2.18.1](https://github.com/revanced/revanced-cli/compare/v2.18.0...v2.18.1) (2022-12-15)

### Bug Fixes

* don't log when package is incompatible and `exclusive` option is used ([ad81a1b](ad81a1b656))
2022-12-15 23:50:16 +00:00
oSumAtrIX
ff0d3dd224 chore: merge branch dev to main (#178) 2022-12-15 23:43:46 +01:00
semantic-release-bot
d9a1fd33ed chore(release): 2.18.1-dev.1 [skip ci]
## [2.18.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.18.0...v2.18.1-dev.1) (2022-12-15)

### Bug Fixes

* don't log when package is incompatible and `exclusive` option is used ([ad81a1b](ad81a1b656))
2022-12-15 22:43:16 +00:00
oSumAtrIX
ad81a1b656 fix: don't log when package is incompatible and exclusive option is used 2022-12-15 23:41:42 +01:00
oSumAtrIX
8c2aeff2cf build: exclude Bouncy Castle dependency from minimizing 2022-12-15 23:41:42 +01:00
semantic-release-bot
eb6c659f5b chore(release): 2.18.0 [skip ci]
# [2.18.0](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.18.0) (2022-12-15)

### Bug Fixes

* start with uppercase in log message ([ae91b0d](ae91b0d597))
* use correct prefix in log message ([1a67cd8](1a67cd81da))

### Features

* simplify log message ([74d73ca](74d73ca3a7))
2022-12-15 21:11:11 +00:00
semantic-release-bot
bac4f839c9 chore(release): 2.18.0 [skip ci]
# [2.18.0](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.18.0) (2022-12-15)

### Bug Fixes

* start with uppercase in log message ([ae91b0d](ae91b0d597))
* use correct prefix in log message ([1a67cd8](1a67cd81da))

### Features

* simplify log message ([74d73ca](74d73ca3a7))
2022-12-15 21:06:50 +00:00
oSumAtrIX
c1e7215d31 chore: merge branch dev to main (#176) 2022-12-15 22:05:59 +01:00
semantic-release-bot
18d132123f chore(release): 2.18.0-dev.1 [skip ci]
# [2.18.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.17.1-dev.2...v2.18.0-dev.1) (2022-12-15)

### Bug Fixes

* start with uppercase in log message ([ae91b0d](ae91b0d597))
* use correct prefix in log message ([1a67cd8](1a67cd81da))

### Features

* simplify log message ([74d73ca](74d73ca3a7))
2022-12-15 21:04:58 +00:00
oSumAtrIX
74d73ca3a7 feat: simplify log message 2022-12-15 22:03:47 +01:00
oSumAtrIX
ae91b0d597 fix: start with uppercase in log message 2022-12-15 22:03:29 +01:00
oSumAtrIX
1a67cd81da fix: use correct prefix in log message 2022-12-15 22:00:08 +01:00
oSumAtrIX
9b9fad7cc0 chore: merge branch dev to main (#174) 2022-12-15 21:46:55 +01:00
oSumAtrIX
1620305b4a ci: do not release on build commit type 2022-12-15 19:47:48 +01:00
semantic-release-bot
d906edbe78 chore(release): 2.17.1-dev.2 [skip ci]
## [2.17.1-dev.2](https://github.com/revanced/revanced-cli/compare/v2.17.1-dev.1...v2.17.1-dev.2) (2022-12-15)
2022-12-15 18:34:01 +00:00
oSumAtrIX
4e53638cb9 build: exclude Kotlin standard library dependencies from minimizing 2022-12-15 19:32:08 +01:00
semantic-release-bot
7d1f200621 chore(release): 2.17.1-dev.1 [skip ci]
## [2.17.1-dev.1](https://github.com/revanced/revanced-cli/compare/v2.17.0...v2.17.1-dev.1) (2022-12-15)
2022-12-15 00:01:17 +00:00
oSumAtrIX
a7db6cb8f1 build: do not comment on successful releases 2022-12-15 01:00:22 +01:00
semantic-release-bot
d61ab058da chore(release): 2.17.0 [skip ci]
# [2.17.0](https://github.com/revanced/revanced-cli/compare/v2.16.1...v2.17.0) (2022-12-14)

### Bug Fixes

* invalid header when writing a `ZipFile` ([#169](https://github.com/revanced/revanced-cli/issues/169)) ([6e703eb](6e703eb8e8))

### Features

* improve missing compatibility annotation tracing log ([2c7eb72](2c7eb7274c))
* trace logs when compatibility annotation is missing ([#166](https://github.com/revanced/revanced-cli/issues/166)) ([c590bf5](c590bf559c))
2022-12-14 23:48:26 +00:00
oSumAtrIX
235c2742ec chore: merge branch dev to main (#173) 2022-12-15 00:39:03 +01:00
semantic-release-bot
8a964efd00 chore(release): 2.17.0-dev.3 [skip ci]
# [2.17.0-dev.3](https://github.com/revanced/revanced-cli/compare/v2.17.0-dev.2...v2.17.0-dev.3) (2022-12-14)

### Features

* improve missing compatibility annotation tracing log ([2c7eb72](2c7eb7274c))
2022-12-14 23:37:35 +00:00
oSumAtrIX
8114d1dca0 build: remove unnecessary step 2022-12-15 00:32:48 +01:00
oSumAtrIX
5a7cadd96d build: remove manifest attributes 2022-12-15 00:32:47 +01:00
oSumAtrIX
1c5983b803 build: minimize shadow jar 2022-12-15 00:32:47 +01:00
oSumAtrIX
2c7eb7274c feat: improve missing compatibility annotation tracing log 2022-12-15 00:32:47 +01:00
oSumAtrIX
512152fb66 ci: stash before rebasing 2022-12-15 00:32:47 +01:00
oSumAtrIX
8793b5fc65 chore: merge branch dev to main (#167) 2022-12-14 01:18:05 +01:00
semantic-release-bot
39c490d6b7 chore(release): 2.17.0-dev.2 [skip ci]
# [2.17.0-dev.2](https://github.com/revanced/revanced-cli/compare/v2.17.0-dev.1...v2.17.0-dev.2) (2022-12-14)

### Bug Fixes

* invalid header when writing a `ZipFile` ([#169](https://github.com/revanced/revanced-cli/issues/169)) ([6e703eb](6e703eb8e8))
2022-12-14 00:16:38 +00:00
oSumAtrIX
6e703eb8e8 fix: invalid header when writing a ZipFile (#169) 2022-12-14 01:14:00 +01:00
oSumAtrIX
c677eb9792 ci: back-merge releases back into dev branch 2022-12-14 01:13:45 +01:00
oSumAtrIX
75c8ea4639 chore: bump patcher dependency version 2022-12-14 01:13:00 +01:00
semantic-release-bot
b69dd52ca9 chore(release): 2.17.0-dev.1 [skip ci]
# [2.17.0-dev.1](https://github.com/revanced/revanced-cli/compare/v2.16.1...v2.17.0-dev.1) (2022-12-11)

### Features

* trace logs when compatibility annotation is missing ([#166](https://github.com/revanced/revanced-cli/issues/166)) ([c590bf5](c590bf559c))
2022-12-11 19:10:19 +00:00
oSumAtrIX
c590bf559c feat: trace logs when compatibility annotation is missing (#166) 2022-12-11 20:08:52 +01:00
oSumAtrIX
ec0b847419 chore: merge branch dev to main (#165) 2022-12-11 05:19:08 +01:00
oSumAtrIX
b3cf32e89d ci: open pull requests to merge dev to main (#164) 2022-12-11 05:16:51 +01:00
oSumAtrIX
8a1199ba9a ci: refactor release workflow 2022-12-11 05:14:23 +01:00
oSumAtrIX
25b45800a1 chore: bump patcher dependency version 2022-12-02 04:04:25 +01:00
oSumAtrIX
2fe3303a27 chore: bump patcher dependency version 2022-12-02 02:35:35 +01:00
semantic-release-bot
04339f0654 chore(release): 2.16.1 [skip ci]
## [2.16.1](https://github.com/revanced/revanced-cli/compare/v2.16.0...v2.16.1) (2022-11-22)
2022-11-22 23:37:24 +00:00
oSumAtrIX
456428a836 build: bump dependencies 2022-11-23 00:33:45 +01:00
oSumAtrIX
c9ae379c77 feat!: apply changes from ReVanced Patcher 2022-11-23 00:20:48 +01:00
semantic-release-bot
81d702949c chore(release): 2.16.0 [skip ci]
# [2.16.0](https://github.com/revanced/revanced-cli/compare/v2.15.1...v2.16.0) (2022-11-20)

### Features

* do not warn on incompatible packages ([39e377b](39e377bc48))
2022-11-20 01:50:38 +00:00
oSumAtrIX
39e377bc48 feat: do not warn on incompatible packages 2022-11-20 00:34:00 +01:00
oSumAtrIX
fce40421e9 chore: ignore file vcs.xml from version control [skip ci] 2022-11-19 19:56:46 +01:00
semantic-release-bot
cb554c8bdf chore(release): 2.15.1 [skip ci]
## [2.15.1](https://github.com/revanced/revanced-cli/compare/v2.15.0...v2.15.1) (2022-11-18)
2022-11-18 01:37:14 +00:00
oSumAtrIX
269c753dfa build: bump picocli dependency version 2022-11-18 02:34:28 +01:00
oSumAtrIX
6403e34712 build: bump patcher dependency version 2022-11-18 02:27:33 +01:00
Nico Mexis
f68e7697ff build: update workflow actions (#161) [skip ci] 2022-11-05 15:28:42 +01:00
semantic-release-bot
64b7e86252 chore(release): 2.15.0 [skip ci]
# [2.15.0](https://github.com/revanced/revanced-cli/compare/v2.14.0...v2.15.0) (2022-10-31)

### Bug Fixes

* **gitignore:** ignore `options.toml` ([#158](https://github.com/revanced/revanced-cli/issues/158)) ([7be9af0](7be9af0942))

### Features

* use `am` instead of `monkey` to launch the app ([#159](https://github.com/revanced/revanced-cli/issues/159)) ([6a35cf7](6a35cf7ea4))
2022-10-31 13:19:05 +00:00
OxrxL
7be9af0942 fix(gitignore): ignore options.toml (#158) 2022-10-31 14:16:00 +01:00
decipher
6a35cf7ea4 feat: use am instead of monkey to launch the app (#159) 2022-10-31 14:15:34 +01:00
SriBalaji
4914fd37bc build: update checkout actions to v3 [skip ci] (#155) 2022-10-13 17:35:24 +02:00
semantic-release-bot
38052b6ecf chore(release): 2.14.0 [skip ci]
# [2.14.0](https://github.com/revanced/revanced-cli/compare/v2.13.0...v2.14.0) (2022-10-05)

### Bug Fixes

* escape quotation mark in string ([6e21d81](6e21d81964))

### Features

* handle unmounting deleted files ([#148](https://github.com/revanced/revanced-cli/issues/148)) ([3a733e5](3a733e5137))
* unmount all occurrences in `/proc/mounts` ([#131](https://github.com/revanced/revanced-cli/issues/131)) ([4f4e1f9](4f4e1f9834))
2022-10-05 18:27:53 +00:00
oSumAtrIX
6e21d81964 fix: escape quotation mark in string 2022-10-05 20:26:15 +02:00
decipher
3a733e5137 feat: handle unmounting deleted files (#148) 2022-10-05 14:47:23 +02:00
decipher
4f4e1f9834 feat: unmount all occurrences in /proc/mounts (#131) 2022-10-05 14:20:41 +02:00
oSumAtrIX
e035d93d2c chore: migrate to new changes from the patcher 2022-10-05 04:12:46 +02:00
oSumAtrIX
839854d890 refactor: remove unused variable 2022-10-04 08:30:53 +02:00
semantic-release-bot
43c772c98d chore(release): 2.13.0 [skip ci]
# [2.13.0](https://github.com/revanced/revanced-cli/compare/v2.12.0...v2.13.0) (2022-10-01)

### Features

* check, if input file exists ([b6dff6d](b6dff6d832))
2022-10-01 03:21:30 +00:00
oSumAtrIX
b6dff6d832 feat: check, if input file exists 2022-10-01 05:19:42 +02:00
OxrxL
29b057dead chore: do not commit revanced-cache (#144) 2022-09-30 00:33:17 +02:00
oSumAtrIX
7df4a7e7da chore: bump patcher dependency version 2022-09-29 21:32:39 +02:00
semantic-release-bot
07c09f092c chore(release): 2.12.0 [skip ci]
# [2.12.0](https://github.com/revanced/revanced-cli/compare/v2.11.2...v2.12.0) (2022-09-26)

### Features

* remove unused option `-r` ([467d838](467d8387e6))
2022-09-26 07:02:22 +00:00
oSumAtrIX
e8c9c80349 chore: bump patcher dependency version 2022-09-26 09:00:29 +02:00
oSumAtrIX
467d8387e6 feat: remove unused option -r 2022-09-26 09:00:14 +02:00
oSumAtrIX
65637c8b3a chore: bump patcher dependency version 2022-09-26 04:29:35 +02:00
semantic-release-bot
aa21137e99 chore(release): 2.11.2 [skip ci]
## [2.11.2](https://github.com/revanced/revanced-cli/compare/v2.11.1...v2.11.2) (2022-09-23)
2022-09-23 04:46:47 +00:00
oSumAtrIX
b35302094a build: update patcher dependency 2022-09-23 06:35:32 +02:00
semantic-release-bot
dfb527fc29 chore(release): 2.11.1 [skip ci]
## [2.11.1](https://github.com/revanced/revanced-cli/compare/v2.11.0...v2.11.1) (2022-09-21)
2022-09-21 02:16:24 +00:00
oSumAtrIX
ac2332a592 build: bump patcher dependency version to v5.0.0 2022-09-21 04:14:45 +02:00
semantic-release-bot
a530624fb2 chore(release): 2.11.0 [skip ci]
# [2.11.0](https://github.com/revanced/revanced-cli/compare/v2.10.2...v2.11.0) (2022-09-20)

### Features

* section `acknowledgements` for issue templates ([0e3ecc3](0e3ecc3a51))
2022-09-20 22:37:23 +00:00
oSumAtrIX
0e3ecc3a51 feat: section acknowledgements for issue templates
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-09-21 00:35:56 +02:00
semantic-release-bot
7fac75c6b6 chore(release): 2.10.2 [skip ci]
## [2.10.2](https://github.com/revanced/revanced-cli/compare/v2.10.1...v2.10.2) (2022-09-18)
2022-09-18 06:29:07 +00:00
oSumAtrIX
7ca0b35e45 build: bump patcher dependency version
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-09-18 08:27:20 +02:00
Sculas
cb0fde4908 refactor: clarify config header 2022-09-12 12:24:36 +02:00
Sculas
75e810e42e chore: remove broken dir mappings
cc @oSumAtrIX: if you need this, don't push this file to remote.
2022-09-12 11:47:35 +02:00
semantic-release-bot
37cc77dfc5 chore(release): 2.10.1 [skip ci]
## [2.10.1](https://github.com/revanced/revanced-cli/compare/v2.10.0...v2.10.1) (2022-09-09)
2022-09-09 20:51:44 +00:00
Sculas
075bf406fd refactor: improve OptionsLoader a lot 2022-09-09 22:50:15 +02:00
Sculas
71c81510f7 build: update patcher dependency 2022-09-09 20:59:10 +02:00
semantic-release-bot
51fd16409f chore(release): 2.10.0 [skip ci]
# [2.10.0](https://github.com/revanced/revanced-cli/compare/v2.9.10...v2.10.0) (2022-09-08)

### Features

* Patch Options CLI implementation ([#132](https://github.com/revanced/revanced-cli/issues/132)) ([3f5345a](3f5345af6e))
2022-09-08 20:36:40 +00:00
Sculas
3f5345af6e feat: Patch Options CLI implementation (#132)
* feat: Patch Options CLI implementation

* fix: remove leftover log message
2022-09-08 22:35:09 +02:00
semantic-release-bot
649d9bdb2a chore(release): 2.9.10 [skip ci]
## [2.9.10](https://github.com/revanced/revanced-cli/compare/v2.9.9...v2.9.10) (2022-09-08)

### Bug Fixes

* don't print same patch multiple times ([f4b0469](f4b04698d8))
2022-09-08 20:21:12 +00:00
Sculas
f4b04698d8 fix: don't print same patch multiple times 2022-09-08 22:19:53 +02:00
semantic-release-bot
240ab18eaf chore(release): 2.9.9 [skip ci]
## [2.9.9](https://github.com/revanced/revanced-cli/compare/v2.9.8...v2.9.9) (2022-09-08)
2022-09-08 15:03:24 +00:00
Sculas
096dba2337 build: update patcher dependency 2022-09-08 17:02:02 +02:00
semantic-release-bot
26780f94e5 chore(release): 2.9.8 [skip ci]
## [2.9.8](https://github.com/revanced/revanced-cli/compare/v2.9.7...v2.9.8) (2022-09-08)

### Bug Fixes

* broken deprecation message ([e3e74ac](e3e74ac0e9))
2022-09-08 11:51:01 +00:00
Sculas
faa52e2c68 Merge remote-tracking branch 'origin/main' into main 2022-09-08 13:49:18 +02:00
Sculas
e3e74ac0e9 fix: broken deprecation message 2022-09-08 13:49:03 +02:00
Sculas
de1bdb708c build: update patcher 2022-09-08 13:46:23 +02:00
semantic-release-bot
9b2b933998 chore(release): 2.9.7 [skip ci]
## [2.9.7](https://github.com/revanced/revanced-cli/compare/v2.9.6...v2.9.7) (2022-09-08)
2022-09-08 10:55:29 +00:00
Sculas
fb5a72fdc0 build: remove useless stdlib 2022-09-08 12:53:38 +02:00
Sculas
86c5992630 build: update patcher 2022-09-08 12:53:08 +02:00
Sculas
06d2139ebf refactor: handle deprecation & cleanup 2022-09-08 12:52:00 +02:00
Sculas
15ba4f40cd chore: ignore kotlinc 2022-09-08 12:45:14 +02:00
semantic-release-bot
2d70037913 chore(release): 2.9.6 [skip ci]
## [2.9.6](https://github.com/revanced/revanced-cli/compare/v2.9.5...v2.9.6) (2022-09-07)
2022-09-07 21:17:46 +00:00
Canny
34108b9229 build: bump patcher dependency version (#126) 2022-09-07 23:16:12 +02:00
semantic-release-bot
64a323e7e7 chore(release): 2.9.5 [skip ci]
## [2.9.5](https://github.com/revanced/revanced-cli/compare/v2.9.4...v2.9.5) (2022-09-01)

### Bug Fixes

* mount bind revanced.apk from magisk's mirror ([372470c](372470c77b))
2022-09-01 00:41:46 +00:00
Nguyen Hoang The Vi
372470c77b fix: mount bind revanced.apk from magisk's mirror
Some banking apps detect the mountpoint of youtube base apk to determine device is rooted. So mount bind from magisk's mirror to trigger magisk unmount and let it hidden along with magisk hiding.
2022-09-01 02:40:20 +02:00
semantic-release-bot
3cef245728 chore(release): 2.9.4 [skip ci]
## [2.9.4](https://github.com/revanced/revanced-cli/compare/v2.9.3...v2.9.4) (2022-08-31)
2022-08-31 18:40:54 +00:00
oSumAtrIX
aa54a2b1a9 build: bump patcher dependency version
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-08-31 20:36:57 +02:00
semantic-release-bot
f8c430be33 chore(release): 2.9.3 [skip ci]
## [2.9.3](https://github.com/revanced/revanced-cli/compare/v2.9.2...v2.9.3) (2022-08-14)
2022-08-14 15:34:54 +00:00
oSumAtrIX
7692c18282 build: bump patcher dependency version 2022-08-14 17:33:14 +02:00
semantic-release-bot
469d0861af chore(release): 2.9.2 [skip ci]
## [2.9.2](https://github.com/revanced/revanced-cli/compare/v2.9.1...v2.9.2) (2022-08-07)
2022-08-07 20:42:09 +00:00
oSumAtrIX
208c5bc5b0 build: bump patcher dependency version 2022-08-07 21:55:15 +02:00
Ankit Majumder
82efd9941f refactor: spelling mistake (#114) 2022-08-06 09:54:37 +02:00
semantic-release-bot
48e9043517 chore(release): 2.9.1 [skip ci]
## [2.9.1](https://github.com/revanced/revanced-cli/compare/v2.9.0...v2.9.1) (2022-08-04)

### Reverts

* feat: remove extra zipalign step ([c3d8fec](c3d8fecad0))
2022-08-04 16:42:28 +00:00
Sculas
c3d8fecad0 revert: feat: remove extra zipalign step
This reverts commit c8e793efab.
2022-08-04 18:40:17 +02:00
semantic-release-bot
d96eb847d7 chore(release): 2.9.0 [skip ci]
# [2.9.0](https://github.com/revanced/revanced-cli/compare/v2.8.3...v2.9.0) (2022-08-03)

### Features

* remove extra zipalign step ([#106](https://github.com/revanced/revanced-cli/issues/106)) ([c8e793e](c8e793efab))
2022-08-03 19:38:07 +00:00
bogadana
c8e793efab feat: remove extra zipalign step (#106)
* feat: remove extra zipalign step

* remove zipfs

* remove use

* reduce compression

* put back misc.xml

* revert stupid autofix
2022-08-03 21:36:38 +02:00
34 changed files with 7586 additions and 345 deletions

View File

@@ -59,3 +59,15 @@ body:
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

View File

@@ -43,4 +43,16 @@ body:
label: Additional context
description: Add additional context here.
validations:
required: false
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

2
.github/config.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
firstPRMergeComment: >
Thank you for contributing to ReVanced. Join us on [Discord](https://revanced.app/discord) if you want to receive a contributor role.

25
.github/workflows/pull_request.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: PR to main
on:
push:
branches:
- dev
workflow_dispatch:
env:
MESSAGE: merge branch `${{ github.head_ref || github.ref_name }}` to `main`
jobs:
pull-request:
name: Open pull request
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Open pull request
uses: repo-sync/pull-request@v2
with:
destination_branch: 'main'
pr_title: 'chore: ${{ env.MESSAGE }}'
pr_body: 'This pull request will ${{ env.MESSAGE }}.'
pr_draft: true

View File

@@ -1,4 +1,5 @@
name: Release
on:
workflow_dispatch:
push:
@@ -9,32 +10,33 @@ on:
branches:
- main
- dev
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# Make sure the release step uses its own credentials:
# https://github.com/cycjimmy/semantic-release-action#private-packages
persist-credentials: false
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
distribution: 'zulu'
cache: gradle
- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build clean
node-version: "18"
cache: 'npm'
- name: Setup semantic-release
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D
run: npm install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
run: npm exec semantic-release

View File

@@ -0,0 +1,19 @@
name: Update documentation
on:
push:
paths:
- docs/**
jobs:
trigger:
runs-on: ubuntu-latest
name: Dispatch event to documentation repository
if: github.ref == 'refs/heads/main'
steps:
- uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.DOCUMENTATION_REPO_ACCESS_TOKEN }}
repository: revanced/revanced-documentation
event-type: update-documentation
client-payload: '{"repo": "${{ github.event.repository.name }}", "ref": "${{ github.ref }}"}'

10
.gitignore vendored
View File

@@ -74,6 +74,7 @@ cmake-build-*/
# IntelliJ
out/
.idea
# mpeltonen/sbt-idea plugin
.idea_modules/
@@ -111,4 +112,11 @@ gradle-app.setting
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
# gradle/wrapper/gradle-wrapper.properties
# Dependency directories
node_modules/
# ReVanced CLI
revanced-cache/
options.toml

8
.idea/.gitignore generated vendored
View File

@@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

7
.idea/discord.xml generated
View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>

10
.idea/misc.xml generated
View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="azul-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

14
.idea/vcs.xml generated
View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CommitMessageInspectionProfile">
<profile version="1.0">
<inspection_tool class="CommitFormat" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CommitNamingConvention" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../revanced-patcher" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../revanced-patches" vcs="Git" />
</component>
</project>

View File

@@ -7,11 +7,7 @@
}
],
"plugins": [
["@semantic-release/commit-analyzer", {
"releaseRules": [
{"type": "build", "release": "patch"}
]
}],
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"gradle-semantic-release-plugin",
@@ -31,7 +27,15 @@
{
"path": "build/libs/*all.jar"
}
]
],
successComment: false
}
],
[
"@saithodev/semantic-release-backmerge",
{
backmergeBranches: [{"from": "main", "to": "dev"}],
clearWorkspace: true
}
]
]

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.7.0"
kotlin("jvm") version "1.8.10"
id("com.github.johnrengelman.shadow") version "7.1.2"
}
@@ -23,25 +23,35 @@ repositories {
}
dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.20-RC")
implementation("app.revanced:revanced-patcher:3.3.1")
implementation("info.picocli:picocli:4.6.3")
implementation("com.android.tools.build:apksig:7.2.1")
implementation("com.github.revanced:jadb:master-SNAPSHOT") // updated fork
implementation("app.revanced:revanced-patcher:7.0.0")
implementation("info.picocli:picocli:4.7.1")
implementation("com.github.revanced:jadb:2531a28109") // updated fork
implementation("com.android.tools.build:apksig:8.1.0-alpha09")
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.+")
testImplementation("org.jetbrains.kotlin:kotlin-test:1.8.20-RC")
}
tasks {
test {
useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
}
}
build {
dependsOn(shadowJar)
}
shadowJar {
manifest {
attributes("Main-Class" to "app.revanced.cli.main.MainKt")
attributes("Implementation-Title" to project.name)
attributes("Implementation-Version" to project.version)
}
minimize {
exclude(dependency("org.jetbrains.kotlin:.*"))
exclude(dependency("org.bouncycastle:.*"))
exclude(dependency("app.revanced:.*"))
}
}
// Dummy task to fix the Gradle semantic-release plugin.

17
docs/0_prerequisites.md Normal file
View File

@@ -0,0 +1,17 @@
# 💼 Prerequisites
To use the ReVanced CLI, you will need to fulfill certain requirements.
## 🤝 Requirements
- [Android Debug Bridge (adb)](https://developer.android.com/studio/command-line/adb), the command-line tool that lets
you communicate with a device (optional).
- A x86/x86_64 host (or a custom AAPT binary for your architecture)
- Zulu OpenJDK 17
- An APK file (e.g. YouTube v17.49.37 or YouTube Music v5.36.51)
## ⏭️ Whats next
The next section will show, how to use the [ReVanced CLI](https://github.com/revanced/revanced-cli).
Continue: [🛠️ Using the ReVanced CLI](1_usage.md)

74
docs/1_usage.md Normal file
View File

@@ -0,0 +1,74 @@
# 🛠️ Using the ReVanced CLI
Learn how to use the ReVanced CLI.
## ⚡ Setup (optional)
1. Make sure your device is connected
```bash
adb shell exit
```
If you plan to use the root variant, check if you have root access
```bash
adb shell su -c exit
```
2. Copy the ADB device name
```bash
adb devices
```
## 🔨 ReVanced CLI Usage
- ### Show all available options for the ReVanced CLI
```bash
java -jar revanced-cli.jar -h
```
- ### List all available patches from supplied patch bundles
```bash
java -jar revanced-cli.jar \
-b revanced-patches.jar \
-l
```
- ### Use the ReVanced CLI without root permissions
```bash
java -jar revanced-cli.jar \
-a input.apk \
-o patched-output.apk \
-b revanced-patches.jar
```
- ### Mount the patched application with root permissions over the installed application
```bash
adb install input.apk # make sure the same version is installed
java -jar revanced-cli.jar \
-a input.apk \
-d device-name \
-o patched-output.apk \
-b revanced-patches.jar \
-e vanced-microg-support \
--mount
```
> **Note**:
>
> - If you want to exclude patches, you can use the option `-e`. In the case of YouTube, you can exclude
the `vanced-microg-support` patch from [ReVanced Patches](https://github.com/revanced/revanced-patches) with the
option `-e vanced-microg-support` when mounting for example.
>
> - Some patches from [ReVanced Patches](https://github.com/revanced/revanced-patches) also might require
[ReVanced Integrations](https://github.com/revanced/revanced-integrations). Supply them with the option `-m`.
> The integrations will be merged, if necessary automatically, if supplied.
>
> - If you supplied a device with the option `-d`, the patched application will be automatically installed on the
device.

8
docs/README.md Normal file
View File

@@ -0,0 +1,8 @@
# 💻 Documentation and guides of ReVanced CLI
This documentation explains how to use the [ReVanced CLI](https://github.com/revanced/revanced-cli).
## 📖 Table of contents
1. [💼 Prerequisites](0_prerequisites.md)
2. [🛠️ Using the ReVanced CLI](1_usage.md)

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.8.3
version = 2.21.0-dev.1

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

6580
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

9
package.json Normal file
View File

@@ -0,0 +1,9 @@
{
"devDependencies": {
"@saithodev/semantic-release-backmerge": "^3.1.0",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/git": "^10.0.1",
"gradle-semantic-release-plugin": "^1.7.6",
"semantic-release": "^20.1.0"
}
}

View File

@@ -1,12 +1,37 @@
package app.revanced.cli.aligning
import app.revanced.cli.command.MainCommand.logger
import app.revanced.patcher.PatcherResult
import app.revanced.utils.signing.align.ZipAligner
import app.revanced.utils.signing.align.zip.ZipFile
import app.revanced.utils.signing.align.zip.structures.ZipEntry
import java.io.File
object Aligning {
fun align(inputFile: File, outputFile: File) {
fun align(result: PatcherResult, inputFile: File, outputFile: File) {
logger.info("Aligning ${inputFile.name} to ${outputFile.name}")
ZipAligner.align(inputFile, outputFile)
if (outputFile.exists()) outputFile.delete()
ZipFile(outputFile).use { file ->
result.dexFiles.forEach {
file.addEntryCompressData(
ZipEntry.createWithName(it.name),
it.stream.readBytes()
)
}
result.resourceFile?.let {
file.copyEntriesFromFileAligned(
ZipFile(it),
ZipAligner::getEntryAlignment
)
}
file.copyEntriesFromFileAligned(
ZipFile(inputFile),
ZipAligner::getEntryAlignment
)
}
}
}

View File

@@ -7,15 +7,24 @@ import app.revanced.cli.patcher.logging.impl.PatcherLogger
import app.revanced.cli.signing.Signing
import app.revanced.cli.signing.SigningOptions
import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.data.Context
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.extensions.PatchExtensions.description
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.util.patch.PatchBundle
import app.revanced.utils.Options
import app.revanced.utils.Options.setOptions
import app.revanced.utils.adb.Adb
import picocli.CommandLine.*
import java.io.File
import java.nio.file.Files
/**
* Alias for return type of [PatchBundle.loadPatches].
*/
internal typealias PatchList = List<Class<out Patch<Context>>>
private class CLIVersionProvider : IVersionProvider {
override fun getVersion() = arrayOf(
MainCommand::class.java.`package`.implementationVersion ?: "unknown"
@@ -34,13 +43,16 @@ internal object MainCommand : Runnable {
lateinit var args: Args
class Args {
@Option(names = ["-a", "--apk"], description = ["Input file to be patched"], required = true)
@Option(names = ["-a", "--apk"], description = ["Input APK file to be patched"], required = true)
lateinit var inputFile: File
@Option(names = ["--uninstall"], description = ["Uninstall the mount variant"])
var uninstall: Boolean = false
@Option(names = ["-d", "--deploy-on"], description = ["If specified, deploy to adb device with given name"])
@Option(
names = ["-d", "--deploy-on"],
description = ["If specified, deploy to device over ADB with given name"]
)
var deploy: String? = null
@ArgGroup(exclusive = false)
@@ -48,9 +60,12 @@ internal object MainCommand : Runnable {
}
class PatchArgs {
@Option(names = ["-b", "--bundles"], description = ["One or more bundles of patches"], required = true)
@Option(names = ["-b", "--bundle"], description = ["One or more bundles of patches"], required = true)
var patchBundles = arrayOf<String>()
@Option(names = ["--options"], description = ["Path to patch options JSON file"])
var optionsFile: File = File("options.json")
@ArgGroup(exclusive = false)
var listingArgs: ListingArgs? = null
@@ -59,7 +74,7 @@ internal object MainCommand : Runnable {
}
class ListingArgs {
@Option(names = ["-l", "--list"], description = ["List patches only"], required = true)
@Option(names = ["-l", "--list"], description = ["List patches"], required = true)
var listOnly: Boolean = false
@Option(names = ["--with-versions"], description = ["List patches with compatible versions"])
@@ -67,9 +82,6 @@ internal object MainCommand : Runnable {
@Option(names = ["--with-packages"], description = ["List patches with compatible packages"])
var withPackages: Boolean = false
@Option(names = ["--with-descriptions"], description = ["List patches with their descriptions"])
var withDescriptions: Boolean = true
}
class PatchingArgs {
@@ -83,14 +95,11 @@ internal object MainCommand : Runnable {
names = ["--exclusive"],
description = ["Only installs the patches you include, not including any patch by default"]
)
var defaultExclude = false
var exclusive = false
@Option(names = ["-i", "--include"], description = ["Include patches"])
var includedPatches = arrayOf<String>()
@Option(names = ["-r", "--resource-patcher"], description = ["Disable patching resources"])
var disableResourcePatching: Boolean = false
@Option(names = ["--experimental"], description = ["Disable patch version compatibility patch"])
var experimental: Boolean = false
@@ -109,12 +118,12 @@ internal object MainCommand : Runnable {
@Option(names = ["-p", "--password"], description = ["Overwrite the default password for the signed file"])
var password = "ReVanced"
@Option(names = ["-t", "--temp-dir"], description = ["Temporal resource cache directory"])
@Option(names = ["-t", "--temp-dir"], description = ["Temporary resource cache directory"])
var cacheDirectory = "revanced-cache"
@Option(
names = ["-c", "--clean"],
description = ["Clean the temporal resource cache directory. This will be done anyways when running the patcher"]
description = ["Clean the temporary resource cache directory. This will be done anyways when running the patcher"]
)
var clean: Boolean = false
@@ -123,26 +132,25 @@ internal object MainCommand : Runnable {
}
override fun run() {
if (args.patchArgs?.listingArgs?.listOnly == true) {
printListOfPatches()
return
}
if (args.uninstall) {
uninstall()
return
}
if (args.patchArgs?.listingArgs?.listOnly == true) return printListOfPatches()
if (args.uninstall) return uninstall()
val pArgs = this.args.patchArgs?.patchingArgs ?: return
val outputFile = File(pArgs.outputPath) // the file to write to
// the file to write to
val outputFile = File(pArgs.outputPath)
val allPatches = args.patchArgs!!.patchBundles.flatMap { bundle ->
PatchBundle.Jar(bundle).loadPatches()
}
args.patchArgs!!.optionsFile.let {
if (it.exists()) allPatches.setOptions(it, logger)
else Options.serialize(allPatches, prettyPrint = true).let(it::writeText)
}
val patcher = app.revanced.patcher.Patcher(
PatcherOptions(
args.inputFile,
args.inputFile.also { if (!it.exists()) return logger.error("Input file ${args.inputFile} does not exist.") },
pArgs.cacheDirectory,
!pArgs.disableResourcePatching,
pArgs.aaptPath,
pArgs.cacheDirectory,
PatcherLogger
@@ -151,19 +159,17 @@ internal object MainCommand : Runnable {
// prepare adb
val adb: Adb? = args.deploy?.let {
Adb(outputFile, patcher.data.packageMetadata.packageName, args.deploy!!, !pArgs.mount)
Adb(outputFile, patcher.context.packageMetadata.packageName, args.deploy!!, !pArgs.mount)
}
val patchedFile = File(pArgs.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk")
// start the patcher
Patcher.start(patcher, patchedFile)
val result = Patcher.start(patcher, allPatches)
val cacheDirectory = File(pArgs.cacheDirectory)
// align the file
val alignedFile = cacheDirectory.resolve("${outputFile.nameWithoutExtension}_aligned.apk")
Aligning.align(patchedFile, alignedFile)
Aligning.align(result, args.inputFile, alignedFile)
// sign the file
val finalFile = if (!pArgs.mount) {
@@ -209,26 +215,23 @@ internal object MainCommand : Runnable {
}
private fun uninstall() {
// temporarily get package name using Patcher method
// fix: abstract options in patcher
val patcher = app.revanced.patcher.Patcher(
PatcherOptions(
args.inputFile,
"uninstaller-cache",
val adb: Adb? = args.deploy?.let {
Adb(
File("placeholder_file"),
app.revanced.patcher.Patcher(PatcherOptions(args.inputFile, "")).context.packageMetadata.packageName,
args.deploy!!,
false
)
)
File("uninstaller-cache").deleteRecursively()
val adb: Adb? = args.deploy?.let {
Adb(File("placeholder_file"), patcher.data.packageMetadata.packageName, args.deploy!!, false)
}
adb?.uninstall()
}
private fun printListOfPatches() {
for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in JarPatchBundle(patchBundlePath).loadPatches()) {
for (compatiblePackage in patch.compatiblePackages!!) {
val logged = mutableListOf<String>()
for (patchBundlePath in args.patchArgs?.patchBundles!!) for (patch in PatchBundle.Jar(patchBundlePath)
.loadPatches()) {
if (patch.patchName in logged) continue
for (compatiblePackage in patch.compatiblePackages ?: continue) {
val packageEntryStr = buildString {
// Add package if flag is set
if (args.patchArgs?.listingArgs?.withPackages == true) {
@@ -236,22 +239,24 @@ internal object MainCommand : Runnable {
append(packageName)
append("\t")
}
// Add patch name
val patchName = patch.patchName.padStart(25)
append(patchName)
// Add description if flag is set.
if (args.patchArgs?.listingArgs?.withDescriptions == true) {
append("\t")
append(patch.description)
}
append("\t")
append(patch.description)
// Add compatible versions, if flag is set
if (args.patchArgs?.listingArgs?.withVersions == true) {
val compatibleVersions = compatiblePackage.versions.joinToString(separator = ", ")
append("\t")
append(compatibleVersions)
}
}
logged.add(patch.patchName)
logger.info(packageEntryStr)
}
}

View File

@@ -1,48 +1,23 @@
package app.revanced.cli.patcher
import app.revanced.cli.command.MainCommand.args
import app.revanced.cli.command.MainCommand.logger
import app.revanced.utils.filesystem.ZipFileSystemUtils
import app.revanced.cli.command.PatchList
import app.revanced.patcher.PatcherResult
import app.revanced.utils.patcher.addPatchesFiltered
import app.revanced.utils.patcher.applyPatchesVerbose
import app.revanced.utils.patcher.mergeFiles
import java.io.File
import java.nio.file.Files
internal object Patcher {
internal fun start(patcher: app.revanced.patcher.Patcher, output: File) {
val inputFile = args.inputFile
val args = args.patchArgs?.patchingArgs!!
internal fun start(
patcher: app.revanced.patcher.Patcher,
allPatches: PatchList
): PatcherResult {
// merge files like necessary integrations
patcher.mergeFiles()
// add patches, but filter incompatible or excluded patches
patcher.addPatchesFiltered()
patcher.addPatchesFiltered(allPatches)
// apply patches
patcher.applyPatchesVerbose()
// write output file
if (output.exists()) Files.delete(output.toPath())
inputFile.copyTo(output)
val result = patcher.save()
ZipFileSystemUtils(output).use { outputFileSystem ->
// replace all dex files
result.dexFiles.forEach {
logger.info("Writing dex file ${it.name}")
outputFileSystem.write(it.name, it.dexFileInputStream.readAllBytes())
}
if (!args.disableResourcePatching) {
logger.info("Writing resources...")
ZipFileSystemUtils(result.resourceFile!!).use { resourceFileSystem ->
val resourceFiles = resourceFileSystem.getFile(File.separator)
outputFileSystem.writePathRecursively(resourceFiles)
}
}
result.doNotCompress?.let { outputFileSystem.uncompress(*it.toTypedArray()) }
}
return patcher.save()
}
}

View File

@@ -0,0 +1,103 @@
package app.revanced.utils
import app.revanced.cli.command.PatchList
import app.revanced.cli.logging.CliLogger
import app.revanced.patcher.extensions.PatchExtensions.options
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.patch.NoSuchOptionException
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import java.io.File
internal object Options {
private var mapper = jacksonObjectMapper()
/**
* Serializes the options for the patches in the list.
*
* @param patches The list of patches to serialize.
* @param prettyPrint Whether to pretty print the JSON.
* @return The JSON string containing the options.
* @see PatchList
*/
fun serialize(patches: PatchList, prettyPrint: Boolean = false): String = patches
.filter { it.options?.any() == true }
.map { patch ->
PatchOption(
patch.patchName,
patch.options!!.map { option -> PatchOption.Option(option.key, option.value) }
)
}.let {
if (prettyPrint)
mapper.writerWithDefaultPrettyPrinter().writeValueAsString(it)
else
mapper.writeValueAsString(it)
}
/**
* Deserializes the options for the patches in the list.
*
* @param json The JSON string containing the options.
* @return The list of [PatchOption]s.
* @see PatchOption
* @see PatchList
*/
@Suppress("MemberVisibilityCanBePrivate")
fun deserialize(json: String): Array<PatchOption> = mapper.readValue(json, Array<PatchOption>::class.java)
/**
* Sets the options for the patches in the list.
*
* @param json The JSON string containing the options.
* @param logger The logger to use for logging.
*/
fun PatchList.setOptions(json: String, logger: CliLogger? = null) {
filter { it.options?.any() == true }.let { patches ->
if (patches.isEmpty()) return
val patchOptions = deserialize(json)
patches.forEach { patch ->
patchOptions.find { option -> option.patchName == patch.patchName }?.let {
it.options.forEach { option ->
try {
patch.options?.set(option.key, option.value)
?: logger?.warn("${patch.patchName} has no options")
} catch (e: NoSuchOptionException) {
logger?.error(e.message ?: "Unknown error")
}
}
}
}
}
}
/**
* Sets the options for the patches in the list.
*
* @param file The file containing the JSON string containing the options.
* @param logger The logger to use for logging.
* @see setOptions
*/
fun PatchList.setOptions(file: File, logger: CliLogger? = null) = setOptions(file.readText(), logger)
/**
* Data class for a patch and its [Option]s.
*
* @property patchName The name of the patch.
* @property options The [Option]s for the patch.
*/
internal data class PatchOption(
val patchName: String,
val options: List<Option>
) {
/**
* Data class for patch option.
*
* @property key The name of the option.
* @property value The value of the option.
*/
internal data class Option(val key: String, val value: Any?)
}
}

View File

@@ -17,7 +17,7 @@ internal class Adb(
private val device: JadbDevice
init {
device = JadbConnection().devices.find { it.serial == deviceName }
device = JadbConnection().devices.let { device -> device.find { it.serial == deviceName } ?: device.first() }
?: throw IllegalArgumentException("No such device with name $deviceName")
if (!modeInstall && device.run("su -h", false) != 0)

View File

@@ -9,7 +9,7 @@ internal object Constants {
internal const val COMMAND_PID_OF = "pidof -s"
internal const val COMMAND_CREATE_DIR = "mkdir -p"
internal const val COMMAND_LOGCAT = "logcat -c && logcat | grep AndroidRuntime"
internal const val COMMAND_RESTART = "monkey -p $PLACEHOLDER 1 && kill ${'$'}($COMMAND_PID_OF $PLACEHOLDER)"
internal const val COMMAND_RESTART = "pm resolve-activity --brief $PLACEHOLDER | tail -n 1 | xargs am start -n && kill ${'$'}($COMMAND_PID_OF $PLACEHOLDER)"
// default mount file name
private const val NAME_MOUNT_SCRIPT = "mount_revanced_$PLACEHOLDER.sh"
@@ -35,7 +35,7 @@ internal object Constants {
// unmount command
internal const val COMMAND_UMOUNT =
"stock_path=${'$'}( pm path $PLACEHOLDER | grep base | sed 's/package://g' ) && umount -l ${'$'}stock_path"
"grep $PLACEHOLDER /proc/mounts | while read -r line; do echo ${'$'}line | cut -d \" \" -f 2 | sed 's/apk.*/apk/' | xargs -r umount -l; done"
// install mount script & set permissions
internal const val COMMAND_INSTALL_MOUNT = "mv $PATH_INIT_PUSH $PATH_MOUNT && $COMMAND_CHMOD_MOUNT $PATH_MOUNT"
@@ -44,12 +44,14 @@ internal object Constants {
internal val CONTENT_MOUNT_SCRIPT =
"""
#!/system/bin/sh
MAGISKTMP="${'$'}(magisk --path)" || MAGISKTMP=/sbin
MIRROR="${'$'}MAGISKTMP/.magisk/mirror"
while [ "${'$'}(getprop sys.boot_completed | tr -d '\r')" != "1" ]; do sleep 1; done
base_path="$PATH_REVANCED_APP"
stock_path=${'$'}( pm path $PLACEHOLDER | grep base | sed 's/package://g' )
chcon u:object_r:apk_data_file:s0 ${'$'}base_path
mount -o bind ${'$'}base_path ${'$'}stock_path
mount -o bind ${'$'}MIRROR${'$'}base_path ${'$'}stock_path
""".trimIndent()
}

View File

@@ -1,64 +0,0 @@
package app.revanced.utils.filesystem
import java.io.Closeable
import java.io.File
import java.nio.file.FileSystems
import java.nio.file.Files
import java.nio.file.Path
import java.util.zip.ZipEntry
internal class ZipFileSystemUtils(
file: File
) : Closeable {
private var zipFileSystem = FileSystems.newFileSystem(file.toPath(), mapOf("noCompression" to true))
private fun Path.deleteRecursively() {
if (!Files.exists(this)) {
throw IllegalStateException("File exists in real folder but not in zip file system")
}
if (Files.isDirectory(this)) {
Files.list(this).forEach { path ->
path.deleteRecursively()
}
}
Files.delete(this)
}
internal fun getFile(path: String) = zipFileSystem.getPath(path)
internal fun writePathRecursively(path: Path) {
Files.list(path).use { fileStream ->
fileStream.forEach { filePath ->
val fileSystemPath = filePath.getRelativePath(path)
fileSystemPath.deleteRecursively()
}
}
Files.walk(path).use { fileStream ->
// don't include build directory
// by skipping the root node.
fileStream.skip(1).forEach { filePath ->
val relativePath = filePath.getRelativePath(path)
if (Files.isDirectory(filePath)) {
Files.createDirectory(relativePath)
return@forEach
}
Files.copy(filePath, relativePath)
}
}
}
internal fun write(path: String, content: ByteArray) = Files.write(zipFileSystem.getPath(path), content)
private fun Path.getRelativePath(path: Path): Path = zipFileSystem.getPath(path.relativize(this).toString())
// TODO: figure out why the file system is uncompressed by default and how to fix it
internal fun uncompress(vararg paths: String) =
paths.forEach { Files.setAttribute(zipFileSystem.getPath(it), "zip:method", ZipEntry.STORED) }
override fun close() = zipFileSystem.close()
}

View File

@@ -3,65 +3,63 @@ package app.revanced.utils.patcher
import app.revanced.cli.command.MainCommand
import app.revanced.cli.command.MainCommand.args
import app.revanced.cli.command.MainCommand.logger
import app.revanced.cli.command.PatchList
import app.revanced.patcher.Patcher
import app.revanced.patcher.data.Data
import app.revanced.patcher.data.Context
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.extensions.PatchExtensions.include
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.util.patch.implementation.JarPatchBundle
fun Patcher.addPatchesFiltered() {
val packageName = this.data.packageMetadata.packageName
val packageVersion = this.data.packageMetadata.packageVersion
fun Patcher.addPatchesFiltered(allPatches: PatchList) {
val packageName = this.context.packageMetadata.packageName
val packageVersion = this.context.packageMetadata.packageVersion
args.patchArgs?.patchBundles!!.forEach { bundle ->
val includedPatches = mutableListOf<Class<out Patch<Data>>>()
JarPatchBundle(bundle).loadPatches().forEach patch@{ patch ->
val compatiblePackages = patch.compatiblePackages
val patchName = patch.patchName
val includedPatches = mutableListOf<Class<out Patch<Context>>>()
allPatches.forEach patchLoop@{ patch ->
val compatiblePackages = patch.compatiblePackages
val patchName = patch.patchName
val args = MainCommand.args.patchArgs?.patchingArgs!!
val prefix = "Skipping $patchName"
val prefix = "Skipping $patchName"
val args = MainCommand.args.patchArgs?.patchingArgs!!
if (args.excludedPatches.contains(patchName)) {
logger.info("$prefix: Explicitly excluded")
return@patch
} else if ((!patch.include || args.defaultExclude) && !args.includedPatches.contains(patchName)) {
logger.info("$prefix: Not explicitly included")
return@patch
if (compatiblePackages == null) logger.trace("$patchName: No constraint on packages.")
else {
if (!compatiblePackages.any { it.name == packageName }) {
logger.trace("$prefix: Incompatible with $packageName. This patch is only compatible with ${
compatiblePackages.joinToString(
", "
) { it.name }
}")
return@patchLoop
}
if (compatiblePackages == null) logger.warn("$prefix: Missing compatibility annotation. Continuing.")
else {
if (!compatiblePackages.any { it.name == packageName }) {
logger.warn("$prefix: Incompatible with $packageName. This patch is only compatible with ${
compatiblePackages.joinToString(
", "
) { it.name }
}")
return@patch
}
if (!(args.experimental || compatiblePackages.any { it.versions.isEmpty() || it.versions.any { version -> version == packageVersion } })) {
val compatibleWith = compatiblePackages.map { _package ->
"${_package.name}: ${_package.versions.joinToString(", ")}"
}.joinToString(";")
logger.warn("$prefix: Incompatible with version $packageVersion. This patch is only compatible with version $compatibleWith")
return@patch
if (!(args.experimental || compatiblePackages.any { it.versions.isEmpty() || it.versions.any { version -> version == packageVersion } })) {
val compatibleWith = compatiblePackages.joinToString(";") { _package ->
"${_package.name}: ${_package.versions.joinToString(", ")}"
}
logger.warn("$prefix: Incompatible with version $packageVersion. This patch is only compatible with $compatibleWith")
return@patchLoop
}
logger.trace("Adding $patchName")
includedPatches.add(patch)
}
this.addPatches(includedPatches)
if (args.excludedPatches.contains(patchName)) {
logger.info("$prefix: Manually excluded")
return@patchLoop
} else if ((!patch.include || args.exclusive) && !args.includedPatches.contains(patchName)) {
logger.info("$prefix: Excluded by default")
return@patchLoop
}
logger.trace("Adding $patchName")
includedPatches.add(patch)
}
this.addPatches(includedPatches)
}
fun Patcher.applyPatchesVerbose() {
this.applyPatches().forEach { (patch, result) ->
this.executePatches().forEach { (patch, result) ->
if (result.isSuccess) {
logger.info("$patch succeeded")
return@forEach
@@ -72,7 +70,7 @@ fun Patcher.applyPatchesVerbose() {
}
fun Patcher.mergeFiles() {
this.addFiles(args.patchArgs?.patchingArgs!!.mergeFiles) { file ->
this.addIntegrations(args.patchArgs?.patchingArgs!!.mergeFiles) { file ->
logger.info("Merging $file")
}
}

View File

@@ -1,28 +1,11 @@
package app.revanced.utils.signing.align
import app.revanced.utils.signing.align.zip.ZipFile
import java.io.File
import app.revanced.utils.signing.align.zip.structures.ZipEntry
internal object ZipAligner {
private const val DEFAULT_ALIGNMENT = 4
private const val LIBRARY_ALIGNMENT = 4096
fun align(input: File, output: File) {
val inputZip = ZipFile(input)
val outputZip = ZipFile(output)
for (entry in inputZip.entries) {
val data = inputZip.getDataForEntry(entry)
if (entry.compression == 0.toUShort()) {
val alignment = if (entry.fileName.endsWith(".so")) LIBRARY_ALIGNMENT else DEFAULT_ALIGNMENT
outputZip.addEntryAligned(entry, data, alignment)
} else {
outputZip.addEntry(entry, data)
}
}
outputZip.finish()
}
fun getEntryAlignment(entry: ZipEntry): Int? =
if (entry.compression.toUInt() != 0u) null else if (entry.fileName.endsWith(".so")) LIBRARY_ALIGNMENT else DEFAULT_ALIGNMENT
}

View File

@@ -2,15 +2,21 @@ package app.revanced.utils.signing.align.zip
import app.revanced.utils.signing.align.zip.structures.ZipEndRecord
import app.revanced.utils.signing.align.zip.structures.ZipEntry
import java.io.Closeable
import java.io.File
import java.io.RandomAccessFile
import java.nio.ByteBuffer
import java.nio.channels.FileChannel
import java.util.zip.CRC32
import java.util.zip.Deflater
class ZipFile(val file: File) {
class ZipFile(file: File) : Closeable {
var entries: MutableList<ZipEntry> = mutableListOf()
private val filePointer: RandomAccessFile = RandomAccessFile(file, "rw")
private var CDNeedsRewrite = false
private val compressionLevel = 5
init {
//if file isn't empty try to load entries
@@ -53,23 +59,24 @@ class ZipFile(val file: File) {
return buildList(numberOfEntries) {
for (i in 1..numberOfEntries) {
add(ZipEntry.fromCDE(filePointer).also
{
//for some reason the local extra field can be different from the central one
it.readLocalExtra(
filePointer.channel.map(
FileChannel.MapMode.READ_ONLY,
it.localHeaderOffset.toLong() + 28,
2
add(
ZipEntry.fromCDE(filePointer).also
{
//for some reason the local extra field can be different from the central one
it.readLocalExtra(
filePointer.channel.map(
FileChannel.MapMode.READ_ONLY,
it.localHeaderOffset.toLong() + 28,
2
)
)
)
})
})
}
}
}
private fun writeCDE() {
val CDEStart = filePointer.channel.position().toUInt()
private fun writeCD() {
val CDStart = filePointer.channel.position().toUInt()
entries.forEach {
filePointer.channel.write(it.toCDE())
@@ -82,15 +89,17 @@ class ZipFile(val file: File) {
0u,
entriesCount,
entriesCount,
filePointer.channel.position().toUInt() - CDEStart,
CDEStart,
filePointer.channel.position().toUInt() - CDStart,
CDStart,
""
)
filePointer.channel.write(endRecord.toECD())
}
fun addEntry(entry: ZipEntry, data: ByteBuffer) {
private fun addEntry(entry: ZipEntry, data: ByteBuffer) {
CDNeedsRewrite = true
entry.localHeaderOffset = filePointer.channel.position().toUInt()
filePointer.channel.write(entry.toLFH())
@@ -99,17 +108,45 @@ class ZipFile(val file: File) {
entries.add(entry)
}
fun addEntryAligned(entry: ZipEntry, data: ByteBuffer, alignment: Int) {
//calculate where data would end up
val dataOffset = filePointer.filePointer + entry.LFHSize
fun addEntryCompressData(entry: ZipEntry, data: ByteArray) {
val compressor = Deflater(compressionLevel, true)
compressor.setInput(data)
compressor.finish()
val mod = dataOffset % alignment
val uncompressedSize = data.size
val compressedData =
ByteArray(uncompressedSize) //i'm guessing compression won't make the data bigger
//wrong alignment
if (mod != 0L) {
//add padding at end of extra field
entry.localExtraField =
entry.localExtraField.copyOf((entry.localExtraField.size + (alignment - mod)).toInt())
val compressedDataLength = compressor.deflate(compressedData)
val compressedBuffer =
ByteBuffer.wrap(compressedData.take(compressedDataLength).toByteArray())
compressor.end()
val crc = CRC32()
crc.update(data)
entry.compression = 8u //deflate compression
entry.uncompressedSize = uncompressedSize.toUInt()
entry.compressedSize = compressedDataLength.toUInt()
entry.crc32 = crc.value.toUInt()
addEntry(entry, compressedBuffer)
}
private fun addEntryCopyData(entry: ZipEntry, data: ByteBuffer, alignment: Int? = null) {
alignment?.let {
//calculate where data would end up
val dataOffset = filePointer.filePointer + entry.LFHSize
val mod = dataOffset % alignment
//wrong alignment
if (mod != 0L) {
//add padding at end of extra field
entry.localExtraField =
entry.localExtraField.copyOf((entry.localExtraField.size + (alignment - mod)).toInt())
}
}
addEntry(entry, data)
@@ -123,8 +160,17 @@ class ZipFile(val file: File) {
)
}
fun finish() {
writeCDE()
fun copyEntriesFromFileAligned(file: ZipFile, entryAlignment: (entry: ZipEntry) -> Int?) {
for (entry in file.entries) {
if (entries.any { it.fileName == entry.fileName }) continue //don't add duplicates
val data = file.getDataForEntry(entry)
addEntryCopyData(entry, data, entryAlignment(entry))
}
}
override fun close() {
if (CDNeedsRewrite) writeCD()
filePointer.close()
}
}
}

Some files were not shown because too many files have changed in this diff Show More