1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 05:16:37 +02:00

Remove webpanel:ssl configuration option because its dumb

This commit is contained in:
Adam
2013-08-23 01:14:00 -04:00
parent 154fa25e8f
commit 4d1492d444
10 changed files with 17 additions and 19 deletions
-3
View File
@@ -672,7 +672,4 @@ module { name = "help" }
/* Page title. */
title = "Anope IRC Services";
/* Whether or not to use https on redirecting URLs. */
ssl = no
}
+7 -1
View File
@@ -131,11 +131,12 @@ class HTTPProvider : public ListenSocket, public Service
{
Anope::string ip;
unsigned short port;
bool ssl;
public:
Anope::string ext_ip;
std::vector<Anope::string> ext_headers;
HTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p) : ListenSocket(i, p, i.find(':') != Anope::string::npos), Service(c, "HTTPProvider", n), ip(i), port(p) { }
HTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, bool s) : ListenSocket(i, p, i.find(':') != Anope::string::npos), Service(c, "HTTPProvider", n), ip(i), port(p), ssl(s) { }
const Anope::string &GetIP() const
{
@@ -147,6 +148,11 @@ class HTTPProvider : public ListenSocket, public Service
return this->port;
}
bool IsSSL() const
{
return this->ssl;
}
virtual bool RegisterPage(HTTPPage *page) = 0;
virtual void UnregisterPage(HTTPPage *page) = 0;
virtual HTTPPage* FindPage(const Anope::string &name) = 0;
+2 -4
View File
@@ -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;
}
+3 -3
View File
@@ -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");
+1 -1
View File
@@ -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;
}
-2
View File
@@ -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)
+1 -2
View File
@@ -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
}