1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Refactor ScriptApiSecurity for cleaner separation of concerns

This commit is contained in:
sfan5 2024-11-03 14:24:35 +01:00
parent 4c44942a39
commit 1fd4e0b82d
11 changed files with 229 additions and 135 deletions

View file

@ -5,6 +5,8 @@
#pragma once
#include <cassert>
#include "cpp_api/s_base.h"
#include "cpp_api/s_client.h"
#include "cpp_api/s_modchannels.h"
@ -27,6 +29,16 @@ public:
void on_camera_ready(Camera *camera);
void on_minimap_ready(Minimap *minimap);
protected:
// from ScriptApiSecurity:
bool checkPathInternal(const std::string &abs_path, bool write_required,
bool *write_allowed) override {
warningstream << "IO API called in client scripting" << std::endl;
assert(0);
return false;
}
bool modNamesAreTrusted() override { return true; }
private:
virtual void InitializeModApi(lua_State *L, int top);
};