Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sami616 committed Nov 28, 2017
0 parents commit 2cb175a
Show file tree
Hide file tree
Showing 57 changed files with 10,912 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build
/dist

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Binary file added electron/icon.icns
Binary file not shown.
Binary file added electron/icon.ico
Binary file not shown.
169 changes: 169 additions & 0 deletions electron/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
if(!process.env.DEV){ require('./server') }

const {autoUpdater} = require('electron-updater');
autoUpdater.autoDownload = false;

const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const path = require('path');
const url = require('url');
var ipcMain = require('electron').ipcMain;
let mainWindow;
let splashWindow;

const inspector = process.env.DEV ? true : false;
const startUrl = 'http://localhost:3007';
const startUrlSplash = path.join(startUrl, 'splash.html');

ipcMain.on('authClearCookies', () => {
mainWindow.webContents.session.clearStorageData({
storages: ['local storage', 'cookies']
})
});

ipcMain.on('openAuthWindow', createAuthWindow);

function handleCallback (url, config) {

var raw_code = /code=([^&]*)/.exec(url) || null;
var code = (raw_code && raw_code.length > 1) ? raw_code[1] : null;
var err = /\?error=(.+)$/.exec(url);

if (code || err) { authWindow.destroy() }

if (code) {

mainWindow.webContents.send('receivedCode', {code, config});

} else if (err) {
mainWindow.webContents.send('receivedErr');
}

}


function createAuthWindow(){

const config = {
client_id: "1033d581116c6ebc4f60",
client_secret: "74360dea7a68388bad6cf9f574535ae9e00f3ab3",
scope: ['repo', 'user']
}

const {client_id, client_seceret, scope} = config;

const authUrl = `https://github.com/login/oauth/authorize?client_id=${client_id}&scope=${scope}`;

authWindow = new BrowserWindow({
width: 400,
height: 600,
parent: mainWindow,
alwaysOnTop: true
});

authWindow.setMenu(null);
authWindow.loadURL(authUrl);

authWindow.on('closed', function() {
authWindow = null
})

authWindow.webContents.on('will-navigate', function (event, url) {
handleCallback(url, config);
});

}

function createMainWindow() {

mainWindow = new BrowserWindow({
width: 800,
height: 600,
show: false,
backgroundColor: '#313131',
webPreferences: {
webSecurity: false,
devTools: inspector
}
});

mainWindow.loadURL(startUrl);

mainWindow.on('closed', function () {
mainWindow = null
})

}


function createSplashWindow() {

splashWindow = new BrowserWindow({
width: 300,
height: 370,
resizable: false,
backgroundColor: '#313131',
movable: false,
frame: false,
webPreferences: {
webSecurity: false,
devTools: inspector
}
});

splashWindow.loadURL(startUrlSplash);

splashWindow.on('closed', function () {
splashWindow = null
})

}




autoUpdater.on('update-available', info => {
mainWindow.webContents.send('updateAvailable', info)
});

ipcMain.on('downloadUpdate', (event, arg) => {
autoUpdater.downloadUpdate();
})

autoUpdater.on('update-downloaded', info => {
mainWindow.webContents.send('updateDownloaded')
});

ipcMain.on('quitAndInstall', (event, arg) => {
autoUpdater.quitAndInstall();
})



app.on('ready', function(){

createMainWindow();
createSplashWindow();

setTimeout(()=>{

mainWindow.show();
splashWindow.close();
autoUpdater.checkForUpdates();

},2000);
});

app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
});

app.on('activate', function () {
if (mainWindow === null) {
createMainWindow()
mainWindow.show();
}
});
7 changes: 7 additions & 0 deletions electron/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const express = require('express');
const path = require('path');

let server = express();
server.use(express.static(__dirname + '/../build'));

server.listen(3007);
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "APL",
"description": "Advanced Project Launcher",
"author": "srdesigns",
"version": "0.1.0",
"private": true,
"main": "electron/index.js",
"homepage": "./",
"dependencies": {
"command-exists": "^1.2.2",
"electron-updater": "^2.16.1",
"express": "^4.16.2",
"firebase": "^4.6.2",
"polished": "^1.9.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-loading": "^1.0.1",
"react-redux": "^5.0.6",
"react-scripts": "1.0.17",
"redux": "^3.7.2",
"request": "^2.83.0",
"rimraf": "^2.6.2",
"styled-components": "^2.2.3",
"unzip": "^0.1.11"
},
"build": {
"appId": "APL.sr.com",
"mac": {
"icon": "electron/icon.icns"
},
"win": {
"icon": "electron/icon.ico"
},
"files": [
"electron",
"build",
"node_modules"
]
},
"scripts": {
"start": "PORT=3007 react-scripts start",
"build": "react-scripts build",
"elec:d": "DEV=true electron .",
"elec:p": "electron .",
"elec:b": "electron-builder",
"ship": "electron-builder -p always",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"electron": "^1.7.9",
"electron-builder": "^19.45.4",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0"
}
}
11 changes: 11 additions & 0 deletions public/callback.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
</body>
</html>
Binary file added public/favicon.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">

<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<title>Project Launcher</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>

</body>
</html>
15 changes: 15 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
86 changes: 86 additions & 0 deletions public/splash.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Project Launcher</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
background: #373a3e;
text-align: center;
height: 100vh;
width: 100%;
margin: 0;
font-size: 24px;
color: #fff;
font-family: "Menlo", "Monaco", "Courier New", "monospace";
}
div {
margin: 30px 0 0 0;
width: 250px;
}
</style>
</head>
<body>
<div>


<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 642.1" style="enable-background:new 0 0 512 642.1;" xml:space="preserve">
<g id="Layer_3">
<path style="fill:#2B2E31;" d="M499.2,256c0,68.1-28,129.7-73.1,173.8c-15,14.7-31.9,27.5-50.3,37.9c-8.5,4.8-17.3,9.2-26.5,12.9
c-28.7,12-60.3,18.6-93.4,18.6C121.7,499.2,12.8,390.3,12.8,256S121.7,12.8,256,12.8c123.4,0,225.3,91.9,241.1,211
C498.5,234.3,499.2,245.1,499.2,256z"/>
</g>
<g id="Layer_1_1_">
<g>
<g>
<g>
<path style="fill:#FFFFFF;" d="M396,120.1c-0.3-2.4-2.2-4.4-4.7-4.7c-21.9-2.7-44.6-0.3-65.5,6.8c-20.9,7.2-40.2,19.2-55.9,34.9
l-35.7,35.7l-51.5,6.6c-1.2,0.2-2.3,0.7-3.1,1.5L130,250.5c-1.4,1.4-1.9,3.5-1.3,5.4c0.6,1.9,2.2,3.3,4.1,3.7l37.5,7l7.4,7.4
l-15.7,8.5c-1.5,0.8-2.5,2.3-2.7,3.9s0.3,3.4,1.5,4.6l59.5,59.5c1,1,2.4,1.6,3.8,1.6c0.3,0,0.5,0,0.8-0.1
c1.7-0.2,3.1-1.3,3.9-2.7l8.5-15.7l7.4,7.4l7,37.5c0.4,2,1.8,3.5,3.7,4.1c0.5,0.2,1.1,0.2,1.6,0.2c1.4,0,2.8-0.5,3.8-1.6
l49.6-49.6c0.8-0.8,1.4-1.9,1.5-3.1l6.6-51.5l35.7-35.7c15.6-15.6,27.7-34.9,34.9-55.8C396.4,164.7,398.7,142.1,396,120.1z
M171.3,256l-26.4-4.9l41.2-41.2l35.9-4.6L171.3,256z M222.9,338l-49.4-49.4l12.2-6.6l43.8,43.8L222.9,338z M301.6,325.5
l-41.2,41.2l-4.9-26.4l50.7-50.7L301.6,325.5z M346.7,233.9l-97,97l-69.1-69.1l97-97c14.1-14.1,31.4-25,50.2-31.8
c2.4,12.5,8.5,24.1,17.6,33.1c9.1,9.1,20.6,15.2,33.1,17.6C371.7,202.5,360.8,219.8,346.7,233.9z M381.7,173.5
c-10.9-1.9-20.9-7-28.8-14.9s-13-17.9-14.9-28.8c15.5-4.2,31.8-5.6,47.8-4.1C387.3,141.7,385.9,158,381.7,173.5z"/>
<path style="fill:#FFFFFF;" d="M272.4,193.2c-12.7,12.7-12.7,33.3,0,45.9c6.3,6.3,14.6,9.5,23,9.5c8.3,0,16.6-3.2,23-9.5l0,0
c12.7-12.7,12.7-33.3,0-45.9C305.6,180.6,285,180.6,272.4,193.2z M310.7,231.6c-8.5,8.5-22.3,8.5-30.8,0s-8.5-22.3,0-30.8
c4.2-4.2,9.8-6.4,15.4-6.4s11.1,2.1,15.4,6.4C319.2,209.3,319.2,223.1,310.7,231.6z"/>
<path style="fill:#3DEAD5;" d="M184.6,327.9c-2.1-2.1-5.5-2.1-7.6,0l-45.9,45.9c-2.1,2.1-2.1,5.5,0,7.6c1,1,2.4,1.6,3.8,1.6
c1.4,0,2.7-0.5,3.8-1.6l45.9-45.9C186.7,333.4,186.7,330,184.6,327.9z"/>
<path style="fill:#3DEAD5;" d="M191.7,342.5L171,363.2c-2.1,2.1-2.1,5.5,0,7.6c1,1,2.4,1.6,3.8,1.6s2.7-0.5,3.8-1.6l20.7-20.7
c2.1-2.1,2.1-5.5,0-7.6C197.1,340.5,193.8,340.5,191.7,342.5z"/>
<path style="fill:#3DEAD5;" d="M163.7,372.7c-2.2,0-4.3,1.4-5,3.5c-0.8,2.1-0.1,4.6,1.7,6s4.5,1.5,6.4,0.2
c2-1.4,2.8-4.1,1.9-6.4C167.9,374,165.9,372.7,163.7,372.7z"/>
<path style="fill:#3DEAD5;" d="M168.7,376C168.8,376.3,168.5,375.7,168.7,376L168.7,376z"/>
<path style="fill:#3DEAD5;" d="M148.6,385.6l-2.8,2.8c-2.1,2.1-2.1,5.5,0,7.6c1,1,2.4,1.6,3.8,1.6c1.4,0,2.7-0.5,3.8-1.6
l2.8-2.8c2.1-2.1,2.1-5.5,0-7.6S150.7,383.5,148.6,385.6z"/>
<path style="fill:#3DEAD5;" d="M144.7,338.5c-2.1-2.1-5.5-2.1-7.6,0l-20.7,20.7c-2.1,2.1-2.1,5.5,0,7.6c1,1,2.4,1.6,3.8,1.6
s2.7-0.5,3.8-1.6l20.7-20.7C146.8,344,146.8,340.6,144.7,338.5z"/>
<path style="fill:#3DEAD5;" d="M153.3,336.4c2.2-0.5,3.8-2.4,4-4.7c0.2-2.2-1-4.3-2.9-5.3c-2.1-1-4.7-0.6-6.3,1.1
c-1.7,1.8-2,4.6-0.6,6.7c0-0.1-0.1-0.1,0,0s0.1,0.1,0,0C148.8,336.1,151.1,337,153.3,336.4z"/>
<path style="fill:#3DEAD5;" d="M167.1,323.7l2.8-2.8c2.1-2.1,2.1-5.5,0-7.6s-5.5-2.1-7.6,0l-2.8,2.8c-2.1,2.1-2.1,5.5,0,7.6
c1,1,2.4,1.6,3.8,1.6C164.7,325.3,166.1,324.7,167.1,323.7z"/>
</g>
</g>
</g>
</g>
<g>
<path style="fill:#3DEAD5;" d="M227.3,565.6h-15.9l-3,9h-9.6l16.3-43.9h8.4l16.4,43.9h-9.6L227.3,565.6z M213.9,558.2h11l-5.5-16.4
L213.9,558.2z"/>
<path style="fill:#FFFFFF;" d="M253.1,559.1v15.5h-9v-43.9h17.1c3.3,0,6.2,0.6,8.7,1.8c2.5,1.2,4.4,2.9,5.8,5.1
c1.3,2.2,2,4.7,2,7.6c0,4.3-1.5,7.7-4.4,10.2c-2.9,2.5-7,3.7-12.2,3.7H253.1z M253.1,551.8h8.1c2.4,0,4.2-0.6,5.5-1.7
c1.3-1.1,1.9-2.7,1.9-4.8c0-2.2-0.6-3.9-1.9-5.2c-1.3-1.3-3-2-5.2-2h-8.3V551.8z"/>
<path style="fill:#FFFFFF;" d="M292.9,567.3h19.2v7.3h-28.3v-43.9h9V567.3z"/>
</g>
</svg>


</div>
</body>
</html>
Loading

0 comments on commit 2cb175a

Please sign in to comment.