Skip to content

Commit cfbf063

Browse files
committed
init
1 parent d835c9d commit cfbf063

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+43345
-67
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
build
3+
release

Gruntfile.coffee

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
grunt = require 'grunt'
2+
3+
grunt.loadNpmTasks 'grunt-contrib-clean'
4+
grunt.loadNpmTasks 'grunt-contrib-copy'
5+
grunt.loadNpmTasks 'grunt-rcedit'
6+
grunt.loadNpmTasks 'grunt-electron-installer'
7+
8+
version = require('./package.json').version
9+
10+
grunt.initConfig
11+
clean:
12+
build: 'build'
13+
14+
copy:
15+
electron:
16+
expand: true
17+
cwd: 'electron/'
18+
src: ['**', '!electron.exe']
19+
dest: 'build/'
20+
'electron-exe':
21+
src: 'electron/electron.exe'
22+
dest: 'build/Birdex.exe'
23+
app:
24+
src: 'app/*'
25+
dest: 'build/resources/'
26+
27+
rcedit:
28+
exes:
29+
files: [
30+
src: 'build/Birdex.exe'
31+
]
32+
options:
33+
'icon': 'app/birdex.ico'
34+
'file-version': version
35+
'product-version': version
36+
'version-string':
37+
'ProductName': 'Birdex'
38+
'FileDescription': 'Secure messenger'
39+
'CompanyName': 'Algorithm LLC'
40+
'LegalCopyright': 'Copyright © 2016 Algorithm LLC. All rights reserved.'
41+
42+
'create-windows-installer':
43+
ia32:
44+
appDirectory: 'build'
45+
outputDirectory: 'release'
46+
loadingGif: 'app/birdex.png'
47+
version: version
48+
exe: 'Birdex.exe'
49+
noMsi: true
50+
setupIcon: 'app/birdex.ico'
51+
iconUrl: 'https://raw.githubusercontent.com/AlgorithmLLC/chat-client-electron/app/birdex.ico'
52+
remoteReleases: 'https://github.com/AlgorithmLLC/chat-client-electron'
53+
54+
grunt.registerTask 'default', ['clean', 'copy', 'rcedit', 'create-windows-installer', 'clean:build']

app/birdex.asar

7.45 MB
Binary file not shown.

app/birdex.ico

39.6 KB
Binary file not shown.

app/birdex.png

8.94 KB
Loading

app/main.js

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
'use strict';
2+
const electron = require('electron');
3+
const app = electron.app; // Module to control application life.
4+
5+
const handleSetupEvent = function() {
6+
if (process.argv.length === 1) {
7+
return false;
8+
}
9+
10+
const ChildProcess = require('child_process');
11+
const path = require('path');
12+
13+
const appFolder = path.resolve(process.execPath, '..');
14+
const rootAtomFolder = path.resolve(appFolder, '..');
15+
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
16+
const exeName = path.basename(process.execPath);
17+
18+
const spawn = function(command, args) {
19+
let spawnedProcess, error;
20+
21+
try {
22+
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
23+
} catch (error) {}
24+
25+
return spawnedProcess;
26+
};
27+
28+
const spawnUpdate = function(args) {
29+
return spawn(updateDotExe, args);
30+
};
31+
32+
const squirrelEvent = process.argv[1];
33+
switch (squirrelEvent) {
34+
case '--squirrel-install':
35+
case '--squirrel-updated':
36+
// Optionally do things such as:
37+
//
38+
// - Install desktop and start menu shortcuts
39+
// - Add your .exe to the PATH
40+
// - Write to the registry for things like file associations and
41+
// explorer context menus
42+
43+
spawnUpdate(['--createShortcut', exeName]);
44+
45+
setTimeout(app.quit, 1000);
46+
return true;
47+
48+
case '--squirrel-uninstall':
49+
// Undo anything you did in the --squirrel-install and
50+
// --squirrel-updated handlers
51+
52+
spawnUpdate(['--removeShortcut', exeName]);
53+
54+
setTimeout(app.quit, 1000);
55+
return true;
56+
57+
case '--squirrel-obsolete':
58+
// This is called on the outgoing version of your app before
59+
// we update to the new version - it's the opposite of
60+
// --squirrel-updated
61+
62+
setTimeout(app.quit, 1000);
63+
return true;
64+
}
65+
};
66+
if (handleSetupEvent()) {
67+
return;
68+
}
69+
70+
// Quit when all windows are closed.
71+
app.on('window-all-closed', function() {
72+
app.quit();
73+
});
74+
75+
let mainWindow;
76+
77+
// This method will be called when Electron has finished
78+
// initialization and is ready to create browser windows.
79+
app.on('ready', function() {
80+
const protocol = electron.protocol;
81+
protocol.registerFileProtocol('app', function(request, callback) {
82+
let url = request.url.substr(12);
83+
callback({path: require('path').normalize(__dirname + '/birdex.asar/' + url)});
84+
}, function (error) {
85+
if (error)
86+
console.error('Failed to register protocol')
87+
});
88+
89+
// bugfix for <img ng-src> requesting unsafe:app://birdex/path
90+
protocol.registerFileProtocol('unsafe', function(request, callback) {
91+
let url = request.url.substr(19);
92+
callback({path: require('path').normalize(__dirname + '/birdex.asar/' + url)});
93+
}, function (error) {
94+
if (error)
95+
console.error('Failed to register protocol')
96+
});
97+
98+
// Create the browser window.
99+
mainWindow = new electron.BrowserWindow({
100+
width: 1280
101+
, height: 720
102+
, minHeight: 720
103+
, minWidth: 1024
104+
, 'web-preferences': {
105+
'web-security': false
106+
}
107+
});
108+
109+
// and load the index.html of the app.
110+
mainWindow.loadURL('app://birdex/index.html');
111+
// mainWindow.loadURL('http://new.001.birdex.org/');
112+
// mainWindow.loadURL('http://oleg.dev:8000/index-dev.html');
113+
// mainWindow.loadURL('http://oleg.dev:8000/index.html');
114+
115+
// Open the DevTools.
116+
// mainWindow.webContents.openDevTools();
117+
118+
// Emitted when the window is closed.
119+
mainWindow.on('closed', function() {
120+
// Dereference the window object, usually you would store windows
121+
// in an array if your app supports multi windows, this is the time
122+
// when you should delete the corresponding element.
123+
mainWindow = null;
124+
});
125+
});

app/message_empty.png

1.96 KB
Loading

app/message_exist.png

1.86 KB
Loading

app/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "birdex",
3+
"productName": "Birdex",
4+
"description": "Secure chat",
5+
"author": "Algorithm LLC",
6+
"main": "main.js"
7+
}

electron/LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2014 GitHub Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)