aperture-development / msync-2 Goto Github PK
View Code? Open in Web Editor NEWVersion 2 of MSync - Fully working and extra steak
Home Page: https://www.Aperture-Development.de
License: GNU General Public License v3.0
Version 2 of MSync - Fully working and extra steak
Home Page: https://www.Aperture-Development.de
License: GNU General Public License v3.0
I have all my servers set to dstm-build currently, for the sake of testing before I adjust things.
In this state, I have two groups:
I thought maybe it just made two different groups, but then I looked at my mrsync table:
For the sake of consistency, I dropped myself out of the mrsync table, and the tbl_users, reconnected, and disconnected. I went back to being on the rank of owner, in group 1.
So it appears that ranks which are set up to go to any server are in the allservers category. Is allservers to be interpreted as the overall wildcard ranks between all servers, or the group the server is in?
Is there supposed to be two sets of groups? This might just be a documentation limitation causing this confusion, let me know.
I was able to get everything connected last night after my rookie mistake. Database tables are up, server is populated, however, nothing else has copied over.
I have specified ranks which will synchronize to the all servers category, enabled the module, chose sync, rebooted, tried syncing again, and left the server running at idle all night.
All I was able to get was on disconnect, an entry for my player in the following table:
My settings.txt - cleaned confidential details out:
{
"mysql": {
"host": "localhost",
"database": "msync",
"username": "msync",
"password": "1-1-1-1-1-1-1-1-",
"port": "3306"
},
"serverGroup": "darkstorm-all",
"enabledModules": {
"MRSync": true,
"mrsync": true,
"MBSync": true
}
}
mrsync.txt
{
"nosync": [],
"syncall": {
"owner": true,
"member": true,
"retired-staff": true,
"serveradmin": true,
"grandmaster": true,
"mod": true
}
}
A bug was just discovered within the nested SQL statements. It appears that the current nested selects for the insert queries are all not working with a regular mysql database.
This syntax:
INSERT INTO `tbl_mrsync` (user_id, rank, server_group)
VALUES (
(SELECT p_user_id FROM tbl_users WHERE steamid=? AND steamid64=?),
?,
(SELECT p_group_id FROM tbl_server_grp WHERE group_name=?)
)
ON DUPLICATE KEY UPDATE rank=VALUES(rank);
is only MariaDB specific and does not work with MySQL 8. The proper syntax to use for the example given above would be
INSERT INTO `tbl_mrsync` (user_id, rank, server_group)
SELECT tbl_users.p_user_id, ?, tbl_server_grp.p_group_id
FROM tbl_users, tbl_server_grp
WHERE
tbl_users.steamid=? AND tbl_users.steamid64=?
AND
tbl_server_grp.group_name=?
ON DUPLICATE KEY UPDATE rank=VALUES(rank);
Hey there,
I am running the latest code from your github stable branch, and it is not even letting me do !msync. I have superadmin level of powers, what gives?
In looking through your autorun I did notice that the sv_ulx.lua file is not included, is this intentional?
My ULX is working perfectly fine, just your commands do not work either from rcon or ingame.
Here's how I was grabbing the syntax of your commands for ULX. tried both !msync and MSync in the ingame console.
` local OpenAdminGUI = ulx.command( "MSync", "msync.openAdminGUI", MSync.func.openAdminGUI, "!msync" )
OpenAdminGUI:defaultAccess( ULib.ACCESS_SUPERADMIN )
OpenAdminGUI:help( "Opens MSync Settings." )
end
--ucl.registerAccess("msync.", "superadmin", "", "MSync" )
`
As a troubleshooting step I also pulled aWarn from my server, and gBans, as both use MYSQL, as I didnt know if your code may conflict.
When using the in-game GUI to setup a database connection or to load a module, the module settings are not being reloaded and the GUI needs to be re-opened.
Excpected behaviour
Actual behaviour
This bug does not affect the functionality of MSync 2 in any way, it just is a convenience bug which makes this medium priority
When joining the server for the first time and opening the MSync GUI, a error will occur because the clientside part of the MRSync module still get loaded despite not being loaded on the server due to a not existing database connection.
Possible solutions may include:
Ingame I am presented with this:
cat mrsync.txt
{
"nosync": [],
"syncall": {
"owner": true,
"member": true,
"retired-staff": true,
"serveradmin": true,
"grandmaster": true,
"mod": true
}
This behavior exists upon disconnecting and reconnecting. When I try and add an existing rank to the ingame window, I get the following error:
[ERROR] addons/msync-2/lua/msync/client_gui/modules/cl_mrsync.lua:74: attempt to index field 'settings' (a nil value)
1. DoClick - addons/msync-2/lua/msync/client_gui/modules/cl_mrsync.lua:74
2. unknown - lua/vgui/dlabel.lua:237
As a workaround, one can edit the txt file directly.
Update module loader to allow real-time enabling and disabling of already loaded modules
I've been using this actively on 3 servers for a few weeks.
I recently noticed issues with ulib rank syncing and found this error in the console:
[MSync] Failed to create server ! Please report this to the developer: Data too long for column 'server_name' at row 1
I think this might have been caused by changing the server hostname.
Should I reset the database and re-add the servers?
Is there a way to recover from this error?
Description
Attempting to use the name "communitymanager" for a rank in MSync gives you a data too long for column 'rank'.
Reproduction
Add a rank to the sync system with the name "communitymanager"
Error Messages
------------------------------------
[MRSync] SQL Error!
------------------------------------
Please include this in a Bug report:
Data too long for column 'rank' at row 1
------------------------------------
I believe this is just a varchar sizing issue, would it be possible to increase the size limit? I believe I could fix this manually myself, however, I felt it prudent to report things like this so you are aware.
An issue with the MySQLoo Database:ping()
function causes the server to freeze up permanently when no database is connected. Due to this issue, users are not able to join their server when MSync is unconfigured.
Alternatively to Database:ping()
I could implement Database:status()
and compare them to the connection enums.
Description
My allservers ID is 1, my individual server is ID 2. Assume a situation where the user has an existing rank on ID 2. If they are granted an allservers rank in ID 1, Id 2 should assumedly be overridden. In its current state, it does not do this.
Reproduction
Set a user to a non-allservers rank, then set the user to an allservers rank, and have them reconnect. The system will prioritize their per-server rank, in this case demoting them.
I can understand having the allservers rank also rank lower, e.g. user is owner of one server and not another, but it can get confusing to track down the problem if a server, like we do, uses APromote, which quickly sets them to a specific rank before we can get them into the allservers rank.
Description
After I installed every dependency and your addon, I started the server, joined, executed !msync and then it threw errors
I tried Workshop installation and git installation
Reproduction
Just installed and executed !msync
Error Messages
Server-Error:
Lua Error: [ERROR] addons/msync2/lua/msync/server/sv_init.lua:91: attempt to index field 'enabledModules' (a nil value) 1. getModuleInfos - addons/msync2/lua/msync/server/sv_init.lua:91 2. func - addons/msync2/lua/msync/server/sv_net.lua:121 3. unknown - lua/includes/extensions/net.lua:32
Client-Error:
[msync2] addons/msync2/lua/msync/client_gui/cl_admin_gui.lua:230: attempt to index field 'moduleState' (a nil value)
1. InitModuleSettings - addons/msync2/lua/msync/client_gui/cl_admin_gui.lua:230
2. InitPanel - addons/msync2/lua/msync/client_gui/cl_admin_gui.lua:262
3. func - addons/msync2/lua/msync/client_gui/cl_net.lua:89
4. unknown - lua/includes/extensions/net.lua:32
I noticed that the function for loading modules has a huge issue. If a module is disabled, it stopd the loop and hangs. I dont yet know why that happens but I have a workaround
Replace:
for k,v in pairs(MSync.modules) do
if not MSync.settings.data.enabledModules[v["info"].ModuleIdentifier] then return end;
v["init"](initTransaction)
v["net"]()
v["ulx"]()
v["hooks"]()
print("["..v["info"]["Name"].."] Module loaded")
end
With:
for k,v in pairs(MSync.modules) do
if MSync.settings.data.enabledModules[v["info"].ModuleIdentifier] then
v["init"](initTransaction)
v["net"]()
v["ulx"]()
v["hooks"]()
print("["..v["info"]["Name"].."] Module loaded")
end
end
The responsible line of code is this:
if not MSync.settings.data.enabledModules[v["info"].ModuleIdentifier] then return end;
Custom Command handler to avoid using the command handler by ULX ( only for comfort reasons, nothing else really )
Description:
Having the ability to add users to the MSync database while they are offline would improve server management productivity
Usage Cases:
This would be useful should we need to provide a user a new rank while they are offline, and have not yet played on our server. For example, we have a rank for retired staff, who have not been on in a very long time. Many of them not in a few years. Since they are not in the MSync database, we would need to currently use ulx adduserid, and add them to our users.txt file. This is not ideal, as when we provide them a new rank via ulx adduser, the users.txt always overrides it.
Optional: Alternatives
Make a command which creates a user in MSync using just their steamid. This would allow us to manually manipulate the database, in order to set them to the appropriate rank.
Hi there,
in the latest version I realized ranks done either via ulx adduserid or ulx adduser end up in the users.txt. Surely I could just make the file read-only, however, I wanted to report this bug.
Also, it would be nice to have a verbose entry in console for when someone is updated in the database successfully, for peace of mind. I found out the hard way that this was still writing to the users.txt, and thus someone kept their rank despite me removing it!
We need to add a debugger with a ConVar that allows people to set debug levels. Right now everything is debugged.
Debug Levels:
Description:
Improve the Nickname feature for MBSync. Right now, Nicknames are only saved if players are banned while on the server or if they recently left. If I use ban on the ULX Ban tab, I can put in a nickname for the player, and it will show up on the list with a nickname. However, on MBSync, the nickname will only show "None Given." It would be great to have MBSync also use the nickname from the ULX ban function on the ban tab. Another great feature would be to be able to change the Nickname, as it is currently locked like SteamID.
Usage Cases:
Reading through a list of bans, it makes it easier to identify a player by name.
Optional: Alternatives
Create a feature that syncs bans already in place, including all bans before MSync2 was installed.
Description:
This is similar to our prior request, but falls more into the realm of automation. Using regex, it would be possible for you to make a command which would parse the JSON-formatted users.txt, and import said users to the MSync database. An initial command such as msync_importusers would make this process easy when people are first switching to this system.
Usage Cases:
People moving from a longstanding reliance on the built-in ULX ranking system can have massive user files which they do not want to lose. In the current format, years of people with ranks will need to be manually tracked down by looking at the file after migration to MSync
Optional: Alternatives
Automatically parse the users.txt file on server start, and convert + delete entries after verifying they are in the database.
As of now, MBSync updates its data every few minutes to prevent the queries from overloading the dastabase. This logic has a flaw, if the user is banned on another server within this period it takes several minutes for the other servers to syncronize the ban, which could be enough time for the banned user to cause more trouble.
The solution for this would be a simplified query which can run every few seconds. It should be as simple as:
SELECT version FROM tbl_msyncdb_version WHERE module_id='mbsync_data'
Another solution would be to implement some kind of messaging service with increasing version numbers. For this we would need at least one new table. With this table we wouldnt need to query all MBSync bans every few minutes, but instead only syncronize changes across the servers. This would require the table to hold the following data:
Neonsy: !msync
[Neonsy|4|STEAM_0:1:73680268] Lua Error:
[ERROR] lua/msync/client_gui/modules/cl_mbsync.lua:1382: Calling net.Start with unpooled message name! [ http://goo.gl/qcx0y ]
Start - [C]:-1
getSettings - lua/msync/client_gui/modules/cl_mbsync.lua:1382
3. adminPanel - lua/msync/client_gui/modules/cl_mbsync.lua:720
4. InitModuleSettings - lua/msync/client_gui/cl_admin_gui.lua:231
5. InitPanel - lua/msync/client_gui/cl_admin_gui.lua:259
6. func - lua/msync/client_gui/cl_net.lua:89
7. unknown - lua/includes/extensions/net.lua:32
MSync 2 Workshop
Saving the users rank would be helpful in a situation where a user is promoted to a rank, such as admin, and the server crashes before they disconnect.
In its current state, when a user is given a rank it does not apply until they disconnect from the server.
A library for the sake of smaller module files. Writing thousands of lines of code, just for a few GUI elements is ridicolus and unecessary.
Description
There seems to be an issue with the latest mysqloo and libmysqlclient versions that causes an unknown error within the addon. This also may just be my server, guidance would be appreciated.
Reproduction
mysqloo9 version: https://github.com/FredyH/MySQLOO/releases/download/9.6.1/gmsv_mysqloo_linux.dll
ibmysqlclient version: https://github.com/FredyH/MySQLOO/tree/master/MySQL/lib64/linux
Error Messages
Your server is using the latest mysqloo9 version
TymuOG: !msync
[MSync] There has been a error while loading the module querys.
Please inform the Developer and send him this:
SSL connection error: unknown error number
This seemed to be the best way to inform you of the issue.
Currently, you have the addon set so that they store a user in the following manner:
function MSync.modules.MRSync.init( transaction )
transaction:addQuery( MSync.DBServer:query([[
CREATE TABLE IF NOT EXISTS `tbl_mrsync` (
`p_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user_id` INT UNSIGNED NOT NULL,
`rank` VARCHAR(15) NOT NULL,
`server_group` INT UNSIGNED NOT NULL,
FOREIGN KEY (server_group) REFERENCES tbl_server_grp(p_group_id),
FOREIGN KEY (user_id) REFERENCES tbl_users(p_user_id),
UNIQUE INDEX `user_UNIQUE` (`user_id`, `server_group`)
);
]] ))
This is a great way to handle it from an initial standard of functionality, however, giving the user a unique number completely separate from STEAMID64 or the traditional STEAMID can cause for issues down the road.
I understand that you have the p_id as the common identifier to prevent user name changing from messing this up, but this is also an inefficient storage of the database, and the overall need for an extra table carrying redundant columns.
A more efficient approach, would be to combine tables tbl_users & tbl_mrsync, in a format like so:
Obviously disregard the commas in the steamid64 - my spreadsheet is helping a little too much today
This will allow for the following:
A MySQL based warning system to support infractions across multible servers.
What to do in the order it will be done
If someone installed MSync 1 and updated to MSync 2, the settings file is incompatible and it errors out, to fix that we need to check the settings for old variable names and then generate a new setting configuration from the old file
Description
When a user loads into a server where they are not cached in the users.txt file of that server, they will have the appropriate rank visibly, however, some addons such as the widely used restriction system WUMA will think the user is the guest role, and assign rights as such.
Reproduction
Workaround
Error Messages
N/A
This very small use case bug is caused by the way that MSync assigns ranks to users when they load in, more of a bandaid would be to use the function RunConsoleCommand("ulx", "adduserid" , ply:SteamID() , newRank)
Many servers already use auto promote addons which use the above logic, and this makes sure everyone fully has their rank working
Steps to reproduce:
L 05/12/2020 - 11:35:25: Lua Error: addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:87: attempt to index a nil value
stack traceback:
[C]: in function '__index'
addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:87: in function <addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:84>
[C]: in function 'fn'
addons/ulib/lua/ulib/shared/hook.lua:109: in function <addons/ulib/lua/ulib/shared/hook.lua:92>
addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:87: attempt to index a nil value
stack traceback:
[C]: in function '__index'
addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:87: in function <addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:84>
[C]: in function 'fn'
addons/ulib/lua/ulib/shared/hook.lua:109: in function <addons/ulib/lua/ulib/shared/hook.lua:92>
[MSync] User [DSTM] Bryant successfully created
This failure will also cause the users rank to be updated in the rank table, causing them to lose their rights in the table as well. In my case, it set me to the rank new in the table, as that is the rank I would fall into not having any access.
Upon repeating the same steps above for consistency, I am greeted with the same error and outcome:
L 05/12/2020 - 11:42:56: "[DSTM] Bryant<2><STEAM_0:0:26745653><>" entered the game
L 05/12/2020 - 11:42:56: Lua Error: addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:87: attempt to index a nil value
stack traceback:
[C]: in function '__index'
addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:87: in function <addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:84>
[C]: in function 'fn'
addons/ulib/lua/ulib/shared/hook.lua:109: in function <addons/ulib/lua/ulib/shared/hook.lua:92>
addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:87: attempt to index a nil value
stack traceback:
[C]: in function '__index'
addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:87: in function <addons/msync-2/lua/msync/server/modules/sv_mrsync.lua:84>
[C]: in function 'fn'
addons/ulib/lua/ulib/shared/hook.lua:109: in function <addons/ulib/lua/ulib/shared/hook.lua:92>
[MSync] User [DSTM] Bryant successfully created
Sending full update to Client [DSTM] Bryant
The maximum size of a net package in GMod is 64Kb, to solve future issues we need to implement a system to send the data in single bits.
So I have this really annoying friend, right? This is his name on steam:
BR CHIL (CAMPS LOCK mAChin BRKE)
Here's a breakdown of the unicode: Unicode Inspector
Here's the error in console:
[MSync] Failed to create user BR CHIL (CAMPS LOCK mAChin BRKE) !
Please report this to the developer: Data too long for column 'nickname' at row 1
I can't really get him to change his name, and there will always be players with insane names going into the database, so I was wondering if you knew a way to patch this.
Hello, there was a problem, I don’t know how to solve it
[ERROR] Warning! A net message (msync.sendTable) is already started! Discarding in favor of the new message! (DLib.NetworkedRemove)
1. nextevent - addons/dlib/lua/dlib/modules/nwvar/sv_nwvar.lua:118
2. unknown - addons/dlib/lua/dlib/modules/hook.lua:439
Add console commands to be able to enable and disable modules using the console. Also allow changing mysql settings via console and other console commands
DEPENDS: Command Handler
I just recently updated to the latest commit because I saw there was more development of this script.
I just replaced the /addons/msync-2 folder with the new version and didn't change any configs or touch the database hoping it would just work.
The console is logging the following:
[MSync] Module querys have been completed successfully
[MSync] Failed to create server !
Please report this to the developer: Data truncated for column 'ip' at row 1
Not exactly sure what to do about this. Should I rebuild my database? Should I change a setting or something in the config?
[MSync] There has been a error while loading the module querys.
Please inform the Developer and send him this:
Can't connect to MySQL server on '185.234.72.59' (111)
A good way to syncronize data in Real-Time across servers would be using Socket connections. This would require a socket module, currently these are avaiable:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.