fix: Login uri was impossible to change

This commit is contained in:
2024-04-25 01:44:13 +01:00
committed by chucky-n-ice
parent 93871cc260
commit e776135d7d

View File

@@ -594,17 +594,17 @@ void ShowCommandsToolbar()
// login window // login window
class GetHTTPContent: public HTTPCallback { class GetHTTPContent: public HTTPCallback {
public: public:
GetHTTPContent(const std::string &uri): uri{uri} { GetHTTPContent() {
this->proccessing = false; this->proccessing = false;
this->buf_last = lastof(buf); this->buf_last = lastof(buf);
} }
bool proccessing = false; bool proccessing = false;
void InitiateLoginSequence() { void InitiateLoginSequence(const std::string& uri) {
if(this->proccessing) return; if(this->proccessing) return;
this->proccessing = true; this->proccessing = true;
this->cursor = this->buf; this->cursor = this->buf;
NetworkHTTPSocketHandler::Connect(this->uri, this); NetworkHTTPSocketHandler::Connect(uri, this);
} }
void OnReceiveData(std::unique_ptr<char[]> data, size_t length) override { void OnReceiveData(std::unique_ptr<char[]> data, size_t length) override {
@@ -642,7 +642,6 @@ private:
char buf[HTTPBUFLEN]; char buf[HTTPBUFLEN];
char *buf_last; char *buf_last;
char *cursor; char *cursor;
std::string uri;
}; };
std::string urlencode(const std::string &s) { std::string urlencode(const std::string &s) {
@@ -692,8 +691,9 @@ void AccountLogin(CommunityName community){
default: default:
return; return;
} }
static GetHTTPContent login(uri);
login.InitiateLoginSequence(); static GetHTTPContent login{};
login.InitiateLoginSequence(uri);
} }
//login window //login window