You've already forked KemoFureApi
							
							fix
This commit is contained in:
		| @@ -4,8 +4,6 @@ from .endpoints.query import Archive_Query | |||||||
|  |  | ||||||
| class Database: | class Database: | ||||||
|     db : DatabaseController = None |     db : DatabaseController = None | ||||||
|     processed_friends = {} |  | ||||||
|     item_stages = {} |  | ||||||
|  |  | ||||||
|     def __init__(self, api) -> None: |     def __init__(self, api) -> None: | ||||||
|         app = api.app |         app = api.app | ||||||
|   | |||||||
| @@ -1,12 +1,16 @@ | |||||||
| import json | import json | ||||||
| from flask_restful import Resource | from flask_restful import Resource | ||||||
| from flask import current_app as app, jsonify | from flask import current_app as app, jsonify, request | ||||||
|  |  | ||||||
| class Archive_Query(Resource): | class Archive_Query(Resource): | ||||||
|     def post(self, query:str): |     def post(self): | ||||||
|  |         query = str(request.data) | ||||||
|  |         print(query) | ||||||
|  |  | ||||||
|         db = app.databases["Archive"] |         db = app.databases["Archive"] | ||||||
|  |  | ||||||
|         result = db.run_query(query) |         result = db.db.run_query(query) | ||||||
|  |         print(result) | ||||||
|  |  | ||||||
|         if result is None: |         if result is None: | ||||||
|             response = app.response_class(status=400) |             response = app.response_class(status=400) | ||||||
|   | |||||||
| @@ -82,7 +82,10 @@ async def download_cache(server_name, server : str): | |||||||
|             file.write(data) |             file.write(data) | ||||||
|         with open(file_path_json, "wt", encoding="utf-8") as out_file: |         with open(file_path_json, "wt", encoding="utf-8") as out_file: | ||||||
|             data = gzip.decompress(data) |             data = gzip.decompress(data) | ||||||
|             json.dump(json.loads(data), out_file, ensure_ascii=False, indent=1) |             data = json.loads(data) | ||||||
|  |             # if key == "GACHA_DATA": | ||||||
|  |             #     download_banners(data, server_name) | ||||||
|  |             json.dump(data, out_file, ensure_ascii=False, indent=1) | ||||||
|  |  | ||||||
|         old_mst_ver[key] = new_mst_ver[key] |         old_mst_ver[key] = new_mst_ver[key] | ||||||
|  |  | ||||||
| @@ -93,6 +96,36 @@ async def download_cache(server_name, server : str): | |||||||
|     await session.close() |     await session.close() | ||||||
|     return downloaded_files |     return downloaded_files | ||||||
|  |  | ||||||
|  | async def download_banners(gacha_data, server_name, session): | ||||||
|  |     path = f"/var/www/html/Katworks/KF/assets/KF3/{server_name}/banners/" | ||||||
|  |     os.makedirs(path, exist_ok=True) | ||||||
|  |  | ||||||
|  |     for entry in gacha_data: | ||||||
|  |         banner_name = entry["banner"] | ||||||
|  |         if banner_name == "" or banner_name == None: | ||||||
|  |             continue | ||||||
|  |         banner_name += ".png" | ||||||
|  |         file_path = path + banner_name | ||||||
|  |         if os.path.exists(file_path): | ||||||
|  |             continue | ||||||
|  |          | ||||||
|  |         file_url = "https://parade-mobile-prod-cdn.kemono-friends-3.jp/Texture2D/GachaTop/" + banner_name | ||||||
|  |         file_url_alt = "https://parade-mobile-develop01-app.kemono-friends-3.jp/Texture2D/GachaTop/" + banner_name | ||||||
|  |          | ||||||
|  |         status = 0 | ||||||
|  |         async with session.get(file_url) as resp: | ||||||
|  |             response = await resp.read() | ||||||
|  |             status = resp.status | ||||||
|  |         if status != 200: | ||||||
|  |             async with session.get(file_url_alt) as resp: | ||||||
|  |                 response = await resp.read() | ||||||
|  |                 status = resp.status | ||||||
|  |         if status != 200: continue | ||||||
|  |  | ||||||
|  |         with open(file_path, "wb") as file: | ||||||
|  |             file.write(response) | ||||||
|  |          | ||||||
|  |  | ||||||
| async def download_files(server_name, asset_bundle_url, srv_platform : str): | async def download_files(server_name, asset_bundle_url, srv_platform : str): | ||||||
|     def parse_ab_list(filecontent : str): |     def parse_ab_list(filecontent : str): | ||||||
|         out = {} |         out = {} | ||||||
| @@ -194,6 +227,15 @@ async def convert_files(): | |||||||
|             print("Conversion failed", f) |             print("Conversion failed", f) | ||||||
|  |  | ||||||
| async def manual(): | async def manual(): | ||||||
|  |  | ||||||
|  |     # session = aiohttp.ClientSession() | ||||||
|  |  | ||||||
|  |     # path = f"/var/www/html/Katworks/KF/assets/KF3/{server_name}/cache/" | ||||||
|  |  | ||||||
|  |     # await session.close() | ||||||
|  |  | ||||||
|  |     # return | ||||||
|  |  | ||||||
|     downloaded_cache = {} |     downloaded_cache = {} | ||||||
|     downloaded_files = {} |     downloaded_files = {} | ||||||
|      |      | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								run.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								run.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | #!/usr/bin/env bash | ||||||
|  | gunicorn --bind 127.0.0.1:8081 --config gunicorn_config.py wsgi:app | ||||||
		Reference in New Issue
	
	Block a user