Compare commits

..

1 Commits

Author SHA1 Message Date
Fabian Dill
8fdad3cbba CommonClient: handle Firefox removing the password part of userinfo 2024-01-28 06:47:34 +01:00
3 changed files with 18 additions and 26 deletions

View File

@@ -612,6 +612,10 @@ async def server_loop(ctx: CommonContext, address: typing.Optional[str] = None)
address = f"ws://{address}" if "://" not in address \
else address.replace("archipelago://", "ws://")
uri = urllib.parse.urlparse(address)
if uri.username and uri.password is None:
# Fix for Firefox stripping empty password https://bugzilla.mozilla.org/show_bug.cgi?id=1876952
address = address.replace("@", ":@")
server_url = urllib.parse.urlparse(address)
if server_url.username:

View File

@@ -39,8 +39,7 @@ class AutoWorldRegister(type):
def __new__(mcs, name: str, bases: Tuple[type, ...], dct: Dict[str, Any]) -> AutoWorldRegister:
if "web" in dct:
assert isinstance(dct["web"], WebWorld) or isinstance(dct["web"], staticproperty), \
"WebWorld has to be instantiated."
assert isinstance(dct["web"], WebWorld), "WebWorld has to be instantiated."
# filter out any events
dct["item_name_to_id"] = {name: id for name, id in dct["item_name_to_id"].items() if id}
dct["location_name_to_id"] = {name: id for name, id in dct["location_name_to_id"].items() if id}
@@ -485,11 +484,6 @@ class LogicMixin(metaclass=AutoLogicRegister):
pass
class staticproperty(staticmethod):
def __get__(self, *args):
return self.__func__()
def data_package_checksum(data: "GamesPackage") -> str:
"""Calculates the data package checksum for a game from a dict"""
assert "checksum" not in data, "Checksum already in data"

View File

@@ -5,8 +5,7 @@ import itertools
from typing import List, Dict, Any, cast
from BaseClasses import Region, Entrance, Location, Item, Tutorial, ItemClassification
from worlds.AutoWorld import World, WebWorld, staticproperty
from Utils import cache_argsless
from worlds.AutoWorld import World, WebWorld
from . import items
from . import locations
from . import creatures
@@ -17,26 +16,21 @@ from .rules import set_rules
logger = logging.getLogger("Subnautica")
class SubnaticaWeb(WebWorld):
tutorials = [Tutorial(
"Multiworld Setup Guide",
"A guide to setting up the Subnautica randomizer connected to an Archipelago Multiworld",
"English",
"setup_en.md",
"setup/en",
["Berserker"]
)]
all_locations = {data["name"]: loc_id for loc_id, data in locations.location_table.items()}
all_locations.update(creatures.creature_locations)
@staticproperty
@cache_argsless
def web():
class SubnaticaWeb(WebWorld):
tutorials = [Tutorial(
"Multiworld Setup Guide",
"A guide to setting up the Subnautica randomizer connected to an Archipelago Multiworld",
"English",
"setup_en.md",
"setup/en",
["Berserker"]
)]
return SubnaticaWeb()
class SubnauticaWorld(World):
"""
Subnautica is an undersea exploration game. Stranded on an alien world, you become infected by
@@ -44,7 +38,7 @@ class SubnauticaWorld(World):
You must find a cure for yourself, build an escape rocket, and leave the planet.
"""
game = "Subnautica"
web = web
web = SubnaticaWeb()
item_name_to_id = {data.name: item_id for item_id, data in items.item_table.items()}
location_name_to_id = all_locations