Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for setting HTTP / HTTPS mode and default_password #116

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/backend/templates/layout_external.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<?php include_javascripts() ?>
<script>
var socketIoAddress = "<?php echo sfConfig::get("app_ebot_ip"); ?>:<?php echo sfConfig::get("app_ebot_port"); ?>";
var httpMode = "<?php echo sfConfig::get("app_ebot_httpmode"); ?>";
var socket = null;
var socketIoLoaded = false;
var loadingSocketIo = false;
Expand All @@ -22,7 +23,7 @@ function initSocketIo(callback) {
}

loadingSocketIo = true;
$.getScript("http://"+socketIoAddress+"/socket.io/socket.io.js", function(){
$.getScript(httpMode+socketIoAddress+"/socket.io/socket.io.js", function(){
socket = io.connect("http://"+socketIoAddress);
socket.on('connect', function(){
socketIoLoaded = true;
Expand Down
6 changes: 5 additions & 1 deletion config/app_user.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
default_rules: rules
default_overtime_enable: false
default_overtime_max_round: 3
default_overtime_startmoney: 16000
default_overtime_startmoney: 10000

# If you want a default password for all matches, you can set it here. Otherwise it will be random.
#default_password: ''

# true or false, whether demos will be downloaded by the ebot server
# the demos can be downloaded at the matchpage, if it's true
Expand All @@ -20,6 +23,7 @@
websocket_url: 'http://localhost:12360'
ebot_ip: 192.168.1.1
ebot_port: 12360
httpMode: http

# lan or net, it's to display the server IP or the GO TV IP
# net mode display only started match on home page
Expand Down
11 changes: 9 additions & 2 deletions lib/form/doctrine/MatchsForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ class MatchsForm extends BaseMatchsForm {
public function configure() {
unset($this["config_authkey"], $this["ip"], $this["identifier_id"], $this["force_zoom_match"], $this["config_switch_auto"], $this["server_id"], $this["ingame_enable"], $this["config_auto_change_password"], $this["created_at"], $this["updated_at"], $this["current_map"], $this["status"], $this["score_a"], $this["score_b"], $this["config_heatmap"], $this["enable"], $this["is_paused"]);

$password = array('frosch', 'gehen', 'rennen', 'gucken', 'fliegen', 'rasen', 'snobb', 'peter', 'wackel', 'dackel', 'gut', 'schlecht', 'win', 'loss', 'tragen',
$passwordArray = array('frosch', 'gehen', 'rennen', 'gucken', 'fliegen', 'rasen', 'snobb', 'peter', 'wackel', 'dackel', 'gut', 'schlecht', 'win', 'loss', 'tragen',
'weg', 'berlin', 'aachen', 'mensch', 'tier', 'turtle', 'adler', 'raupe', 'rauben', 'bank', 'schalter', 'ticket', 'bahn', 'zug', 'delay', 'flugzeug', 'ratte',
'nager', 'hase', 'feld', 'gras', 'kraut', 'gurke', 'apfel', 'salat', 'tomate', 'dressing', 'essig', 'zwiebel', 'kuchen', 'zucker', 'salz', 'kaffee', 'tee',
'monday', 'tuesday', 'wednesday', 'friday', 'weekend', 'holiday', 'doctor', 'game', 'cup', 'death', 'player', 'monitor', 'hand', 'food', 'paper', 'windows', 'together');
$password = $password[rand(0, count($password)-1)];

$defaultPassword = sfConfig::get('app_default_password', '');
if (empty($defaultPassword)) {
$password = $passwordArray[rand(0, count($passwordArray) - 1)];
} else {
$password = $defaultPassword;
}

$supportedRoundFormats = array("15" => "MR15", "12" => "MR12", "9" => "MR9", "5" => "MR5", "3" => "MR3");
$defaultRoundFormat = sfConfig::get('app_default_max_round');
if (!array_key_exists($defaultRoundFormat, $supportedRoundFormats)) $defaultRoundFormat = 12;
Expand Down