mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved Nextcloud integration for #96
This commit is contained in:
parent
dc241ded1b
commit
5c597c4c1d
10 changed files with 123 additions and 35 deletions
|
|
@ -21,8 +21,8 @@ foreach ($files as $file) {
|
|||
$nc_tar->addFile('data/.htaccess');
|
||||
$nc_tar->addFromString('data/VERSION', $package->version);
|
||||
$nc_tar->addFile('data/README.md');
|
||||
*/
|
||||
$nc_tar->addFile('_include.php', 'snappymail/app/_include.php');
|
||||
*/
|
||||
$nc_tar->addFile('.htaccess', 'snappymail/app/.htaccess');
|
||||
|
||||
$index = file_get_contents('index.php');
|
||||
|
|
|
|||
12
dev/External/SquireUI.js
vendored
12
dev/External/SquireUI.js
vendored
|
|
@ -283,7 +283,7 @@ class SquireUI
|
|||
this.wysiwyg = wysiwyg;
|
||||
|
||||
toolbar.className = 'squire-toolbar btn-toolbar';
|
||||
let group, action, touchTap;
|
||||
let group, action/*, touchTap*/;
|
||||
for (group in actions) {
|
||||
/*
|
||||
if ('bidi' == group && !rl.settings.app('allowHtmlEditorBitiButtons')) {
|
||||
|
|
@ -328,16 +328,18 @@ class SquireUI
|
|||
input.className = 'btn';
|
||||
input.innerHTML = cfg.html;
|
||||
input.action_cmd = cfg.cmd;
|
||||
input.addEventListener('touchstart', () => touchTap = input, {passive:true});
|
||||
input.addEventListener('touchmove', () => touchTap = null, {passive:true});
|
||||
input.addEventListener('touchcancel', () => touchTap = null);
|
||||
input.addEventListener('touchend', e => {
|
||||
/*
|
||||
input.addEventListener('pointerdown', () => touchTap = input, {passive:true});
|
||||
input.addEventListener('pointermove', () => touchTap = null, {passive:true});
|
||||
input.addEventListener('pointercancel', () => touchTap = null);
|
||||
input.addEventListener('pointerup', e => {
|
||||
if (touchTap === input) {
|
||||
e.preventDefault();
|
||||
cfg.cmd(input);
|
||||
}
|
||||
touchTap = null;
|
||||
});
|
||||
*/
|
||||
}
|
||||
input.addEventListener(ev, () => cfg.cmd(input));
|
||||
if (cfg.hint) {
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ To fill in the default email address and password to use, each Nextcloud user sh
|
|||
|
||||
## How to Activate SnappyMail Logging and then Find Logs
|
||||
|
||||
You can activate SnappyMail logging here: `/path/to/nextcloud/data/snappymail-storage/_data_/_default_/configs/application.ini`
|
||||
You can activate SnappyMail logging here: `/path/to/nextcloud/data/appdata_snappymail/_data_/_default_/configs/application.ini`
|
||||
```
|
||||
[logs]
|
||||
enable = On
|
||||
```
|
||||
Logs are then available in `/path/to/nextcloud/data/snappymail-storage/_data_/_default_/logs/`
|
||||
Logs are then available in `/path/to/nextcloud/data/appdata_snappymail/_data_/_default_/logs/`
|
||||
|
|
|
|||
44
integrations/nextcloud/snappymail/app/include.php
Normal file
44
integrations/nextcloud/snappymail/app/include.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
// Name this file as "include.php" to enable it.
|
||||
|
||||
//header('Strict-Transport-Security: max-age=31536000');
|
||||
|
||||
/**
|
||||
* Uncomment to use gzip compressed output
|
||||
*/
|
||||
//define('USE_GZIP', 1);
|
||||
|
||||
/**
|
||||
* Uncomment to use brotli compressed output
|
||||
*/
|
||||
//define('USE_BROTLI', 1);
|
||||
|
||||
/**
|
||||
* Uncomment to enable multiple domain installation.
|
||||
*/
|
||||
//define('MULTIDOMAIN', 1);
|
||||
|
||||
/**
|
||||
* Uncomment to disable APCU.
|
||||
*/
|
||||
//define('APP_USE_APCU_CACHE', false);
|
||||
|
||||
/**
|
||||
* Custom 'data' folder path
|
||||
*/
|
||||
if (!empty($_ENV['SNAPPYMAIL_NEXTCLOUD'])) {
|
||||
define('APP_DATA_FOLDER_PATH', \rtrim(\trim(\OC::$server->getSystemConfig()->getValue('datadirectory', '')), '\\/').'/appdata_snappymail/');
|
||||
} else {
|
||||
http_response_code(400);
|
||||
header($_SERVER['SERVER_PROTOCOL'].' 400 Bad Request', true, 400);
|
||||
error_log("SnappyMail outside Nextcloud {$_SERVER['REQUEST_URI']}");
|
||||
exit('Not inside Nextcloud');
|
||||
// define('APP_DATA_FOLDER_PATH', dirname(__DIR__) . '/snappymail-data/');
|
||||
// define('APP_DATA_FOLDER_PATH', '/var/external-snappymail-data-folder/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional configuration file name
|
||||
*/
|
||||
//define('APP_CONFIGURATION_NAME', $_SERVER['HTTP_HOST'].'.ini');
|
||||
|
|
@ -7,6 +7,11 @@ return [
|
|||
'url' => '/',
|
||||
'verb' => 'GET'
|
||||
],
|
||||
[
|
||||
'name' => 'page#indexPost',
|
||||
'url' => '/',
|
||||
'verb' => 'POST'
|
||||
],
|
||||
[
|
||||
'name' => 'page#appGet',
|
||||
'url' => '/run/',
|
||||
|
|
|
|||
40
integrations/nextcloud/snappymail/css/embed.css
Normal file
40
integrations/nextcloud/snappymail/css/embed.css
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
SnappyMail runs in an iframe, so this style sheet is not used there.
|
||||
Only needed to give you the opportunity to theme the nextcloud part of this app.
|
||||
However, there is hidden code in the PageController to embed instead of using an iframe.
|
||||
Then the below #rl-app can be used to style it.
|
||||
*/
|
||||
#rl-app {
|
||||
position: relative;
|
||||
min-width: 100%;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
#content[class*="app-"] #rl-app * {
|
||||
box-sizing: content-box;
|
||||
}
|
||||
#content[class*="app-"] #rl-app #V-Settings-Domains .domain-name,
|
||||
#content[class*="app-"] #rl-app #V-Settings-Domains .domain-alias
|
||||
#content[class*="app-"] #rl-app #rl-settings-subscreen,
|
||||
#content[class*="app-"] #rl-app .e-checkbox.material-design > div > div,
|
||||
#content[class*="app-"] #rl-app .attachmentItem .iconMain,
|
||||
#content[class*="app-"] #rl-app .attachmentItem .iconPreview,
|
||||
#content[class*="app-"] #rl-app #V-PopupsCompose .textAreaParent,
|
||||
#content[class*="app-"] #rl-app #V-PopupsCompose .attachmentAreaParent,
|
||||
#content[class*="app-"] #rl-app .emailaddresses,
|
||||
#content[class*="app-"] #rl-app .squire-wysiwyg,
|
||||
#content[class*="app-"] #rl-app .squire-plain,
|
||||
/* bootstrap */
|
||||
#content[class*="app-"] #rl-app .btn-block,
|
||||
#content[class*="app-"] #rl-app select,
|
||||
#content[class*="app-"] #rl-app .select,
|
||||
#content[class*="app-"] #rl-app textarea,
|
||||
#content[class*="app-"] #rl-app input,
|
||||
#content[class*="app-"] #rl-app .input-block-level
|
||||
{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.squire-wysiwyg {
|
||||
min-width: 100%;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
|
@ -26,13 +26,12 @@ class Application extends App implements IBootstrap
|
|||
$this->getContainer()->query('SnappyMailHelper')->registerHooks();
|
||||
}
|
||||
|
||||
public function __construct(array $urlParams = [])
|
||||
// public function __construct(string $appName, array $urlParams = [])
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('snappymail', $urlParams);
|
||||
|
||||
$container = $this->getContainer();
|
||||
// $server = $container->getServer();
|
||||
// $config = $server->getConfig();
|
||||
|
||||
/**
|
||||
* Controllers
|
||||
|
|
|
|||
|
|
@ -76,17 +76,30 @@ class PageController extends Controller
|
|||
SnappyMailHelper::startApp();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function indexPost()
|
||||
{
|
||||
SnappyMailHelper::startApp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draft code to run without using an iframe
|
||||
*/
|
||||
private static function index_embed()
|
||||
{
|
||||
if (!empty($_SERVER['QUERY_STRING'])) {
|
||||
SnappyMailHelper::startApp();
|
||||
return;
|
||||
}
|
||||
|
||||
\OC::$server->getNavigationManager()->setActiveEntry('snappymail');
|
||||
|
||||
\OCP\Util::addStyle('snappymail', 'style');
|
||||
\OCP\Util::addStyle('snappymail', 'embed');
|
||||
|
||||
SnappyMailHelper::startApp(true);
|
||||
$webPath = \OC::$server->getAppManager()->getAppWebPath('snappymail') . '/app';
|
||||
$oConfig = \RainLoop\Api::Config();
|
||||
$oActions = \RainLoop\Api::Actions();
|
||||
$oHttp = \MailSo\Base\Http::SingletonInstance();
|
||||
|
|
@ -102,11 +115,7 @@ class PageController extends Controller
|
|||
$params = [
|
||||
'LoadingDescriptionEsc' => \htmlspecialchars($oConfig->Get('webmail', 'loading_description', 'SnappyMail'), ENT_QUOTES|ENT_IGNORE, 'UTF-8'),
|
||||
'BaseTemplates' => \RainLoop\Utils::ClearHtmlOutput($oServiceActions->compileTemplates(false)),
|
||||
'BaseAppBootScript' => \str_replace(
|
||||
'loadScript(`./?/',
|
||||
'loadScript(`'.$webPath.'/?/',
|
||||
\file_get_contents(APP_VERSION_ROOT_PATH.'static/js'.($sAppJsMin ? '/min' : '').'/boot'.$sAppJsMin.'.js')
|
||||
),
|
||||
'BaseAppBootScript' => \file_get_contents(APP_VERSION_ROOT_PATH.'static/js'.($sAppJsMin ? '/min' : '').'/boot'.$sAppJsMin.'.js'),
|
||||
'BaseAppBootScriptNonce' => $sScriptNonce,
|
||||
'BaseLanguage' => $oActions->compileLanguage($sLanguage, false),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -44,39 +44,29 @@ class SnappyMailHelper
|
|||
}
|
||||
});
|
||||
|
||||
$path = \OC::$server->getAppManager()->getAppPath('snappymail') . '/app/';
|
||||
|
||||
$sData = \rtrim(\trim(\OC::$server->getSystemConfig()->getValue('datadirectory', '')), '\\/').'/appdata_snappymail/';
|
||||
if (!\is_file("{$path}include.php")) {
|
||||
\file_put_contents("{$path}include.php",
|
||||
\file_get_contents("{$path}_include.php")
|
||||
. "define('APP_DATA_FOLDER_PATH', '{$sData}');\n"
|
||||
);
|
||||
}
|
||||
// \define('APP_DATA_FOLDER_PATH', $sData);
|
||||
|
||||
if ($api) {
|
||||
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
|
||||
}
|
||||
|
||||
require_once "{$path}index.php";
|
||||
require_once \dirname(\dirname(__DIR__)) . '/app/index.php';
|
||||
|
||||
if ($api) {
|
||||
$oConfig = \RainLoop\Api::Config();
|
||||
$bSave = false;
|
||||
if (!$oConfig->Get('webmail', 'app_path')) {
|
||||
$oConfig->Set('webmail', 'app_path', \OC::$server->getAppManager()->getAppWebPath('snappymail') . '/app/');
|
||||
$oConfig->Save();
|
||||
$bSave = true;
|
||||
}
|
||||
/*
|
||||
if (!\is_dir(APP_PLUGINS_PATH . 'nextcloud')) {
|
||||
\SnappyMail\Repository::installPackage('plugin', 'nextcloud');
|
||||
$oConfig->Set('plugins', 'enable', true);
|
||||
$aList = \SnappyMail\Repository::getEnabledPackagesNames();
|
||||
$aList[] = 'nextcloud';
|
||||
$oConfig->Set('plugins', 'enabled_list', \implode(',', \array_unique($aList)));
|
||||
$oConfig->Save();
|
||||
$oConfig->Set('webmail', 'theme', 'Nextcloud@custom');
|
||||
$bSave = true;
|
||||
}
|
||||
*/
|
||||
$bSave && $oConfig->Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
/*
|
||||
\OC::$server->getCalendarManager();
|
||||
\OC::$server->getLDAPProvider();
|
||||
\OC::$server->getAppDataDir('snappymail'); ??
|
||||
|
||||
$oFiles = \OCP\Files::getStorage('files');
|
||||
if ($oFiles and $oFiles->is_dir('/')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue