mirror of
https://github.com/moraroy/NonSteamLaunchers-On-Steam-Deck.git
synced 2025-02-01 11:22:37 +01:00
Update proxycache.py
This commit is contained in:
parent
b4ec47c819
commit
3839e79934
@ -82,19 +82,35 @@ class ProxyCacheHandler(BaseHTTPRequestHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if path_parts[1] == 'search':
|
if path_parts[1] == 'search':
|
||||||
|
# Handle search request: /search/<game_name>
|
||||||
|
if len(path_parts) < 3:
|
||||||
|
self.send_response(400)
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(b'Game name is required for search')
|
||||||
|
return
|
||||||
|
|
||||||
game_name = unquote(path_parts[2]) # Decode the URL-encoded game name
|
game_name = unquote(path_parts[2]) # Decode the URL-encoded game name
|
||||||
self.handle_search(game_name)
|
self.handle_search(game_name)
|
||||||
else:
|
else:
|
||||||
|
# Handle artwork request: /<art_type>/<game_id>
|
||||||
if len(path_parts) < 4:
|
if len(path_parts) < 4:
|
||||||
self.send_response(400)
|
self.send_response(400)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(b'Invalid request')
|
self.wfile.write(b'Invalid request: art type and game ID are required')
|
||||||
return
|
return
|
||||||
|
|
||||||
art_type = path_parts[1]
|
art_type = path_parts[1] # art type (e.g., grid, cover, etc.)
|
||||||
game_id = path_parts[3]
|
game_id = path_parts[2] # game ID (e.g., 123456)
|
||||||
dimensions = parse_qs(parsed_path.query).get('dimensions', [None])[0]
|
dimensions = parse_qs(parsed_path.query).get('dimensions', [None])[0]
|
||||||
|
|
||||||
|
# Ensure that the art_type is valid
|
||||||
|
valid_art_types = ['grid', 'cover', 'banner', 'logo', 'icon']
|
||||||
|
if art_type not in valid_art_types:
|
||||||
|
self.send_response(400)
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(b'Invalid art type')
|
||||||
|
return
|
||||||
|
|
||||||
logger.info(f"Art type: {art_type}")
|
logger.info(f"Art type: {art_type}")
|
||||||
logger.info(f"Game ID: {game_id}")
|
logger.info(f"Game ID: {game_id}")
|
||||||
logger.info(f"Dimensions: {dimensions}")
|
logger.info(f"Dimensions: {dimensions}")
|
||||||
@ -113,6 +129,7 @@ class ProxyCacheHandler(BaseHTTPRequestHandler):
|
|||||||
self.end_headers()
|
self.end_headers()
|
||||||
logger.info(f"OPTIONS request handled for: {self.path}")
|
logger.info(f"OPTIONS request handled for: {self.path}")
|
||||||
|
|
||||||
|
|
||||||
def handle_search(self, game_name):
|
def handle_search(self, game_name):
|
||||||
logger.info(f"Searching for game ID for: {game_name}")
|
logger.info(f"Searching for game ID for: {game_name}")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user