mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 23:35:41 +00:00
Fix protected mod kick
This commit is contained in:
parent
0bb18de9f6
commit
6053aa6192
@ -808,13 +808,17 @@ void TNetwork::SendFile(TClient& c, const std::string& UnsafeName) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto FileName = fs::path(UnsafeName).filename().string();
|
auto FileName = fs::path(UnsafeName).filename().string();
|
||||||
FileName = Application::Settings.getAsString(Settings::Key::General_ResourceFolder) + "/Client/" + FileName;
|
|
||||||
|
|
||||||
for (auto mod : mResourceManager.GetMods()) {
|
for (auto mod : mResourceManager.GetMods()) {
|
||||||
if (mod["filename"] == FileName && mod["protected"] == true)
|
if (mod["file_name"].get<std::string>() == FileName && mod["protected"] == true) {
|
||||||
|
beammp_warn("Client tried to access protected file " + UnsafeName);
|
||||||
|
c.Disconnect("Mod is protected thus cannot be downloaded");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileName = Application::Settings.getAsString(Settings::Key::General_ResourceFolder) + "/Client/" + FileName;
|
||||||
|
|
||||||
if (!std::filesystem::exists(FileName)) {
|
if (!std::filesystem::exists(FileName)) {
|
||||||
if (!TCPSend(c, StringToVector("CO"))) {
|
if (!TCPSend(c, StringToVector("CO"))) {
|
||||||
// TODO: handle
|
// TODO: handle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user