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

use generell url parser. #33

Open
lublak opened this issue Aug 16, 2024 · 4 comments
Open

use generell url parser. #33

lublak opened this issue Aug 16, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@lublak
Copy link
Contributor

lublak commented Aug 16, 2024

Currently the code uses the same regex multiple times:

func get_authorization_host() -> String:
	var matches = url_regex.search(authorization_url)
	if matches == null: return ""
	return matches.get_string(1)
	
func get_authorization_path() -> String:
	var matches = url_regex.search(authorization_url)
	if matches == null: return ""
	return matches.get_string(6)

a better solution could be a "URL" class.

just a quick note:

class Url {
  port
  host
  path
  ....
  new() {
  
  }

  static fromString(url string) {
     // use regex to fill props
  }
}
@kanimaru
Copy link
Owner

I wonder why godot doesn't have such a class already.

@lublak
Copy link
Contributor Author

lublak commented Aug 17, 2024

@kanimaru I think, most of the time, it's not needed in game development. In which game do you need a URL parser? Okay yes, now it would be useful xD

@kanimaru
Copy link
Owner

All games with multiplayer support via REST? :D

@lublak
Copy link
Contributor Author

lublak commented Aug 17, 2024

Touché! xD but I think with the native Godot client you could use the full URL address without splitting it into host and path. So most of the time, nobody needs to split it.

@kanimaru kanimaru added enhancement New feature or request good first issue Good for newcomers labels Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants