mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 00:47:04 +03:00
Nextcloud unified search working in iframe mode
This commit is contained in:
parent
7250bfa1e1
commit
115f603d20
2 changed files with 15 additions and 13 deletions
|
|
@ -27,17 +27,12 @@ class PageController extends Controller
|
||||||
\OCP\Util::addScript('snappymail', 'snappymail');
|
\OCP\Util::addScript('snappymail', 'snappymail');
|
||||||
\OCP\Util::addStyle('snappymail', 'style');
|
\OCP\Util::addStyle('snappymail', 'style');
|
||||||
|
|
||||||
$query = '';
|
SnappyMailHelper::startApp();
|
||||||
$aCredentials = SnappyMailHelper::getLoginCredentials();
|
|
||||||
if ($aCredentials[0] && $aCredentials[1]) {
|
|
||||||
$query = '?sso&hash=' . \RainLoop\Api::CreateUserSsoHash($aCredentials[0] && $aCredentials[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = [
|
$response = new TemplateResponse('snappymail', 'index', [
|
||||||
'snappymail-iframe-url' => SnappyMailHelper::normalizeUrl(SnappyMailHelper::getAppUrl()) . $query
|
'snappymail-iframe-url' => SnappyMailHelper::normalizeUrl(SnappyMailHelper::getAppUrl())
|
||||||
];
|
. (empty($_GET['target']) ? '' : "#{$_GET['target']}")
|
||||||
|
]);
|
||||||
$response = new TemplateResponse('snappymail', 'index', $params);
|
|
||||||
|
|
||||||
$csp = new ContentSecurityPolicy();
|
$csp = new ContentSecurityPolicy();
|
||||||
$csp->addAllowedFrameDomain("'self'");
|
$csp->addAllowedFrameDomain("'self'");
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,15 @@ class Provider implements IProvider
|
||||||
// instanceof \MailSo\Mail\MessageCollection
|
// instanceof \MailSo\Mail\MessageCollection
|
||||||
$MessageCollection = $oMailClient->MessageList($oParams);
|
$MessageCollection = $oMailClient->MessageList($oParams);
|
||||||
|
|
||||||
|
$baseURL = $this->urlGenerator->linkToRoute('snappymail.page.index');
|
||||||
|
$config = \OC::$server->getConfig();
|
||||||
|
if ($config->getAppValue('snappymail', 'snappymail-embed')) {
|
||||||
|
$baseURL .= '#';
|
||||||
|
} else {
|
||||||
|
$baseURL .= '?target=';
|
||||||
|
}
|
||||||
|
$search = \rawurlencode($oParams->sSearch);
|
||||||
|
|
||||||
// $MessageCollection->MessageResultCount;
|
// $MessageCollection->MessageResultCount;
|
||||||
foreach ($MessageCollection as $Message) {
|
foreach ($MessageCollection as $Message) {
|
||||||
// $Message instanceof \MailSo\Mail\Message
|
// $Message instanceof \MailSo\Mail\Message
|
||||||
|
|
@ -98,9 +107,7 @@ class Provider implements IProvider
|
||||||
// subline
|
// subline
|
||||||
$Message->From()->ToString(),
|
$Message->From()->ToString(),
|
||||||
// resourceUrl /index.php/apps/snappymail/#/mailbox/INBOX/p2/text=an&unseen
|
// resourceUrl /index.php/apps/snappymail/#/mailbox/INBOX/p2/text=an&unseen
|
||||||
$this->urlGenerator->linkToRoute('snappymail.page.index')
|
$baseURL . '/mailbox/INBOX/m' . $Message->Uid() . '/' . $search,
|
||||||
. '#/mailbox/INBOX/m' . $Message->Uid()
|
|
||||||
. '/' . \rawurlencode($oParams->sSearch),
|
|
||||||
// icon
|
// icon
|
||||||
'icon-mail',
|
'icon-mail',
|
||||||
// rounded
|
// rounded
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue