Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rdex committed Jan 13, 2016
1 parent d835c9d commit cfbf063
Show file tree
Hide file tree
Showing 84 changed files with 43,345 additions and 67 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
build
release
54 changes: 54 additions & 0 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
grunt = require 'grunt'

grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.loadNpmTasks 'grunt-rcedit'
grunt.loadNpmTasks 'grunt-electron-installer'

version = require('./package.json').version

grunt.initConfig
clean:
build: 'build'

copy:
electron:
expand: true
cwd: 'electron/'
src: ['**', '!electron.exe']
dest: 'build/'
'electron-exe':
src: 'electron/electron.exe'
dest: 'build/Birdex.exe'
app:
src: 'app/*'
dest: 'build/resources/'

rcedit:
exes:
files: [
src: 'build/Birdex.exe'
]
options:
'icon': 'app/birdex.ico'
'file-version': version
'product-version': version
'version-string':
'ProductName': 'Birdex'
'FileDescription': 'Secure messenger'
'CompanyName': 'Algorithm LLC'
'LegalCopyright': 'Copyright © 2016 Algorithm LLC. All rights reserved.'

'create-windows-installer':
ia32:
appDirectory: 'build'
outputDirectory: 'release'
loadingGif: 'app/birdex.png'
version: version
exe: 'Birdex.exe'
noMsi: true
setupIcon: 'app/birdex.ico'
iconUrl: 'https://raw.githubusercontent.com/AlgorithmLLC/chat-client-electron/app/birdex.ico'
remoteReleases: 'https://github.com/AlgorithmLLC/chat-client-electron'

grunt.registerTask 'default', ['clean', 'copy', 'rcedit', 'create-windows-installer', 'clean:build']
Binary file added app/birdex.asar
Binary file not shown.
Binary file added app/birdex.ico
Binary file not shown.
Binary file added app/birdex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions app/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
'use strict';
const electron = require('electron');
const app = electron.app; // Module to control application life.

const handleSetupEvent = function() {
if (process.argv.length === 1) {
return false;
}

const ChildProcess = require('child_process');
const path = require('path');

const appFolder = path.resolve(process.execPath, '..');
const rootAtomFolder = path.resolve(appFolder, '..');
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
const exeName = path.basename(process.execPath);

const spawn = function(command, args) {
let spawnedProcess, error;

try {
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
} catch (error) {}

return spawnedProcess;
};

const spawnUpdate = function(args) {
return spawn(updateDotExe, args);
};

const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
// Optionally do things such as:
//
// - Install desktop and start menu shortcuts
// - Add your .exe to the PATH
// - Write to the registry for things like file associations and
// explorer context menus

spawnUpdate(['--createShortcut', exeName]);

setTimeout(app.quit, 1000);
return true;

case '--squirrel-uninstall':
// Undo anything you did in the --squirrel-install and
// --squirrel-updated handlers

spawnUpdate(['--removeShortcut', exeName]);

setTimeout(app.quit, 1000);
return true;

case '--squirrel-obsolete':
// This is called on the outgoing version of your app before
// we update to the new version - it's the opposite of
// --squirrel-updated

setTimeout(app.quit, 1000);
return true;
}
};
if (handleSetupEvent()) {
return;
}

// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.quit();
});

let mainWindow;

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
const protocol = electron.protocol;
protocol.registerFileProtocol('app', function(request, callback) {
let url = request.url.substr(12);
callback({path: require('path').normalize(__dirname + '/birdex.asar/' + url)});
}, function (error) {
if (error)
console.error('Failed to register protocol')
});

// bugfix for <img ng-src> requesting unsafe:app://birdex/path
protocol.registerFileProtocol('unsafe', function(request, callback) {
let url = request.url.substr(19);
callback({path: require('path').normalize(__dirname + '/birdex.asar/' + url)});
}, function (error) {
if (error)
console.error('Failed to register protocol')
});

// Create the browser window.
mainWindow = new electron.BrowserWindow({
width: 1280
, height: 720
, minHeight: 720
, minWidth: 1024
, 'web-preferences': {
'web-security': false
}
});

// and load the index.html of the app.
mainWindow.loadURL('app://birdex/index.html');
// mainWindow.loadURL('http://new.001.birdex.org/');
// mainWindow.loadURL('http://oleg.dev:8000/index-dev.html');
// mainWindow.loadURL('http://oleg.dev:8000/index.html');

// Open the DevTools.
// mainWindow.webContents.openDevTools();

// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});
Binary file added app/message_empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/message_exist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "birdex",
"productName": "Birdex",
"description": "Secure chat",
"author": "Algorithm LLC",
"main": "main.js"
}
20 changes: 20 additions & 0 deletions electron/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2014 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit cfbf063

Please sign in to comment.