mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 13:24:41 +03:00
Merge pull request #214 from Mibew/fs_fix
Make possible to force secure URLs for iframe styles
This commit is contained in:
commit
7c07d7f3e2
@ -80,6 +80,15 @@ chat_user_popup_style:
|
|||||||
requirements:
|
requirements:
|
||||||
style: "[0-9A-Za-z_]*"
|
style: "[0-9A-Za-z_]*"
|
||||||
|
|
||||||
|
chat_user_popup_style_force_secure:
|
||||||
|
path: /chat/style/popup/{style}/force_secure
|
||||||
|
defaults:
|
||||||
|
_controller: Mibew\Controller\Chat\StyleController::loadPopupStyleAction
|
||||||
|
style: ""
|
||||||
|
force_secure: on
|
||||||
|
requirements:
|
||||||
|
style: "[0-9A-Za-z_]*"
|
||||||
|
|
||||||
chat_user_start:
|
chat_user_start:
|
||||||
path: /chat
|
path: /chat
|
||||||
defaults:
|
defaults:
|
||||||
|
@ -187,7 +187,7 @@ abstract class AbstractGenerator implements GeneratorInterface
|
|||||||
$style_name = $this->getOption('chat_style');
|
$style_name = $this->getOption('chat_style');
|
||||||
if (!$style_name) {
|
if (!$style_name) {
|
||||||
return $defaults + array(
|
return $defaults + array(
|
||||||
'styleLoader' => $this->generateUrl('chat_user_popup_style'),
|
'styleLoader' => $this->generateUrl($this->getOption('force_secure') ? 'chat_user_popup_style_force_secure' : 'chat_user_popup_style') // An ugly way to solve the architecture issue
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ abstract class AbstractGenerator implements GeneratorInterface
|
|||||||
$defaults
|
$defaults
|
||||||
) + array(
|
) + array(
|
||||||
'styleLoader' => $this->generateUrl(
|
'styleLoader' => $this->generateUrl(
|
||||||
'chat_user_popup_style',
|
$this->getOption('force_secure') ? 'chat_user_popup_style_force_secure' : 'chat_user_popup_style', // An ugly way to solve the architecture issue
|
||||||
array('style' => $style_name)
|
array('style' => $style_name)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -219,6 +219,7 @@ abstract class AbstractGenerator implements GeneratorInterface
|
|||||||
'url' => $this->getChatUrl(),
|
'url' => $this->getChatUrl(),
|
||||||
'preferIFrame' => $this->getOption('prefer_iframe'),
|
'preferIFrame' => $this->getOption('prefer_iframe'),
|
||||||
'modSecurity' => $this->getOption('mod_security'),
|
'modSecurity' => $this->getOption('mod_security'),
|
||||||
|
'forceSecure' => $this->getOption('force_secure'),
|
||||||
) + $this->getPopupStyle();
|
) + $this->getPopupStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,10 +48,15 @@ class StyleController extends AbstractController
|
|||||||
$response = new JsonResponse();
|
$response = new JsonResponse();
|
||||||
if ($configs['chat']['iframe']['css']) {
|
if ($configs['chat']['iframe']['css']) {
|
||||||
$generator = $this->getAssetManager()->getUrlGenerator();
|
$generator = $this->getAssetManager()->getUrlGenerator();
|
||||||
$css = $generator->generate(
|
$css = $request->attributes->get('force_secure') ?
|
||||||
$style->getFilesPath() . '/' . $configs['chat']['iframe']['css'],
|
$generator->generateSecure(
|
||||||
UrlGeneratorInterface::ABSOLUTE_URL
|
$style->getFilesPath() . '/' . $configs['chat']['iframe']['css'],
|
||||||
);
|
UrlGeneratorInterface::ABSOLUTE_URL
|
||||||
|
) :
|
||||||
|
$generator->generate(
|
||||||
|
$style->getFilesPath() . '/' . $configs['chat']['iframe']['css'],
|
||||||
|
UrlGeneratorInterface::ABSOLUTE_URL
|
||||||
|
);
|
||||||
$response->setData($css);
|
$response->setData($css);
|
||||||
$response->setCallback('Mibew.Utils.loadStyleSheet');
|
$response->setCallback('Mibew.Utils.loadStyleSheet');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user