fix: Work with the new API

This commit is contained in:
Sayantan Santra 2024-11-13 23:49:11 -06:00
parent 64ab240a8a
commit ad125bfb7b
Signed by: SinTan1729
GPG key ID: 0538DD402EA50898
3 changed files with 7 additions and 12 deletions

View file

@ -96,9 +96,7 @@ def get_apks(appstate):
# Get latest patches using the ReVanced API # Get latest patches using the ReVanced API
try: try:
# Get the first result # Get the first result
patches_json = next(filter( patches = session.get('https://api.revanced.app/v4/patches/list').json()
lambda x: x['repository'] == 'revanced/revanced-patches', appstate['tools']))
patches = session.get(patches_json['browser_download_url']).json()
except session.exceptions.RequestException as e: except session.exceptions.RequestException as e:
err_exit(f"Error fetching patches, {e}", appstate) err_exit(f"Error fetching patches, {e}", appstate)
@ -123,12 +121,9 @@ def get_apks(appstate):
hard_version = False hard_version = False
compatible_vers = [] compatible_vers = []
for patch in patches: for patch in patches:
if patch['compatiblePackages'] is not None:
for pkg in patch['compatiblePackages']:
if pkg['name'] == apk:
try: try:
compatible_vers.append(pkg['versions'][-1]) compatible_vers.append(patch['compatiblePackages'][apk][-1])
except TypeError: except (KeyError, TypeError):
pass pass
if not compatible_vers: if not compatible_vers:

View file

@ -36,7 +36,7 @@ def build_apps(appstate):
continue continue
# Build the command to be run # Build the command to be run
cmd = 'java -jar revanced-cli.jar patch -b revanced-patches.jar -m revanced-integrations.apk' cmd = 'java -jar revanced-cli.jar patch -p revanced-patches.rvp'
try: try:
root = build_config[app].getboolean('root') root = build_config[app].getboolean('root')

View file

@ -21,7 +21,7 @@ from ReVancedBuilder.Cleanup import move_apps, err_exit
# Update the ReVanced tools, if needed # Update the ReVanced tools, if needed
def update_tools(appstate): def update_tools(appstate):
for item in ['revanced-cli', 'revanced-integrations', 'revanced-patches']: for item in ['revanced-cli', 'revanced-patches']:
print(f"Checking updates for {item}...") print(f"Checking updates for {item}...")
tools = appstate['tools'] tools = appstate['tools']
tool = next(filter(lambda x: x['repository'] == 'revanced/'+item and x['content_type'] not in ['application/pgp-keys', 'application/json'], tools)) tool = next(filter(lambda x: x['repository'] == 'revanced/'+item and x['content_type'] not in ['application/pgp-keys', 'application/json'], tools))