mirror of
https://github.com/anope/anope.git
synced 2026-07-07 15:23:13 +02:00
Remove webpanel:ssl configuration option because its dumb
This commit is contained in:
@@ -291,9 +291,7 @@ class MyHTTPProvider : public HTTPProvider, public Timer
|
||||
std::list<Reference<MyHTTPClient> > clients;
|
||||
|
||||
public:
|
||||
bool ssl;
|
||||
|
||||
MyHTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, const int t, bool s) : Socket(-1, i.find(':') != Anope::string::npos), HTTPProvider(c, n, i, p), Timer(c, 10, Anope::CurTime, true), timeout(t), ssl(s) { }
|
||||
MyHTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, const int t, bool s) : Socket(-1, i.find(':') != Anope::string::npos), HTTPProvider(c, n, i, p, s), Timer(c, 10, Anope::CurTime, true), timeout(t) { }
|
||||
|
||||
void Tick(time_t) anope_override
|
||||
{
|
||||
@@ -461,7 +459,7 @@ class HTTPD : public Module
|
||||
{
|
||||
MyHTTPProvider *p = it->second;
|
||||
|
||||
if (p->ssl && sslref)
|
||||
if (p->IsSSL() && sslref)
|
||||
try
|
||||
{
|
||||
sslref->Init(p);
|
||||
|
||||
@@ -18,7 +18,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
|
||||
if (chname.empty())
|
||||
{
|
||||
reply.error = HTTP_FOUND;
|
||||
reply.headers["Location"] = Anope::string("http") + (use_ssl ? "s" : "") + "://" + message.headers["Host"] + "/chanserv/info";
|
||||
reply.headers["Location"] = Anope::string("http") + (server->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/chanserv/info";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ bool WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::st
|
||||
if (chname.empty())
|
||||
{
|
||||
reply.error = HTTP_FOUND;
|
||||
reply.headers["Location"] = Anope::string("http") + (use_ssl ? "s" : "") + "://" + message.headers["Host"] + "/chanserv/info";
|
||||
reply.headers["Location"] = Anope::string("http") + (server->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/chanserv/info";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
|
||||
if (chname.empty())
|
||||
{
|
||||
reply.error = HTTP_FOUND;
|
||||
reply.headers["Location"] = Anope::string("http") + (use_ssl ? "s" : "") + "://" + message.headers["Host"] + "/chanserv/info";
|
||||
reply.headers["Location"] = Anope::string("http") + (server->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/chanserv/info";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class WebpanelRequest : public IdentifyRequest
|
||||
|
||||
void OnSuccess() anope_override
|
||||
{
|
||||
if (!client)
|
||||
if (!client || !server)
|
||||
return;
|
||||
NickAlias *na = NickAlias::Find(this->GetAccount());
|
||||
if (!na)
|
||||
@@ -58,14 +58,14 @@ class WebpanelRequest : public IdentifyRequest
|
||||
}
|
||||
|
||||
reply.error = HTTP_FOUND;
|
||||
reply.headers["Location"] = Anope::string("http") + (use_ssl ? "s" : "") + "://" + message.headers["Host"] + "/nickserv/info";
|
||||
reply.headers["Location"] = Anope::string("http") + (server->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/nickserv/info";
|
||||
|
||||
client->SendReply(&reply);
|
||||
}
|
||||
|
||||
void OnFail() anope_override
|
||||
{
|
||||
if (!client)
|
||||
if (!client || !server)
|
||||
return;
|
||||
replacements["INVALID_LOGIN"] = "Invalid username or password";
|
||||
TemplateFileServer page("login.html");
|
||||
|
||||
@@ -17,7 +17,7 @@ bool WebCPanel::Logout::OnRequest(HTTPProvider *server, const Anope::string &pag
|
||||
na->Shrink<Anope::string>("webcpanel_ip");
|
||||
|
||||
reply.error = HTTP_FOUND;
|
||||
reply.headers["Location"] = Anope::string("http") + (use_ssl ? "s" : "") + "://" + message.headers["Host"] + "/";
|
||||
reply.headers["Location"] = Anope::string("http") + (server->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
Module *me;
|
||||
Anope::string provider_name, template_name, template_base, page_title;
|
||||
bool use_ssl = false;
|
||||
|
||||
class ModuleWebCPanel : public Module
|
||||
{
|
||||
@@ -59,7 +58,6 @@ class ModuleWebCPanel : public Module
|
||||
template_name = block->Get<const Anope::string>("template", "default");
|
||||
template_base = Anope::DataDir + "/modules/webcpanel/templates/" + template_name;
|
||||
page_title = block->Get<const Anope::string>("title", "Anope IRC Services");
|
||||
use_ssl = block->Get<bool>("ssl", "no"); // This is dumb, is there a better way to do this?
|
||||
|
||||
provider = ServiceReference<HTTPProvider>("HTTPProvider", provider_name);
|
||||
if (!provider)
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
extern Module *me;
|
||||
|
||||
extern Anope::string provider_name, template_name, template_base, page_title;
|
||||
extern bool use_ssl;
|
||||
|
||||
struct SubSection
|
||||
{
|
||||
@@ -89,7 +88,7 @@ class WebPanelProtectedPage : public WebPanelPage
|
||||
if (!panel || !(na = panel->GetNickFromSession(client, message)))
|
||||
{
|
||||
reply.error = HTTP_FOUND;
|
||||
reply.headers["Location"] = Anope::string("http") + (use_ssl ? "s" : "") + "://" + message.headers["Host"] + "/";
|
||||
reply.headers["Location"] = Anope::string("http") + (provider->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/";
|
||||
return true; // Access denied
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user