This commit is contained in:
Jiiks 2016-07-22 11:52:05 +03:00
parent 91fcf59656
commit e5d91a8564
12 changed files with 0 additions and 897 deletions

View File

@ -1,368 +0,0 @@
html, body {
margin:0;
padding:0;
background: rgba(34, 35, 42, 0.6);
overflow: hidden;
}
html, body {
width:800px;
height:400px;
}
* {
font-family: Calibri;
color:#E8E8E8;
outline:none;
user-select: none;
-webkit-user-select: none;
cursor: default;
}
#titleBar {
display:flex;
-webkit-app-region: drag;
pointer-events: none;
width:100%;
height:40px;
background:rgba(34, 35, 42, 0.6);
border-bottom:1px solid #000;
box-shadow:0 1px 0 0 #303030;
background: rgba(23, 23, 23, 0.6);
border:none;
box-shadow: none;
}
#titleBar h3 {
color:#FFF;
}
.icon {
display:inline-block;
width:40px;
height:40px;
padding:5px;
}
.icon-image {
background:blue;
height:30px;
width:30px;
}
.title {
display:inline-block;
height:40px;
line-height:40px;
color:#FFF;
}
.main-container {
display:flex;
width:100%;
height:calc(100% - 40px);
}
.sidebar {
width:200px;
height:359px;
border-right:1px solid #000;
box-shadow:1px 0 0 0 #303030;
background:rgba(34, 35, 42, 0.6);
z-index:90001;
margin-top: 1px;
border:none;
margin:0;
box-shadow: none;
margin-left:1px;
}
.sidebar-inner {
width:100%;
height:100%;
padding:5px;
}
.main {
flex-grow:1;
padding:5px;
transform:translateX(0);
}
.panel-container {
position:absolute;
left:10px;
transition: all 0.5s ease-in;
}
.panel {
display:inline-block;
width:590px;
position:absolute;
}
#panel-1 {
left:600px;
}
#panel-2 {
left:1200px;
}
#panel-3 {
left:1800px;
}
#licensetext {
width: 100%;
overflow-y: scroll;
white-space: pre-line;
height:280px;
}
#licenseform {
float:right;
margin-top:5px;
margin-right:10px;
}
input[type='radio'] {
cursor:pointer;
}
label {
cursor:pointer;
}
label, input[type='radio']{
font-size: 16px;
display: inline-block;
margin: 0;
margin-left: 3px;
line-height: 25px;
height: 28px;
vertical-align: top;
}
ul {
margin:0;
padding:0;
list-style:none;
}
li {
list-style:none;
color:gray;
}
li.active {
color:#FFF;
}
li.visited {
color:#EBEBEB;
}
li:before {
content: "";
display:inline-block;
background:gray;
border-radius: 50%;
width: 10px;
height: 10px;
margin-right:3px;
}
li.active:before {
background:dodgerblue;
}
li.visited:before {
background:#00D443;
}
.controls {
position:absolute;
bottom:5px;
right:5px;
}
button {
color:gray;
width:60px;
background:#1b1c23;
border-style:solid;
border-color:#000;
border-width:0 1px 1px 0;
padding:5px;
box-shadow:1px 1px 0 0 #303030 inset;
cursor:pointer;
border: none;
box-shadow: none;
}
button:hover {
color:#FFF;
background:#24262f;
}
button:disabled {
background:#292929;
border-color:#191919;
color:gray;
cursor: not-allowed;
}
button:active {
background: #232b2e;
}
::-webkit-scrollbar-thumb {
background:#282828 !important;
}
::-webkit-scrollbar, ::-webkit-scrollbar-track-piece {
background:#383838 !important;
}
input.path {
width: 450px;
height: 23px;
background: rgb(27, 28, 35) none repeat scroll 0% 0%;
border: 1px solid rgb(17, 17, 17);
box-shadow: -1px -1px 0px 0px rgb(50, 49, 49) inset;
border-width: 1px 0px 0px 1px;
border-style: solid;
border-color: #111;
}
.modal {
position: absolute;
background: rgba(29, 29, 29, 0.71);
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 900000;
}
.modal-container {
background: #212229;
width: 600px;
height: 200px;
position: relative;
margin: auto;
top: 100px;
box-shadow: 0px 0px 5px 5px rgba(0, 0, 0, 0.39);
}
.modal-header {
height: 30px;
line-height: 30px;
background: #212229;
padding-left: 10px;
border-bottom: 1px solid #000;
box-shadow: 0 1px 0 0 #303030;
}
.modal-body {
padding:30px;
}
.modal-footer {
position: absolute;
bottom: 0;
left:0;
right: 0;
height: 35px;
padding-top:10px;
background:#212229;
box-shadow: 0 1px 0 0 #303030 inset;
border-top: 1px solid #000;
}
.modal-footer button {
margin-right:5px;
float: right;
}
.splash {
width:300px !important;
height:100px !important;
}
.splash .wrapper {
top:20px;
width:40px;
margin:auto;
position:relative;
}
.splash .wrapper .spinner {
width:30px;
height:30px;
border-radius:30px;
border-width:5px;
border-color:#121212 #404040 #404040 #404040;
border-style:solid;
animation: spin 0.7s linear infinite;
}
.splash .spinnertext {
position: absolute;
bottom: 0;
width: 100%;
display: block;
text-align: center;
bottom: 10px;
color: rgb(171, 171, 171);
-webkit-animation: spinnertext-opacity 2s linear 0s infinite;
}
@-webkit-keyframes spin {
100% {
transform: rotate(360deg);
}
}
@-webkit-keyframes spinnertext-opacity {
0% {opacity: 0}
20% {opacity: 0}
50% {opacity: 1}
100%{opacity: 0}
}
#log {
padding: 10px;
height:294px;
resize: none;
width: 563px;
background: rgba(42, 44, 55, 0.6);
border: none;
-webkit-user-select: text;
word-wrap: break-word;
white-space: pre-line;
overflow: auto;
}
progress {
position: absolute;
bottom: -36px;
left:0;
width:520px;
height: 27px;
-webkit-appearance:none;
}
progress::-webkit-progress-bar {
background:rgba(42, 44, 55, 0.6);
}
progress[value]::-webkit-progress-value {
background-image: -webkit-linear-gradient(left, rgba(73,155,234,1) 0%, rgba(32,124,229,1) 100%);
}
.border {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
border:1px solid #55BBF7;
}

View File

@ -1,112 +0,0 @@
<html>
<head>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<div class="border"></div>
<div id="titleBar">
<div class="icon">
<div class="icon-image"></div>
</div>
<div class="title">
BetterDiscord Installer - v0.1.1
</div>
</div>
<div class="main-container">
<div class="sidebar">
<div class="sidebar-inner">
<ul>
<li id="li-0" class="navli active">Introduction</li>
<li id="li-1" class="navli">License</li>
<li id="li-2" class="navli">Destination</li>
<li id="li-3" class="navli">Installation</li>
</ul>
</div>
</div>
<div class="main">
<div class="panel-container">
<div class="panel" id="panel-3">
<h2>Welcome to the BetterDiscord setup</h2>
<p>
The setup will install BetterDiscord on your computer.
<br>
Click "Next" to continue or "Cancel" to exit the setup.
</p>
</div>
<div class="panel" id="panel-1">
<div id="licensetext">The MIT License (MIT)
Copyright (c) 2015-2016 Jiiks | Jiiks.net
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.
</div>
<form action="" id="licenseform">
<input type="radio" name="licensegroup" value="Accept" id="accept" disabled="true"><label for="accept">Accept</label>
<input type="radio" name="licensegroup" value="Decline" id="decline" checked="true"><label for="decline">Decline</label>
</form>
</div>
<div class="panel" id="panel-2">
<p>Setup will install BetterDiscord to the following location. Click Install to continue.</p>
<input class="path" id="discordPath" type="text" style="height:26px;" disabled="true" />
<button id="path" style="height:26px;">Browse</button>
<p style="font-size:14px">*If the path is not pointing to the latest version of Discord then click "Browse" and select it
<br>
*Installer will kill Discord process
</p>
<input type="checkbox" name="restart" id="restart" checked="true">
<label for="restart" style="margin:0; line-height: 18px;">Restart Discord after installation</label>
</div>
<div class="panel" id="panel-0">
<div name="log" id="log"></div>
<progress id="logpbar" value="0" max="100"></progress>
</div>
</div>
<div class="controls">
<button id="uninstall" style="display: none;">Uninstall</button>
<button id="back" style="display: none;">Back</button>
<button id="next" style="display: none;">Next</button>
<button id="cancel">Abort</button>
</div>
</div>
</div>
<div class="modal" id="quit" style="display: none;">
<div class="modal-container">
<div class="modal-header">
<span>Exit Setup?</span>
</div>
<div class="modal-body">
Setup is not complete. If you exit now, BetterDiscord will not be installed.
<br>
Exit Setup?
</div>
<div class="modal-footer">
<button id="modal-exit">
Yes
</button>
<button id="modal-cancel">
No
</button>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="js/jquery-2.0.0.min.js"></script>
<script type="text/javascript">
$(window).blur(function(){
$(".border").css("border-color", "#F76455");
});
$(window).focus(function(){
$(".border").css("border-color", "#55BBF7");
});
</script>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,139 +0,0 @@
'use strict';
const ipcRenderer = require('electron').ipcRenderer;
(function() {
var currentPanel = 0;
$("#accept").on("change", function() {
$("#next").prop("disabled", true);
if($(this).prop("checked")) {
$("#next").prop("disabled", false);
}
});
$("#decline").on("change", function() {
$("#next").prop("disabled", true);
if(!$(this).prop("checked")) {
$("#next").prop("disabled", false);
}
});
$("#back").on("click", function(){
currentPanel--;
if(currentPanel <= 0) currentPanel = 0;
switchPanel();
});
$("#next").on("click", function() {
currentPanel++;
if(currentPanel >= 3) currentPanel = 3;
switchPanel();
});
$("#path").on("click", function() {
var p = ipcRenderer.sendSync('sync', 'openDirectory');
if(p != null) {
$("#discordPath").val(p);
}
});
$("#cancel").on("click", quit);
$("#licensetext").on("scroll", function() {
var e = $(this);
if(e.height() + e.scrollTop() >= e[0].scrollHeight) {
$("#accept").prop("disabled", false);
} else {
$("#accept").prop("disabled", true);
$("#decline").prop("checked", true)
$("#next").prop("disabled", true);
}
});
function switchPanel() {
$(".panel-container").css("left", currentPanel*-600+10 + "px");
switch(currentPanel) {
case 0:
$("#back").hide();
$("#next").show();
$("#next").text("Next");
$("#next").prop("disabled", false);
$(".navli").removeClass("active").removeClass("visited");
$("#li-0").addClass("active").removeClass("visited");
$("#li-1").removeClass("active").removeClass("visited");
break;
case 1:
$("#back").show();
$("#next").text("Next");
$("#next").prop("disabled", !$("#accept").prop("checked"));
$("#li-0").addClass("visited").removeClass("active");
$("#li-1").addClass("active").removeClass("visited");
$("#li-2").removeClass("active").removeClass("visited");
break;
case 2:
$("#back").show();
$("#next").show();
$("#next").text("Install");
$("#li-1").addClass("visited").removeClass("active");
$("#li-2").addClass("active").removeClass("visited");
$("#li-3").removeClass("active");
break;
case 3:
$("#li-2").removeClass("active").addClass("visited");
$("#li-3").addClass("active");
break;
}
}
$(".modal").on("click", function(e) {
if(e.target.className != "modal") return;
$(this).hide();
});
$("#modal-cancel").on("click", function() {
$(".modal").hide();
});
$("#modal-exit").on("click", function() {
ipcRenderer.send('sync', 'quit');
});
function quit() {
$("#quit").show();
}
$("#discordPath").val(ipcRenderer.sendSync('sync', '{ "arg": "getInstallPath" }'));
install();
})();
ipcRenderer.on('async-reply', (event, arg) => {
console.log(arg);
switch(arg.arg) {
case "exists":
switch(arg.file) {
case "app.asar":
if(arg.exists) {
appendLog("Located app.asar");
appendLog("Downloading latest BetterDiscord package");
ipcRenderer.send('async', '{"arg": "download", "package": { "host": "https://github.com/", "path": "Jiiks/BetterDiscordApp/archive/stable16.zip" }}');
} else {
appendLog("Unable to locate app.asar. Check your install path.");
}
}
break;
}
});
function install() {
appendLog("Initiating installation");
ipcRenderer.send('async', '{ "arg": "locate-discord" }');
}
function appendLog(text) {
var log = $("#log");
log.append(text+"\n");
var sh = log[0].scrollHeight - 40;
if(log.height() + log.scrollTop() >= sh) {
log.scrollTop(sh);
}
}

View File

@ -1,15 +0,0 @@
'use strict';
const ipcRenderer = require('electron').ipcRenderer;
ipcRenderer.on('async-reply', (event, arg) => {
switch(arg) {
case "update":
$(".spinnertext").text("Downloading Update");
break;
}
});
$(function() {
ipcRenderer.send('async', '{ "arg": "update" }');
});

View File

@ -1,16 +0,0 @@
<html>
<head>
<head>
<link rel="stylesheet" href="css/main.css">
<script type="text/javascript" src="js/jquery-2.0.0.min.js"></script>
<script type="text/javascript" src="js/splash.js"></script>
</head>
</head>
<body class="splash">
<div class="border"></div>
<div class="wrapper">
<div class="spinner"></div>
</div>
<span class="spinnertext">Checking for updates...</span>
</body>
</html>

View File

@ -1,8 +0,0 @@
{
"windows": {
"version": "0.1.1"
},
"osx": {
"version": "0.1.1"
}
}

View File

@ -1,173 +0,0 @@
'use strict';
const utils = require('./utils');
const _utils = new utils.utils();
const electron = require('electron');
const fs = require('fs');
const path = require('path');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const ipcMain = electron.ipcMain;
var mainWindow = null;
var lastKnownVersion = "0.0.291";
var platform = process.platform;
var installPath = getInstallPath();
var dataPath = `${__dirname}/data/`;
var vi = require(`${dataPath}vi.json`);
function getInstallPath() {
switch(platform) {
case "win32":
var hver = "0.0.0";
var path = `${process.env.LOCALAPPDATA}/Discord/app-${lastKnownVersion}/`;
fs.readdirSync(`${process.env.LOCALAPPDATA}/Discord/`).filter(function(file) {
var tpath = `${process.env.LOCALAPPDATA}/Discord/${file}`;
if(fs.statSync(tpath).isDirectory()) return;
if(!file.startsWith("app-")) return;
var ver = file.replace("app-", "");
if(ver < hver) return;
hver = ver;
});
return path;
break;
case "darwin":
return "/Applications/Discord.app";
break;
default:
return "";
break;
}
}
function loadContent(file, width, height, center) {
if(mainWindow == null) {
createMainWindow(file, width, height);
return;
}
mainWindow.setSize(width, height);
if(center) mainWindow.center();
mainWindow.loadURL(`${dataPath}${file}.html`);
}
function createMainWindow(file, width, height) {
mainWindow = new BrowserWindow({
width: width,
height: height,
fullscreenable: false,
maximizable: false,
frame: false,
resizable: true,
alwaysOnTop: true,
transparent: true
});
mainWindow.loadURL(`${dataPath}${file}.html`);
}
function update() {
var promises = [
new Promise((resolve, reject) => {
downloadResource("default", "/Jiiks/BetterDiscordApp/master/Installers/Electron/src/data/index.html", (error, data) => {
if(error) {
error(data);
reject();
return;
}
_utils.log("Succesfully loaded index.html");
resolve();
});
}),
new Promise((resolve, reject) => {
downloadResource("default", "/Jiiks/BetterDiscordApp/master/Installers/Electron/src/data/js/main.js", (error, data) => {
if(error) {
error(data);
reject();
return;
}
_utils.log("Succesfully loaded main.js");
resolve();
});
}),
new Promise((resolve, reject) => {
downloadResource("default", "/Jiiks/BetterDiscordApp/master/Installers/Electron/src/data/css/main.css", (error, data) => {
if(error) {
error(data);
reject();
return;
}
_utils.log("Succesfully loaded main.css");
resolve();
});
})
];
return Promise.all(promises);
}
function checkForUpdates(okCb, errorCb) {
_utils.downloadResource("default", "/Jiiks/BetterDiscordApp/master/Installers/Electron/src/data/vi.json", (error, data) => {
if(error) {
errorCb(data);
return;
}
try {
data = JSON.parse(data);
}catch(err) {
errorCb(err);
return;
}
switch(platform) {
case "win32":
okCb(data.windows.version < vi.windows.version);
break;
case "darwin":
okCb(data.osx.version < vi.osx.version);
break;
}
});
}
ipcMain.on('async', (event, arg) => {
var obj = JSON.parse(arg);
switch(obj.arg) {
case "update":
checkForUpdates((update) => {
if(update) {
event.sender.send('async-reply', "update");
update().then(() => {
_utils.log("Update OK!");
loadContent("index", 800, 400, true);
}, () => {
error("Update Failed!");
});
} else {
loadContent("index", 800, 400, true);
}
}, (err) => {
error(err);
});
break;
}
});
function error(error) {
_utils.log(error);
loadContent("error");
}
app.on('ready', function() {
//loadContent("https://raw.githubusercontent.com/Jiiks/BetterDiscordApp/master/Installers/Electron/src/data/index.html", 800, 400 ,true);
//loadContent("splash", 300, 100, true);
});

View File

@ -1,10 +0,0 @@
{
"name": "Install",
"description": "Better Discord enhances Discord.",
"version": "0.1.1",
"homepage": "https://github.com/Jiiks/BetterDiscordApp",
"license": "MIT",
"devDependencies": {
"electron-prebuilt": "^1.0.0"
}
}

View File

@ -1,45 +0,0 @@
'use strict';
const https = require('https');
const fs = require('fs');
const eol = require('os').EOL;
function utils() {}
var logs = "";
utils.prototype.log = (message) => {
var d = new Date();
var ds = ("00" + (d.getDate() + 1)).slice(-2) + "/" +
("00" + d.getMonth()).slice(-2) + "/" +
d.getFullYear() + " " +
("00" + d.getHours()).slice(-2) + ":" +
("00" + d.getMinutes()).slice(-2) + ":" +
("00" + d.getSeconds()).slice(-2);
console.log(`[${ds}] ${message}`);
logs += `[${ds}] ${message}${eol}`;
}
utils.prototype.saveLogs = () => {
}
utils.prototype.downloadResource = (host, resource, callback) => {
https.get({
host: host == "default" ? "raw.githubusercontent.com" : host,
path: resource,
headers: { 'user-agent': 'Mozilla/5.0' }
},
(response) => {
var data = "";
response.on("data", (chunk) => {
data += chunk;
});
response.on("end", () => {
callback(false, data);
});
response.on("error", (e) => {
callback(true, e);
});
});
}
exports.utils = utils;

View File

@ -1 +0,0 @@
{ "version": "0.0.9" }