mirror of
https://github.com/ReVanced/revanced-api.git
synced 2026-01-18 00:43:57 +00:00
Compare commits
18 Commits
v1.0.0-dev
...
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d18e09cba3 | ||
|
|
bc919b85f5 | ||
|
|
665de7bcd0 | ||
|
|
dfe6df3ef6 | ||
|
|
39d0b78c79 | ||
|
|
435beae383 | ||
|
|
03fb28cd10 | ||
|
|
7214214d42 | ||
|
|
236e7e7907 | ||
|
|
541783d959 | ||
|
|
db41081155 | ||
|
|
c40d50c013 | ||
|
|
b3c82535eb | ||
|
|
f814fe5825 | ||
|
|
a34b7c8c31 | ||
|
|
ad7d4b226f | ||
|
|
97a5d119ec | ||
|
|
2ade550d58 |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -45,7 +45,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
fingerprint: ${{ env.GPG_FINGERPRINT }}
|
fingerprint: ${{ vars.GPG_FINGERPRINT }}
|
||||||
|
|
||||||
- name: Setup QEMU
|
- name: Setup QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -43,3 +43,5 @@ docker-compose.yml
|
|||||||
patches-public-key.asc
|
patches-public-key.asc
|
||||||
integrations-public-key.asc
|
integrations-public-key.asc
|
||||||
node_modules/
|
node_modules/
|
||||||
|
static/
|
||||||
|
about.json
|
||||||
149
CHANGELOG.md
149
CHANGELOG.md
@@ -1,3 +1,152 @@
|
|||||||
|
# [1.1.0](https://github.com/ReVanced/revanced-api/compare/v1.0.0...v1.1.0) (2024-07-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Don't encode public keys & instead send them raw ([435beae](https://github.com/ReVanced/revanced-api/commit/435beae3831fc8ce161aec676ff20f253b1caf66))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add static file paths to remove env specific files in resources ([39d0b78](https://github.com/ReVanced/revanced-api/commit/39d0b78c7919f684439b6f052ab3f064159c2a70))
|
||||||
|
* Convert static about file to documented route & add key parameter to about route ([dfe6df3](https://github.com/ReVanced/revanced-api/commit/dfe6df3ef6006d06681673bcfaf87c44c40ad446))
|
||||||
|
|
||||||
|
# [1.1.0-dev.1](https://github.com/ReVanced/revanced-api/compare/v1.0.0...v1.1.0-dev.1) (2024-07-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Don't encode public keys & instead send them raw ([435beae](https://github.com/ReVanced/revanced-api/commit/435beae3831fc8ce161aec676ff20f253b1caf66))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add static file paths to remove env specific files in resources ([39d0b78](https://github.com/ReVanced/revanced-api/commit/39d0b78c7919f684439b6f052ab3f064159c2a70))
|
||||||
|
* Convert static about file to documented route & add key parameter to about route ([dfe6df3](https://github.com/ReVanced/revanced-api/commit/dfe6df3ef6006d06681673bcfaf87c44c40ad446))
|
||||||
|
|
||||||
|
# 1.0.0 (2024-07-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Add missing auth realm ([a6008a2](https://github.com/ReVanced/revanced-api/commit/a6008a2fb6d01fb577dcf357a1d698b6c1068b31))
|
||||||
|
* Add missing OpenAPI docs ([d4ac471](https://github.com/ReVanced/revanced-api/commit/d4ac47194e51b3e708516150d1690a72830ab809))
|
||||||
|
* add required headers ([#8](https://github.com/ReVanced/revanced-api/issues/8)) ([f4c10dc](https://github.com/ReVanced/revanced-api/commit/f4c10dc064c4ac0fb6b8e612d680e4f6bda2b0c7))
|
||||||
|
* Add uri to rate limiter request key ([e8c2488](https://github.com/ReVanced/revanced-api/commit/e8c2488bc61793345c4b8171e520fb0127b34643))
|
||||||
|
* **ci:** add git dep ([d61ddcc](https://github.com/ReVanced/revanced-api/commit/d61ddcc8ac76d78b7a79c09bbfba812f652aa4cf))
|
||||||
|
* **ci:** fix git deps ([5564c2d](https://github.com/ReVanced/revanced-api/commit/5564c2da0946d67abab0f95e43fe6e6b108f5ec7))
|
||||||
|
* Configure CORS correctly ([2ed4cf3](https://github.com/ReVanced/revanced-api/commit/2ed4cf3b40caeb6181d068d411344e6732000f22))
|
||||||
|
* Correct env var comment ([9d7b049](https://github.com/ReVanced/revanced-api/commit/9d7b0493498bbf594928fc61181beadf6f59643b))
|
||||||
|
* Correct persistence directory name ([6238e33](https://github.com/ReVanced/revanced-api/commit/6238e33c42216885d5e9e8075bfc46eaf2a990ed))
|
||||||
|
* **deps:** fix requirements file ([5f0ab26](https://github.com/ReVanced/revanced-api/commit/5f0ab26cedef27cc95eec58ea4dce00904b53289))
|
||||||
|
* **deps:** missing pydantic ([089f29e](https://github.com/ReVanced/revanced-api/commit/089f29e95fc6b87f90885eb31b8e3460857224a8))
|
||||||
|
* **deps:** update poetry.lock ([b2c2fa7](https://github.com/ReVanced/revanced-api/commit/b2c2fa7136f6305703ba11d0bd5a87c0d563eaf3))
|
||||||
|
* Don't configure server ([280dbc3](https://github.com/ReVanced/revanced-api/commit/280dbc30f607483adad0bde6ab1b016d5da047ba))
|
||||||
|
* Encode defaults to fix OpenAPI spec ([e9d1c8f](https://github.com/ReVanced/revanced-api/commit/e9d1c8fae0bc46e761056197658c4bb045784104))
|
||||||
|
* Finish DB Model to API model transformation inside transaction ([89a577e](https://github.com/ReVanced/revanced-api/commit/89a577e91abbfcd2865e770088661eac4aeb4dd7))
|
||||||
|
* fix codeql issues ([b5568db](https://github.com/ReVanced/revanced-api/commit/b5568db79fa0620d06d6945b42a66744b6340bc5))
|
||||||
|
* Fix OpenAPI docs casing of a word ([541783d](https://github.com/ReVanced/revanced-api/commit/541783d9599c257f184d1b244e1b857b7c200227))
|
||||||
|
* Fix spelling mistake ([17ecf58](https://github.com/ReVanced/revanced-api/commit/17ecf58e550d13dd93ab69e1cf522366aeb3da3f))
|
||||||
|
* Increase pool size to mitigate overflow ([#113](https://github.com/ReVanced/revanced-api/issues/113)) ([5aed3d6](https://github.com/ReVanced/revanced-api/commit/5aed3d6ce6efcaf04b3cfa8f344623413518c9b1))
|
||||||
|
* Move old API endpoint configuration from env to configuration file ([7e99e49](https://github.com/ReVanced/revanced-api/commit/7e99e49af202c4ec0a0d7e61dd0182dd2097e867))
|
||||||
|
* Move robots.txt to root ([2ade550](https://github.com/ReVanced/revanced-api/commit/2ade550d58c0e4b53fa7417bef0064f4f476aed8))
|
||||||
|
* Only list public members ([97a5d11](https://github.com/ReVanced/revanced-api/commit/97a5d119ec415f9c25fbc50cb240603047defc73))
|
||||||
|
* Remove punctuation ([f9cae1e](https://github.com/ReVanced/revanced-api/commit/f9cae1ea56c93aded25159f6b0814bf84d192192))
|
||||||
|
* remove revanced-api from tools map ([4800ee9](https://github.com/ReVanced/revanced-api/commit/4800ee96a82c0a9fc1905c6960cd560b55304944))
|
||||||
|
* Serialize response correctly ([1dccfd2](https://github.com/ReVanced/revanced-api/commit/1dccfd2deff3c5de6a6cf2156cac8516b40bdd22))
|
||||||
|
* Set body for all eligible request methods ([c6cacef](https://github.com/ReVanced/revanced-api/commit/c6cacef907a5039ed029e1e26204aaba8e698aaa))
|
||||||
|
* unversioned endpoints placement under v0 should be at root ([8b29f49](https://github.com/ReVanced/revanced-api/commit/8b29f49805d4a651bdd26aa4958a3639760a2f4b))
|
||||||
|
* Use correct persistance folder path ([500a589](https://github.com/ReVanced/revanced-api/commit/500a5896e34f6a9600dcec2834b3d340161bb90a))
|
||||||
|
* Use correct proxy path ([ef92768](https://github.com/ReVanced/revanced-api/commit/ef927688a377c16fe37b578ea870207871c30056))
|
||||||
|
* Use correct resource path ([4dffd32](https://github.com/ReVanced/revanced-api/commit/4dffd32c99a5a3deafe21bc9e9960795ff93ff1d))
|
||||||
|
* Use multidict 6.0.5, add setup tools as dev dependency ([af19446](https://github.com/ReVanced/revanced-api/commit/af19446a67445e96624dfdb9f1fa6b4de77545c8))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add `/list` route ([6c930ff](https://github.com/ReVanced/revanced-api/commit/6c930fff9a99f9ee23edd3d661694d2074f53b23))
|
||||||
|
* Add `preferred` field to socials ([#100](https://github.com/ReVanced/revanced-api/issues/100)) ([24c8f60](https://github.com/ReVanced/revanced-api/commit/24c8f60a707ebec9465d9fdcd234b1c949a11a60))
|
||||||
|
* Add announcements API ([42f7318](https://github.com/ReVanced/revanced-api/commit/42f731854d0b91070bd7b075054d67d3d9e1d1b4))
|
||||||
|
* Add announcements endpoints ([#91](https://github.com/ReVanced/revanced-api/issues/91)) ([8583e2a](https://github.com/ReVanced/revanced-api/commit/8583e2a2bbdd62c4c10eb2af607f0bf6b686331c))
|
||||||
|
* Add backend rate limit route ([b967170](https://github.com/ReVanced/revanced-api/commit/b9671703be9f0842c00c38caa0953a177dc74491))
|
||||||
|
* Add bio field for team members ([c40d50c](https://github.com/ReVanced/revanced-api/commit/c40d50c01368cb6b9ab06857694ec51d27aba2cb))
|
||||||
|
* Add CLI ([a988ffb](https://github.com/ReVanced/revanced-api/commit/a988ffbd2303a79ee18be7263ef6cd45c7bc4daf))
|
||||||
|
* Add configuration to specify public key id ([ad7d4b2](https://github.com/ReVanced/revanced-api/commit/ad7d4b226f71fd965421dc2f2a51825c8e8b3036))
|
||||||
|
* add download_count to releases ([#118](https://github.com/ReVanced/revanced-api/issues/118)) ([665b913](https://github.com/ReVanced/revanced-api/commit/665b913c04edd8e55e7ba89839c5c39f8dfa42ac))
|
||||||
|
* add friendly crypto names ([#53](https://github.com/ReVanced/revanced-api/issues/53)) ([7b70780](https://github.com/ReVanced/revanced-api/commit/7b707807cc307c1a64abbb09983fb70d5b095698))
|
||||||
|
* Add GPG key to team members ([71f58cf](https://github.com/ReVanced/revanced-api/commit/71f58cf352e06b8504e00582e0c68aec55c4688b))
|
||||||
|
* Add local ReVanced API server ([cd5d57f](https://github.com/ReVanced/revanced-api/commit/cd5d57f8f87125df361e23715eda6e755203d727))
|
||||||
|
* Add manager route ([f814fe5](https://github.com/ReVanced/revanced-api/commit/f814fe5825eb8b864f2b0cba53ff721eba577eb4))
|
||||||
|
* add member gpg keys ([80cdb3b](https://github.com/ReVanced/revanced-api/commit/80cdb3be6ad2264977bf84269b09546a744576f5))
|
||||||
|
* Add OpenAPI docs and cache to routes ([6ea63be](https://github.com/ReVanced/revanced-api/commit/6ea63be490e7786c6486ee78c1fa38f302e8b81c))
|
||||||
|
* add preferred field to donations ([#56](https://github.com/ReVanced/revanced-api/issues/56)) ([6b705b1](https://github.com/ReVanced/revanced-api/commit/6b705b10545d5e6d2c9424275fbbd996bc45089f))
|
||||||
|
* Add proxy for old API ([39f54bb](https://github.com/ReVanced/revanced-api/commit/39f54bbb32512a6df255bbec6821f7f7acf91340))
|
||||||
|
* Add rate limiting to routes ([80403f7](https://github.com/ReVanced/revanced-api/commit/80403f7130cd48e68e802ee3111760256e49c77d))
|
||||||
|
* added branding ([#104](https://github.com/ReVanced/revanced-api/issues/104)) ([edcad62](https://github.com/ReVanced/revanced-api/commit/edcad620f29ee7e522bbc3a29db607f9823d9ce9))
|
||||||
|
* API Fixes and Adjustments ([#23](https://github.com/ReVanced/revanced-api/issues/23)) ([b18097e](https://github.com/ReVanced/revanced-api/commit/b18097e030c82e97f3880fd0788b562645f6e002))
|
||||||
|
* API rewrite ([#2](https://github.com/ReVanced/revanced-api/issues/2)) ([45ef337](https://github.com/ReVanced/revanced-api/commit/45ef33741c7a8fbd0144fda04370fe361a1d7c0c))
|
||||||
|
* better versioning engine ([8d36663](https://github.com/ReVanced/revanced-api/commit/8d36663610164d8198c18e5080184c1357f29254))
|
||||||
|
* Change default port to avoid using existing port ([9825865](https://github.com/ReVanced/revanced-api/commit/9825865bbc7505fc3e808d21a46a151151796591))
|
||||||
|
* Disallow all web crawlers ([#111](https://github.com/ReVanced/revanced-api/issues/111)) ([b69acfa](https://github.com/ReVanced/revanced-api/commit/b69acfa8d7f5385735f933a761239be6afd07384))
|
||||||
|
* Do not ignore, if `.env` file is missing ([24c6f4e](https://github.com/ReVanced/revanced-api/commit/24c6f4e4354b4e6da0e4a4e7f0ee0a7a5e3c90ed))
|
||||||
|
* favicon ([a8126d7](https://github.com/ReVanced/revanced-api/commit/a8126d785f8f828a746f7f1ce2fe20d1a605e8f8))
|
||||||
|
* hostname filtering ([5482d9c](https://github.com/ReVanced/revanced-api/commit/5482d9c44245bae75007935db6ec02fb553bfa2d))
|
||||||
|
* Implement more routes and add configuration ([9999b24](https://github.com/ReVanced/revanced-api/commit/9999b242ad05dcea9e6b021e3ed4eeead4567805))
|
||||||
|
* Improve routing paths ([df999c0](https://github.com/ReVanced/revanced-api/commit/df999c00c4c1f8645cc67ae19b732f0af9d71823))
|
||||||
|
* info endpoint ([#71](https://github.com/ReVanced/revanced-api/issues/71)) ([9bbd056](https://github.com/ReVanced/revanced-api/commit/9bbd056c1bc6a30059a8ed0a47823c228531e4c0))
|
||||||
|
* Initialize project ([8ae50b5](https://github.com/ReVanced/revanced-api/commit/8ae50b543eb78f2173c66acc2e9b676a7026f80a))
|
||||||
|
* List more repository contributors ([19ebc82](https://github.com/ReVanced/revanced-api/commit/19ebc827bfb54a597dd06f9d99bdc820ee9977ee))
|
||||||
|
* Load system properties ([e373d26](https://github.com/ReVanced/revanced-api/commit/e373d269982428357bd04b659d9d17110cf0d5d2))
|
||||||
|
* manager-related endpoints ([3a128c4](https://github.com/ReVanced/revanced-api/commit/3a128c4661b161dc9961837056a3b64b84824162))
|
||||||
|
* Move config file to CLI argument ([6a9f0ca](https://github.com/ReVanced/revanced-api/commit/6a9f0cadac9e09bcf834ef708fab180038ebd4bd))
|
||||||
|
* **observability:** sentry ([99e645c](https://github.com/ReVanced/revanced-api/commit/99e645c5f5604b5b1c8cbab0bed22177fc01c695))
|
||||||
|
* project init ([856fc66](https://github.com/ReVanced/revanced-api/commit/856fc667170d21ae5aba996bcc356ca44412e10d))
|
||||||
|
* remove appinfo capabilities ([10f5225](https://github.com/ReVanced/revanced-api/commit/10f5225f514a03b2532ec430b5caace6c6049b92))
|
||||||
|
* remove codecov tests ([9c69fa3](https://github.com/ReVanced/revanced-api/commit/9c69fa3b924b2ecda5c52256c383d8619ec61ece))
|
||||||
|
* Remove Swagger and OpenAPI ([af0b086](https://github.com/ReVanced/revanced-api/commit/af0b0865f4c2f22975a836b72ff0b902ddac1ce9))
|
||||||
|
* Setup CI/CD ([c736a75](https://github.com/ReVanced/revanced-api/commit/c736a75d92d97124e1aca392f37049449a786c84))
|
||||||
|
* Setup cors and cache ([205bcde](https://github.com/ReVanced/revanced-api/commit/205bcde77aad90e0eb49fc25961399f1e37698bb))
|
||||||
|
* Show default CLI option values ([db0bfc3](https://github.com/ReVanced/revanced-api/commit/db0bfc3be5b8d86466fa7f1a01a72247b4e878aa))
|
||||||
|
* Use auth digest instead of basic auth ([89e2acf](https://github.com/ReVanced/revanced-api/commit/89e2acfebb5e14f71d9ce3d962c5531070b7600e))
|
||||||
|
* Use Jetty instead of Netty ([c23cd5c](https://github.com/ReVanced/revanced-api/commit/c23cd5cdad01fee52aecdb36b93a619886edfa4d))
|
||||||
|
* use objects for /socials and /donations ([#51](https://github.com/ReVanced/revanced-api/issues/51)) ([d4eac5c](https://github.com/ReVanced/revanced-api/commit/d4eac5c757106c4762cb3e95f9e4b3509132b39f))
|
||||||
|
* use objects for contact field ([5922830](https://github.com/ReVanced/revanced-api/commit/5922830e0bf1c0504d3205d2fa864c76d0f09c02))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* Cache latest announcements for constant access time ([1ca9952](https://github.com/ReVanced/revanced-api/commit/1ca9952de81feeae1333872a7741119d6d8e7814))
|
||||||
|
* Cache patches list instead of just the patches file ([7a1957d](https://github.com/ReVanced/revanced-api/commit/7a1957d013cfd0851dc0191b715e8f36c530d9d2))
|
||||||
|
* Make async db transactions and use List instead of Set ([a7d1892](https://github.com/ReVanced/revanced-api/commit/a7d1892343094ddb2762ca346759771e6a274081))
|
||||||
|
|
||||||
|
# [1.0.0-dev.7](https://github.com/ReVanced/revanced-api/compare/v1.0.0-dev.6...v1.0.0-dev.7) (2024-07-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Fix OpenAPI docs casing of a word ([541783d](https://github.com/ReVanced/revanced-api/commit/541783d9599c257f184d1b244e1b857b7c200227))
|
||||||
|
|
||||||
|
# [1.0.0-dev.6](https://github.com/ReVanced/revanced-api/compare/v1.0.0-dev.5...v1.0.0-dev.6) (2024-07-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add bio field for team members ([c40d50c](https://github.com/ReVanced/revanced-api/commit/c40d50c01368cb6b9ab06857694ec51d27aba2cb))
|
||||||
|
|
||||||
|
# [1.0.0-dev.5](https://github.com/ReVanced/revanced-api/compare/v1.0.0-dev.4...v1.0.0-dev.5) (2024-07-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Move robots.txt to root ([2ade550](https://github.com/ReVanced/revanced-api/commit/2ade550d58c0e4b53fa7417bef0064f4f476aed8))
|
||||||
|
* Only list public members ([97a5d11](https://github.com/ReVanced/revanced-api/commit/97a5d119ec415f9c25fbc50cb240603047defc73))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add configuration to specify public key id ([ad7d4b2](https://github.com/ReVanced/revanced-api/commit/ad7d4b226f71fd965421dc2f2a51825c8e8b3036))
|
||||||
|
* Add manager route ([f814fe5](https://github.com/ReVanced/revanced-api/commit/f814fe5825eb8b864f2b0cba53ff721eba577eb4))
|
||||||
|
|
||||||
# [1.0.0-dev.4](https://github.com/ReVanced/revanced-api/compare/v1.0.0-dev.3...v1.0.0-dev.4) (2024-07-11)
|
# [1.0.0-dev.4](https://github.com/ReVanced/revanced-api/compare/v1.0.0-dev.3...v1.0.0-dev.4) (2024-07-11)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ReVanced",
|
"name": "ReVanced",
|
||||||
"about": "ReVanced was born out of Vanced's discontinuation and it is our goal to continue the legacy of what Vanced left behind. Thanks to ReVanced Patcher, it's possible to create long-lasting patches for nearly any Android app. ReVanced's patching system is designed to allow patches to work on new versions of the apps automatically with bare minimum maintenance.",
|
"about": "ReVanced was born out of Vanced's discontinuation and it is our goal to continue the legacy of what Vanced left behind. Thanks to ReVanced Patcher, it's possible to create long-lasting patches for nearly any Android app. ReVanced's patching system is designed to allow patches to work on new versions of the apps automatically with bare minimum maintenance.",
|
||||||
|
"keys": "https://api.revanced.app/keys",
|
||||||
"branding": {
|
"branding": {
|
||||||
"logo": "https://raw.githubusercontent.com/ReVanced/revanced-branding/main/assets/revanced-logo/revanced-logo.svg"
|
"logo": "https://raw.githubusercontent.com/ReVanced/revanced-branding/main/assets/revanced-logo/revanced-logo.svg"
|
||||||
},
|
},
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
organization = "revanced"
|
organization = "revanced"
|
||||||
patches = { repository = "revanced-patches", asset-regex = "jar$", signature-asset-regex = "asc$", public-key-file = "patches-public-key.asc" }
|
patches = { repository = "revanced-patches", asset-regex = "jar$", signature-asset-regex = "asc$", public-key-file = "patches-public-key.asc", public-key-id = 0 }
|
||||||
integrations = { repository = "revanced-integrations", asset-regex = "apk$", signature-asset-regex = "asc$", public-key-file = "integrations-public-key.asc" }
|
integrations = { repository = "revanced-integrations", asset-regex = "apk$", signature-asset-regex = "asc$", public-key-file = "integrations-public-key.asc", public-key-id = 0 }
|
||||||
|
manager = { repository = "revanced-manager", asset-regex = "apk$" }
|
||||||
contributors-repositories = [
|
contributors-repositories = [
|
||||||
"revanced-patcher",
|
"revanced-patcher",
|
||||||
"revanced-patches",
|
"revanced-patches",
|
||||||
@@ -16,3 +17,6 @@ cors-allowed-hosts = [
|
|||||||
]
|
]
|
||||||
endpoint = "https://api.revanced.app"
|
endpoint = "https://api.revanced.app"
|
||||||
old-api-endpoint = "https://old-api.revanced.app"
|
old-api-endpoint = "https://old-api.revanced.app"
|
||||||
|
static-files-path = "static/root"
|
||||||
|
versioned-static-files-path = "static/versioned"
|
||||||
|
about-json-file-path = "about.json"
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ services:
|
|||||||
- /data/revanced-api/configuration.toml:/app/configuration.toml
|
- /data/revanced-api/configuration.toml:/app/configuration.toml
|
||||||
- /data/revanced-api/patches-public-key.asc:/app/patches-public-key.asc
|
- /data/revanced-api/patches-public-key.asc:/app/patches-public-key.asc
|
||||||
- /data/revanced-api/integrations-public-key.asc:/app/integrations-public-key.asc
|
- /data/revanced-api/integrations-public-key.asc:/app/integrations-public-key.asc
|
||||||
|
- /data/revanced-api/static:/app/static
|
||||||
|
- /data/revanced-api/about.json:/app/about.json
|
||||||
environment:
|
environment:
|
||||||
- COMMAND=start
|
- COMMAND=start
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 1.0.0-dev.4
|
version = 1.1.0
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ fun Application.configureDependencies(
|
|||||||
singleOf(::AnnouncementService)
|
singleOf(::AnnouncementService)
|
||||||
singleOf(::SignatureService)
|
singleOf(::SignatureService)
|
||||||
singleOf(::PatchesService)
|
singleOf(::PatchesService)
|
||||||
|
singleOf(::ManagerService)
|
||||||
singleOf(::ApiService)
|
singleOf(::ApiService)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ import io.bkbn.kompendium.core.plugin.NotarizedRoute
|
|||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import io.ktor.http.content.*
|
import io.ktor.http.content.*
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
|
import io.ktor.server.http.content.*
|
||||||
import io.ktor.server.plugins.cachingheaders.*
|
import io.ktor.server.plugins.cachingheaders.*
|
||||||
import io.ktor.server.response.*
|
import io.ktor.server.response.*
|
||||||
|
import io.ktor.server.routing.*
|
||||||
|
import java.io.File
|
||||||
|
import java.nio.file.Path
|
||||||
import kotlin.time.Duration
|
import kotlin.time.Duration
|
||||||
|
|
||||||
internal suspend fun ApplicationCall.respondOrNotFound(value: Any?) = respond(value ?: HttpStatusCode.NotFound)
|
internal suspend fun ApplicationCall.respondOrNotFound(value: Any?) = respond(value ?: HttpStatusCode.NotFound)
|
||||||
@@ -25,3 +29,14 @@ internal fun ApplicationCallPipeline.installCache(cacheControl: CacheControl) =
|
|||||||
|
|
||||||
internal fun ApplicationCallPipeline.installNotarizedRoute(configure: NotarizedRoute.Config.() -> Unit = {}) =
|
internal fun ApplicationCallPipeline.installNotarizedRoute(configure: NotarizedRoute.Config.() -> Unit = {}) =
|
||||||
install(NotarizedRoute(), configure)
|
install(NotarizedRoute(), configure)
|
||||||
|
|
||||||
|
internal fun Route.staticFiles(
|
||||||
|
remotePath: String,
|
||||||
|
dir: Path,
|
||||||
|
block: StaticContentConfig<File>.() -> Unit = {
|
||||||
|
contentType {
|
||||||
|
ContentType.Application.Json
|
||||||
|
}
|
||||||
|
extensions("json")
|
||||||
|
},
|
||||||
|
) = staticFiles(remotePath, dir.toFile(), null, block)
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
package app.revanced.api.configuration
|
package app.revanced.api.configuration
|
||||||
|
|
||||||
import app.revanced.api.configuration.repository.ConfigurationRepository
|
import app.revanced.api.configuration.repository.ConfigurationRepository
|
||||||
|
import app.revanced.api.configuration.routes.*
|
||||||
import app.revanced.api.configuration.routes.announcementsRoute
|
import app.revanced.api.configuration.routes.announcementsRoute
|
||||||
|
import app.revanced.api.configuration.routes.apiRoute
|
||||||
import app.revanced.api.configuration.routes.oldApiRoute
|
import app.revanced.api.configuration.routes.oldApiRoute
|
||||||
import app.revanced.api.configuration.routes.patchesRoute
|
import app.revanced.api.configuration.routes.patchesRoute
|
||||||
import app.revanced.api.configuration.routes.rootRoute
|
|
||||||
import io.bkbn.kompendium.core.routes.redoc
|
import io.bkbn.kompendium.core.routes.redoc
|
||||||
import io.bkbn.kompendium.core.routes.swagger
|
import io.bkbn.kompendium.core.routes.swagger
|
||||||
|
import io.ktor.http.*
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
import io.ktor.server.routing.*
|
import io.ktor.server.routing.*
|
||||||
import kotlin.time.Duration.Companion.minutes
|
import kotlin.time.Duration.Companion.minutes
|
||||||
@@ -18,9 +20,37 @@ internal fun Application.configureRouting() = routing {
|
|||||||
installCache(5.minutes)
|
installCache(5.minutes)
|
||||||
|
|
||||||
route("/v${configuration.apiVersion}") {
|
route("/v${configuration.apiVersion}") {
|
||||||
patchesRoute()
|
|
||||||
announcementsRoute()
|
announcementsRoute()
|
||||||
rootRoute()
|
patchesRoute()
|
||||||
|
managerRoute()
|
||||||
|
apiRoute()
|
||||||
|
}
|
||||||
|
|
||||||
|
staticFiles("/", configuration.staticFilesPath) {
|
||||||
|
contentType {
|
||||||
|
when (it.extension) {
|
||||||
|
"json" -> ContentType.Application.Json
|
||||||
|
"asc" -> ContentType.Text.Plain
|
||||||
|
"ico" -> ContentType.Image.XIcon
|
||||||
|
"svg" -> ContentType.Image.SVG
|
||||||
|
"jpg", "jpeg" -> ContentType.Image.JPEG
|
||||||
|
"png" -> ContentType.Image.PNG
|
||||||
|
"gif" -> ContentType.Image.GIF
|
||||||
|
"mp4" -> ContentType.Video.MP4
|
||||||
|
"ogg" -> ContentType.Video.OGG
|
||||||
|
"mp3" -> ContentType.Audio.MPEG
|
||||||
|
"css" -> ContentType.Text.CSS
|
||||||
|
"js" -> ContentType.Application.JavaScript
|
||||||
|
"html" -> ContentType.Text.Html
|
||||||
|
"xml" -> ContentType.Application.Xml
|
||||||
|
"pdf" -> ContentType.Application.Pdf
|
||||||
|
"zip" -> ContentType.Application.Zip
|
||||||
|
"gz" -> ContentType.Application.GZip
|
||||||
|
else -> ContentType.Application.OctetStream
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extensions("json", "asc")
|
||||||
}
|
}
|
||||||
|
|
||||||
swagger(pageTitle = "ReVanced API", path = "/")
|
swagger(pageTitle = "ReVanced API", path = "/")
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package app.revanced.api.configuration.repository
|
package app.revanced.api.configuration.repository
|
||||||
|
|
||||||
|
import app.revanced.api.configuration.schema.APIAbout
|
||||||
|
import app.revanced.api.configuration.services.ManagerService
|
||||||
import app.revanced.api.configuration.services.PatchesService
|
import app.revanced.api.configuration.services.PatchesService
|
||||||
|
import kotlinx.serialization.ExperimentalSerializationApi
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@@ -9,7 +12,11 @@ import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
|||||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.encoding.Encoder
|
import kotlinx.serialization.encoding.Encoder
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonNamingStrategy
|
||||||
|
import kotlinx.serialization.json.decodeFromStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.nio.file.Path
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The repository storing the configuration for the API.
|
* The repository storing the configuration for the API.
|
||||||
@@ -17,17 +24,23 @@ import java.io.File
|
|||||||
* @property organization The API backends organization name where the repositories for the patches and integrations are.
|
* @property organization The API backends organization name where the repositories for the patches and integrations are.
|
||||||
* @property patches The source of the patches.
|
* @property patches The source of the patches.
|
||||||
* @property integrations The source of the integrations.
|
* @property integrations The source of the integrations.
|
||||||
|
* @property manager The source of the manager.
|
||||||
* @property contributorsRepositoryNames The names of the repositories to get contributors from.
|
* @property contributorsRepositoryNames The names of the repositories to get contributors from.
|
||||||
* @property apiVersion The version to use for the API.
|
* @property apiVersion The version to use for the API.
|
||||||
* @property corsAllowedHosts The hosts allowed to make requests to the API.
|
* @property corsAllowedHosts The hosts allowed to make requests to the API.
|
||||||
* @property endpoint The endpoint of the API.
|
* @property endpoint The endpoint of the API.
|
||||||
* @property oldApiEndpoint The endpoint of the old API to proxy requests to.
|
* @property oldApiEndpoint The endpoint of the old API to proxy requests to.
|
||||||
|
* @property staticFilesPath The path to the static files to be served under the root path.
|
||||||
|
* @property versionedStaticFilesPath The path to the static files to be served under a versioned path.
|
||||||
|
* @property about The path to the json file deserialized to [APIAbout]
|
||||||
|
* (because com.akuleshov7.ktoml.Toml does not support nested tables).
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
internal class ConfigurationRepository(
|
internal class ConfigurationRepository(
|
||||||
val organization: String,
|
val organization: String,
|
||||||
val patches: AssetConfiguration,
|
val patches: SignedAssetConfiguration,
|
||||||
val integrations: AssetConfiguration,
|
val integrations: SignedAssetConfiguration,
|
||||||
|
val manager: AssetConfiguration,
|
||||||
@SerialName("contributors-repositories")
|
@SerialName("contributors-repositories")
|
||||||
val contributorsRepositoryNames: Set<String>,
|
val contributorsRepositoryNames: Set<String>,
|
||||||
@SerialName("api-version")
|
@SerialName("api-version")
|
||||||
@@ -37,11 +50,20 @@ internal class ConfigurationRepository(
|
|||||||
val endpoint: String,
|
val endpoint: String,
|
||||||
@SerialName("old-api-endpoint")
|
@SerialName("old-api-endpoint")
|
||||||
val oldApiEndpoint: String,
|
val oldApiEndpoint: String,
|
||||||
|
@Serializable(with = PathSerializer::class)
|
||||||
|
@SerialName("static-files-path")
|
||||||
|
val staticFilesPath: Path,
|
||||||
|
@Serializable(with = PathSerializer::class)
|
||||||
|
@SerialName("versioned-static-files-path")
|
||||||
|
val versionedStaticFilesPath: Path,
|
||||||
|
@Serializable(with = AboutSerializer::class)
|
||||||
|
@SerialName("about-json-file-path")
|
||||||
|
val about: APIAbout,
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* An asset configuration.
|
* Am asset configuration whose asset is signed.
|
||||||
*
|
*
|
||||||
* [PatchesService] uses [BackendRepository] to get assets from its releases.
|
* [PatchesService] for example uses [BackendRepository] to get assets from its releases.
|
||||||
* A release contains multiple assets.
|
* A release contains multiple assets.
|
||||||
*
|
*
|
||||||
* This configuration is used in [ConfigurationRepository]
|
* This configuration is used in [ConfigurationRepository]
|
||||||
@@ -51,9 +73,10 @@ internal class ConfigurationRepository(
|
|||||||
* @property assetRegex The regex matching the asset name.
|
* @property assetRegex The regex matching the asset name.
|
||||||
* @property signatureAssetRegex The regex matching the signature asset name to verify the asset.
|
* @property signatureAssetRegex The regex matching the signature asset name to verify the asset.
|
||||||
* @property publicKeyFile The public key file to verify the signature of the asset.
|
* @property publicKeyFile The public key file to verify the signature of the asset.
|
||||||
|
* @property publicKeyId The ID of the public key to verify the signature of the asset.
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
internal class AssetConfiguration(
|
internal class SignedAssetConfiguration(
|
||||||
val repository: String,
|
val repository: String,
|
||||||
@Serializable(with = RegexSerializer::class)
|
@Serializable(with = RegexSerializer::class)
|
||||||
@SerialName("asset-regex")
|
@SerialName("asset-regex")
|
||||||
@@ -64,6 +87,28 @@ internal class ConfigurationRepository(
|
|||||||
@Serializable(with = FileSerializer::class)
|
@Serializable(with = FileSerializer::class)
|
||||||
@SerialName("public-key-file")
|
@SerialName("public-key-file")
|
||||||
val publicKeyFile: File,
|
val publicKeyFile: File,
|
||||||
|
@SerialName("public-key-id")
|
||||||
|
val publicKeyId: Long,
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Am asset configuration.
|
||||||
|
*
|
||||||
|
* [ManagerService] for example uses [BackendRepository] to get assets from its releases.
|
||||||
|
* A release contains multiple assets.
|
||||||
|
*
|
||||||
|
* This configuration is used in [ConfigurationRepository]
|
||||||
|
* to determine which release assets from repositories to get and to verify them.
|
||||||
|
*
|
||||||
|
* @property repository The repository in which releases are made to get an asset.
|
||||||
|
* @property assetRegex The regex matching the asset name.
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
internal class AssetConfiguration(
|
||||||
|
val repository: String,
|
||||||
|
@Serializable(with = RegexSerializer::class)
|
||||||
|
@SerialName("asset-regex")
|
||||||
|
val assetRegex: Regex,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,3 +127,23 @@ private object FileSerializer : KSerializer<File> {
|
|||||||
|
|
||||||
override fun deserialize(decoder: Decoder) = File(decoder.decodeString())
|
override fun deserialize(decoder: Decoder) = File(decoder.decodeString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private object PathSerializer : KSerializer<Path> {
|
||||||
|
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("Path", PrimitiveKind.STRING)
|
||||||
|
|
||||||
|
override fun serialize(encoder: Encoder, value: Path) = encoder.encodeString(value.toString())
|
||||||
|
|
||||||
|
override fun deserialize(decoder: Decoder): Path = Path.of(decoder.decodeString())
|
||||||
|
}
|
||||||
|
|
||||||
|
private object AboutSerializer : KSerializer<APIAbout> {
|
||||||
|
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("APIAbout", PrimitiveKind.STRING)
|
||||||
|
|
||||||
|
override fun serialize(encoder: Encoder, value: APIAbout) = error("Serializing APIAbout is not supported")
|
||||||
|
|
||||||
|
@OptIn(ExperimentalSerializationApi::class)
|
||||||
|
val json = Json { namingStrategy = JsonNamingStrategy.SnakeCase }
|
||||||
|
|
||||||
|
override fun deserialize(decoder: Decoder): APIAbout =
|
||||||
|
json.decodeFromStream(File(decoder.decodeString()).inputStream())
|
||||||
|
}
|
||||||
|
|||||||
@@ -67,10 +67,10 @@ class GitHubBackendRepository(client: HttpClient) : BackendRepository(client) {
|
|||||||
|
|
||||||
override suspend fun members(organization: String): List<BackendMember> {
|
override suspend fun members(organization: String): List<BackendMember> {
|
||||||
// Get the list of members of the organization.
|
// Get the list of members of the organization.
|
||||||
val members: List<GitHubOrganization.GitHubMember> = client.get(Organization.Members(organization)).body()
|
val publicMembers: List<GitHubOrganization.GitHubMember> = client.get(Organization.PublicMembers(organization)).body()
|
||||||
|
|
||||||
return coroutineScope {
|
return coroutineScope {
|
||||||
members.map { member ->
|
publicMembers.map { member ->
|
||||||
async {
|
async {
|
||||||
awaitAll(
|
awaitAll(
|
||||||
async {
|
async {
|
||||||
@@ -187,8 +187,8 @@ class User(val login: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Organization {
|
class Organization {
|
||||||
@Resource("/orgs/{org}/members")
|
@Resource("/orgs/{org}/public_members")
|
||||||
class Members(val org: String)
|
class PublicMembers(val org: String)
|
||||||
|
|
||||||
class Repository {
|
class Repository {
|
||||||
@Resource("/repos/{owner}/{repo}/contributors")
|
@Resource("/repos/{owner}/{repo}/contributors")
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package app.revanced.api.configuration.routes
|
package app.revanced.api.configuration.routes
|
||||||
|
|
||||||
|
import app.revanced.api.configuration.*
|
||||||
import app.revanced.api.configuration.installCache
|
import app.revanced.api.configuration.installCache
|
||||||
import app.revanced.api.configuration.installNoCache
|
import app.revanced.api.configuration.installNoCache
|
||||||
import app.revanced.api.configuration.installNotarizedRoute
|
import app.revanced.api.configuration.installNotarizedRoute
|
||||||
import app.revanced.api.configuration.respondOrNotFound
|
import app.revanced.api.configuration.respondOrNotFound
|
||||||
|
import app.revanced.api.configuration.schema.APIAbout
|
||||||
import app.revanced.api.configuration.schema.APIContributable
|
import app.revanced.api.configuration.schema.APIContributable
|
||||||
import app.revanced.api.configuration.schema.APIMember
|
import app.revanced.api.configuration.schema.APIMember
|
||||||
import app.revanced.api.configuration.schema.APIRateLimit
|
import app.revanced.api.configuration.schema.APIRateLimit
|
||||||
@@ -13,14 +15,13 @@ import io.bkbn.kompendium.core.metadata.*
|
|||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import io.ktor.server.application.*
|
import io.ktor.server.application.*
|
||||||
import io.ktor.server.auth.*
|
import io.ktor.server.auth.*
|
||||||
import io.ktor.server.http.content.*
|
|
||||||
import io.ktor.server.plugins.ratelimit.*
|
import io.ktor.server.plugins.ratelimit.*
|
||||||
import io.ktor.server.response.*
|
import io.ktor.server.response.*
|
||||||
import io.ktor.server.routing.*
|
import io.ktor.server.routing.*
|
||||||
import kotlin.time.Duration.Companion.days
|
import kotlin.time.Duration.Companion.days
|
||||||
import org.koin.ktor.ext.get as koinGet
|
import org.koin.ktor.ext.get as koinGet
|
||||||
|
|
||||||
internal fun Route.rootRoute() {
|
internal fun Route.apiRoute() {
|
||||||
val apiService = koinGet<ApiService>()
|
val apiService = koinGet<ApiService>()
|
||||||
val authService = koinGet<AuthService>()
|
val authService = koinGet<AuthService>()
|
||||||
|
|
||||||
@@ -56,6 +57,16 @@ internal fun Route.rootRoute() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
route("about") {
|
||||||
|
installCache(1.days)
|
||||||
|
|
||||||
|
installAboutRouteDocumentation()
|
||||||
|
|
||||||
|
get {
|
||||||
|
call.respond(apiService.about)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
route("ping") {
|
route("ping") {
|
||||||
installNoCache()
|
installNoCache()
|
||||||
|
|
||||||
@@ -75,14 +86,26 @@ internal fun Route.rootRoute() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
staticResources("/", "/app/revanced/api/static") {
|
staticFiles("/", apiService.versionedStaticFilesPath)
|
||||||
contentType { ContentType.Application.Json }
|
}
|
||||||
extensions("json")
|
}
|
||||||
|
|
||||||
|
private fun Route.installAboutRouteDocumentation() = installNotarizedRoute {
|
||||||
|
tags = setOf("API")
|
||||||
|
|
||||||
|
get = GetInfo.builder {
|
||||||
|
description("Get information about the API")
|
||||||
|
summary("Get about")
|
||||||
|
response {
|
||||||
|
description("Information about the API")
|
||||||
|
mediaTypes("application/json")
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<APIAbout>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Route.installRateLimitRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installRateLimitRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("API")
|
tags = setOf("API")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
@@ -97,7 +120,7 @@ fun Route.installRateLimitRouteDocumentation() = installNotarizedRoute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Route.installPingRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installPingRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("API")
|
tags = setOf("API")
|
||||||
|
|
||||||
head = HeadInfo.builder {
|
head = HeadInfo.builder {
|
||||||
@@ -111,7 +134,7 @@ fun Route.installPingRouteDocumentation() = installNotarizedRoute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Route.installTeamRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installTeamRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("API")
|
tags = setOf("API")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
@@ -126,7 +149,7 @@ fun Route.installTeamRouteDocumentation() = installNotarizedRoute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Route.installContributorsRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installContributorsRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("API")
|
tags = setOf("API")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
@@ -141,7 +164,7 @@ fun Route.installContributorsRouteDocumentation() = installNotarizedRoute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Route.installTokenRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installTokenRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("API")
|
tags = setOf("API")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package app.revanced.api.configuration.routes
|
||||||
|
|
||||||
|
import app.revanced.api.configuration.installNotarizedRoute
|
||||||
|
import app.revanced.api.configuration.schema.APIManagerAsset
|
||||||
|
import app.revanced.api.configuration.schema.APIRelease
|
||||||
|
import app.revanced.api.configuration.schema.APIReleaseVersion
|
||||||
|
import app.revanced.api.configuration.services.ManagerService
|
||||||
|
import io.bkbn.kompendium.core.metadata.GetInfo
|
||||||
|
import io.ktor.http.*
|
||||||
|
import io.ktor.server.application.*
|
||||||
|
import io.ktor.server.plugins.ratelimit.*
|
||||||
|
import io.ktor.server.response.*
|
||||||
|
import io.ktor.server.routing.*
|
||||||
|
import org.koin.ktor.ext.get as koinGet
|
||||||
|
|
||||||
|
internal fun Route.managerRoute() = route("manager") {
|
||||||
|
val managerService = koinGet<ManagerService>()
|
||||||
|
|
||||||
|
route("latest") {
|
||||||
|
installLatestManagerRouteDocumentation()
|
||||||
|
|
||||||
|
rateLimit(RateLimitName("weak")) {
|
||||||
|
get {
|
||||||
|
call.respond(managerService.latestRelease())
|
||||||
|
}
|
||||||
|
|
||||||
|
route("version") {
|
||||||
|
installLatestManagerVersionRouteDocumentation()
|
||||||
|
|
||||||
|
get {
|
||||||
|
call.respond(managerService.latestVersion())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Route.installLatestManagerRouteDocumentation() = installNotarizedRoute {
|
||||||
|
tags = setOf("Manager")
|
||||||
|
|
||||||
|
get = GetInfo.builder {
|
||||||
|
description("Get the latest manager release")
|
||||||
|
summary("Get latest manager release")
|
||||||
|
response {
|
||||||
|
description("The latest manager release")
|
||||||
|
mediaTypes("application/json")
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<APIRelease<APIManagerAsset>>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Route.installLatestManagerVersionRouteDocumentation() = installNotarizedRoute {
|
||||||
|
tags = setOf("Manager")
|
||||||
|
|
||||||
|
get = GetInfo.builder {
|
||||||
|
description("Get the latest manager release version")
|
||||||
|
summary("Get latest manager release version")
|
||||||
|
response {
|
||||||
|
description("The latest manager release version")
|
||||||
|
mediaTypes("application/json")
|
||||||
|
responseCode(HttpStatusCode.OK)
|
||||||
|
responseType<APIReleaseVersion>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package app.revanced.api.configuration.routes
|
|||||||
import app.revanced.api.configuration.installCache
|
import app.revanced.api.configuration.installCache
|
||||||
import app.revanced.api.configuration.installNotarizedRoute
|
import app.revanced.api.configuration.installNotarizedRoute
|
||||||
import app.revanced.api.configuration.schema.APIAssetPublicKeys
|
import app.revanced.api.configuration.schema.APIAssetPublicKeys
|
||||||
|
import app.revanced.api.configuration.schema.APIPatchesAsset
|
||||||
import app.revanced.api.configuration.schema.APIRelease
|
import app.revanced.api.configuration.schema.APIRelease
|
||||||
import app.revanced.api.configuration.schema.APIReleaseVersion
|
import app.revanced.api.configuration.schema.APIReleaseVersion
|
||||||
import app.revanced.api.configuration.services.PatchesService
|
import app.revanced.api.configuration.services.PatchesService
|
||||||
@@ -59,7 +60,7 @@ internal fun Route.patchesRoute() = route("patches") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Route.installLatestPatchesRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installLatestPatchesRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("Patches")
|
tags = setOf("Patches")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
@@ -69,12 +70,12 @@ fun Route.installLatestPatchesRouteDocumentation() = installNotarizedRoute {
|
|||||||
description("The latest patches release")
|
description("The latest patches release")
|
||||||
mediaTypes("application/json")
|
mediaTypes("application/json")
|
||||||
responseCode(HttpStatusCode.OK)
|
responseCode(HttpStatusCode.OK)
|
||||||
responseType<APIRelease>()
|
responseType<APIRelease<APIPatchesAsset>>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Route.installLatestPatchesVersionRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installLatestPatchesVersionRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("Patches")
|
tags = setOf("Patches")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
@@ -89,7 +90,7 @@ fun Route.installLatestPatchesVersionRouteDocumentation() = installNotarizedRout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Route.installLatestPatchesListRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installLatestPatchesListRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("Patches")
|
tags = setOf("Patches")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
@@ -104,7 +105,7 @@ fun Route.installLatestPatchesListRouteDocumentation() = installNotarizedRoute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Route.installPatchesPublicKeyRouteDocumentation() = installNotarizedRoute {
|
private fun Route.installPatchesPublicKeyRouteDocumentation() = installNotarizedRoute {
|
||||||
tags = setOf("Patches")
|
tags = setOf("Patches")
|
||||||
|
|
||||||
get = GetInfo.builder {
|
get = GetInfo.builder {
|
||||||
|
|||||||
@@ -3,15 +3,6 @@ package app.revanced.api.configuration.schema
|
|||||||
import kotlinx.datetime.LocalDateTime
|
import kotlinx.datetime.LocalDateTime
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
|
||||||
class APIRelease(
|
|
||||||
val version: String,
|
|
||||||
val createdAt: LocalDateTime,
|
|
||||||
val description: String,
|
|
||||||
// Using a list instead of a set because set semantics are unnecessary here.
|
|
||||||
val assets: List<APIAsset>,
|
|
||||||
)
|
|
||||||
|
|
||||||
interface APIUser {
|
interface APIUser {
|
||||||
val name: String
|
val name: String
|
||||||
val avatarUrl: String
|
val avatarUrl: String
|
||||||
@@ -23,6 +14,7 @@ class APIMember(
|
|||||||
override val name: String,
|
override val name: String,
|
||||||
override val avatarUrl: String,
|
override val avatarUrl: String,
|
||||||
override val url: String,
|
override val url: String,
|
||||||
|
val bio: String?,
|
||||||
val gpgKey: APIGpgKey?,
|
val gpgKey: APIGpgKey?,
|
||||||
) : APIUser
|
) : APIUser
|
||||||
|
|
||||||
@@ -48,7 +40,21 @@ class APIContributable(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class APIAsset(
|
class APIRelease<T>(
|
||||||
|
val version: String,
|
||||||
|
val createdAt: LocalDateTime,
|
||||||
|
val description: String,
|
||||||
|
// Using a list instead of a set because set semantics are unnecessary here.
|
||||||
|
val assets: List<T>,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class APIManagerAsset(
|
||||||
|
val downloadUrl: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class APIPatchesAsset(
|
||||||
val downloadUrl: String,
|
val downloadUrl: String,
|
||||||
val signatureDownloadUrl: String,
|
val signatureDownloadUrl: String,
|
||||||
// TODO: Remove this eventually when integrations are merged into patches.
|
// TODO: Remove this eventually when integrations are merged into patches.
|
||||||
@@ -114,3 +120,55 @@ class APIAssetPublicKeys(
|
|||||||
val patchesPublicKey: String,
|
val patchesPublicKey: String,
|
||||||
val integrationsPublicKey: String,
|
val integrationsPublicKey: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class APIAbout(
|
||||||
|
val name: String,
|
||||||
|
val about: String,
|
||||||
|
val keys: String,
|
||||||
|
val branding: Branding?,
|
||||||
|
val contact: Contact?,
|
||||||
|
// Using a list instead of a set because set semantics are unnecessary here.
|
||||||
|
val socials: List<Social>?,
|
||||||
|
val donations: Donations?,
|
||||||
|
) {
|
||||||
|
@Serializable
|
||||||
|
class Branding(
|
||||||
|
val logo: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Contact(
|
||||||
|
val email: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Social(
|
||||||
|
val name: String,
|
||||||
|
val url: String,
|
||||||
|
val preferred: Boolean? = false,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Wallet(
|
||||||
|
val network: String,
|
||||||
|
val currencyCode: String,
|
||||||
|
val address: String,
|
||||||
|
val preferred: Boolean? = false,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Link(
|
||||||
|
val name: String,
|
||||||
|
val url: String,
|
||||||
|
val preferred: Boolean? = false,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Donations(
|
||||||
|
// Using a list instead of a set because set semantics are unnecessary here.
|
||||||
|
val wallets: List<Wallet>?,
|
||||||
|
// Using a list instead of a set because set semantics are unnecessary here.
|
||||||
|
val links: List<Link>?,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ internal class ApiService(
|
|||||||
private val backendRepository: BackendRepository,
|
private val backendRepository: BackendRepository,
|
||||||
private val configurationRepository: ConfigurationRepository,
|
private val configurationRepository: ConfigurationRepository,
|
||||||
) {
|
) {
|
||||||
|
val versionedStaticFilesPath = configurationRepository.versionedStaticFilesPath
|
||||||
|
val about = configurationRepository.about
|
||||||
|
|
||||||
suspend fun contributors() = withContext(Dispatchers.IO) {
|
suspend fun contributors() = withContext(Dispatchers.IO) {
|
||||||
configurationRepository.contributorsRepositoryNames.map {
|
configurationRepository.contributorsRepositoryNames.map {
|
||||||
async {
|
async {
|
||||||
@@ -30,6 +33,7 @@ internal class ApiService(
|
|||||||
member.name,
|
member.name,
|
||||||
member.avatarUrl,
|
member.avatarUrl,
|
||||||
member.url,
|
member.url,
|
||||||
|
member.bio,
|
||||||
if (member.gpgKeys.ids.isNotEmpty()) {
|
if (member.gpgKeys.ids.isNotEmpty()) {
|
||||||
APIGpgKey(
|
APIGpgKey(
|
||||||
// Must choose one of the GPG keys, because it does not make sense to have multiple GPG keys for the API.
|
// Must choose one of the GPG keys, because it does not make sense to have multiple GPG keys for the API.
|
||||||
@@ -39,7 +43,6 @@ internal class ApiService(
|
|||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
},
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package app.revanced.api.configuration.services
|
||||||
|
|
||||||
|
import app.revanced.api.configuration.repository.BackendRepository
|
||||||
|
import app.revanced.api.configuration.repository.BackendRepository.BackendOrganization.BackendRepository.BackendRelease.Companion.first
|
||||||
|
import app.revanced.api.configuration.repository.ConfigurationRepository
|
||||||
|
import app.revanced.api.configuration.schema.*
|
||||||
|
|
||||||
|
internal class ManagerService(
|
||||||
|
private val backendRepository: BackendRepository,
|
||||||
|
private val configurationRepository: ConfigurationRepository,
|
||||||
|
) {
|
||||||
|
suspend fun latestRelease(): APIRelease<APIManagerAsset> {
|
||||||
|
val managerRelease = backendRepository.release(
|
||||||
|
configurationRepository.organization,
|
||||||
|
configurationRepository.manager.repository,
|
||||||
|
)
|
||||||
|
|
||||||
|
val managerAsset = APIManagerAsset(
|
||||||
|
managerRelease.assets.first(configurationRepository.manager.assetRegex).downloadUrl,
|
||||||
|
)
|
||||||
|
|
||||||
|
return APIRelease(
|
||||||
|
managerRelease.tag,
|
||||||
|
managerRelease.createdAt,
|
||||||
|
managerRelease.releaseNote,
|
||||||
|
listOf(managerAsset),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun latestVersion(): APIReleaseVersion {
|
||||||
|
val managerRelease = backendRepository.release(
|
||||||
|
configurationRepository.organization,
|
||||||
|
configurationRepository.manager.repository,
|
||||||
|
)
|
||||||
|
|
||||||
|
return APIReleaseVersion(managerRelease.tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,6 @@ import app.revanced.api.configuration.schema.*
|
|||||||
import app.revanced.library.PatchUtils
|
import app.revanced.library.PatchUtils
|
||||||
import app.revanced.patcher.PatchBundleLoader
|
import app.revanced.patcher.PatchBundleLoader
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine
|
import com.github.benmanes.caffeine.cache.Caffeine
|
||||||
import io.ktor.util.*
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
@@ -18,7 +17,7 @@ internal class PatchesService(
|
|||||||
private val backendRepository: BackendRepository,
|
private val backendRepository: BackendRepository,
|
||||||
private val configurationRepository: ConfigurationRepository,
|
private val configurationRepository: ConfigurationRepository,
|
||||||
) {
|
) {
|
||||||
suspend fun latestRelease(): APIRelease {
|
suspend fun latestRelease(): APIRelease<APIPatchesAsset> {
|
||||||
val patchesRelease = backendRepository.release(
|
val patchesRelease = backendRepository.release(
|
||||||
configurationRepository.organization,
|
configurationRepository.organization,
|
||||||
configurationRepository.patches.repository,
|
configurationRepository.patches.repository,
|
||||||
@@ -29,10 +28,10 @@ internal class PatchesService(
|
|||||||
configurationRepository.integrations.repository,
|
configurationRepository.integrations.repository,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun ConfigurationRepository.AssetConfiguration.asset(
|
fun ConfigurationRepository.SignedAssetConfiguration.asset(
|
||||||
release: BackendRepository.BackendOrganization.BackendRepository.BackendRelease,
|
release: BackendRepository.BackendOrganization.BackendRepository.BackendRelease,
|
||||||
assetName: APIAssetName,
|
assetName: APIAssetName,
|
||||||
) = APIAsset(
|
) = APIPatchesAsset(
|
||||||
release.assets.first(assetRegex).downloadUrl,
|
release.assets.first(assetRegex).downloadUrl,
|
||||||
release.assets.first(signatureAssetRegex).downloadUrl,
|
release.assets.first(signatureAssetRegex).downloadUrl,
|
||||||
assetName,
|
assetName,
|
||||||
@@ -92,6 +91,7 @@ internal class PatchesService(
|
|||||||
patchesFile,
|
patchesFile,
|
||||||
signatureDownloadUrl,
|
signatureDownloadUrl,
|
||||||
configurationRepository.patches.publicKeyFile,
|
configurationRepository.patches.publicKeyFile,
|
||||||
|
configurationRepository.patches.publicKeyId,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
PatchBundleLoader.Jar(patchesFile)
|
PatchBundleLoader.Jar(patchesFile)
|
||||||
@@ -112,12 +112,13 @@ internal class PatchesService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun publicKeys(): APIAssetPublicKeys {
|
fun publicKeys(): APIAssetPublicKeys {
|
||||||
fun publicKeyBase64(getAssetConfiguration: ConfigurationRepository.() -> ConfigurationRepository.AssetConfiguration) =
|
fun readPublicKey(
|
||||||
configurationRepository.getAssetConfiguration().publicKeyFile.readBytes().encodeBase64()
|
getSignedAssetConfiguration: ConfigurationRepository.() -> ConfigurationRepository.SignedAssetConfiguration,
|
||||||
|
) = configurationRepository.getSignedAssetConfiguration().publicKeyFile.readText()
|
||||||
|
|
||||||
return APIAssetPublicKeys(
|
return APIAssetPublicKeys(
|
||||||
publicKeyBase64 { patches },
|
readPublicKey { patches },
|
||||||
publicKeyBase64 { integrations },
|
readPublicKey { integrations },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package app.revanced.api.configuration.services
|
package app.revanced.api.configuration.services
|
||||||
|
|
||||||
import com.github.benmanes.caffeine.cache.Caffeine
|
import com.github.benmanes.caffeine.cache.Caffeine
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider
|
|
||||||
import org.bouncycastle.openpgp.*
|
import org.bouncycastle.openpgp.*
|
||||||
import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator
|
import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator
|
||||||
import org.bouncycastle.openpgp.operator.bc.BcPGPContentVerifierBuilderProvider
|
import org.bouncycastle.openpgp.operator.bc.BcPGPContentVerifierBuilderProvider
|
||||||
@@ -9,7 +8,6 @@ import java.io.File
|
|||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import java.security.Security
|
|
||||||
|
|
||||||
internal class SignatureService {
|
internal class SignatureService {
|
||||||
private val signatureCache = Caffeine
|
private val signatureCache = Caffeine
|
||||||
@@ -21,6 +19,7 @@ internal class SignatureService {
|
|||||||
file: File,
|
file: File,
|
||||||
signatureDownloadUrl: String,
|
signatureDownloadUrl: String,
|
||||||
publicKeyFile: File,
|
publicKeyFile: File,
|
||||||
|
publicKeyId: Long,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val fileBytes = file.readBytes()
|
val fileBytes = file.readBytes()
|
||||||
|
|
||||||
@@ -28,7 +27,8 @@ internal class SignatureService {
|
|||||||
verify(
|
verify(
|
||||||
fileBytes = fileBytes,
|
fileBytes = fileBytes,
|
||||||
signatureInputStream = URL(signatureDownloadUrl).openStream(),
|
signatureInputStream = URL(signatureDownloadUrl).openStream(),
|
||||||
publicKeyInputStream = publicKeyFile.inputStream(),
|
publicKeyFileInputStream = publicKeyFile.inputStream(),
|
||||||
|
publicKeyId = publicKeyId,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,37 +36,32 @@ internal class SignatureService {
|
|||||||
private fun verify(
|
private fun verify(
|
||||||
fileBytes: ByteArray,
|
fileBytes: ByteArray,
|
||||||
signatureInputStream: InputStream,
|
signatureInputStream: InputStream,
|
||||||
publicKeyInputStream: InputStream,
|
publicKeyFileInputStream: InputStream,
|
||||||
|
publicKeyId: Long,
|
||||||
) = getSignature(signatureInputStream).apply {
|
) = getSignature(signatureInputStream).apply {
|
||||||
init(BcPGPContentVerifierBuilderProvider(), getPublicKey(publicKeyInputStream))
|
init(BcPGPContentVerifierBuilderProvider(), getPublicKey(publicKeyFileInputStream, publicKeyId))
|
||||||
update(fileBytes)
|
update(fileBytes)
|
||||||
}.verify()
|
}.verify()
|
||||||
|
|
||||||
private fun getPublicKey(publicKeyInputStream: InputStream): PGPPublicKey {
|
private fun getPublicKey(
|
||||||
val decoderStream = PGPUtil.getDecoderStream(publicKeyInputStream)
|
publicKeyFileInputStream: InputStream,
|
||||||
|
publicKeyId: Long,
|
||||||
|
): PGPPublicKey {
|
||||||
|
val decoderStream = PGPUtil.getDecoderStream(publicKeyFileInputStream)
|
||||||
|
val pgpPublicKeyRingCollection = PGPPublicKeyRingCollection(decoderStream, BcKeyFingerprintCalculator())
|
||||||
|
val publicKeyRing = pgpPublicKeyRingCollection.getPublicKeyRing(publicKeyId)
|
||||||
|
?: throw IllegalArgumentException("Can't find public key ring with ID $publicKeyId.")
|
||||||
|
|
||||||
PGPPublicKeyRingCollection(decoderStream, BcKeyFingerprintCalculator()).forEach { keyRing ->
|
return publicKeyRing.getPublicKey(publicKeyId)
|
||||||
keyRing.publicKeys.forEach { publicKey ->
|
?: throw IllegalArgumentException("Can't find public key with ID $publicKeyId.")
|
||||||
if (publicKey.isEncryptionKey) {
|
|
||||||
return publicKey
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw IllegalArgumentException("Can't find encryption key in key ring.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSignature(inputStream: InputStream): PGPSignature {
|
private fun getSignature(inputStream: InputStream): PGPSignature {
|
||||||
val decoderStream = PGPUtil.getDecoderStream(inputStream)
|
val decoderStream = PGPUtil.getDecoderStream(inputStream)
|
||||||
val pgpObjectFactory = PGPObjectFactory(decoderStream, BcKeyFingerprintCalculator())
|
val pgpSignatureList = PGPObjectFactory(decoderStream, BcKeyFingerprintCalculator()).first {
|
||||||
val signatureList = pgpObjectFactory.nextObject() as PGPSignatureList
|
it is PGPSignatureList
|
||||||
|
} as PGPSignatureList
|
||||||
|
|
||||||
return signatureList.first()
|
return pgpSignatureList.first()
|
||||||
}
|
|
||||||
|
|
||||||
private companion object {
|
|
||||||
init {
|
|
||||||
Security.addProvider(BouncyCastleProvider())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
User-agent: *
|
|
||||||
Disallow: /
|
|
||||||
Reference in New Issue
Block a user