mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Small fixes
This commit is contained in:
parent
aabed21b19
commit
c6ec3fb311
6 changed files with 71 additions and 49 deletions
|
|
@ -36,7 +36,6 @@
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.Capa = {
|
Enums.Capa = {
|
||||||
'Prem': 'PREM',
|
|
||||||
'TwoFactor': 'TWO_FACTOR',
|
'TwoFactor': 'TWO_FACTOR',
|
||||||
'OpenPGP': 'OPEN_PGP',
|
'OpenPGP': 'OPEN_PGP',
|
||||||
'Prefetch': 'PREFETCH',
|
'Prefetch': 'PREFETCH',
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
Settings = require('Storage/Settings')
|
Settings = require('Storage/Settings')
|
||||||
;
|
;
|
||||||
|
|
||||||
this.capa = !!Settings.capa(Enums.Capa.Prem);
|
this.capa = !!Settings.settingsGet('PremType');
|
||||||
this.capa = true;
|
this.capa = true;
|
||||||
|
|
||||||
this.title = ko.observable(Settings.settingsGet('Title'));
|
this.title = ko.observable(Settings.settingsGet('Title'));
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var
|
var
|
||||||
window = require('window'),
|
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
$ = require('$'),
|
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
|
|
||||||
Enums = require('Common/Enums'),
|
Enums = require('Common/Enums'),
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
|
|
||||||
Enums = require('Common/Enums'),
|
|
||||||
|
|
||||||
Settings = require('Storage/Settings'),
|
Settings = require('Storage/Settings'),
|
||||||
Data = require('Storage/Admin/Data'),
|
Data = require('Storage/Admin/Data'),
|
||||||
Remote = require('Storage/Admin/Remote'),
|
Remote = require('Storage/Admin/Remote'),
|
||||||
|
|
@ -29,7 +27,7 @@
|
||||||
this.version = ko.observable(Settings.settingsGet('Version'));
|
this.version = ko.observable(Settings.settingsGet('Version'));
|
||||||
|
|
||||||
this.adminManLoadingVisibility = Data.adminManLoadingVisibility;
|
this.adminManLoadingVisibility = Data.adminManLoadingVisibility;
|
||||||
this.capa = !!Settings.capa(Enums.Capa.Prem);
|
this.capa = !!Settings.settingsGet('PremType');
|
||||||
this.capa = false;
|
this.capa = false;
|
||||||
|
|
||||||
kn.constructorEnd(this);
|
kn.constructorEnd(this);
|
||||||
|
|
|
||||||
|
|
@ -953,6 +953,14 @@ class Actions
|
||||||
return $this->GetAccountFromCustomToken($this->getAuthToken(), $bThrowExceptionOnFalse);
|
return $this->GetAccountFromCustomToken($this->getAuthToken(), $bThrowExceptionOnFalse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function PremType()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $bAdmin
|
* @param bool $bAdmin
|
||||||
* @param string $sAuthAccountHash = ''
|
* @param string $sAuthAccountHash = ''
|
||||||
|
|
@ -1003,6 +1011,7 @@ class Actions
|
||||||
'UseImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
|
'UseImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
|
||||||
'UseImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
|
'UseImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
|
||||||
'AllowAppendMessage' => (bool) $oConfig->Get('labs', 'allow_message_append', false),
|
'AllowAppendMessage' => (bool) $oConfig->Get('labs', 'allow_message_append', false),
|
||||||
|
'PremType' => $this->PremType(),
|
||||||
'Capa' => array(),
|
'Capa' => array(),
|
||||||
'Plugins' => array()
|
'Plugins' => array()
|
||||||
);
|
);
|
||||||
|
|
@ -1029,7 +1038,7 @@ class Actions
|
||||||
$aResult['AuthAccountHash'] = $sAuthAccountHash;
|
$aResult['AuthAccountHash'] = $sAuthAccountHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->GetCapa(true, \RainLoop\Enumerations\Capa::PREM))
|
if ($this->PremType() || true)
|
||||||
{
|
{
|
||||||
$aResult['Title'] = $oConfig->Get('webmail', 'title', '');
|
$aResult['Title'] = $oConfig->Get('webmail', 'title', '');
|
||||||
$aResult['LoadingDescription'] = $oConfig->Get('webmail', 'loading_description', '');
|
$aResult['LoadingDescription'] = $oConfig->Get('webmail', 'loading_description', '');
|
||||||
|
|
@ -2452,7 +2461,7 @@ class Actions
|
||||||
$this->setConfigFromParams($oConfig, 'DetermineUserLanguage', 'login', 'determine_user_language', 'bool');
|
$this->setConfigFromParams($oConfig, 'DetermineUserLanguage', 'login', 'determine_user_language', 'bool');
|
||||||
$this->setConfigFromParams($oConfig, 'DetermineUserDomain', 'login', 'determine_user_domain', 'bool');
|
$this->setConfigFromParams($oConfig, 'DetermineUserDomain', 'login', 'determine_user_domain', 'bool');
|
||||||
|
|
||||||
if ($this->GetCapa(true, \RainLoop\Enumerations\Capa::PREM))
|
if ($this->PremType() || true)
|
||||||
{
|
{
|
||||||
$this->setConfigFromParams($oConfig, 'Title', 'webmail', 'title', 'string');
|
$this->setConfigFromParams($oConfig, 'Title', 'webmail', 'title', 'string');
|
||||||
$this->setConfigFromParams($oConfig, 'LoadingDescription', 'webmail', 'loading_description', 'string');
|
$this->setConfigFromParams($oConfig, 'LoadingDescription', 'webmail', 'loading_description', 'string');
|
||||||
|
|
@ -2556,6 +2565,57 @@ class Actions
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function licenseHelper($sForce = false, $iCacheTimeInMin = 5)
|
||||||
|
{
|
||||||
|
$sDomain = APP_SITE;
|
||||||
|
|
||||||
|
$oCacher = $this->Cacher();
|
||||||
|
$oHttp = \MailSo\Base\Http::SingletonInstance();
|
||||||
|
|
||||||
|
if ($oHttp->CheckLocalhost($sDomain))
|
||||||
|
{
|
||||||
|
return 'NO';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sValue = '';
|
||||||
|
if (!$sForce && $oCacher)
|
||||||
|
{
|
||||||
|
$iTime = $oCacher->GetTimer(\RainLoop\KeyPathHelper::LicensingDomainKeyValue($sDomain));
|
||||||
|
if ($iTime + 60 * $iCacheTimeInMin > \time())
|
||||||
|
{
|
||||||
|
$sValue = $oCacher->Get(\RainLoop\KeyPathHelper::LicensingDomainKeyValue($sDomain));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 === \strlen($sValue))
|
||||||
|
{
|
||||||
|
$iCode = 0;
|
||||||
|
$sContentType = '';
|
||||||
|
|
||||||
|
$sValue = $oHttp->GetUrlAsString(APP_API_PATH.'status/'.\urlencode($sDomain),
|
||||||
|
'RainLoop/'.APP_VERSION, $sContentType, $iCode, $this->Logger(), 10,
|
||||||
|
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''),
|
||||||
|
array(), false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (200 !== $iCode)
|
||||||
|
{
|
||||||
|
$sValue = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($oCacher)
|
||||||
|
{
|
||||||
|
$oCacher->Set(\RainLoop\KeyPathHelper::LicensingDomainKeyValue($sDomain), $sValue);
|
||||||
|
$oCacher->SetTimer(\RainLoop\KeyPathHelper::LicensingDomainKeyValue($sDomain));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sValue;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
@ -2564,54 +2624,22 @@ class Actions
|
||||||
$iStart = \time();
|
$iStart = \time();
|
||||||
$this->IsAdminLoggined();
|
$this->IsAdminLoggined();
|
||||||
|
|
||||||
$sForce = '1' === (string) $this->GetActionParam('Force', '0');
|
$bForce = '1' === (string) $this->GetActionParam('Force', '0');
|
||||||
|
|
||||||
$mResult = false;
|
$mResult = false;
|
||||||
$iErrorCode = -1;
|
$iErrorCode = -1;
|
||||||
|
|
||||||
$oHttp = \MailSo\Base\Http::SingletonInstance();
|
if (2 < \strlen(APP_SITE))
|
||||||
if ($oHttp->CheckLocalhost(APP_SITE))
|
|
||||||
{
|
{
|
||||||
return $this->DefaultResponse(__FUNCTION__, $mResult);
|
$sValue = $this->licenseHelper($bForce);
|
||||||
}
|
|
||||||
|
|
||||||
$sDomain = APP_SITE;
|
if ($iStart === \time())
|
||||||
if (2 < \strlen($sDomain))
|
|
||||||
{
|
|
||||||
$sValue = '';
|
|
||||||
$iTime = $this->Cacher()->GetTimer(\RainLoop\KeyPathHelper::LicensingDomainKeyValue($sDomain));
|
|
||||||
if (!$sForce && $iTime + 60 * 5 > \time())
|
|
||||||
{
|
{
|
||||||
$sValue = $this->Cacher()->Get(\RainLoop\KeyPathHelper::LicensingDomainKeyValue($sDomain));
|
\sleep(1);
|
||||||
}
|
|
||||||
|
|
||||||
if (0 === \strlen($sValue))
|
|
||||||
{
|
|
||||||
$iCode = 0;
|
|
||||||
$sContentType = '';
|
|
||||||
|
|
||||||
$sValue = $oHttp->GetUrlAsString(APP_API_PATH.'status/'.\urlencode($sDomain),
|
|
||||||
'RainLoop', $sContentType, $iCode, $this->Logger(), 10,
|
|
||||||
$this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''),
|
|
||||||
array(), false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (200 !== $iCode)
|
|
||||||
{
|
|
||||||
$sValue = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($iStart === \time())
|
|
||||||
{
|
|
||||||
\sleep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->Cacher()->Set(\RainLoop\KeyPathHelper::LicensingDomainKeyValue($sDomain), $sValue);
|
|
||||||
$this->Cacher()->SetTimer(\RainLoop\KeyPathHelper::LicensingDomainKeyValue($sDomain));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$aMatch = array();
|
$aMatch = array();
|
||||||
if (5 < \strlen($sValue) && \preg_match('/^EXPIRED:([\d]+)$/', $sValue, $aMatch))
|
if (\preg_match('/^EXPIRED:([\d]+)$/', $sValue, $aMatch))
|
||||||
{
|
{
|
||||||
$mResult = array(
|
$mResult = array(
|
||||||
'Banned' => false,
|
'Banned' => false,
|
||||||
|
|
@ -6406,7 +6434,6 @@ class Actions
|
||||||
$oConfig = $this->Config();
|
$oConfig = $this->Config();
|
||||||
|
|
||||||
$aResult = array(
|
$aResult = array(
|
||||||
\RainLoop\Enumerations\Capa::PREM,
|
|
||||||
// \RainLoop\Enumerations\Capa::FILTERS
|
// \RainLoop\Enumerations\Capa::FILTERS
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label data-bind="click: function () { dropboxEnable(!dropboxEnable()); }">
|
<label data-bind="click: function () { dropboxEnable(!dropboxEnable()); }">
|
||||||
<i data-bind="css: dropboxEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
|
<i data-bind="css: dropboxEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
|
||||||
Enable Dropbox Integration (Compose attachments)
|
Enable Dropbox Integration (Compose view)
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue