Skip to content

Commit 6c3e0e4

Browse files
author
Sergey Tatarintsev
committed
Make ProtonWeb run in Electron
Few changes were required to make it happen: 1. base url must point to ./ and all asset refrences must use relative paths. 2. Angular must be updated to 1.5.10 due to this bug angular/angular.js#11091 3. Second package.json, specifically for electron app, is added. 4. main.js file with electron initalisation code is added.
1 parent 032f753 commit 6c3e0e4

File tree

6 files changed

+74
-24
lines changed

6 files changed

+74
-24
lines changed

Gruntfile.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,15 @@ module.exports = function(grunt) {
236236
nonull: true
237237
}]
238238
},
239+
electron_package: {
240+
files: [{
241+
src: ["package.json", "main.js"],
242+
filter: "isFile",
243+
expand: true,
244+
dest: "./<%= build_dir %>/",
245+
cwd: "./src"
246+
}]
247+
}
239248
},
240249

241250
sass: {
@@ -365,7 +374,8 @@ module.exports = function(grunt) {
365374
'<%= build_dir %>/src/**/*.js',
366375
'<%= vendor_files.included_js %>',
367376
'<%= build_dir %>/assets/application.css',
368-
'<%= build_dir %>/assets/vendor.css'
377+
'<%= build_dir %>/assets/vendor.css',
378+
'!<%= build_dir %>/main.js'
369379
],
370380
deployment: false
371381
},
@@ -503,6 +513,19 @@ module.exports = function(grunt) {
503513
'src/app/translations.js': ['po/*.po']
504514
}
505515
}
516+
},
517+
518+
electron: {
519+
mac: {
520+
options: {
521+
name: 'Charge',
522+
out: 'dist',
523+
dir: '<%= build_dir %>',
524+
version: '<%= pkg.version %>',
525+
platform: 'darwin',
526+
arch: 'x64',
527+
}
528+
}
506529
}
507530
};
508531

@@ -553,4 +576,9 @@ module.exports = function(grunt) {
553576
'babel',
554577
'index:build'
555578
]);
579+
580+
grunt.registerTask('build:app', [
581+
'build',
582+
'copy:electron_package',
583+
]);
556584
};

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"angular-translate-storage-local": "~2.11.0",
3232
"angular-translate": "~2.11.0",
3333
"angular-ui-router": "~0.2.15",
34-
"angular": "~1.4.10",
34+
"angular": "~1.5.8",
3535
"autofill-event": "~1.0.0",
3636
"bootstrap-sass": "bootstrap-sass-official#~3.3.6",
3737
"bootstrap": "~3.3.6",

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"devDependencies": {
1010
"babel-preset-es2015": "^6.9.0",
1111
"bower": "^1.7.7",
12+
"electron": "^1.4.3",
1213
"findup-sync": "^0.3.0",
1314
"grunt": "^0.4.5",
1415
"grunt-angular-gettext": "https://github.com/bartbutler/grunt-angular-gettext.git",
@@ -24,6 +25,7 @@
2425
"grunt-contrib-jshint": "~1.0.0",
2526
"grunt-contrib-uglify": "^2.0.0",
2627
"grunt-contrib-watch": "^0.6.1",
28+
"grunt-electron": "^5.0.0",
2729
"grunt-forever": "^0.4.7",
2830
"grunt-git": "^0.3.7",
2931
"grunt-html2js": "^0.3.5",

src/app.html

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, user-scalable=no">
6-
<base href="/">
6+
<base href="./">
77
<title>ProtonMail - Log in</title>
88
<meta name="description" content="Log in or create an account.">
99

10-
<link rel="apple-touch-icon" sizes="57x57" href="/assets/favicons/apple-touch-icon-57x57.png">
11-
<link rel="apple-touch-icon" sizes="60x60" href="/assets/favicons/apple-touch-icon-60x60.png">
12-
<link rel="apple-touch-icon" sizes="72x72" href="/assets/favicons/apple-touch-icon-72x72.png">
13-
<link rel="apple-touch-icon" sizes="76x76" href="/assets/favicons/apple-touch-icon-76x76.png">
14-
<link rel="apple-touch-icon" sizes="114x114" href="/assets/favicons/apple-touch-icon-114x114.png">
15-
<link rel="apple-touch-icon" sizes="120x120" href="/assets/favicons/apple-touch-icon-120x120.png">
16-
<link rel="apple-touch-icon" sizes="144x144" href="/assets/favicons/apple-touch-icon-144x144.png">
17-
<link rel="apple-touch-icon" sizes="152x152" href="/assets/favicons/apple-touch-icon-152x152.png">
18-
<link rel="apple-touch-icon" sizes="180x180" href="/assets/favicons/apple-touch-icon-180x180.png">
19-
<link rel="icon" type="image/png" href="/assets/favicons/favicon-32x32.png" sizes="32x32">
20-
<link rel="icon" type="image/png" href="/assets/favicons/favicon-194x194.png" sizes="194x194">
21-
<link rel="icon" type="image/png" href="/assets/favicons/favicon-96x96.png" sizes="96x96">
22-
<link rel="icon" type="image/png" href="/assets/favicons/android-chrome-192x192.png" sizes="192x192">
23-
<link rel="icon" type="image/png" href="/assets/favicons/favicon-16x16.png" sizes="16x16">
24-
<link rel="manifest" href="/manifest.json">
25-
<link rel="mask-icon" href="/assets/favicons/safari-pinned-tab.svg" color="#333366">
26-
<link rel="shortcut icon" href="/assets/favicons/favicon.ico">
10+
<link rel="apple-touch-icon" sizes="57x57" href="assets/favicons/apple-touch-icon-57x57.png">
11+
<link rel="apple-touch-icon" sizes="60x60" href="assets/favicons/apple-touch-icon-60x60.png">
12+
<link rel="apple-touch-icon" sizes="72x72" href="assets/favicons/apple-touch-icon-72x72.png">
13+
<link rel="apple-touch-icon" sizes="76x76" href="assets/favicons/apple-touch-icon-76x76.png">
14+
<link rel="apple-touch-icon" sizes="114x114" href="assets/favicons/apple-touch-icon-114x114.png">
15+
<link rel="apple-touch-icon" sizes="120x120" href="assets/favicons/apple-touch-icon-120x120.png">
16+
<link rel="apple-touch-icon" sizes="144x144" href="assets/favicons/apple-touch-icon-144x144.png">
17+
<link rel="apple-touch-icon" sizes="152x152" href="assets/favicons/apple-touch-icon-152x152.png">
18+
<link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon-180x180.png">
19+
<link rel="icon" type="image/png" href="assets/favicons/favicon-32x32.png" sizes="32x32">
20+
<link rel="icon" type="image/png" href="assets/favicons/favicon-194x194.png" sizes="194x194">
21+
<link rel="icon" type="image/png" href="assets/favicons/favicon-96x96.png" sizes="96x96">
22+
<link rel="icon" type="image/png" href="assets/favicons/android-chrome-192x192.png" sizes="192x192">
23+
<link rel="icon" type="image/png" href="assets/favicons/favicon-16x16.png" sizes="16x16">
24+
<link rel="manifest" href="manifest.json">
25+
<link rel="mask-icon" href="assets/favicons/safari-pinned-tab.svg" color="#333366">
26+
<link rel="shortcut icon" href="assets/favicons/favicon.ico">
2727
<meta name="apple-mobile-web-app-title" content="ProtonMail">
2828
<meta name="application-name" content="ProtonMail">
2929
<meta name="msapplication-TileColor" content="#333366">
30-
<meta name="msapplication-TileImage" content="/assets/favicons/mstile-144x144.png">
30+
<meta name="msapplication-TileImage" content="assets/favicons/mstile-144x144.png">
3131
<meta name="theme-color" content="#333366">
3232

3333
<% styles.forEach(function (file) { %>
34-
<link rel="stylesheet" type="text/css" href="/<%= file %>" />
34+
<link rel="stylesheet" type="text/css" href="<%= file %>" />
3535
<% }); %>
3636

3737
<style type="text/css">
@@ -85,14 +85,17 @@
8585
<proton-loader></proton-loader>
8686

8787
<div id="exiting" ng-class="{ 'show': loggingOut }">
88-
<img src="/assets/img/decrypt1.gif" class="loader">
88+
<img src="assets/img/decrypt1.gif" class="loader">
8989
<p>LOGGING OUT...</p>
9090
</div>
9191

9292
<div ui-view="main" autoscroll="false" id="body"></div>
93+
94+
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
9395
<% scripts.forEach(function (file) { %>
94-
<script type="text/javascript" src="/<%= file %>"></script>
96+
<script type="text/javascript" src="<%= file %>"></script>
9597
<% }); %>
98+
<script>if (window.module) module = window.module;</script>
9699

97100
<script type="text/javascript">
98101
if(window.location.href.indexOf("/eo/") > -1) {

src/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const electron = require('electron');
2+
3+
const BrowserWindow = electron.BrowserWindow;
4+
5+
electron.app && electron.app.on('ready', () => {
6+
const mainWindow = new BrowserWindow();
7+
8+
mainWindow.loadURL(`file://${__dirname}/app.html`)
9+
});

src/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "charge-app",
3+
"version": "0.1.0",
4+
"description": "Proton mail desktop client",
5+
"main": "main.js",
6+
"author": "Sergey Tatarintsev <[email protected]> (https://github.com/SevInf)",
7+
"license": "MIT"
8+
}

0 commit comments

Comments
 (0)