Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d21febaaa1 | |||
| 6acba9c082 | |||
| 65147a9ac6 | |||
| a366ed749e | |||
| 87f6956958 | |||
| 3a78ac68f2 | |||
| 39774c1ed9 | |||
| bd477b3354 | |||
| 86e33a5e0a | |||
| 365c71751d | |||
| 46399bd8ed | |||
| c3a8fa73cd | |||
| fe7c9992a5 | |||
| 1922ab328b | |||
| a91f2df040 | |||
| 1a4e81963e | |||
| 5ae61ff2c7 | |||
| 995bb0b43e | |||
| 4c841aaafa | |||
| 49abf8d86f | |||
| e3ca74f09b | |||
| 6818e82c92 | |||
| 2ea95f529e | |||
| 6cec286886 | |||
| f38d22d70d |
@@ -25,12 +25,12 @@ else
|
||||
DC=ENV=$(ENV) CLIENT=$(CLIENT) "$(DOCKERCOMPOSE)" --project-name "$(CLIENT)_$(ENV)" --file conf/docker-compose.win.yml $(DC_OVERRIDE) $(DC_OVERRIDE_ENV)
|
||||
endif
|
||||
|
||||
|
||||
default:
|
||||
$(info $(USAGE))
|
||||
$(error Exiting)
|
||||
|
||||
docker-build:
|
||||
$(DC) pull
|
||||
$(DC) build
|
||||
$(DC) up -d
|
||||
|
||||
@@ -64,8 +64,8 @@ config:
|
||||
|
||||
@echo " --> Generating mysql auth file"
|
||||
@cat conf/env/store-mysql.env \
|
||||
| python -c "import sys; import string; v=sys.stdin.readline().split('MYSQL_ROOT_PASSWORD=')[1]; print(string.Template(open('conf/build/mysql/my.cnf').read()).substitute({'PASSWORD':v}))" \
|
||||
| docker exec -i $(CLIENT).store-mysql.$(ENV) sh -c 'cat > /root/.my.cnf'
|
||||
| python -c "import sys; import string; v=sys.stdin.readline().split('MYSQL_ROOT_PASSWORD=')[1]; print(string.Template(open('conf/build/mysql/my.cnf').read()).substitute({'PASSWORD':v}))" \
|
||||
| docker exec -i $(CLIENT).store-mysql.$(ENV) sh -c 'cat > /root/.my.cnf'
|
||||
|
||||
db-backup-all: db-backup-website db-backup-store
|
||||
|
||||
@@ -83,6 +83,11 @@ db-backup-store:
|
||||
|
||||
db-restore-all: db-restore-website db-restore-store
|
||||
|
||||
db-backup-script:
|
||||
@mkdir -p backup/
|
||||
@docker exec $(CLIENT).postgres.$(ENV) pg_dumpall --database database -c -U postgres > backup/postgres_$(ENV)_`date +%d-%m-%Y"_"%H_%M_%S`.sql
|
||||
@docker exec $(CLIENT).store-mysql.$(ENV) mysqldump -uroot database > backup/store-mysql_$(ENV)_`date +%d-%m-%Y"_"%H_%M_%S`.sql
|
||||
|
||||
db-restore-website:
|
||||
@echo "Restoring file to database (backup/postgres.sql)"
|
||||
@cat backup/postgres.sql | docker exec -i $(CLIENT).postgres.$(ENV) psql --dbname database -U user
|
||||
@@ -114,4 +119,4 @@ es-populate:
|
||||
|
||||
sys:
|
||||
@echo $(SYS)
|
||||
@echo $(DC)
|
||||
@echo $(DC)
|
||||
|
||||
+27
-26
@@ -1,53 +1,54 @@
|
||||
FROM php:7.1-fpm
|
||||
FROM php:7.1-fpm-buster
|
||||
|
||||
ENV TERM=xterm
|
||||
|
||||
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list.d/debian-backports.list
|
||||
#RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main\ndeb http://archive.debian.org/debian/ jessie-backports main" > /etc/apt/sources.list.d/debian-backports.list
|
||||
|
||||
RUN apt-get clean \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y lsof nano less git locales
|
||||
&& apt-get update \
|
||||
&& apt-get install -y lsof nano less git locales
|
||||
|
||||
RUN echo 'fr_FR.UTF-8 UTF-8' > /etc/locale.gen \
|
||||
&& /usr/sbin/locale-gen
|
||||
&& /usr/sbin/locale-gen
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install libgmp-dev \
|
||||
&& ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/local/include/gmp.h \
|
||||
&& docker-php-ext-install gmp \
|
||||
&& docker-php-ext-configure gmp
|
||||
&& ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/local/include/gmp.h \
|
||||
&& docker-php-ext-install gmp \
|
||||
&& docker-php-ext-configure gmp
|
||||
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y ffmpeg exiftool graphviz libfreetype6-dev libjpeg62-turbo-dev libpng-dev libmcrypt-dev libxslt-dev libicu-dev libxml2-dev libpq-dev libgeoip-dev libedit-dev mysql-client nodejs npm \
|
||||
&& apt-get install -y --no-install-recommends libmagickwand-dev \
|
||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||
&& docker-php-ext-install -j4 gd mcrypt xsl zip intl gettext soap pdo_pgsql pdo_mysql mysqli pgsql json readline opcache \
|
||||
&& pecl install geoip-1.1.1 redis imagick mongodb \
|
||||
&& docker-php-ext-enable geoip redis imagick mongodb
|
||||
&& apt-get install -y ffmpeg exiftool graphviz libfreetype6-dev libjpeg62-turbo-dev libpng-dev libmcrypt-dev libxslt-dev libicu-dev libxml2-dev libpq-dev libgeoip-dev libedit-dev mariadb-client nodejs npm \
|
||||
&& apt-get install -y --no-install-recommends libmagickwand-dev \
|
||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||
&& docker-php-ext-install -j4 gd mcrypt xsl zip intl gettext soap pdo_pgsql pdo_mysql mysqli pgsql json readline opcache \
|
||||
&& pecl install geoip-1.1.1 redis imagick mongodb \
|
||||
&& docker-php-ext-enable geoip redis imagick mongodb
|
||||
|
||||
RUN { \
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
echo 'opcache.revalidate_freq=60'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
echo 'opcache.enable_cli=1'; \
|
||||
} >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
|
||||
echo 'opcache.memory_consumption=128'; \
|
||||
echo 'opcache.interned_strings_buffer=8'; \
|
||||
echo 'opcache.max_accelerated_files=4000'; \
|
||||
echo 'opcache.revalidate_freq=60'; \
|
||||
echo 'opcache.fast_shutdown=1'; \
|
||||
echo 'opcache.enable_cli=1'; \
|
||||
} >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
|
||||
|
||||
COPY zz-logformat.conf /usr/local/etc/php-fpm.d/
|
||||
COPY php.ini /usr/local/etc/php/conf.d/
|
||||
|
||||
RUN (curl --silent --show-error https://getcomposer.org/installer | php) \
|
||||
&& mv composer.phar /usr/local/bin/composer
|
||||
&& mv composer.phar /usr/local/bin/composer
|
||||
|
||||
RUN curl --location --silent --show-error https://symfony.com/installer -o /usr/local/bin/symfony \
|
||||
&& chmod a+x /usr/local/bin/symfony
|
||||
&& chmod a+x /usr/local/bin/symfony
|
||||
|
||||
RUN curl --location --silent --show-error https://s3.amazonaws.com/files.drush.org/drush.phar -o /usr/local/bin/drush \
|
||||
&& chmod a+x /usr/local/bin/drush
|
||||
&& chmod a+x /usr/local/bin/drush
|
||||
|
||||
RUN (npm install -g uglify-es) \
|
||||
&& ln -s /usr/bin/nodejs /usr/local/bin/node
|
||||
&& ln -s /usr/bin/nodejs /usr/local/bin/node
|
||||
|
||||
RUN apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/
|
||||
&& rm -rf /var/lib/apt/lists/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM php:7.1-fpm
|
||||
FROM php:7.1-fpm-buster
|
||||
|
||||
ENV TERM=xterm
|
||||
|
||||
@@ -10,7 +10,7 @@ RUN echo 'fr_FR.UTF-8 UTF-8' > /etc/locale.gen \
|
||||
&& /usr/sbin/locale-gen
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev libmcrypt-dev libxslt-dev libicu-dev libxml2-dev libpq-dev libgeoip-dev libedit-dev mysql-client \
|
||||
&& apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev libmcrypt-dev libxslt-dev libicu-dev libxml2-dev libpq-dev libgeoip-dev libedit-dev mariadb-client \
|
||||
&& apt-get install -y --no-install-recommends libmagickwand-dev \
|
||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||
&& docker-php-ext-install -j4 gd mcrypt xsl zip intl gettext soap pdo_pgsql pdo_mysql mysqli pgsql json readline opcache \
|
||||
|
||||
@@ -14,6 +14,12 @@ Copy this before composer require : COMPOSER_MEMORY_LIMIT=-1
|
||||
In php container, root@php:/home/www/website/www# php bin/console doctrine:schema:update --force
|
||||
It'll update database based on entities
|
||||
|
||||
## For Js : use assetic commande inside server container
|
||||
- do a cache-clear to update the assectic.yml file
|
||||
bin/console cache:clear --env=prod --no-debug
|
||||
- then
|
||||
php bin/console assetic:dump --env=prod --no-debug
|
||||
|
||||
## To push notifications
|
||||
- Create new .json file in web/push folder.
|
||||
|
||||
|
||||
@@ -3,20 +3,11 @@
|
||||
<head>
|
||||
|
||||
<!-- Google Tag Manager -->
|
||||
<script>
|
||||
(function (w, d, s, l, i) {
|
||||
w[l] = w[l] || [];
|
||||
w[l].push({
|
||||
'gtm.start': new Date().getTime(), event: 'gtm.js'
|
||||
});
|
||||
var f = d.getElementsByTagName(s)[0],
|
||||
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
||||
j.async = true;
|
||||
j.src =
|
||||
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
||||
f.parentNode.insertBefore(j, f);
|
||||
})(window, document, 'script', 'dataLayer', 'UA-98246968-1');
|
||||
</script>
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-P4G65WJ');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
<script type="text/javascript" defer="defer" src="https://extend.vimeocdn.com/ga/64189815.js"></script>
|
||||
|
||||
|
||||
@@ -3,20 +3,11 @@
|
||||
<head>
|
||||
|
||||
<!-- Google Tag Manager -->
|
||||
<script>
|
||||
(function (w, d, s, l, i) {
|
||||
w[l] = w[l] || [];
|
||||
w[l].push({
|
||||
'gtm.start': new Date().getTime(), event: 'gtm.js'
|
||||
});
|
||||
var f = d.getElementsByTagName(s)[0],
|
||||
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
||||
j.async = true;
|
||||
j.src =
|
||||
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
||||
f.parentNode.insertBefore(j, f);
|
||||
})(window, document, 'script', 'dataLayer', 'GTM-P4G65WJ');
|
||||
</script>
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-P4G65WJ');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
<script type="text/javascript" defer="defer" src="https://extend.vimeocdn.com/ga/64189815.js"></script>
|
||||
|
||||
|
||||
@@ -83,13 +83,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{#<div id="newApp" class="container-fluid">
|
||||
<div id="newApp" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col s12 m12">
|
||||
<p>"Nouveau ! Trouvez un job plus facilement avec notre <a href="http://pp.app.talentstube.com">web application</a>.📲"</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>#}
|
||||
</div>
|
||||
</div>
|
||||
<div class="nav-wrapper">
|
||||
<ul class="side-nav collapsible" data-collapsible="accordion" id="mobile-demo">
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
<div class="header-video-inner">
|
||||
<video loop="" preload="metadata" autoplay="" id="vid" muted="muted">
|
||||
{# <source src="/img/home_video.mp4" type="video/mp4"> #}
|
||||
<source src="/img/home_video.mp4" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
<input type="checkbox" id="notificationChecked" name="notificationChecked" {{isNotificationAllowed ? "checked=checked":""}}/>
|
||||
|
||||
<label for="notificationChecked">Autoriser les notificaitons</label>
|
||||
<label for="notificationChecked">Autoriser les notifications</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,8 +5,8 @@ assetic:
|
||||
filters:
|
||||
cssrewrite: ~
|
||||
uglifyjs2:
|
||||
bin: /usr/lib/node_modules/uglify-es/bin/uglifyjs
|
||||
# bin: /usr/local/bin/uglifyjs2
|
||||
#bin: /usr/lib/node_modules/uglify-es/bin/uglifyjs
|
||||
bin: /usr/local/bin/uglifyjs #sym linked in container (see makefile)
|
||||
assets:
|
||||
vendors:
|
||||
inputs:
|
||||
@@ -46,6 +46,8 @@ assetic:
|
||||
- 'js/vendors/datepicker.min.js'
|
||||
- 'js/vendors/jquery.validate.min.js'
|
||||
- 'js/talent.js'
|
||||
- 'js/EdeclicTools.js'
|
||||
- 'js/EdeclicPushAndNotificationClient.js'
|
||||
admin:
|
||||
inputs:
|
||||
- 'admin/AdminLTE/plugins/jQuery/jquery-2.2.3.min.js'
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
fos_elastica:
|
||||
clients:
|
||||
default: { host: %elastic_host%, port: %elastic_port% }
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
indexes:
|
||||
tags:
|
||||
types:
|
||||
@@ -143,4 +141,4 @@ fos_elastica:
|
||||
model: AppBundle\Entity\User
|
||||
provider: ~
|
||||
finder: ~
|
||||
>>>>>>> origin/master
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ parameters:
|
||||
database_port: '5432'
|
||||
database_name: database
|
||||
database_user: user
|
||||
database_password: edcl56
|
||||
database_password: b|RN:iR<g,TNMqM6
|
||||
mongodb_server: 'mongodb://tt-website.mongo.dev:27017'
|
||||
prestashop_key: 9YUQ5jPqT4Z4x5s9B25pb1yuGBtpaeBDxpWDgicPF3CuP8F2p9aK18ZS
|
||||
prestashop_path: /home/projects/prestashop1/store
|
||||
|
||||
@@ -8,8 +8,8 @@ parameters:
|
||||
database_port: '5432'
|
||||
database_name: database
|
||||
database_user: user
|
||||
#database_password: 7C|Uk2B[.>"6{QO{
|
||||
database_password: b|RN:iR<g,TNMqM6
|
||||
database_password: 7C|Uk2B[.>"6{QO{
|
||||
#database_password: b|RN:iR<g,TNMqM6
|
||||
#Mongo
|
||||
mongodb_server: "mongodb://tt-website.mongo.preprod:27017"
|
||||
#Prestashop
|
||||
|
||||
@@ -36,6 +36,6 @@ parameters:
|
||||
service_mail_subject: 'mailto:looping@talentstube.com'
|
||||
ttl: 300
|
||||
urgency: high
|
||||
topic: Emploi
|
||||
topic: Emploi
|
||||
push_params.public_key: BG2lV673DvB67dzEwX9GKfds3sXaEdtZo2oWO1cO2xUdTJAFZ_rV_UrP1nHQz-F8LJNO9HxG0kmQRIb54JL1ZCA
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ use FOS\UserBundle\Event\GetResponseUserEvent;
|
||||
use FOS\UserBundle\Model\UserInterface;
|
||||
use AppBundle\Entity\Company;
|
||||
use AppBundle\Exception\ResourceValidationException;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||
|
||||
class SecurityController extends FOSRestController
|
||||
{
|
||||
|
||||
/**
|
||||
* @Rest\Post(path="/api/confirmAccount", name="api_confirm_account")
|
||||
* @Rest\View
|
||||
@@ -207,6 +207,7 @@ class SecurityController extends FOSRestController
|
||||
// https://graph.facebook.com/debug_token?
|
||||
// input_token=EAAhJAcmfVSoBAFESNEQPJFv4fOqY5G6pSUwU3BOVzmhfoP9DTu827RUelrUQHFJshZBHsHZAlZA22MvfZArsZAlJBvZBWgbuJAJQjbMcgr9dwtHZBWZCI61nsvSBbsjiA8RgonGu0zcMD8GZCJDoZA26fZAgmURRgJUprfZCOvEzZBFgfUo1UjIHhiqey&access_token=2332071840142634|afb8bbca72bd8c517c64f81e998e4f12
|
||||
|
||||
//TODO: à mettre en config
|
||||
$req = 'https://graph.facebook.com/debug_token?input_token=' . ($token) . '&access_token=1800752833559014|454de729b1e58f506f94c8b50ca5c011';//PROD PREPROD
|
||||
//'&access_token=2332071840142634|afb8bbca72bd8c517c64f81e998e4f12'; //DEV
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class Company
|
||||
*
|
||||
* @ORM\Column(name="brand_name", type="string", length=255, options={"comment":"Nom commercial"}, nullable=true)
|
||||
*
|
||||
* @Groups({"ad_detail", "company_list", "company_detail", "answer_list", "answer_detail"})
|
||||
* @Groups({"ad_detail", "ad_list", "company_list", "company_detail","answer_detail","answer_list"})
|
||||
*/
|
||||
private $brandName;
|
||||
|
||||
|
||||
@@ -6,16 +6,15 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use FOS\UserBundle\Model\User as BaseUser;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
<<<<<<< HEAD
|
||||
|
||||
use JMS\Serializer\Annotation\ExclusionPolicy;
|
||||
use JMS\Serializer\Annotation\Expose;
|
||||
use Hateoas\Configuration\Annotation as Hateoas;
|
||||
use JMS\Serializer\Annotation\Groups;
|
||||
use JMS\Serializer\Annotation\Type;
|
||||
|
||||
=======
|
||||
use AppBundle\Utils\Traits\CareerJsonTrait;
|
||||
>>>>>>> origin/master
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
|
||||
* @ORM\Table(name="fos_user")
|
||||
|
||||
@@ -23,8 +23,9 @@ class AdRepository extends AbstractRepository
|
||||
->createQueryBuilder('a')
|
||||
->select('a')
|
||||
->where('a.isVisible = true')
|
||||
->orderBy('a.title', $order);
|
||||
|
||||
->andWhere('a.isPrivate = false')
|
||||
->orderBy('a.title', $order)
|
||||
->orderBy('a.publishedAt', 'desc');
|
||||
|
||||
$qb
|
||||
->andWhere('a.isPromoted = ?3')
|
||||
|
||||
@@ -77,21 +77,10 @@ class CompanyRepository extends AbstractRepository
|
||||
public function search($term, $order = 'asc', $limit = 10, $offset = 1,
|
||||
$isEmphasis)
|
||||
{
|
||||
|
||||
// $qb = $this
|
||||
// ->createQueryBuilder('c')
|
||||
// ->select('c')
|
||||
// ->leftJoin('c.ads', 'a', 'WITH', 'a.status =:status')
|
||||
// ->setParameter(':status', "PUBLISHED")
|
||||
// ->where("c.type = 'COMPANY'")
|
||||
// ->orWhere('c.presentationVideo IS NOT NULL')
|
||||
// ->orderBy('a.publishedAt', 'DESC')
|
||||
// ->orderBy('c.cTime', 'DESC');
|
||||
|
||||
|
||||
$qb = $this->createQueryBuilder('c')
|
||||
->select('c')
|
||||
->where("c.type = 'COMPANY'")
|
||||
->andWhere("c.isPrivate = false")
|
||||
->leftJoin('c.ads', 'a', 'WITH', 'a.status =:status')
|
||||
->setParameter(':status', "PUBLISHED")
|
||||
->orderBy('a.publishedAt', 'DESC')
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../doctrine/dbal/bin/doctrine-dbal
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
XSym
|
||||
0028
|
||||
6ad9c04ba34037260849b181387a137a
|
||||
../doctrine/orm/bin/doctrine
|
||||
|
||||
0034
|
||||
9c0044dbf9d81c454fd8aeca68e706da
|
||||
../doctrine/dbal/bin/doctrine-dbal
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
XSym
|
||||
0044
|
||||
2a11eaeab3acf944b97bb7a15e6c72bf
|
||||
../symfony/phpunit-bridge/bin/simple-phpunit
|
||||
|
||||
@@ -745,7 +745,8 @@ EdeclicLib = window.EdeclicLib || {},
|
||||
|
||||
navigator.serviceWorker.addEventListener('message', event => {
|
||||
|
||||
var toastHTML = '<div class="card white horizontal"><div class="card-image">' +
|
||||
var toastHTML =
|
||||
'<div class="card white horizontal"><div class="card-image">' +
|
||||
'<img style="max-height:100px;" src="' +
|
||||
event.data.image + '"></div><div class="card-stacked"><div class="card-content dark-text">' +
|
||||
'<span class="card-title dark-text">' +
|
||||
@@ -759,5 +760,5 @@ EdeclicLib = window.EdeclicLib || {},
|
||||
'</div></div></div>'
|
||||
Materialize.toast(toastHTML, 10000000);
|
||||
});
|
||||
|
||||
|
||||
}(jQuery)
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4610,4 +4610,340 @@ $("#profile_picture_file, #profile_logo_file").change(function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
EdeclicLib = window.EdeclicLib || {},
|
||||
function (d) {
|
||||
|
||||
"use strict";
|
||||
d.extend(EdeclicLib, {
|
||||
/* GESTION des cookies pour la modal du tuto */
|
||||
setCookie: function (name, value, days) {
|
||||
var expires = "";
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toUTCString();
|
||||
}
|
||||
document.cookie = name + "=" + (value || "") + expires + "; path=/";
|
||||
},
|
||||
getCookie: function (name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
eraseCookie: function (name) {
|
||||
document.cookie = name + '=; Max-Age=-99999999;';
|
||||
}
|
||||
})
|
||||
}(jQuery);
|
||||
|
||||
/// EdeclicPushAndNotificationClient.js
|
||||
/// A push and notification client
|
||||
/// inspired by https://github.com/gauntface/web-push-book
|
||||
///
|
||||
EdeclicLib = window.EdeclicLib || {},
|
||||
function (d) {
|
||||
"use strict";
|
||||
|
||||
d.extend(EdeclicLib, {
|
||||
|
||||
askForNotifications: function (resolve, reject) {
|
||||
var publicKey, saveUrl, deleteUrl, serviceWorkerUrl;
|
||||
|
||||
if (!IsFeatureDetected()) {
|
||||
//alert feature unavailable
|
||||
alert("Votre navigateur ne permet pas d'envoyer des push.");
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
||||
var conf = document.getElementById('pushParams');
|
||||
if (conf === null) {
|
||||
console.warn('The pushParams div is not found. can\'t get datadash config.');
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
publicKey = conf.dataset.pushPublicKey;
|
||||
saveUrl = conf.dataset.saveSubscriptionUrl;
|
||||
deleteUrl = conf.dataset.deleteSubscriptionUrl;
|
||||
serviceWorkerUrl = conf.dataset.serviceWorkerUrl;
|
||||
|
||||
return Promise.all([
|
||||
registerServiceWorker(),
|
||||
getNotificationPermissionState()
|
||||
])
|
||||
.then(function (results) {
|
||||
const registration = results[0];
|
||||
const currentPermissionState = results[1];
|
||||
|
||||
if (currentPermissionState === 'denied') {
|
||||
console.warn('The notification permission has been blocked. Nothing we can do.');
|
||||
|
||||
alert("Les notifications sont désactivés, veuillez modifier vos paramètres pour bénéficier de cette fonctionnalité.");
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
let promiseChain = Promise.resolve();
|
||||
if (currentPermissionState !== 'granted') {
|
||||
promiseChain = askPermission();
|
||||
}
|
||||
|
||||
promiseChain
|
||||
.then(subscribeUserToPush)
|
||||
.then(function (subscription) {
|
||||
if (subscription) {
|
||||
return sendSubscriptionToBackEnd(subscription)
|
||||
.then(function () {
|
||||
return subscription;
|
||||
});
|
||||
}
|
||||
|
||||
return subscription;
|
||||
})
|
||||
.then(function (subscription) {
|
||||
// We got a subscription AND it was sent to our backend,
|
||||
// re-enable our UI and set up state.
|
||||
console.log('SUBSCRIPTION', subscription);
|
||||
resolve();
|
||||
return;
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Failed to subscribe the user.', err);
|
||||
reject();
|
||||
return;
|
||||
});
|
||||
|
||||
// if (currentPermissionState !== 'granted') {
|
||||
// // If permission isn't granted then we can't be subscribed for Push.
|
||||
// console.log("permission isn't granted then we can't be subscribed for Push.");
|
||||
|
||||
// return;
|
||||
// }
|
||||
},
|
||||
reject
|
||||
).catch(function (err) {
|
||||
console.log('Unable to register the service worker: ' + err);
|
||||
reject();
|
||||
return;
|
||||
});
|
||||
|
||||
function IsFeatureDetected() {
|
||||
if (!('serviceWorker' in navigator)) {
|
||||
// Service Worker isn't supported on this browser, disable or hide UI.
|
||||
console.info("Service Worker isn't supported on this browser, disable or hide UI.");
|
||||
return false;
|
||||
}
|
||||
if (!('PushManager' in window)) {
|
||||
// Push isn't supported on this browser, disable or hide UI.
|
||||
console.info("Push isn't supported on this browser, disable or hide UI.");
|
||||
return false;
|
||||
}
|
||||
console.info("Push and serviceWorker supported on this browser.");
|
||||
return true;
|
||||
}
|
||||
//https://stackoverflow.com/questions/39136625/service-worker-registration-failed
|
||||
function registerServiceWorker() {
|
||||
console.log('registerServiceWorker');
|
||||
return navigator.serviceWorker.register(serviceWorkerUrl)
|
||||
.then(function (registration) {
|
||||
console.log('Service worker successfully registered.');
|
||||
registration.update();
|
||||
return registration;
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Unable to register service worker.', err);
|
||||
});
|
||||
}
|
||||
|
||||
function askPermission() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const permissionResult = Notification.requestPermission(function (result) {
|
||||
resolve(result);
|
||||
});
|
||||
if (permissionResult) {
|
||||
permissionResult.then(resolve, reject);
|
||||
}
|
||||
})
|
||||
.then(function (permissionResult) {
|
||||
if (permissionResult !== 'granted') {
|
||||
throw new Error('We weren\'t granted permission.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getNotificationPermissionState() {
|
||||
if (navigator.permissions) {
|
||||
return navigator.permissions.query({ name: 'notifications' })
|
||||
.then((result) => {
|
||||
return result.state;
|
||||
});
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
resolve(Notification.permission);
|
||||
});
|
||||
}
|
||||
|
||||
function getSWRegistration() {
|
||||
return navigator.serviceWorker.register(serviceWorkerUrl);
|
||||
}
|
||||
|
||||
function urlBase64ToUint8Array(base64String) {
|
||||
const padding = '='.repeat((4 - base64String.length % 4) % 4);
|
||||
const base64 = (base64String + padding)
|
||||
.replace(/\-/g, '+')
|
||||
.replace(/_/g, '/');
|
||||
|
||||
const rawData = window.atob(base64);
|
||||
const outputArray = new Uint8Array(rawData.length);
|
||||
|
||||
for (let i = 0; i < rawData.length; ++i) {
|
||||
outputArray[i] = rawData.charCodeAt(i);
|
||||
}
|
||||
return outputArray;
|
||||
}
|
||||
|
||||
function subscribeUserToPush() {
|
||||
getSWRegistration();
|
||||
return navigator.serviceWorker.ready.then(function (registration) {
|
||||
const subscribeOptions = {
|
||||
// At the moment you must pass in a value of true. If you don’t include the
|
||||
// userVisibleOnly key or pass in false you’ll get the following error:
|
||||
// 9
|
||||
// Chrome currently only supports the Push API for subscriptions that
|
||||
// will result in user-visible messages. You can indicate this by calling
|
||||
// pushManager.subscribe({userVisibleOnly: true}) instead.
|
||||
// See https://goo.gl/yqv4Q4 for more details.
|
||||
userVisibleOnly: true,
|
||||
applicationServerKey: urlBase64ToUint8Array(
|
||||
publicKey)
|
||||
};
|
||||
return registration.pushManager.subscribe(subscribeOptions);
|
||||
})
|
||||
.then(function (pushSubscription) {
|
||||
|
||||
return pushSubscription;
|
||||
});
|
||||
}
|
||||
|
||||
function sendSubscriptionToBackEnd(subscription) {
|
||||
|
||||
return fetch(saveUrl, {
|
||||
method: 'POST',
|
||||
//edge requirements
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(subscription)
|
||||
})
|
||||
.then(function (response) {
|
||||
if (!response.ok) {
|
||||
throw new Error('Bad status code from server.');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(function (responseData) {
|
||||
if (!(responseData && responseData.success)) {
|
||||
throw new Error('Bad response from server.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
delayedAsk: function () {
|
||||
var pushTrigger = EdeclicLib.getCookie("pushTrigger") * 1;
|
||||
if (pushTrigger == 3) {
|
||||
new Promise(EdeclicLib.askForNotifications)
|
||||
.then(() =>Materialize.toast("Vous êtes bien enregistré aux alertes.", 5000));
|
||||
}
|
||||
|
||||
if (pushTrigger <= 3) {
|
||||
EdeclicLib.setCookie("pushTrigger", pushTrigger + 1);
|
||||
}
|
||||
},
|
||||
unsubscribe: function () {
|
||||
navigator.serviceWorker.ready
|
||||
.then((serviceWorkerRegistration) => {
|
||||
serviceWorkerRegistration.pushManager.getSubscription()
|
||||
.then((subscription) => {
|
||||
if (!subscription) {
|
||||
console.log("Not subscribed, nothing to do.");
|
||||
return;
|
||||
}
|
||||
|
||||
subscription.unsubscribe()
|
||||
.then(function () {
|
||||
console.log("Successfully unsubscribed!.");
|
||||
})
|
||||
.catch((e) => {
|
||||
logger.error('Error thrown while unsubscribing from push messaging', e);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
unsubscribeUserFromPush: function () {
|
||||
|
||||
return registration.pushManager.getSubscription()
|
||||
|
||||
.then(function (subscription) {
|
||||
if (subscription) {
|
||||
|
||||
return subscription.unsubscribe();
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
return fetch(deleteUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(subscription)
|
||||
})
|
||||
.then(function (response) {
|
||||
if (!response.ok) {
|
||||
throw new Error('Bad status code from server.');
|
||||
}
|
||||
///TODO bind UI
|
||||
return true;
|
||||
})
|
||||
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Failed to unsubscribe the user.', err);
|
||||
getNotificationPermissionState()
|
||||
.then((permissionState) => {
|
||||
// pushCheckbox.disabled = permissionState === 'denied';
|
||||
// pushCheckbox.checked = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
navigator.serviceWorker.addEventListener('message', event => {
|
||||
|
||||
var toastHTML =
|
||||
'<div class="card white horizontal"><div class="card-image">' +
|
||||
'<img style="max-height:100px;" src="' +
|
||||
event.data.image + '"></div><div class="card-stacked"><div class="card-content dark-text">' +
|
||||
'<span class="card-title dark-text">' +
|
||||
event.data.title +
|
||||
'</span>' +
|
||||
'<p>' +
|
||||
event.data.body +
|
||||
'</p>' +
|
||||
'</div><div class="card-action right-align">' +
|
||||
'<a href="' + event.data.data.link + '">Voir</a>' +
|
||||
'</div></div></div>'
|
||||
Materialize.toast(toastHTML, 10000000);
|
||||
});
|
||||
|
||||
}(jQuery)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user