centralize jquery && bugfix mysql auto-termination problem w/ user auth
This commit is contained in:
@@ -167,6 +167,7 @@ header section div.buttons > a.slack-login {
|
||||
margin-bottom: 10px;
|
||||
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
|
||||
@@ -1,17 +1,3 @@
|
||||
<script>
|
||||
function fbLogin() {
|
||||
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>
|
||||
|
||||
<a class="fb-login" href="#" onclick="fbLogin();"><i class="fa fa-facebook"></i><span>w/ Facebook</span></a>
|
||||
<a id="fbLogin" class="fb-login">
|
||||
<i class="fa fa-facebook"></i><span>w/ Facebook</span>
|
||||
</a>
|
||||
|
||||
@@ -33,18 +33,31 @@
|
||||
{% 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 %}
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/JQuery-Snowfall/1.7.4/snowfall.jquery.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$(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>
|
||||
{% 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:
|
||||
server:
|
||||
host: 0.0.0.0
|
||||
port: 6450
|
||||
port: "%mineseeker.websocket%"
|
||||
router:
|
||||
resources:
|
||||
- "@MineSeekerBundle/Resources/config/pubsub/routing.yml"
|
||||
@@ -42,3 +42,5 @@ gos_web_socket:
|
||||
storage:
|
||||
driver: "@gos_web_socket.client_storage.driver.predis"
|
||||
decorator: "@gos_web_socket.client_storage.doctrine.decorator"
|
||||
periodic:
|
||||
- "@mineseeker.periodic"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
services:
|
||||
|
||||
pdo:
|
||||
class: PDO
|
||||
arguments:
|
||||
@@ -26,6 +25,11 @@ services:
|
||||
arguments:
|
||||
- "@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:
|
||||
class: Mine\SeekerBundle\Topic\MineseekerTopic
|
||||
tags:
|
||||
|
||||
@@ -333,7 +333,8 @@ class MineSeeker extends React.Component {
|
||||
let websocket = WS.connect(
|
||||
this.state.env === 'dev'
|
||||
? "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>
|
||||
{% 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>
|
||||
{% else %}
|
||||
<h2>A minesweeper game rethought...</h2>
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
|
||||
{% if env == 'dev' %}
|
||||
{% 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/gos_web_socket_client.js'
|
||||
'@MineSeekerBundle/Resources/public/js/node/howler/dist/howler.min.js'
|
||||
@@ -53,8 +51,6 @@
|
||||
{% endjavascripts %}
|
||||
{% else %}
|
||||
{% 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/gos_web_socket_client.js'
|
||||
'@MineSeekerBundle/Resources/public/js/node/howler/dist/howler.min.js'
|
||||
|
||||
@@ -1,12 +1 @@
|
||||
{% 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