mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
Replace auth.txt with SQLite auth database (#7279)
* Replace auth.txt with SQLite auth database
This commit is contained in:
parent
1836882495
commit
153fb211ac
19 changed files with 1153 additions and 82 deletions
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
// for player files
|
||||
|
||||
#include "database.h"
|
||||
#include <unordered_map>
|
||||
|
||||
class PlayerDatabaseFiles : public PlayerDatabase
|
||||
{
|
||||
|
@ -41,3 +42,23 @@ private:
|
|||
|
||||
std::string m_savedir;
|
||||
};
|
||||
|
||||
class AuthDatabaseFiles : public AuthDatabase
|
||||
{
|
||||
public:
|
||||
AuthDatabaseFiles(const std::string &savedir);
|
||||
virtual ~AuthDatabaseFiles() = default;
|
||||
|
||||
virtual bool getAuth(const std::string &name, AuthEntry &res);
|
||||
virtual bool saveAuth(const AuthEntry &authEntry);
|
||||
virtual bool createAuth(AuthEntry &authEntry);
|
||||
virtual bool deleteAuth(const std::string &name);
|
||||
virtual void listNames(std::vector<std::string> &res);
|
||||
virtual void reload();
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, AuthEntry> m_auth_list;
|
||||
std::string m_savedir;
|
||||
bool readAuthFile();
|
||||
bool writeAuthFile();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue