mirror of
https://github.com/moparisthebest/mail
synced 2024-11-22 08:52:15 -05:00
Firefox App and AppCache
* Add app manifest for firefox packaged app * Ask user to reload when appcache is updated * Fix boxshadow on all inputs and textareas * Fix AppCache for Firefox * Move Chrome App update code to updatehandler
This commit is contained in:
parent
909bca2da5
commit
1311cd1c5e
@ -93,7 +93,7 @@ module.exports = function(grunt) {
|
|||||||
tasks: ['copy:lib', 'manifest']
|
tasks: ['copy:lib', 'manifest']
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
files: ['src/*.js', 'src/**/*.html', 'src/**/*.json', 'src/img/**/*', 'src/font/**/*'],
|
files: ['src/*.js', 'src/**/*.html', 'src/**/*.json', 'src/manifest.*', 'src/img/**/*', 'src/font/**/*'],
|
||||||
tasks: ['copy:app', 'copy:ca', 'copy:tpl', 'copy:img', 'copy:font', 'manifest-dev', 'manifest']
|
tasks: ['copy:app', 'copy:ca', 'copy:tpl', 'copy:img', 'copy:font', 'manifest-dev', 'manifest']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -179,7 +179,7 @@ module.exports = function(grunt) {
|
|||||||
app: {
|
app: {
|
||||||
expand: true,
|
expand: true,
|
||||||
cwd: 'src/',
|
cwd: 'src/',
|
||||||
src: ['*.html', '*.js', '*.json'],
|
src: ['*.html', '*.js', '*.json', 'manifest.*'],
|
||||||
dest: 'dist/'
|
dest: 'dist/'
|
||||||
},
|
},
|
||||||
integration: {
|
integration: {
|
||||||
@ -220,7 +220,7 @@ module.exports = function(grunt) {
|
|||||||
timestamp: true,
|
timestamp: true,
|
||||||
hash: true,
|
hash: true,
|
||||||
cache: ['socket.io/socket.io.js'],
|
cache: ['socket.io/socket.io.js'],
|
||||||
exclude: ['appcache.manifest'],
|
exclude: ['appcache.manifest', 'manifest.webapp'],
|
||||||
master: ['index.html']
|
master: ['index.html']
|
||||||
},
|
},
|
||||||
src: ['**/*.*'],
|
src: ['**/*.*'],
|
||||||
|
14
server.js
14
server.js
@ -71,7 +71,6 @@ app.disable('x-powered-by');
|
|||||||
//
|
//
|
||||||
|
|
||||||
var port = process.env.PORT || 8585,
|
var port = process.env.PORT || 8585,
|
||||||
oneDay = 86400000,
|
|
||||||
development = process.argv[2] === '--dev';
|
development = process.argv[2] === '--dev';
|
||||||
|
|
||||||
// set HTTP headers
|
// set HTTP headers
|
||||||
@ -81,7 +80,14 @@ app.use(function(req, res, next) {
|
|||||||
// CSP
|
// CSP
|
||||||
var iframe = development ? "http://" + req.hostname + ":" + port : "https://" + req.hostname; // allow iframe to load assets
|
var iframe = development ? "http://" + req.hostname + ":" + port : "https://" + req.hostname; // allow iframe to load assets
|
||||||
res.set('Content-Security-Policy', "default-src 'self' " + iframe + "; object-src 'none'; connect-src *; style-src 'self' 'unsafe-inline' " + iframe + "; img-src 'self' data:");
|
res.set('Content-Security-Policy', "default-src 'self' " + iframe + "; object-src 'none'; connect-src *; style-src 'self' 'unsafe-inline' " + iframe + "; img-src 'self' data:");
|
||||||
return next();
|
// set Cache-control Header (for AppCache)
|
||||||
|
res.set('Cache-control', 'public, max-age=0');
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use('/appcache.manifest', function(req, res, next) {
|
||||||
|
res.set('Cache-control', 'no-cache');
|
||||||
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
// redirect all http traffic to https
|
// redirect all http traffic to https
|
||||||
@ -97,9 +103,7 @@ app.use(function(req, res, next) {
|
|||||||
app.use(compression());
|
app.use(compression());
|
||||||
|
|
||||||
// server static files
|
// server static files
|
||||||
app.use(express.static(__dirname + '/dist', {
|
app.use(express.static(__dirname + '/dist'));
|
||||||
maxAge: oneDay
|
|
||||||
}));
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Socket.io proxy
|
// Socket.io proxy
|
||||||
|
@ -173,24 +173,7 @@ define(function(require) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.checkForUpdate = function() {
|
self.checkForUpdate = function() {
|
||||||
if (!window.chrome || !chrome.runtime || !chrome.runtime.onUpdateAvailable) {
|
self._updateHandler.checkForUpdate(self.onError);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for update and restart
|
|
||||||
chrome.runtime.onUpdateAvailable.addListener(function(details) {
|
|
||||||
axe.debug("Updating to version " + details.version);
|
|
||||||
chrome.runtime.reload();
|
|
||||||
});
|
|
||||||
chrome.runtime.requestUpdateCheck(function(status) {
|
|
||||||
if (status === "update_found") {
|
|
||||||
axe.debug("Update pending...");
|
|
||||||
} else if (status === "no_update") {
|
|
||||||
axe.debug("No update found.");
|
|
||||||
} else if (status === "throttled") {
|
|
||||||
axe.debug("Checking updates too frequently.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Check if a new ApaCache is available on page load.
|
||||||
|
if (typeof window.applicationCache !== 'undefined') {
|
||||||
|
window.onload = function() {
|
||||||
|
window.applicationCache.onupdateready = function() {
|
||||||
|
if (window.applicationCache.status === window.applicationCache.UPDATEREADY) {
|
||||||
|
// Browser downloaded a new app cache
|
||||||
|
if (window.confirm('A new version of Whiteout Mail is available. Restart the app to update?')) {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// hey Angular, we're bootstrapping manually!
|
// hey Angular, we're bootstrapping manually!
|
||||||
window.name = 'NG_DEFER_BOOTSTRAP!';
|
window.name = 'NG_DEFER_BOOTSTRAP!';
|
||||||
|
|
||||||
@ -54,8 +70,6 @@ requirejs([
|
|||||||
backButtonUtil,
|
backButtonUtil,
|
||||||
FastClick
|
FastClick
|
||||||
) {
|
) {
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// reset window.name
|
// reset window.name
|
||||||
window.name = util.UUID();
|
window.name = util.UUID();
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@ define(function(require) {
|
|||||||
var appController = require('js/app-controller');
|
var appController = require('js/app-controller');
|
||||||
|
|
||||||
var LoginCtrl = function($scope, $location) {
|
var LoginCtrl = function($scope, $location) {
|
||||||
// check for app update
|
|
||||||
appController.checkForUpdate();
|
|
||||||
|
|
||||||
// start main application controller
|
// start main application controller
|
||||||
appController.start({
|
appController.start({
|
||||||
@ -16,6 +14,9 @@ define(function(require) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check for app update
|
||||||
|
appController.checkForUpdate();
|
||||||
|
|
||||||
initializeUser();
|
initializeUser();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
define(function(require) {
|
define(function(require) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var cfg = require('js/app-config').config,
|
var axe = require('axe'),
|
||||||
|
cfg = require('js/app-config').config,
|
||||||
updateV1 = require('js/util/update/update-v1'),
|
updateV1 = require('js/util/update/update-v1'),
|
||||||
updateV2 = require('js/util/update/update-v2'),
|
updateV2 = require('js/util/update/update-v2'),
|
||||||
updateV3 = require('js/util/update/update-v3'),
|
updateV3 = require('js/util/update/update-v3'),
|
||||||
@ -92,5 +93,40 @@ define(function(require) {
|
|||||||
executeNextUpdate();
|
executeNextUpdate();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check application version and update correspondingly
|
||||||
|
*/
|
||||||
|
UpdateHandler.prototype.checkForUpdate = function(dialog) {
|
||||||
|
// Chrome Packaged App
|
||||||
|
if (typeof window.chrome !== 'undefined' && chrome.runtime && chrome.runtime.onUpdateAvailable) {
|
||||||
|
// check for Chrome app update and restart
|
||||||
|
chrome.runtime.onUpdateAvailable.addListener(function(details) {
|
||||||
|
axe.debug('New Chrome App update... requesting reload.');
|
||||||
|
// Chrome downloaded a new app version
|
||||||
|
dialog({
|
||||||
|
title: 'Update available',
|
||||||
|
message: 'A new version ' + details.version + ' of the app is available. Restart the app to update?',
|
||||||
|
positiveBtnStr: 'Restart',
|
||||||
|
negativeBtnStr: 'Not now',
|
||||||
|
showNegativeBtn: true,
|
||||||
|
callback: function(agree) {
|
||||||
|
if (agree) {
|
||||||
|
chrome.runtime.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
chrome.runtime.requestUpdateCheck(function(status) {
|
||||||
|
if (status === "update_found") {
|
||||||
|
axe.debug("Update pending...");
|
||||||
|
} else if (status === "no_update") {
|
||||||
|
axe.debug("No update found.");
|
||||||
|
} else if (status === "throttled") {
|
||||||
|
axe.debug("Checking updates too frequently.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return UpdateHandler;
|
return UpdateHandler;
|
||||||
});
|
});
|
26
src/manifest.webapp
Normal file
26
src/manifest.webapp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "Whiteout Mail",
|
||||||
|
"description": "Simple and elegant email client with integrated end-to-end encryption. Keeping your emails safe has never been so easy.",
|
||||||
|
"version": "0.17.1.0",
|
||||||
|
"launch_path": "/index.html",
|
||||||
|
"icons": {
|
||||||
|
"128": "/img/icon-128.png"
|
||||||
|
},
|
||||||
|
"developer": {
|
||||||
|
"name": "Whiteout Networks GmbH",
|
||||||
|
"url": "https://whiteout.io"
|
||||||
|
},
|
||||||
|
"default_locale": "en",
|
||||||
|
"type": "privileged",
|
||||||
|
"permissions": {
|
||||||
|
"tcp-socket": {
|
||||||
|
"description": "Required to connect to mail servers via IMAP/SMTP"
|
||||||
|
},
|
||||||
|
"desktop-notification": {
|
||||||
|
"description": "Required to show notifications on incoming mails."
|
||||||
|
},
|
||||||
|
"storage": {
|
||||||
|
"description": "Required to store messages for offline use."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -35,6 +35,8 @@ textarea {
|
|||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
// disable box shadow on firefox
|
||||||
|
background-image: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset {
|
fieldset {
|
||||||
|
Loading…
Reference in New Issue
Block a user