GithubHelp home page GithubHelp logo

szporwolik / perun Goto Github PK

View Code? Open in Web Editor NEW
32.0 6.0 8.0 1.28 MB

Perun toolset for DCS World server admins. Reads simulation data and pushes it MySQL database.

License: MIT License

C# 9.40% Lua 5.19% PHP 0.72% CMake 0.03% Makefile 1.19% HTML 31.62% Roff 0.80% CSS 0.18% C 49.93% C++ 0.81% Batchfile 0.12%
dcs-world dcsworld dcs-srs dcs-servers dcs

perun's People

Contributors

ags313 avatar davidp57 avatar dependabot[bot] avatar idefixrc avatar szporwolik avatar vladmordock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

perun's Issues

ERROR MySQL - error: Incorrect string value: '\xE9 de l...' for column 'pe_LogChat_msg' at row 675

Hi,

We regularily encouter this kind of errors on several columns, leading to a lot of log messages, and a logfile of a few GiB.
As a countermeasure, we decided to set all the columns of our database with the UTF8mb4_unicode_ci codepage, but we still have this error.

Is it possible that something could be done in Perun to alleviate this problem ?

Also, is there a configuration option to enable/disable logging all the chat messages ? This error made us realize that they're all logged and we don't want that.
If there isn't an existing option, tell me and I'll try and add one in my fork, then request a pull.

Cheers, and thanks for all your hard work on Perun !

2021-05-04  00:00:00.006 | 8.72 | 44.51 | 000002 | 000152 | 2 | X | > |  50 | ERROR MySQL - error id: 1366
2021-05-04  00:00:00.006 | 8.72 | 44.51 | 000002 | 000152 | 2 | X | > |  50 | ERROR MySQL - query: INSERT INTO `pe_DataPlayers` (`pe_DataPlayers_ucid`) SELECT 'aeb5d73b82df24360a8f53a23a28d564' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataPlayers` where `pe_DataPlayers_ucid` = 'aeb5d73b82df24360a8f53a23a28d564' );UPDATE  `pe_DataPlayers` SET `pe_DataPlayers_updated` = '2021-05-02 22:11:54',`pe_DataPlayers_lastname`=@PAR_payload_player WHERE `pe_DataPlayers_ucid`='aeb5d73b82df24360a8f53a23a28d564' ;INSERT INTO `pe_DataMissionHashes` (`pe_DataMissionHashes_hash`,`pe_DataMissionHashes_instance`) SELECT 'VEAF_OpenTraining_Syria-morning-real@[email protected]@20210502_205419','2' FROM DUAL WHERE NOT EXISTS (SELECT * FROM `pe_DataMissionHashes` where `pe_DataMissionHashes_hash` ='VEAF_OpenTraining_Syria-morning-real@[email protected]@20210502_205419' AND `pe_DataMissionHashes_instance`=2);UPDATE `pe_DataMissionHashes` SET `pe_DataMissionHashes_datetime` = '2021-05-02 22:11:54' WHERE `pe_DataMissionHashes_hash` = 'VEAF_OpenTraining_Syria-morning-real@[email protected]@20210502_205419' AND `pe_DataMissionHashes_instance`=2 ;INSERT INTO `pe_LogChat` (`pe_LogChat_id`,`pe_LogChat_datetime`, `pe_LogChat_playerid`, `pe_LogChat_msg`, `pe_LogChat_all`,`pe_LogChat_missionhash_id`) VALUES (NULL,'2021-05-02 22:11:54', (SELECT `pe_DataPlayers_id` from `pe_DataPlayers` WHERE `pe_DataPlayers_ucid` = 'aeb5d73b82df24360a8f53a23a28d564'), @PAR_payload_msg, '3',(SELECT `pe_DataMissionHashes_id` FROM `pe_DataMissionHashes` WHERE `pe_DataMissionHashes_hash` = 'VEAF_OpenTraining_Syria-morning-real@[email protected]@20210502_205419'));
2021-05-04  00:00:00.006 | 8.72 | 44.51 | 000002 | 000152 | 2 | X | > |  50 | ERROR MySQL - error: Incorrect string value: '\xE9 de l...' for column 'pe_LogChat_msg' at row 675

Documentation needed: php example

Hello, a suggestion, would it be possible to add a php file of how tables are made? I know it's not part of the project, but it would help beginners like me. Thank you very much.

No update when mission changes on the server

I'm not 100% sure, but it seems that the LUA hook only refreshes the mission and slots data at start, and when reconnecting to the TCP socket.
Does that mean what I think ? If the server switches mission (without restarting the server itself, only loading a new mission) then the mission and slots data will not be updated ?

Change database character set to utf8

Please change the SQL template character set to utf8mb4 and collation utf8mb4_unicode_ci

Please modify in the next version of the program line form_Main.cs -> Globals.DatabaseConnection.DatabaseConnectionString = $"server={con_txt_mysql_server.Text};user={con_txt_mysql_username.Text};database={con_txt_mysql_database.Text};port={con_txt_mysql_port.Text};password={con_txt_mysql_password.Text}";

TO

Globals.DatabaseConnection.DatabaseConnectionString = $"server={con_txt_mysql_server.Text};user={con_txt_mysql_username.Text};database={con_txt_mysql_database.Text};port={con_txt_mysql_port.Text};password={con_txt_mysql_password.Text};CharSet=utf8";

We use accented characters in our server's chat so this is a solution for the correct character displaying.

Change the config file default TCP port to 48621

In the app, the default port offered is 48621 and all documentaiton refers to that. Except in the actual config the port is for some reason 48620 and I don't think this offers any value and only confusion.

Rename DLL folder to Bin

Such a small thing, yet we've seen lots of people on Discord get caught out and place the DLL into the DLL folder instead of the Bin folder as per the instructions.

What is the DLL folder for?

[NOT AN ISSUE] Perun usage in the real world

Hi, dear Perun authors and contributors !

We, at VEAF, have updated our website and it now sports real-time and aggregated statistics, thanks to Perun.

I take the liberty of hijacking this fine issue system to provide with a detailed, yet synthetic report of what we've done.

Our site is accessible to all, here.
We hope you'll find this little presentation interesting, and are available to answer any question either here or on our Discord.

The homepage

image

The list of servers

image

Details of a specific server

image

Our attendance heatmap

image

Statistics for a specific pilot

image

Player actual ping

The actual ping shall come with the connected players table.
The max. user ping rate during session is also a good idea.

CLI startup failure

Current startup procedures for CLI and auto connect are not valid.

Seemingly none of the values are passing into the Perun. application. Please update wiki and or ticket here with propper flags to start.

C:\Perun_v1\Perun.exe 48621 1 "G:\DCS SRS\clients-list.json" "C:\Users\DCS\Saved Games\DCS\Mods\tech\LotAtc\stats.json"

Start C:\Users"DCS server"\Downloads\Perun_v_0_12_0\Perun\Perun.application 48620 1 "C:"Program Files"\DCS-SimpleRadio-Standalone\clients-list.json" "1" "1"
Thanks

Stats are not getting pulled from net.get_stat

Data is not available or the API function is not working correctly
p_stats['PS_CAR']=net.get_stat(playerID,2) p_stats['PS_PLANE']=net.get_stat(playerID,3) p_stats['PS_SHIP']=net.get_stat(playerID,4) p_stats['PS_SCORE']=net.get_stat(playerID,5) p_stats['PS_LAND']=net.get_stat(playerID,6) p_stats['PS_PING']=net.get_stat(playerID,0) p_stats['PS_CRASH']=net.get_stat(playerID,1) p_stats['PS_EJECT']=net.get_stat(playerID,7)

sql table has a missing )

Just letting you know your sql table dump for creation is missing a ) on line 31 you have

DROP TABLE IF EXISTS `pe_DataMissionHashes`;
CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
  `pe_DataMissionHashes_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `pe_DataMissionHashes_instance` smallint(5) UNSIGNED NOT NULL,
  `pe_DataMissionHashes_hash` varchar(150) NOT NULL,
  `pe_DataMissionHashes_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pe_DataMissionHashes_id`),
  UNIQUE KEY `UNIQUE_hash` (`pe_DataMissionHashes_hash`),
  KEY `pe_DataMissionHashes_instance` (`pe_DataMissionHashes_instance`)
ENGINE=InnoDB DEFAULT CHARSET=utf8;

should be

DROP TABLE IF EXISTS `pe_DataMissionHashes`;
CREATE TABLE IF NOT EXISTS `pe_DataMissionHashes` (
  `pe_DataMissionHashes_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `pe_DataMissionHashes_instance` smallint(5) UNSIGNED NOT NULL,
  `pe_DataMissionHashes_hash` varchar(150) NOT NULL,
  `pe_DataMissionHashes_datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`pe_DataMissionHashes_id`),
  UNIQUE KEY `UNIQUE_hash` (`pe_DataMissionHashes_hash`),
  KEY `pe_DataMissionHashes_instance` (`pe_DataMissionHashes_instance`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;```

GetMulticrewAllParameters(): nil / empty value in _player_slot causes error

Fixed codeblock:

Perun.GetMulticrewAllParameters = function (PlayerId)
function DCSBot.GetMulticrewAllParameters(PlayerId)
-- Gets all multicrew parameters
local _result = ""
local _master_type= "?"
local _master_slot = nil
local _sub_slot = nil

local _player_slot = net.get_player_info(PlayerId, 'slot')

if _player_slot and _player_slot ~= '' then
	if not(string.find(_player_slot, 'red') or string.find(_player_slot, 'blue')) then
		-- Player took model
		_master_slot = _player_slot
		_sub_slot = 0

		if (not tonumber(_player_slot)) then
			-- If this is multiseat slot parse master slot and look for seat number
			_t_start, _t_end = string.find(_player_slot, '_%d+')

			if _t_start then
				-- This is co-player
				_master_slot = string.sub(_player_slot, 0 , _t_start -1 )
				_sub_slot = string.sub(_player_slot, _t_start + 1, _t_end )
			end
		end
		_master_type = DCS.getUnitType(_master_slot)

	else
		-- Deal with the special slots addded by Combined Arms and Spectators
		if string.find(_player_slot, 'artillery_commander') then
			_master_type = "artillery_commander"
		elseif string.find(_player_slot, 'instructor') then
			_master_type = "instructor"
		elseif string.find(_player_slot, 'forward_observer') then
			_master_type = "forward_observer"
		elseif string.find(_player_slot, 'observer') then
			_master_type = "observer"
		end
		_master_slot = -1
		_sub_slot = 0
	end
else
	_master_slot = -1
	_sub_slot = -1
end
return _master_type,_master_slot,_sub_slot

end

Error when the name of a player contains a single quote (')

When a player name contains a single quote (as for example my friend Ti'rco), the json containing the list of players cannot be parsed and an error is thrown back to the user in the windows app.
Here's the exception that's thrown :

error.zip

Here's a saved payload that triggers the bug :

Perun_LogContent_2021-02-16-00-00-00.0000000-01-00.zip

This is easily solved by removing the quotes around the payload property value :

test.zip

(I said "easily" but I know that it's never as simple as just saying it ^^ - the JSON is created in the LUA script, which is probably difficult to correct)

Potential issue

Not an issue, yet.
In the commit #9569762eac2a5822b9c0852621ca337e6780412a, you separated Perun's LUA configuration from its code.
That's a good thing to do imho.
However, the generic name you chose ("Config") could lead to collisitions with other scripts, in the future (or maybe now, with scripts we don't know yet).
I'd recommend initializing the "Perun" table in the configuration file, and using it (completing it with code) in the code script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.