This repository has been archived by the owner on Dec 1, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7b017ba
Showing
24 changed files
with
496 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules/ | ||
/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2017 Tristan Lins | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
WhatsApp!Web Desktop Client | ||
=========================== | ||
|
||
An inofficial WhatsApp Desktop Client. | ||
|
||
Installation | ||
------------ | ||
|
||
```bash | ||
$ wget https://github.com/bit3/whatsappweb/releases/download/1.0.0-alpha/whatsappweb_1.0.0-alpha_amd64.snap | ||
$ sudo snap install --devmode whatsappweb_1.0.0-alpha_amd64.snap | ||
$ [/snap/bin/]whatsappweb | ||
``` | ||
|
||
Attribution | ||
----------- | ||
|
||
Icon by Aarthi Padmanabhan, licensed under CC-BY 3.0 | ||
https://www.iconfinder.com/icons/1961289/social_media_icons_whatsapp_icon#size=128 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>WhatsApp!Web</title> | ||
<link href="https://fonts.googleapis.com/css?family=Overpass:100,400" rel="stylesheet"> | ||
<link type="text/css" rel="stylesheet" href="style.css"/> | ||
</head> | ||
<body> | ||
<script> | ||
const {ipcRenderer} = require('electron'); | ||
</script> | ||
|
||
<header> | ||
<h1>WhatsApp!Web</h1> | ||
</header> | ||
|
||
<main> | ||
<p> | ||
This is an inofficial WhatsApp Desktop Client build with <a href="https://electron.atom.io/" target="_blank">Electron</a>. | ||
This software is licensed under the <a href="https://opensource.org/licenses/MIT" target="_blank">MIT license</a>. | ||
</p> | ||
|
||
<blockquote id="license"><script>document.write(ipcRenderer.sendSync('get-license'))</script></blockquote> | ||
|
||
<blockquote id="attribution">The <a href="https://www.iconfinder.com/icons/1961289/social_media_icons_whatsapp_icon#size=128" target="_blank">application icon</a> was created by <a href="https://www.iconfinder.com/Aarthi" target="_blank">Aarthi Padmanabhan</a> and licensed under the <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC-BY 3.0 license</a>.</blockquote> | ||
|
||
<p class="buttons"> | ||
<button>Accept and start</button> | ||
</p> | ||
</main> | ||
|
||
<footer> | ||
WhatsApp!Web Version <em><script>document.write(ipcRenderer.sendSync('determine-version'))</script></em><br/> | ||
Node Version <em><script>document.write(process.versions.node)</script></em><br/> | ||
Chrome Version <em><script>document.write(process.versions.chrome)</script></em><br/> | ||
Electron Version <em><script>document.write(process.versions.electron)</script></em><br/> | ||
</footer> | ||
|
||
<script> | ||
document.querySelector('button').addEventListener('click', () => { | ||
ipcRenderer.send('accept'); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
const {app, BrowserWindow, Menu, MenuItem, Tray, ipcMain, shell} = require('electron'); | ||
const fs = require("fs"); | ||
const settings = require('electron-settings'); | ||
const path = require('path'); | ||
const url = require('url'); | ||
|
||
const SETTINGS_ACCEPTED_VERSIONS = 'acceptedVersions'; | ||
|
||
let icon = path.join(__dirname, 'icon.png'); | ||
let disclaimerWindow, whatsappWindow, tray; | ||
|
||
let menu = Menu.buildFromTemplate([ | ||
{ | ||
label: 'File', | ||
submenu: [ | ||
{ label: 'Quit', click: quit } | ||
] | ||
}, | ||
{ | ||
role: 'window', | ||
submenu: [ | ||
{role: 'minimize'}, | ||
{role: 'close'} | ||
] | ||
}, | ||
]); | ||
|
||
ipcMain.on('get-license', (event) => { | ||
var data = fs.readFileSync(path.join(__dirname, 'LICENSE')); | ||
event.returnValue = data.toString(); | ||
}); | ||
|
||
ipcMain.on('determine-version', (event) => { | ||
event.returnValue = app.getVersion(); | ||
}); | ||
|
||
function createWindow() { | ||
if (whatsappWindow) { | ||
return whatsappWindow; | ||
} | ||
|
||
if (disclaimerWindow) { | ||
return disclaimerWindow; | ||
} | ||
|
||
let acceptedVersions = settings.get(SETTINGS_ACCEPTED_VERSIONS); | ||
|
||
if (!(acceptedVersions instanceof Array)) { | ||
acceptedVersions = []; | ||
} | ||
|
||
let version = app.getVersion(); | ||
|
||
if (-1 !== acceptedVersions.indexOf(version)) { | ||
createWhatsAppWindow(); | ||
return whatsappWindow; | ||
} | ||
|
||
createDisclaimerWindow(); | ||
return disclaimerWindow; | ||
} | ||
|
||
function createDisclaimerWindow() { | ||
disclaimerWindow = new BrowserWindow({ | ||
width: 800, | ||
height: 680, | ||
resizable: false, | ||
autoHideMenuBar: true, | ||
icon: icon | ||
}); | ||
disclaimerWindow.setMenu(menu); | ||
disclaimerWindow.loadURL(url.format({ | ||
pathname: path.join(__dirname, 'index.html'), | ||
protocol: 'file:', | ||
slashes: true | ||
})); | ||
|
||
// Open the DevTools. | ||
//disclaimerWindow.webContents.openDevTools() | ||
|
||
disclaimerWindow.webContents.on('new-window', (event, url) => { | ||
event.preventDefault(); | ||
shell.openExternal(url); | ||
}); | ||
|
||
ipcMain.on('accept', () => { | ||
let acceptedVersions = settings.get(SETTINGS_ACCEPTED_VERSIONS); | ||
|
||
if (!(acceptedVersions instanceof Array)) { | ||
acceptedVersions = []; | ||
} | ||
|
||
acceptedVersions.push(app.getVersion()); | ||
settings.set(SETTINGS_ACCEPTED_VERSIONS, acceptedVersions); | ||
|
||
createWhatsAppWindow(); | ||
disclaimerWindow.close(); | ||
}); | ||
|
||
disclaimerWindow.on('closed', () => { | ||
disclaimerWindow = null; | ||
}); | ||
} | ||
|
||
function createWhatsAppWindow() { | ||
whatsappWindow = new BrowserWindow({ | ||
width: 930, | ||
height: 630, | ||
autoHideMenuBar: true, | ||
icon: icon | ||
}); | ||
whatsappWindow.setMenu(menu); | ||
whatsappWindow.loadURL('https://web.whatsapp.com/'); | ||
|
||
// Open the DevTools. | ||
//whatsappWindow.webContents.openDevTools() | ||
|
||
whatsappWindow.webContents.on('new-window', (event, url) => { | ||
event.preventDefault(); | ||
shell.openExternal(url); | ||
}); | ||
|
||
whatsappWindow.on('minimize',function(event){ | ||
event.preventDefault() | ||
mainWindow.hide(); | ||
}); | ||
|
||
whatsappWindow.on('close', function (event) { | ||
if (!app.isQuiting) { | ||
event.preventDefault() | ||
whatsappWindow.hide(); | ||
} | ||
return false; | ||
}); | ||
|
||
whatsappWindow.on('closed', () => { | ||
whatsappWindow = null; | ||
}); | ||
} | ||
|
||
function createTray() { | ||
|
||
let contextMenu = new Menu(); | ||
contextMenu.append(new MenuItem({ label: 'Show window', click: show })); | ||
contextMenu.append(new MenuItem({ type: 'separator' })); | ||
contextMenu.append(new MenuItem({ label: 'Quit', click: quit })); | ||
|
||
tray = new Tray(icon); | ||
tray.setTitle("WhatsApp"); | ||
tray.setToolTip("WhatsApp"); | ||
|
||
tray.setContextMenu(contextMenu); | ||
|
||
tray.on('click', show); | ||
} | ||
|
||
function show() { | ||
let window = createWindow(); | ||
window.show(); | ||
window.focus(); | ||
} | ||
|
||
function quit() { | ||
app.isQuiting = true; | ||
app.quit(); | ||
} | ||
|
||
app.on('ready', () => { | ||
createTray(); | ||
createWindow(); | ||
}); | ||
|
||
app.on('activate', () => { | ||
// On macOS it's common to re-create a window in the app when the | ||
// dock icon is clicked and there are no other windows open. | ||
if (whatsappWindow === null) { | ||
createWindow(); | ||
} | ||
}) |
Oops, something went wrong.