Use allmon stream to key accurate keyup and keydown data

This commit is contained in:
Rob Vella 2020-07-31 04:21:43 -07:00
parent c55f408428
commit a589f2a5ad
6 changed files with 567 additions and 8 deletions

8
app.js
View File

@ -88,7 +88,7 @@ let App = new Vue({
if (typeof this.nodes[type+node] !== "undefined") {
let info = this.nodes[type+node];
if (typeof info.callsign === "undefined") return;
return `${info.callsign} ${info.desc} ${info.location}`;
return `${info.callsign} ${info.desc || ''} ${info.location || ''}`;
} else {
return '';
}
@ -98,7 +98,8 @@ let App = new Vue({
let rows = this.lastData.split("\n");
rows.forEach((v) => {
let match = v.match(/([A-Za-z]+ [0-9]+ [0-9]+\:[0-9]+\:[0-9]+) (rpt|stn)([A-Za-z0-9]+) .*? (?:\[(?:via) ([0-9]+))?/);
// let match = v.match(/([A-Za-z]+ [0-9]+ [0-9]+\:[0-9]+\:[0-9]+) (rpt|stn)([A-Za-z0-9]+) ?.*? (?:\[(?:via) ([0-9]+))?/);
let match = v.match(/([A-Za-z]+ [0-9]+ [0-9]+\:[0-9]+\:[0-9]+) (rpt|stn)([A-Za-z0-9]+) (KEY|UNKEY)?.*? (?:\[(?:via) ([0-9]+))?/);
if (!match) return;
let type = this.getNodeType(match[2]);
@ -106,7 +107,8 @@ let App = new Vue({
this.addEntry(
{
node: match[3],
via: match[4],
key: match[4],
via: match[5],
type: type,
typeLabel: this.getNodeTypeLabel(type),
info: this.fetchNodeInfo(match[3], type),

16
composer.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "robvella/winsystem-whos-talking",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Rob Vella",
"email": "me@robvella.com"
}
],
"require": {
"symfony/var-dumper": "^5.1",
"nesbot/carbon": "^2.37"
},
"require-dev": {}
}

441
composer.lock generated Normal file
View File

@ -0,0 +1,441 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f156819228ed2fb10267af6b8dff264f",
"packages": [
{
"name": "nesbot/carbon",
"version": "2.37.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "1f61206de973d67f36ce50f041c792ddac663c3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1f61206de973d67f36ce50f041c792ddac663c3e",
"reference": "1f61206de973d67f36ce50f041c792ddac663c3e",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.1.8 || ^8.0",
"symfony/polyfill-mbstring": "^1.0",
"symfony/translation": "^3.4 || ^4.0 || ^5.0"
},
"require-dev": {
"doctrine/orm": "^2.7",
"friendsofphp/php-cs-fixer": "^2.14 || ^3.0",
"kylekatarnls/multi-tester": "^2.0",
"phpmd/phpmd": "^2.8",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.30",
"phpunit/phpunit": "^7.5 || ^8.0",
"squizlabs/php_codesniffer": "^3.4"
},
"bin": [
"bin/carbon"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev",
"dev-3.x": "3.x-dev"
},
"laravel": {
"providers": [
"Carbon\\Laravel\\ServiceProvider"
]
},
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"autoload": {
"psr-4": {
"Carbon\\": "src/Carbon/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brian Nesbitt",
"email": "brian@nesbot.com",
"homepage": "http://nesbot.com"
},
{
"name": "kylekatarnls",
"homepage": "http://github.com/kylekatarnls"
}
],
"description": "An API extension for DateTime that supports 281 different languages.",
"homepage": "http://carbon.nesbot.com",
"keywords": [
"date",
"datetime",
"time"
],
"time": "2020-07-28T06:04:54+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.18.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.18.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981",
"reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981",
"shasum": ""
},
"require": {
"php": ">=7.0.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/translation",
"version": "v5.1.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "4b9bf719f0fa5b05253c37fc7b335337ec7ec427"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/4b9bf719f0fa5b05253c37fc7b335337ec7ec427",
"reference": "4b9bf719f0fa5b05253c37fc7b335337ec7ec427",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php80": "^1.15",
"symfony/translation-contracts": "^2"
},
"conflict": {
"symfony/config": "<4.4",
"symfony/dependency-injection": "<5.0",
"symfony/http-kernel": "<5.0",
"symfony/twig-bundle": "<5.0",
"symfony/yaml": "<4.4"
},
"provide": {
"symfony/translation-implementation": "2.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "^4.4|^5.0",
"symfony/console": "^4.4|^5.0",
"symfony/dependency-injection": "^5.0",
"symfony/finder": "^4.4|^5.0",
"symfony/http-kernel": "^5.0",
"symfony/intl": "^4.4|^5.0",
"symfony/service-contracts": "^1.1.2|^2",
"symfony/yaml": "^4.4|^5.0"
},
"suggest": {
"psr/log-implementation": "To use logging capability in translator",
"symfony/config": "",
"symfony/yaml": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Translation\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2020-06-30T17:42:22+00:00"
},
{
"name": "symfony/translation-contracts",
"version": "v2.1.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation-contracts.git",
"reference": "616a9773c853097607cf9dd6577d5b143ffdcd63"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/616a9773c853097607cf9dd6577d5b143ffdcd63",
"reference": "616a9773c853097607cf9dd6577d5b143ffdcd63",
"shasum": ""
},
"require": {
"php": ">=7.2.5"
},
"suggest": {
"symfony/translation-implementation": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Translation\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to translation",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"time": "2020-07-06T13:23:11+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v5.1.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "2ebe1c7bb52052624d6dc1250f4abe525655d75a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/2ebe1c7bb52052624d6dc1250f4abe525655d75a",
"reference": "2ebe1c7bb52052624d6dc1250f4abe525655d75a",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php80": "^1.15"
},
"conflict": {
"phpunit/phpunit": "<5.4.3",
"symfony/console": "<4.4"
},
"require-dev": {
"ext-iconv": "*",
"symfony/console": "^4.4|^5.0",
"symfony/process": "^4.4|^5.0",
"twig/twig": "^2.4|^3.0"
},
"suggest": {
"ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
"ext-intl": "To show region name in time zone dump",
"symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
},
"bin": [
"Resources/bin/var-dump-server"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.1-dev"
}
},
"autoload": {
"files": [
"Resources/functions/dump.php"
],
"psr-4": {
"Symfony\\Component\\VarDumper\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony mechanism for exploring and dumping PHP variables",
"homepage": "https://symfony.com",
"keywords": [
"debug",
"dump"
],
"time": "2020-06-24T13:36:18+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

View File

@ -4,11 +4,15 @@ $cmd = $_GET['cmd'] ?? null;
$node = intval($_GET['node'] ?? null);
$type = intval($_GET['type'] ?? null);
header("Cache-Control: max-age=0");
if ($cmd === "log" || $cmd == "logText") {
$data = file_get_contents("http://www3.winsystem.org/monitor/ajax-logtail.php");
$irlpData = file_get_contents("http://www3.winsystem.org/monitor/ajax-logtail.php");
$data = file_get_contents(__DIR__."/storage/stream.txt");
// Just output the raw data
if ($cmd === "log") {
echo $irlpData;
echo $data;
return;
}
@ -43,7 +47,8 @@ function fetchNodeInfoAllstar($node) {
}
return [
'node' => $node
'node' => $node,
'callsign' => 'Internal'
];
}
@ -66,7 +71,7 @@ function fetchNodeInfoIRLP($node) {
return [
'node' => $node,
'callsign' => $node,
'callsign' => 'Internal',
'desc' => '',
'location' => ''
];

View File

@ -25,7 +25,8 @@
<thead>
<tr>
<th>Node#</th>
<th>Via</th>
<!-- <th>Via</th>-->
<th>Key</th>
<th>Type</th>
<th>When</th>
<th class="desc">Description</th>
@ -34,7 +35,7 @@
<tbody v-cloak>
<tr v-for="row in logs">
<td><lt-node-link :node="row.node" :type="row.type" /></td>
<td><lt-node-link :node="row.via" :type="row.type" /></td>
<td>{{ row.key }}</td>
<td>{{ row.typeLabel }}</td>
<td class="when">{{ row.dateTime.format('hh:mm:ss MM/DD/YY') }}</td>
<td>

94
stream.php Normal file
View File

@ -0,0 +1,94 @@
<?php
require 'vendor/autoload.php';
use Carbon\Carbon;
$keyed = [];
// Allstar Hubs & also ignored below
$hubs = [
1200,
1300,
2560,
27084,
2545,
2353
];
// Intentionally ignored stations because they're IRLP
$ignore = array_merge($hubs, [
1001
]);
$buffer = '';
$stream = fopen(getAllMonUri(), "r");
while (!feof($stream)) {
$buffer .= stream_get_contents($stream, 1024);
if (preg_match("/event: nodes\ndata: (.*)\n\n/m", $buffer, $matches)) {
// echo $matches[1]."\n\n######################################\n\n";
parseStreamData($matches[1]);
$buffer = '';
}
}
echo "DIE!!!!\n";
exit;
/**
* @param $json
*/
function parseStreamData($json)
{
global $keyed;
$obj = json_decode($json);
foreach ($obj as $node => $v) {
foreach ($v->remote_nodes as $rn) {
$node = intval($rn->node);
if (isIgnored($node)) continue;
// Capture previous keyed values
$keyedNow = $rn->keyed === "yes";
$keyedBefore = isset($keyed[$node]);
// Set current key state. In PHP null !== isset
$keyed[$node] = $keyedNow ?: null;
if ($keyedBefore !== $keyedNow) {
// Permanently set to Allstar for now
// $nodePrefix = isIrlp($node) ? 'stn' : 'rpt';
$nodePrefix = 'rpt';
$keyedLabel = $keyedNow ? "KEY" : "UNKEY";
$time = Carbon::now();
$timeFormatted = $time->format("M d h:i:s");
// echo "{$node},{$keyedLabel},{$time}\n";
echo "{$timeFormatted} $nodePrefix{$node} {$keyedLabel} tx\n";
}
}
}
}
/**
* @param $node
* @return bool
*/
function isIgnored($node){
global $ignore;
return in_array($node, $ignore);
}
/**
* @return string
*/
function getAllMonUri()
{
global $hubs;
$hubsStr = implode(",", $hubs);
// return "https://allmon.winsystem.org/server.php?nodes=2353";
// return __DIR__ . '/test.stream';
return "https://allmon.winsystem.org/server.php?nodes=" . $hubsStr;
}