mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +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::addStyle('snappymail', 'style');
|
||||
|
||||
$query = '';
|
||||
$aCredentials = SnappyMailHelper::getLoginCredentials();
|
||||
if ($aCredentials[0] && $aCredentials[1]) {
|
||||
$query = '?sso&hash=' . \RainLoop\Api::CreateUserSsoHash($aCredentials[0] && $aCredentials[1]);
|
||||
}
|
||||
SnappyMailHelper::startApp();
|
||||
|
||||
$params = [
|
||||
'snappymail-iframe-url' => SnappyMailHelper::normalizeUrl(SnappyMailHelper::getAppUrl()) . $query
|
||||
];
|
||||
|
||||
$response = new TemplateResponse('snappymail', 'index', $params);
|
||||
$response = new TemplateResponse('snappymail', 'index', [
|
||||
'snappymail-iframe-url' => SnappyMailHelper::normalizeUrl(SnappyMailHelper::getAppUrl())
|
||||
. (empty($_GET['target']) ? '' : "#{$_GET['target']}")
|
||||
]);
|
||||
|
||||
$csp = new ContentSecurityPolicy();
|
||||
$csp->addAllowedFrameDomain("'self'");
|
||||
|
|
|
|||
|
|
@ -87,6 +87,15 @@ class Provider implements IProvider
|
|||
// instanceof \MailSo\Mail\MessageCollection
|
||||
$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;
|
||||
foreach ($MessageCollection as $Message) {
|
||||
// $Message instanceof \MailSo\Mail\Message
|
||||
|
|
@ -98,9 +107,7 @@ class Provider implements IProvider
|
|||
// subline
|
||||
$Message->From()->ToString(),
|
||||
// resourceUrl /index.php/apps/snappymail/#/mailbox/INBOX/p2/text=an&unseen
|
||||
$this->urlGenerator->linkToRoute('snappymail.page.index')
|
||||
. '#/mailbox/INBOX/m' . $Message->Uid()
|
||||
. '/' . \rawurlencode($oParams->sSearch),
|
||||
$baseURL . '/mailbox/INBOX/m' . $Message->Uid() . '/' . $search,
|
||||
// icon
|
||||
'icon-mail',
|
||||
// rounded
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue