diff --git a/src/packet/packet_mc.cpp b/src/packet/packet_mc.cpp
index 6b2f276..b82cedb 100644
--- a/src/packet/packet_mc.cpp
+++ b/src/packet/packet_mc.cpp
@@ -32,7 +32,10 @@ void PacketMC::handlePacket(AreaData *area, AOClient &client) const
if (client.getServer()->getMusicList().contains(l_argument) || client.m_music_manager->isCustom(client.areaId(), l_argument) || l_argument == "~stop.mp3") { // ~stop.mp3 is a dummy track used by 2.9+
// We have a song here
- if (client.m_is_spectator || area->lockStatus() == AreaData::LockStatus::SPECTATABLE && !area->invited().contains(client.clientId()) && !client.checkPermission(ACLRole::BYPASS_LOCKS)) {
+ if (client.m_is_spectator ||
+ (area->lockStatus() == AreaData::LockStatus::SPECTATABLE &&
+ !area->invited().contains(client.clientId()) &&
+ !client.checkPermission(ACLRole::BYPASS_LOCKS))) {
client.sendServerMessage("Spectators are blocked from changing the music.");
return;
}
diff --git a/src/server.cpp b/src/server.cpp
index a8b8ca2..009f5f6 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1,20 +1,3 @@
-//////////////////////////////////////////////////////////////////////////////////////
-// akashi - a server for Attorney Online 2 //
-// Copyright (C) 2020 scatterflower //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU Affero General Public License as //
-// published by the Free Software Foundation, either version 3 of the //
-// License, or (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU Affero General Public License for more details. //
-// //
-// You should have received a copy of the GNU Affero General Public License //
-// along with this program. If not, see . //
-//////////////////////////////////////////////////////////////////////////////////////
#include "server.h"
#include "acl_roles_handler.h"
@@ -63,7 +46,30 @@ void Server::start()
qDebug() << bind_ip << "is an invalid IP address to listen on! Server not starting, check your config.";
}
- server = new QWebSocketServer("Akashi", QWebSocketServer::NonSecureMode, this);
+ QFile keyFile("/home/gor/Desktop/akashi-esquizolandia/bin/config/certs/private.key");
+ if (!keyFile.open(QIODevice::ReadOnly)) {
+ qWarning() << "Unable to open private key file.";
+ return;
+ }
+ QSslKey privateKey(&keyFile, QSsl::Rsa);
+ keyFile.close();
+
+ QFile certFile("/home/gor/Desktop/akashi-esquizolandia/bin/config/certs/certificate.crt");
+ if (!certFile.open(QIODevice::ReadOnly)) {
+ qWarning() << "Unable to open certificate file.";
+ return;
+ }
+ QSslCertificate certificate(&certFile);
+ certFile.close();
+
+ QSslConfiguration sslConfig = QSslConfiguration::defaultConfiguration();
+ sslConfig.setPrivateKey(privateKey);
+ sslConfig.setLocalCertificate(certificate);
+
+ server = new QWebSocketServer(QStringLiteral("Akashi"), QWebSocketServer::SecureMode, this);
+ server->setSslConfiguration(sslConfig);
+
+
if (!server->listen(bind_addr, m_port)) {
qDebug() << "Server error:" << server->errorString();
}
diff --git a/src/server.h b/src/server.h
index afa57f7..4d04ab5 100644
--- a/src/server.h
+++ b/src/server.h
@@ -28,7 +28,8 @@
#include
#include
#include
-
+#include
+#include
#include "network/aopacket.h"
#include "playerstateobserver.h"