mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Now integrate with Nextcloud by default, but keep iframe option available
This commit is contained in:
parent
7d3cbcd333
commit
e5572975a5
5 changed files with 46 additions and 60 deletions
|
|
@ -51,7 +51,7 @@ class FetchController extends Controller {
|
||||||
isset($_POST['snappymail-autologin']) ? '1' === $_POST['snappymail-autologin'] : false);
|
isset($_POST['snappymail-autologin']) ? '1' === $_POST['snappymail-autologin'] : false);
|
||||||
$this->config->setAppValue('snappymail', 'snappymail-autologin-with-email',
|
$this->config->setAppValue('snappymail', 'snappymail-autologin-with-email',
|
||||||
isset($_POST['snappymail-autologin']) ? '2' === $_POST['snappymail-autologin'] : false);
|
isset($_POST['snappymail-autologin']) ? '2' === $_POST['snappymail-autologin'] : false);
|
||||||
$this->config->setAppValue('snappymail', 'snappymail-embed', isset($_POST['snappymail-embed']));
|
// $this->config->setAppValue('snappymail', 'snappymail-no-embed', isset($_POST['snappymail-no-embed']));
|
||||||
} else {
|
} else {
|
||||||
return new JSONResponse([
|
return new JSONResponse([
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
|
|
|
||||||
|
|
@ -27,61 +27,21 @@ class PageController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bAdmin || $config->getAppValue('snappymail', 'snappymail-embed')) {
|
if (!$bAdmin && $config->getAppValue('snappymail', 'snappymail-no-embed')) {
|
||||||
return static::index_embed($bAdmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
\OC::$server->getNavigationManager()->setActiveEntry('snappymail');
|
\OC::$server->getNavigationManager()->setActiveEntry('snappymail');
|
||||||
|
|
||||||
\OCP\Util::addScript('snappymail', 'snappymail');
|
\OCP\Util::addScript('snappymail', 'snappymail');
|
||||||
\OCP\Util::addStyle('snappymail', 'style');
|
\OCP\Util::addStyle('snappymail', 'style');
|
||||||
|
|
||||||
SnappyMailHelper::startApp();
|
SnappyMailHelper::startApp();
|
||||||
|
|
||||||
$response = new TemplateResponse('snappymail', 'index', [
|
$response = new TemplateResponse('snappymail', 'index', [
|
||||||
'snappymail-iframe-url' => SnappyMailHelper::normalizeUrl(SnappyMailHelper::getAppUrl())
|
'snappymail-iframe-url' => SnappyMailHelper::normalizeUrl(SnappyMailHelper::getAppUrl())
|
||||||
. (empty($_GET['target']) ? '' : "#{$_GET['target']}")
|
. (empty($_GET['target']) ? '' : "#{$_GET['target']}")
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$csp = new ContentSecurityPolicy();
|
$csp = new ContentSecurityPolicy();
|
||||||
$csp->addAllowedFrameDomain("'self'");
|
$csp->addAllowedFrameDomain("'self'");
|
||||||
$response->setContentSecurityPolicy($csp);
|
$response->setContentSecurityPolicy($csp);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @NoAdminRequired
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
public function appGet()
|
|
||||||
{
|
|
||||||
SnappyMailHelper::startApp(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @NoAdminRequired
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
public function appPost()
|
|
||||||
{
|
|
||||||
SnappyMailHelper::startApp(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @NoAdminRequired
|
|
||||||
* @NoCSRFRequired
|
|
||||||
*/
|
|
||||||
public function indexPost()
|
|
||||||
{
|
|
||||||
SnappyMailHelper::startApp(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draft code to run without using an iframe
|
|
||||||
*/
|
|
||||||
private static function index_embed(bool $bAdmin)
|
|
||||||
{
|
|
||||||
\OC::$server->getNavigationManager()->setActiveEntry('snappymail');
|
\OC::$server->getNavigationManager()->setActiveEntry('snappymail');
|
||||||
|
|
||||||
\OCP\Util::addStyle('snappymail', 'embed');
|
\OCP\Util::addStyle('snappymail', 'embed');
|
||||||
|
|
@ -132,4 +92,30 @@ class PageController extends Controller
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @NoCSRFRequired
|
||||||
|
*/
|
||||||
|
public function appGet()
|
||||||
|
{
|
||||||
|
SnappyMailHelper::startApp(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @NoCSRFRequired
|
||||||
|
*/
|
||||||
|
public function appPost()
|
||||||
|
{
|
||||||
|
SnappyMailHelper::startApp(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @NoCSRFRequired
|
||||||
|
*/
|
||||||
|
public function indexPost()
|
||||||
|
{
|
||||||
|
SnappyMailHelper::startApp(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,10 +92,10 @@ class Provider implements IProvider
|
||||||
|
|
||||||
$baseURL = $this->urlGenerator->linkToRoute('snappymail.page.index');
|
$baseURL = $this->urlGenerator->linkToRoute('snappymail.page.index');
|
||||||
$config = \OC::$server->getConfig();
|
$config = \OC::$server->getConfig();
|
||||||
if ($config->getAppValue('snappymail', 'snappymail-embed')) {
|
if ($config->getAppValue('snappymail', 'snappymail-no-embed')) {
|
||||||
$baseURL .= '#';
|
|
||||||
} else {
|
|
||||||
$baseURL .= '?target=';
|
$baseURL .= '?target=';
|
||||||
|
} else {
|
||||||
|
$baseURL .= '#';
|
||||||
}
|
}
|
||||||
$search = \rawurlencode($oParams->sSearch);
|
$search = \rawurlencode($oParams->sSearch);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class AdminSettings implements ISettings
|
||||||
$keys = [
|
$keys = [
|
||||||
'snappymail-autologin',
|
'snappymail-autologin',
|
||||||
'snappymail-autologin-with-email',
|
'snappymail-autologin-with-email',
|
||||||
'snappymail-embed'
|
// 'snappymail-no-embed'
|
||||||
];
|
];
|
||||||
$parameters = [];
|
$parameters = [];
|
||||||
foreach ($keys as $k) {
|
foreach ($keys as $k) {
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p>
|
||||||
<input id="snappymail-embed" name="snappymail-embed" type="checkbox" class="checkbox" <?php if ($_['snappymail-embed']) echo 'checked="checked"'; ?>>
|
<input id="snappymail-no-embed" name="snappymail-no-embed" type="checkbox" class="checkbox" <?php if ($_['snappymail-no-embed']) echo 'checked="checked"'; ?>>
|
||||||
<label for="snappymail-embed">Embed without iframe (experimental)</label>
|
<label for="snappymail-no-embed">Don't fully integrate in Nextcloud, use in iframe</label>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue