wxyz-abcd / node-haxball

The most powerful and lightweight API that allows you to develop your original Haxball(www.haxball.com) host, client, and standalone applications both on node.js and browser environments and also includes every possible hack and functionality that you can imagine.
MIT License
31 stars 12 forks source link

Password string is not encoded as URI #72

Open System32-0101 opened 2 weeks ago

System32-0101 commented 2 weeks ago

Password string is not encoded as URI so it will drop an error when you try to enter in a match that includes special characters in the password like (!,@,#,$,%,^, etc...)

Way I fixed: In joinRoom.js Line: 34: Fix:

            "r_pass": encodeURIComponent(document.getElementById("r_pass").value.toString()),

In: init.js Line: 92 Fix:

                    Room.join({
          id: params.r_id,
          password: decodeURIComponent(params.r_pass),
          token: params.token,
          authObj: authObj
        }

This way we assign the password to the decoded URI component that we coded before.

Hope this works :)

wxyz-abcd commented 1 week ago

Thanks for the attention and the issue. Can you try undoing them and changing this line instead?

In: https://github.com/wxyz-abcd/node-haxball/blob/main/examples_web/src/htmlQueryHelper.js Line: 12

return Object.keys(json).filter((x)=>(json[x]!=null && json[x]!="")).map((x)=>(encodeURI(x)+"="+encodeURI(json[x]))).join("&");

to:

return Object.keys(json).filter((x)=>(json[x]!=null && json[x]!="")).map((x)=>(encodeURIComponent(x)+"="+encodeURIComponent(json[x]))).join("&");