-
Notifications
You must be signed in to change notification settings - Fork 709
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gl' of https://github.com/jamesbrq/ArchipelagoMainMLSS …
…into gl
- Loading branch information
Showing
86 changed files
with
2,931 additions
and
2,220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
import ModuleUpdate | ||
ModuleUpdate.update() | ||
|
||
from worlds._bizhawk.context import launch | ||
|
||
if __name__ == "__main__": | ||
launch() | ||
launch(*sys.argv[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,15 @@ | ||
"""API endpoints package.""" | ||
from typing import List, Tuple | ||
from uuid import UUID | ||
|
||
from flask import Blueprint, abort, url_for | ||
from flask import Blueprint | ||
|
||
import worlds.Files | ||
from ..models import Room, Seed | ||
from ..models import Seed | ||
|
||
api_endpoints = Blueprint('api', __name__, url_prefix="/api") | ||
|
||
# unsorted/misc endpoints | ||
|
||
|
||
def get_players(seed: Seed) -> List[Tuple[str, str]]: | ||
return [(slot.player_name, slot.game) for slot in seed.slots] | ||
|
||
|
||
@api_endpoints.route('/room_status/<suuid:room>') | ||
def room_info(room: UUID): | ||
room = Room.get(id=room) | ||
if room is None: | ||
return abort(404) | ||
|
||
def supports_apdeltapatch(game: str): | ||
return game in worlds.Files.AutoPatchRegister.patch_types | ||
downloads = [] | ||
for slot in sorted(room.seed.slots): | ||
if slot.data and not supports_apdeltapatch(slot.game): | ||
slot_download = { | ||
"slot": slot.player_id, | ||
"download": url_for("download_slot_file", room_id=room.id, player_id=slot.player_id) | ||
} | ||
downloads.append(slot_download) | ||
elif slot.data: | ||
slot_download = { | ||
"slot": slot.player_id, | ||
"download": url_for("download_patch", patch_id=slot.id, room_id=room.id) | ||
} | ||
downloads.append(slot_download) | ||
return { | ||
"tracker": room.tracker, | ||
"players": get_players(room.seed), | ||
"last_port": room.last_port, | ||
"last_activity": room.last_activity, | ||
"timeout": room.timeout, | ||
"downloads": downloads, | ||
} | ||
|
||
|
||
from . import generate, user, datapackage # trigger registration | ||
from . import datapackage, generate, room, user # trigger registration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from typing import Any, Dict | ||
from uuid import UUID | ||
|
||
from flask import abort, url_for | ||
|
||
import worlds.Files | ||
from . import api_endpoints, get_players | ||
from ..models import Room | ||
|
||
|
||
@api_endpoints.route('/room_status/<suuid:room_id>') | ||
def room_info(room_id: UUID) -> Dict[str, Any]: | ||
room = Room.get(id=room_id) | ||
if room is None: | ||
return abort(404) | ||
|
||
def supports_apdeltapatch(game: str) -> bool: | ||
return game in worlds.Files.AutoPatchRegister.patch_types | ||
|
||
downloads = [] | ||
for slot in sorted(room.seed.slots): | ||
if slot.data and not supports_apdeltapatch(slot.game): | ||
slot_download = { | ||
"slot": slot.player_id, | ||
"download": url_for("download_slot_file", room_id=room.id, player_id=slot.player_id) | ||
} | ||
downloads.append(slot_download) | ||
elif slot.data: | ||
slot_download = { | ||
"slot": slot.player_id, | ||
"download": url_for("download_patch", patch_id=slot.id, room_id=room.id) | ||
} | ||
downloads.append(slot_download) | ||
|
||
return { | ||
"tracker": room.tracker, | ||
"players": get_players(room.seed), | ||
"last_port": room.last_port, | ||
"last_activity": room.last_activity, | ||
"timeout": room.timeout, | ||
"downloads": downloads, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.