-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤡 Merge recent changes to live (#196)
* Improve .htaccess rewrite rules - strip www. from www.steamlug.org - redirect to https, if it's not /feed/cast/mp3 or /feed/cast.php?t=mp3 looks like this is solved best through THE_REQUEST instead of RewriteConds matching REQUEST_URI/QUERY_STRING and logical operations between them - RewriteRules in .htaccess files are only parsing the remote uri part (without a / in the beginning), so substitutions don't need a / - added comments for better readability * Fix credit font and spacing * Sign In Through Steam button/logged in avatar as right ending of navbar using steamLogin class instead of inline style to position icon correctly moved about menu to the right leave about always there and admin (without another about) shows only when admin is logged in * Windward support for gameQ (#193) * Added TNet/windward protocol support for gameQ * Update Windward protocol comments * fixed new youtube rss link pattern
- Loading branch information
Showing
7 changed files
with
170 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?php | ||
/** | ||
* This file is part of GameQ. | ||
* | ||
* GameQ is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* GameQ is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/** | ||
* Windward Protocol Class | ||
* | ||
* Result from this call should be a text over HTTP | ||
* | ||
* @author Jason Rivers <jason@jasonrivers.co.uk> | ||
*/ | ||
class GameQ_Protocols_Windward extends GameQ_Protocols_Http | ||
{ | ||
/** | ||
* Array of packets we want to look up. | ||
* Each key should correspond to a defined method in this or a parent class | ||
* | ||
* @var array | ||
*/ | ||
protected $packets = array( | ||
self::PACKET_STATUS => "GET / HTTP/1.0\r\nAccept: */*\r\n\r\n", | ||
); | ||
|
||
/** | ||
* Methods to be run when processing the response(s) | ||
* | ||
* @var array | ||
*/ | ||
protected $process_methods = array( | ||
"process_status", | ||
); | ||
|
||
/** | ||
* The protocol being used | ||
* | ||
* @var string | ||
*/ | ||
protected $protocol = 'tnet'; | ||
|
||
/** | ||
* String name of this protocol class | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'windward'; | ||
|
||
/** | ||
* Longer string name of this protocol class | ||
* | ||
* @var string | ||
*/ | ||
protected $name_long = "Windward"; | ||
|
||
/* | ||
* Internal methods | ||
*/ | ||
protected function preProcess_status($packets=array()) | ||
{ | ||
// Split on newline | ||
$m = explode("\n", $packets[0]); | ||
|
||
return $m; | ||
} | ||
|
||
protected function process_status() | ||
{ | ||
// Make sure we have a valid response | ||
if(!$this->hasValidResponse(self::PACKET_STATUS)) | ||
{ | ||
return array(); | ||
} | ||
$res = ($this->preProcess_status($this->packets_response[self::PACKET_STATUS])); | ||
|
||
|
||
// Loop through the array to get the server name and the number of players. | ||
$playerCount=0; | ||
foreach ($res as $i => $v) { | ||
|
||
if (strstr($v, "Name")) { | ||
$server_name_index=$i; | ||
$server_name=str_replace("Name: ", "", $v); | ||
} | ||
|
||
// Server always shows clients even when there's no player connected. | ||
// So we only do this after we've found the "Clients:" line | ||
if (isset($hasClients) && $hasClients > 0) { | ||
if ($v != "") { | ||
$playerCount++; | ||
} | ||
} | ||
|
||
if (strstr($v, "Clients:")) { | ||
$hasClients = str_replace("Clients: ", "", $v); | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
// Set the result to a new result instance | ||
$result = new GameQ_Result(); | ||
|
||
// Server is always dedicated | ||
$result->add('dedicated', TRUE); | ||
|
||
// No mods, as of yet | ||
$result->add('mod', FALSE); | ||
|
||
$result->add('hostname', $server_name); | ||
$result->add('numplayers', $playerCount); | ||
// Server doesn't give use this maxplayers, Here is the Dev's wording on the matter: | ||
// Challenge 99. Max loot is 100, max challenge is 99. I've had my dev server up to ~25 players at one point. | ||
// 0.2% CPU usage (of a single core out of 12), 96 MB RAM usage. | ||
$result->add('maxplayers', 99); | ||
$result->add('steamappid', 326410); | ||
// Server doesn't report the map that it has generated, so we don't have a blank on the page we're going for "world" | ||
$result->add('map', "world"); | ||
|
||
return $result->fetch(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters