asd
This commit is contained in:
parent
06be552dad
commit
04c8829732
@ -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;
|
||||
}
|
||||
|
@ -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 <https://www.gnu.org/licenses/>. //
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
#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();
|
||||
}
|
||||
|
@ -28,7 +28,8 @@
|
||||
#include <QTimer>
|
||||
#include <QWebSocket>
|
||||
#include <QWebSocketServer>
|
||||
|
||||
#include <QSslSocket>
|
||||
#include <QSslKey>
|
||||
#include "network/aopacket.h"
|
||||
#include "playerstateobserver.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user