Fix cookie bug (#800)

+ small fixes
This commit is contained in:
RainLoop Team 2015-08-14 23:20:47 +04:00
parent 91f3c05d5e
commit 502aebdc37
7 changed files with 47 additions and 29 deletions

View file

@ -12,6 +12,8 @@ var
releasesPath: 'build/dist/releases',
community: true,
watch: false,
watchInterval: 1000,
googleCompile: false,
rainloopBuilded: false,
destPath: '',
@ -81,11 +83,18 @@ function cleanDir(sDir)
.pipe(require('gulp-rimraf')());
}
function renameFileWothMd5Hash(sFile)
function renameFileWithMd5Hash(sFile, callback)
{
var sHash = require('crypto').createHash('md5').update(fs.readFileSync(sFile)).digest('hex');
fs.renameSync(sFile, sFile.replace(/\.zip$/, '-' + sHash + '.zip'));
return true;
cfg.lastMd5File = sFile.replace(/\.zip$/, '-' + sHash + '.zip');
fs.renameSync(sFile, cfg.lastMd5File);
callback();
}
function copyFile(sFile, sNewFile, callback)
{
fs.writeFileSync(sNewFile, fs.readFileSync(sFile));
callback();
}
cfg.paths.globjs = 'dev/**/*.js';
@ -450,13 +459,13 @@ gulp.task('js:lint', function() {
.pipe(jshint.reporter('jshint-summary', cfg.summary))
.pipe(jshint.reporter('fail'))
// google compiler
.pipe(closureCompiler({
.pipe(gulpif(cfg.googleCompile, closureCompiler({
compilerPath: './build/compiler.jar',
fileName: 'gc.js',
compilerFlags: {
output_wrapper: '(function(){%output%}());'
}
}));
})))
;
});
@ -574,6 +583,7 @@ gulp.task('rainloop:setup', ['rainloop:copy'], function() {
cfg.zipSrcPath = dist;
cfg.zipFile = 'rainloop-' + (cfg.community ? 'community-' : '') + versionFull + '.zip';
cfg.md5File = cfg.zipFile;
cfg.lastMd5File = '';
cfg.rainloopBuilded = true;
});
@ -583,15 +593,19 @@ gulp.task('rainloop:zip', ['rainloop:copy', 'rainloop:setup'], function() {
zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false;
});
gulp.task('rainloop:md5', ['rainloop:zip'], function() {
return (cfg.destPath && cfg.md5File) ?
renameFileWothMd5Hash(cfg.destPath + cfg.md5File) : false;
gulp.task('rainloop:md5', ['rainloop:zip'], function(callback) {
renameFileWithMd5Hash(cfg.destPath + cfg.md5File, callback);
});
gulp.task('rainloop:clean', ['rainloop:copy', 'rainloop:setup', 'rainloop:zip'], function() {
return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false;
});
gulp.task('rainloop:shortname', ['rainloop:md5'], function(callback) {
copyFile(cfg.lastMd5File, cfg.destPath +
'rainloop' + (cfg.community ? '-community' : '') + '-latest.zip', callback);
});
// BUILD (OwnCloud)
gulp.task('rainloop:owncloud:copy', function() {
@ -657,15 +671,19 @@ gulp.task('rainloop:owncloud:zip', ['rainloop:owncloud:copy', 'rainloop:owncloud
zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false;
});
gulp.task('rainloop:owncloud:md5', ['rainloop:owncloud:zip'], function() {
return (cfg.destPath && cfg.md5File) ?
renameFileWothMd5Hash(cfg.destPath + cfg.md5File) : false;
gulp.task('rainloop:owncloud:md5', ['rainloop:owncloud:zip'], function(callback) {
renameFileWithMd5Hash(cfg.destPath + cfg.md5File, callback);
});
gulp.task('rainloop:owncloud:clean', ['rainloop:owncloud:copy', 'rainloop:owncloud:setup', 'rainloop:owncloud:zip'], function() {
return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false;
});
gulp.task('rainloop:owncloud:shortname', ['rainloop:owncloud:md5'], function(callback) {
copyFile(cfg.lastMd5File, cfg.destPath +
'rainloop' + (cfg.community ? '' : '-standard') + '.zip', callback);
});
// MAIN
gulp.task('default', ['js:libs', 'js:boot', 'js:openpgp', 'js:openpgpworker', 'js:min', 'css:main:min', 'ckeditor', 'fontastic']);
gulp.task('fast-', ['js:app', 'js:admin', 'js:chunks', 'css:main']);
@ -675,14 +693,14 @@ gulp.task('fast+', ['package:community-off', 'fast-']);
gulp.task('rainloop:start', ['js:lint', 'rainloop:copy', 'rainloop:setup']);
gulp.task('rainloop-', ['rainloop:start', 'rainloop:zip', 'rainloop:md5', 'rainloop:clean']);
gulp.task('rainloop-', ['rainloop:start', 'rainloop:zip', 'rainloop:md5', 'rainloop:clean', 'rainloop:shortname']);
gulp.task('rainloop', ['package:community-on', 'rainloop-']);
gulp.task('rainloop+', ['package:community-off', 'rainloop-']);
gulp.task('owncloud-', ['rainloop:owncloud:copy',
'rainloop:owncloud:copy-rainloop', 'rainloop:owncloud:copy-rainloop:clean',
'rainloop:owncloud:setup', 'rainloop:owncloud:zip', 'rainloop:owncloud:md5', 'rainloop:owncloud:clean']);
'rainloop:owncloud:setup', 'rainloop:owncloud:zip', 'rainloop:owncloud:md5', 'rainloop:owncloud:clean', 'rainloop:owncloud:shortname']);
gulp.task('owncloud', ['package:community-on', 'owncloud-']);
gulp.task('owncloud+', ['package:community-off', 'owncloud-']);
@ -691,15 +709,15 @@ gulp.task('owncloud+', ['package:community-off', 'owncloud-']);
gulp.task('watch', ['fast'], function() {
cfg.watch = true;
livereload.listen();
gulp.watch(cfg.paths.globjs, {interval: 1000}, ['js:app', 'js:admin']);
gulp.watch(cfg.paths.less.main.watch, {interval: 1000}, ['css:main']);
gulp.watch(cfg.paths.globjs, {interval: cfg.watchInterval}, ['js:app', 'js:admin']);
gulp.watch(cfg.paths.less.main.watch, {interval: cfg.watchInterval}, ['css:main']);
});
gulp.task('watch+', ['fast+'], function() {
cfg.watch = true;
livereload.listen();
gulp.watch(cfg.paths.globjs, {interval: 1000}, ['js:app', 'js:admin']);
gulp.watch(cfg.paths.less.main.watch, {interval: 1000}, ['css:main']);
gulp.watch(cfg.paths.globjs, {interval: cfg.watchInterval}, ['js:app', 'js:admin']);
gulp.watch(cfg.paths.less.main.watch, {interval: cfg.watchInterval}, ['css:main']);
});
// ALIASES
@ -719,4 +737,4 @@ gulp.task('o', ['owncloud']);
gulp.task('o+', ['owncloud+']);
gulp.task('h', ['js:lint']);
gulp.task('l', ['js:lint']);
gulp.task('l', ['js:lint']);

View file

@ -2,7 +2,7 @@
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.9.2",
"release": "351",
"release": "353",
"description": "Simple, modern & fast web-based email client",
"homepage": "http://rainloop.net",
"main": "gulpfile.js",
@ -40,7 +40,7 @@
"plugins"
],
"readmeFilename": "README.md",
"ownCloudPackageVersion": "4.5",
"ownCloudPackageVersion": "4.6",
"engines": {
"node": ">= 0.10.0"
},

View file

@ -949,10 +949,7 @@ class MailClient
}
/**
* @param string $sSearch
* @param bool $bDetectGmail = true
*
* @return string
* @return bool
*/
public function IsGmail()
{

View file

@ -1524,7 +1524,6 @@ class Actions
$oSettings = $this->SettingsProvider()->Load($oAccount);
if (!$oAccount->IsAdditionalAccount() && !empty($aResult['WelcomePageUrl']) &&
('once' === $aResult['WelcomePageDisplay'] || 'always' === $aResult['WelcomePageDisplay']))
{

View file

@ -108,7 +108,7 @@ class Api
$sSslCafile = \RainLoop\Api::Config()->Get('ssl', 'cafile', '');
$sSslCapath = \RainLoop\Api::Config()->Get('ssl', 'capath', '');
\RainLoop\Utils::$CookieDefaultPath = \RainLoop\Api::Config()->Get('labs', 'cookie_path', '/');
\RainLoop\Utils::$CookieDefaultPath = \RainLoop\Api::Config()->Get('labs', 'cookie_default_path', '');
if (!empty($sSslCafile) || !empty($sSslCapath))
{

View file

@ -348,7 +348,7 @@ Enables caching in the system'),
'fast_cache_memcache_port' => array(11211),
'fast_cache_memcache_expire' => array(43200),
'use_local_proxy_for_external_images' => array(false),
'cookie_path' => array('/'),
'cookie_default_path' => array(''),
'startup_url' => array(''),
'emogrifier' => array(true),
'dev_email' => array(''),

View file

@ -7,7 +7,7 @@ class Utils
/**
* @var string
*/
static $CookieDefaultPath = '/';
static $CookieDefaultPath = '';
static $Cookies = null;
@ -518,6 +518,7 @@ class Utils
if (null === $sPath)
{
$sPath = \RainLoop\Utils::$CookieDefaultPath;
$sPath = $sPath && 0 < \strlen($sPath) ? $sPath : null;
}
\RainLoop\Utils::$Cookies[$sName] = $sValue;
@ -531,8 +532,11 @@ class Utils
\RainLoop\Utils::$Cookies = is_array($_COOKIE) ? $_COOKIE : array();
}
$sPath = \RainLoop\Utils::$CookieDefaultPath;
$sPath = $sPath && 0 < \strlen($sPath) ? $sPath : null;
unset(\RainLoop\Utils::$Cookies[$sName]);
@\setcookie($sName, '', \time() - 3600 * 24 * 30);
@\setcookie($sName, '', \time() - 3600 * 24 * 30, $sPath);
}
/**