Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommonClient: Explicitly parse url arg as an archipelago:// url #3568

Merged
merged 7 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions CommonClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,11 +1037,12 @@ async def main(args):

if args.url:
url = urllib.parse.urlparse(args.url)
args.connect = url.netloc
if url.username:
args.name = urllib.parse.unquote(url.username)
if url.password:
args.password = urllib.parse.unquote(url.password)
if url.scheme == "archipelago":
args.connect = url.netloc
if url.username:
args.name = urllib.parse.unquote(url.username)
if url.password:
args.password = urllib.parse.unquote(url.password)
Comment on lines -1042 to +1047
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part is still needed, if that's rolled into a different PR or this PR is reopened removing the Launcher.py changes idc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll reopen this and look at it soon, what exactly does this part do on its own?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently argparse grabs the first positional arg and throws it into url, that's to be expected but does mean that launcher "text client" puts the component name in the url block, this causes issues because the highlighted code block only checks if there is a url arg before overriding things

the updated code just confirms that the scheme of the url is correct (i.e. archipelago://blah@blah) before applying any of the available values to the ctx to stop mishandling of any potential bad data


colorama.init()

Expand Down
3 changes: 2 additions & 1 deletion Launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ def main(args: Optional[Union[argparse.Namespace, dict]] = None):
help="Pass either a patch file, a generated game or the name of a component to run.")
run_group.add_argument("args", nargs="*",
help="Arguments to pass to component.")
main(parser.parse_args())
args, unknown_args = parser.parse_known_args()
main(args)

from worlds.LauncherComponents import processes
for process in processes:
Expand Down
Loading