centralize jquery && bugfix mysql auto-termination problem w/ user auth
This commit is contained in:
@@ -36,6 +36,13 @@
|
|||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
|
{% javascripts filter='?uglifyjs2'
|
||||||
|
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-3.0.0.min.js'
|
||||||
|
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-migrate-3.0.0.min.js'
|
||||||
|
'@JotunheimrAdminBundle/Resources/public/js/vendor/bootstrap/js/bootstrap.min.js' %}
|
||||||
|
<script type="text/javascript" src="{{ asset_url }}"></script>
|
||||||
|
{% endjavascripts %}
|
||||||
|
|
||||||
{% include '@MineSeeker/Recent/facebook.html.twig' %}
|
{% include '@MineSeeker/Recent/facebook.html.twig' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ monolog:
|
|||||||
parameters:
|
parameters:
|
||||||
facebook.api: 320599508311862
|
facebook.api: 320599508311862
|
||||||
facebook.version: 'v2.8'
|
facebook.version: 'v2.8'
|
||||||
|
mineseeker.websocket: 6450
|
||||||
|
|
||||||
# Facebook OAuth
|
# Facebook OAuth
|
||||||
hwi_oauth:
|
hwi_oauth:
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ monolog:
|
|||||||
parameters:
|
parameters:
|
||||||
facebook.api: 320597498312063
|
facebook.api: 320597498312063
|
||||||
facebook.version: 'v2.8'
|
facebook.version: 'v2.8'
|
||||||
|
mineseeker.websocket: 8080
|
||||||
|
|
||||||
# Facebook OAuth
|
# Facebook OAuth
|
||||||
hwi_oauth:
|
hwi_oauth:
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ header section div.buttons > a.slack-login {
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
-webkit-border-radius: 3px;
|
-webkit-border-radius: 3px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
<script>
|
<a id="fbLogin" class="fb-login">
|
||||||
function fbLogin() {
|
<i class="fa fa-facebook"></i><span>w/ Facebook</span>
|
||||||
FB.getLoginStatus(function (response) {
|
</a>
|
||||||
if (response.status === 'connected') {
|
|
||||||
document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";
|
|
||||||
} else {
|
|
||||||
FB.login(function (response) {
|
|
||||||
if (response.authResponse) {
|
|
||||||
document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";
|
|
||||||
}
|
|
||||||
}, {scope: 'email'});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<a class="fb-login" href="#" onclick="fbLogin();"><i class="fa fa-facebook"></i><span>w/ Facebook</span></a>
|
|
||||||
|
|||||||
@@ -33,18 +33,31 @@
|
|||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
|
|
||||||
{% javascripts filter='?uglifyjs2'
|
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-3.0.0.min.js'
|
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-migrate-3.0.0.min.js'
|
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/bootstrap/js/bootstrap.min.js' %}
|
|
||||||
<script type="text/javascript" src="{{ asset_url }}"></script>
|
|
||||||
{% endjavascripts %}
|
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/JQuery-Snowfall/1.7.4/snowfall.jquery.min.js"
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/JQuery-Snowfall/1.7.4/snowfall.jquery.min.js"
|
||||||
type="text/javascript"></script>
|
type="text/javascript"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
$(document).snowfall({deviceorientation: true, round: true, minSize: 5, maxSize: 8});
|
$(document).snowfall({deviceorientation: true, round: true, minSize: 5, maxSize: 8});
|
||||||
|
|
||||||
|
$('#fbLogin').length && $('#fbLogin').on('click', function () {
|
||||||
|
FB.login(function (response) {
|
||||||
|
if (response.authResponse) {
|
||||||
|
document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";
|
||||||
|
}
|
||||||
|
}, {scope: 'email'});
|
||||||
|
|
||||||
|
{#FB.getLoginStatus(function (response) {#}
|
||||||
|
{#if (response.status === 'connected') {#}
|
||||||
|
{#document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";#}
|
||||||
|
{#} else {#}
|
||||||
|
{#FB.login(function (response) {#}
|
||||||
|
{#if (response.authResponse) {#}
|
||||||
|
{#document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";#}
|
||||||
|
{#}#}
|
||||||
|
{#}, {scope: 'email'});#}
|
||||||
|
{#}#}
|
||||||
|
{#});#}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
44
src/Mine/SeekerBundle/Periodic/MinePeriodic.php
Normal file
44
src/Mine/SeekerBundle/Periodic/MinePeriodic.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Mine\SeekerBundle\Periodic;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Driver\PDOException;
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
|
use Gos\Bundle\WebSocketBundle\Periodic\PeriodicInterface;
|
||||||
|
|
||||||
|
class MinePeriodic implements PeriodicInterface
|
||||||
|
{
|
||||||
|
private $em;
|
||||||
|
|
||||||
|
public function __construct(EntityManager $entityManager)
|
||||||
|
{
|
||||||
|
$this->em = $entityManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is executed every 5 seconds.
|
||||||
|
*
|
||||||
|
* For more advanced functionality, try injecting a Topic Service to perform actions on your connections every x seconds.
|
||||||
|
*/
|
||||||
|
public function tick()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$connection = $this->em->getConnection();
|
||||||
|
|
||||||
|
if (false === $connection->ping()) {
|
||||||
|
$connection->close();
|
||||||
|
$connection->connect();
|
||||||
|
}
|
||||||
|
} catch(PDOException $ex) {
|
||||||
|
throw PDOException::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getTimeout()
|
||||||
|
{
|
||||||
|
return 777;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ snc_redis:
|
|||||||
gos_web_socket:
|
gos_web_socket:
|
||||||
server:
|
server:
|
||||||
host: 0.0.0.0
|
host: 0.0.0.0
|
||||||
port: 6450
|
port: "%mineseeker.websocket%"
|
||||||
router:
|
router:
|
||||||
resources:
|
resources:
|
||||||
- "@MineSeekerBundle/Resources/config/pubsub/routing.yml"
|
- "@MineSeekerBundle/Resources/config/pubsub/routing.yml"
|
||||||
@@ -42,3 +42,5 @@ gos_web_socket:
|
|||||||
storage:
|
storage:
|
||||||
driver: "@gos_web_socket.client_storage.driver.predis"
|
driver: "@gos_web_socket.client_storage.driver.predis"
|
||||||
decorator: "@gos_web_socket.client_storage.doctrine.decorator"
|
decorator: "@gos_web_socket.client_storage.doctrine.decorator"
|
||||||
|
periodic:
|
||||||
|
- "@mineseeker.periodic"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
services:
|
services:
|
||||||
|
|
||||||
pdo:
|
pdo:
|
||||||
class: PDO
|
class: PDO
|
||||||
arguments:
|
arguments:
|
||||||
@@ -26,6 +25,11 @@ services:
|
|||||||
arguments:
|
arguments:
|
||||||
- "@doctrine_cache.providers.doctrine.orm.default_result_cache"
|
- "@doctrine_cache.providers.doctrine.orm.default_result_cache"
|
||||||
|
|
||||||
|
mineseeker.periodic:
|
||||||
|
class: Mine\SeekerBundle\Periodic\MinePeriodic
|
||||||
|
arguments:
|
||||||
|
doctrine: '@doctrine.orm.entity_manager'
|
||||||
|
|
||||||
mineseeker.topic_sample_service:
|
mineseeker.topic_sample_service:
|
||||||
class: Mine\SeekerBundle\Topic\MineseekerTopic
|
class: Mine\SeekerBundle\Topic\MineseekerTopic
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
@@ -333,7 +333,8 @@ class MineSeeker extends React.Component {
|
|||||||
let websocket = WS.connect(
|
let websocket = WS.connect(
|
||||||
this.state.env === 'dev'
|
this.state.env === 'dev'
|
||||||
? "ws://mine.dev:6450"
|
? "ws://mine.dev:6450"
|
||||||
: (this.state.ssl === 'true' ? "wss" : "ws") + "://" + window.location.hostname + ":6450/"
|
// : (this.state.ssl === 'true' ? "wss" : "ws") + "://" + window.location.hostname + ":6450/"
|
||||||
|
: (this.state.ssl === 'true' ? "wss" : "ws") + "://www.mineseeker.ninja:6450/"
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
|
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
|
||||||
<h2>Hello, {{ app.user.realName is not null ? app.user.realName : app.user.username }}!</h2>
|
<h2 id="fb-welcome">
|
||||||
|
Hello, {{ app.user.realName is not null ? app.user.realName : app.user.username }}!
|
||||||
|
</h2>
|
||||||
<h1>Let's play!! :D</h1>
|
<h1>Let's play!! :D</h1>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h2>A minesweeper game rethought...</h2>
|
<h2>A minesweeper game rethought...</h2>
|
||||||
|
|||||||
@@ -42,8 +42,6 @@
|
|||||||
|
|
||||||
{% if env == 'dev' %}
|
{% if env == 'dev' %}
|
||||||
{% javascripts filter='?uglifyjs2'
|
{% javascripts filter='?uglifyjs2'
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-3.0.0.min.js'
|
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-migrate-3.0.0.min.js'
|
|
||||||
'@GosWebSocketBundle/Resources/public/js/vendor/autobahn.min.js'
|
'@GosWebSocketBundle/Resources/public/js/vendor/autobahn.min.js'
|
||||||
'@GosWebSocketBundle/Resources/public/js/gos_web_socket_client.js'
|
'@GosWebSocketBundle/Resources/public/js/gos_web_socket_client.js'
|
||||||
'@MineSeekerBundle/Resources/public/js/node/howler/dist/howler.min.js'
|
'@MineSeekerBundle/Resources/public/js/node/howler/dist/howler.min.js'
|
||||||
@@ -53,8 +51,6 @@
|
|||||||
{% endjavascripts %}
|
{% endjavascripts %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% javascripts filter='?uglifyjs2'
|
{% javascripts filter='?uglifyjs2'
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-3.0.0.min.js'
|
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-migrate-3.0.0.min.js'
|
|
||||||
'@GosWebSocketBundle/Resources/public/js/vendor/autobahn.min.js'
|
'@GosWebSocketBundle/Resources/public/js/vendor/autobahn.min.js'
|
||||||
'@GosWebSocketBundle/Resources/public/js/gos_web_socket_client.js'
|
'@GosWebSocketBundle/Resources/public/js/gos_web_socket_client.js'
|
||||||
'@MineSeekerBundle/Resources/public/js/node/howler/dist/howler.min.js'
|
'@MineSeekerBundle/Resources/public/js/node/howler/dist/howler.min.js'
|
||||||
|
|||||||
@@ -1,12 +1 @@
|
|||||||
{% extends '::base.html.twig' %}
|
{% extends '::base.html.twig' %}
|
||||||
|
|
||||||
{% block javascripts %}
|
|
||||||
{{ parent() }}
|
|
||||||
|
|
||||||
{% javascripts filter='?uglifyjs2'
|
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-3.0.0.min.js'
|
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/plugins/jQuery/jquery-migrate-3.0.0.min.js'
|
|
||||||
'@JotunheimrAdminBundle/Resources/public/js/vendor/bootstrap/js/bootstrap.min.js' %}
|
|
||||||
<script type="text/javascript" src="{{ asset_url }}"></script>
|
|
||||||
{% endjavascripts %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user