Merge pull request #2 from Jiiks/master

Update
This commit is contained in:
Alex 2016-10-02 21:15:18 +01:00 committed by GitHub
commit a8534308b7
139 changed files with 10639 additions and 58108 deletions

8
.gitignore vendored
View File

@ -6,4 +6,10 @@ devjs/.idea/devjs.iml
*.xpi
Firefox/data/js/jquery-2.1.4.min.js
*.dev.*
/nbproject/private/
/nbproject/private/
node_modules
.sass-cache
/*.jiiks
Installers/dotNet/bin/
Installers/dotNet/packages/
Installers/dotNet/dlls/

46
Gruntfile.js Normal file
View File

@ -0,0 +1,46 @@
module.exports = function(grunt) {
grunt.initConfig({
sass: {
dist: {
options: {
style: 'expanded'
},
files: {
'dev/css/main.css': 'dev/css/main.sass'
}
}
},
concat: {
js: {
src: 'dev/js/*.js',
dest: 'js/main.js'
},
css: {
src: 'dev/css/*.css',
dest: 'css/main.css'
}
},
uglify: {
options: {
screwIE8: true
},
js: {
files: {
'js/main.min.js': ['js/main.js']
}
}
},
cssmin: {
css: {
src: 'css/main.css',
dest: 'css/main.min.css'
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-css');
grunt.registerTask('default', ['sass', 'concat', 'uglify', 'cssmin']);
};

3
Installers/Electron/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
dist/
pack.bat
run.bat

View File

@ -0,0 +1,20 @@
{
"name": "betterdiscordinstaller",
"description": "Better Discord installer.",
"version": "0.1.1",
"homepage": "https://github.com/Jiiks/BetterDiscordApp",
"license": "MIT",
"main": "index.js",
"dependencies": {
"fs-extra": "^0.30.0",
"readline": "^1.3.0",
"open": "^0.0.5",
"request": "^2.72.0",
"path": "^0.12.7",
"walk": "^2.3.9",
"unzip": "^0.1.11"
},
"devDependencies": {
"electron-prebuilt": "~1.2.8"
}
}

View File

@ -0,0 +1,71 @@
'use strict';
const
fs = require('fs'),
path = require('path'),
walk = require('walk'),
p = require('path');
fs.mkdirPSync = function(dirPath) {
try {
fs.mkdirSync(dirPath);
} catch(err) {
if(err.errno === -4058 || err.errno === -2) {
fs.mkdirPSync(path.dirname(dirPath));
fs.mkdirPSync(dirPath);
} else if(err.errno === -4075) {
return "EXIST";
} else {
return "NOT OK";
}
}
return "OK";
}
class Asar {
constructor(filePath) {
this.path = filePath;
this.files = [];
}
extract(statusCb, progressCb, cb) {
this.walker = walk.walk(this.path, { followLinks: false });
statusCb("Creating Directories");
this.walker.on('file', (root, stat, next) => {
this.files.push(`${root}/${stat.name}`);
try {
fs.statSync(root.replace("app.asar", "app"));
} catch(err) {
fs.mkdirPSync(root.replace("app.asar", "app"));
}
next();
});
this.walker.on('end', () => {
var self = this;
statusCb("Copying files");
var p = 1;
var filecount = this.files.length;
function copy(files, index) {
if(index >= filecount) {
statusCb("Finished extracting app package");
cb(null);
return;
}
setTimeout(() => { self.copyfile(files, index, copy) }, 1);
progressCb(index, filecount);
}
copy(this.files, 0);
});
}
copyfile(files, index, cb) {
fs.writeFileSync(files[index].replace("app.asar", "app"), fs.readFileSync(files[index]));
cb(files, index+1);
}
}
module.exports = Asar;

View File

@ -0,0 +1,650 @@
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src:local('Open Sans'), local('OpenSans'), url('../font/OpenSans-Regular.ttf') format('TrueType');
}
/* latin-ext */
@font-face {
font-family: 'Inconsolata';
font-style: normal;
font-weight: 400;
src: local('Inconsolata'), url('../font/Inconsolata.woff2') format('woff2');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Inconsolata';
font-style: normal;
font-weight: 400;
src: local('Inconsolata'), url('../font/Inconsolata.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
html, body {
margin:0;
padding:0;
background: rgba(34, 35, 42, 1);
overflow: hidden;
}
html, body {
width:800px;
height:400px;
}
* {
font-family: "Open Sans";
color:#E8E8E8;
outline:none;
user-select: none;
-webkit-user-select: none;
cursor: default;
}
a {
cursor: pointer;
color: dodgerblue;
}
#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:358px;
border-right:1px solid #000;
box-shadow:1px 0 0 0 #303030;
background:rgba(44, 45, 56, 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-out;
}
.panel {
display:inline-block;
width:580px;
position:absolute;
transition: all 0.5s ease-in-out;
opacity: 0;
}
.main-container.panel-0 #uninstall {
display: inline-block;
}
.main-container.panel-0 #back {
display: none;
}
.main-container.panel-0 #next {
display: inline-block;
}
.main-container.panel-0 #cancel {
display: inline-block;
}
.main-container.panel-1 #uninstall {
display: none;
}
.main-container.panel-1 #back {
display: inline-block;
}
.main-container.panel-1 #next {
display: inline-block;
}
.main-container.panel-1 #cancel {
display: inline-block;
}
.main-container.panel-2 #uninstall {
display: none;
}
.main-container.panel-2 #back {
display: inline-block;
}
.main-container.panel-2 #next {
display: inline-block;
}
.main-container.panel-2 #cancel {
display: inline-block;
}
.main-container.panel-3 #uninstall {
display: none;
}
.main-container.panel-3 #back {
display: none;
}
.main-container.panel-3 #next {
display: none;
}
.main-container.panel-3 #cancel {
display: inline-block;
}
.main-container.panel-0 #li-0:before {
background:dodgerblue;
}
.main-container.panel-0 #li-1:before {
background:gray;
}
.main-container.panel-0 #li-2:before {
background:gray;
}
.main-container.panel-0 #li-3:before {
background:gray;
}
.main-container.panel-1 #li-0:before {
background:#00D443;
}
.main-container.panel-1 #li-1:before {
background:dodgerblue;
}
.main-container.panel-1 #li-2:before {
background:gray;
}
.main-container.panel-1 #li-3:before {
background:gray;
}
.main-container.panel-2 #li-0:before,
.main-container.panel-advanced #li-0:before {
background:#00D443;
}
.main-container.panel-2 #li-1:before,
.main-container.panel-advanced #li-1:before {
background:#00D443;
}
.main-container.panel-2 #li-2:before,
.main-container.panel-advanced #li-2:before {
background:dodgerblue;
}
.main-container.panel-2 #li-3:before,
.main-container.panel-advanced #li-3:before {
background:gray;
}
.main-container.panel-2 #panel-advanced {
pointer-events: none;
}
.main-container.panel-3 #li-0:before {
background:#00D443;
}
.main-container.panel-3 #li-1:before {
background:#00D443;
}
.main-container.panel-3 #li-2:before {
background:#00D443;
}
.main-container.panel-3 #li-3:before {
background:dodgerblue;
}
.main-container.panel-0 .panel-container {
left: 10px;
}
.main-container.panel-1 .panel-container {
left: -590px;
}
.main-container.panel-2 .panel-container,
.main-container.panel-advanced .panel-container {
left: -1180px;
}
.main-container.panel-3 .panel-container {
left: -1770px;
}
.main-container.panel-0 .panel-container #panel-0 {
opacity: 1;
}
.main-container.panel-0 .panel-container #panel-1 {
opacity: 0;
}
.main-container.panel-0 .panel-container #panel-2 {
opacity: 0;
}
.main-container.panel-0 .panel-container #panel-3 {
opacity: 0;
}
.main-container.panel-1 .panel-container #panel-0 {
opacity: 0;
}
.main-container.panel-1 .panel-container #panel-1 {
opacity: 1;
}
.main-container.panel-1 .panel-container #panel-2 {
opacity: 0;
}
.main-container.panel-1 .panel-container #panel-3 {
opacity: 0;
}
.main-container.panel-2 .panel-container #panel-0 {
opacity: 0;
}
.main-container.panel-2 .panel-container #panel-1 {
opacity: 0;
}
.main-container.panel-2 .panel-container #panel-2 {
opacity: 1;
}
.main-container.panel-2 .panel-container #panel-3 {
opacity: 0;
}
.main-container.panel-3 .panel-container #panel-0 {
opacity: 0;
}
.main-container.panel-3 .panel-container #panel-1 {
opacity: 0;
}
.main-container.panel-3 .panel-container #panel-2 {
opacity: 0;
}
.main-container.panel-3 .panel-container #panel-3 {
opacity: 1;
}
.main-container.panel-advanced .controls button {
display: none;
}
.main-container.panel-advanced #panel-advanced {
pointer-events: initial;
}
.main-container.panel-advanced .panel-container #panel-0 {
opacity: 0;
}
.main-container.panel-advanced .panel-container #panel-1 {
opacity: 0;
}
.main-container.panel-advanced .panel-container #panel-2 {
opacity: 0;
}
.main-container.panel-advanced .panel-container #panel-3 {
opacity: 0;
}
.main-container.panel-advanced .panel-container #panel-advanced {
opacity: 1;
}
.main-container .panel-container #panel-advanced textarea {
background: rgba(33, 34, 41, 0.98);
width: 570px;
height: 140px;
resize: none;
border: 1px solid #000;
outline: 1px solid #303030;
}
.main-container .panel-container #panel-advanced button {
float: right;
margin-right: 10px;
margin-top: 5px;
}
.visible {
opacity: 1;
}
#panel-1 {
left:600px;
}
#panel-2 {
left:1200px;
}
#panel-advanced {
left:1200px;
}
#panel-3 {
left:1775px;
}
#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;
}
.sidebar-inner li:before {
content: "";
display:inline-block;
background:gray;
border-radius: 50%;
width: 10px;
height: 10px;
margin-right:3px;
}
.sidebar-inner li.active:before {
background:dodgerblue;
}
.sidebar-inner 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;
}
button#advanced-settings {
width: 100px;
display: block;
}
::-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: 570px;
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:525px;
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;
pointer-events: none;
}
.warning {
color: red;
font-weight: 700;
}

View File

@ -0,0 +1,36 @@
<html>
<head>
<head>
<link rel="stylesheet" href="css/main.css">
<script type="text/javascript" src="js/jquery-2.0.0.min.js"></script>
</head>
</head>
<body>
<div class="border"></div>
<div id="titleBar">
<div class="icon">
<div class="icon-image"></div>
</div>
<div class="title">
Error!
</div>
</div>
<div>
<div id="log" style="width:680px"></div>
</div>
<div>
<button style="position: absolute;right: 10px;bottom: 6px;">OK</button>
</div>
</body>
<script>
const ipcRenderer = require('electron').ipcRenderer;
$(function() {
ipcRenderer.send('async', '{ "arg": "geterror" }');
});
ipcRenderer.on('async-reply', (event, arg) => {
console.log(event);
console.log(arg);
$("#log").text(arg);
});
</script>
</html>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,153 @@
<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 panel-0">
<div class="sidebar">
<div class="sidebar-inner">
<ul>
<li id="li-0" class="navli">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-0">
<h2>Welcome to the BetterDiscord setup</h2>
<p style="white-space:pre-line">
The setup will install BetterDiscord on your computer.
Click "Next" to continue or "Cancel" to exit the setup.
BetterDiscord is not in any way affiliated with Discord
For support join the <a href="https://betterdiscord.net/discord" target="_blank">official BetterDiscord support channel</a> in Discord
</p>
<p>
<strong class="warning" style="font-size:12px">
Do not contact Discord support about BetterDiscord issues!
<br>
If Discord breaks, ask in the BetterDiscord support channel!
</strong>
</p>
<input name="cd" id="cd" type="checkbox">
<label style="margin:0; line-height: 18px;" for="cd">I will not contact Discord support about BetterDiscord issues</label>
</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 style="font-size: 12px;">Setup will install BetterDiscord to the following location:</p>
<input class="path" id="libpath" type="text" style="height:26px;" disabled="true" />
<button id="libpathbtn" style="height:26px;">Browse</button>
<p style="font-size:12px">
*If you wish to install somewhere else then click "Browse" and select your path
</p>
<label for="discordPath" style="display:block; margin-top: 10px; font-size: 12px;">Discord Path:</label>
<input class="path" id="discordPath" type="text" style="height:26px;" disabled="true" />
<button id="path" style="height:26px;">Browse</button>
<p style="font-size:12px">
*If the path is not pointing to the latest version of Discord then click "Browse" and select it
<br>
*If you want to install to ptb/canary then click "Browse" and select it
<br>
*Installer will kill Discord process
</p>
<div class="checkboxGroup">
<input type="checkbox" name="demotes" id="demotes">
<label for="demotes" style="margin:0; line-height: 18px;">Disable emotes completely</label>
</div>
<div class="checkboxGroup">
<input type="checkbox" name="restart" id="restart" checked="true">
<label for="restart" style="margin:0; line-height: 18px;">Restart Discord after installation</label>
</div>
<button id="advanced-settings">Advanced</button>
</div>
<div class="panel" id="panel-advanced">
<span>Advanced settings</span> - <span class="warning">For advanced users only!</span>
<ul>
<li><input type="checkbox" name="aaot" id="aaot"><label for="aaot">Discord window always on top</label></li>
<li><input type="checkbox" name="aframeless" id="aframeless" checked><label for="aframeless">Frameless Discord window</label></li>
<li><input type="checkbox" name="atransparent" id="atransparent"><label for="atransparent">Transparent Discord window</label></li>
<li><input type="checkbox" name="athickframe" id="athickframe"><label for="athickframe">Thick Frame</label></li>
<li><input type="checkbox" name="aprefs" id="aprefs"><label for="aprefs">Use custom Web Preferences:</label></li>
</ul>
<textarea name="" id="" cols="30" rows="10"></textarea>
<button id="advanced-close">Save</button>
</div>
<div class="panel" id="panel-3">
<div name="log" id="log"></div>
<progress id="logpbar" value="0" max="100"></progress>
</div>
</div>
<div class="controls">
<button id="uninstall">Uninstall</button>
<button id="back">Back</button>
<button id="next" >Next</button>
<button id="cancel">Cancel</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" src="js/main.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

@ -0,0 +1,202 @@
'use strict';
const ipcRenderer = require('electron').ipcRenderer;
var config = {
urls: {
package: "https://github.com/Jiiks/BetterDiscordApp/archive/stable16.zip",
finish: "https://betterdiscord.net/installed"
},
discord: {
lastKnownVersion: "0.0.291"
},
import: "BetterDiscordApp-stable16",
cache: [
"emotes_bttv.json",
"emotes_bttv_2.json",
"emotes_ffz.json",
"emotes_twitch_global.json",
"emotes_twitch_subscriber.json",
"user.json"
]
};
(function() {
//Pass latest config to core application
ipcSendAsync("config", config);
//Get Discord installation path
ipcSendAsync("get", "discordpath" );
//Get BetterDiscord installation path
ipcSendAsync("get", "libpath");
})();
//Listeners
(function() {
$("#cd").on("change", () => {
$("#next").prop("disabled", !$("#cd").prop("checked"));
});
var currentPanel = 0;
function switchPanel() {
var container = $(".panel-container");
var main = $(".main-container");
main.removeClass();
main.addClass(`main-container panel-${currentPanel}`)
switch(currentPanel) {
case 0:
$("#next").text("Next");
//$("#next").prop("disabled", !$("#cd").prop("checked"));
break;
case 1:
$("#next").text("Next");
//$("#next").prop("disabled", !$("#accept").prop("checked"));
break;
case 2:
$("#next").text("Install");
$("#cancel").text("Cancel");
break;
case 3:
$("#cancel").text("Abort");
ipcSendAsync("install");
break;
}
}
$("#next").on("click", function() {
currentPanel++;
switchPanel();
});
$("#back").on("click", function() {
currentPanel--;
switchPanel();
});
$("#cancel").on("click", function() {
$("#quit").show();
});
$("#uninstall").on("click", function() {
});
$("#accept").on("change", function() {
// $("#next").prop("disabled", !$(this).prop("checked"));
});
$("#decline").on("change", function() {
// $("#next").prop("disabled", $(this).prop("checked"));
});
$("#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);
}
});
$(".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("async", {arg: "quit", data: []});
});
$("#path").on("click", () => {
ipcRenderer.send("async", { arg: "browsedialog", data: "discordpath" });
});
$("#libpathbtn").on("click", () => {
ipcRenderer.send("async", { arg: "browsedialog", data: "libpath" });
});
$("#advanced-settings").on("click", function() {
currentPanel = "advanced";
switchPanel();
});
$("#advanced-close").on("click", function() {
var main = $(".main-container");
currentPanel = 2;
switchPanel();
});
})();
ipcRenderer.on("async-reply", (event, arg) => {
var data = arg.data;
arg = arg.arg;
switch(arg) {
case "discordpath":
$("#discordPath").val(data);
break;
case "libpath":
$("#libpath").val(data);
break;
}
});
/*ipcRenderer.on('async-reply', (event, arg) => {
switch(arg.arg) {
case "exists":
switch(arg.file) {
case "install":
if(arg.exists) {
appendLog("Located app package");
appendLog("Downloading latest BetterDiscord package");
ipcRenderer.send('async', '{"arg": "download", "package": "https://github.com/Jiiks/BetterDiscordApp/archive/stable16.zip" }');
} else {
appendLog("Unable to locate app.asar. Check your install path.");
}
}
break;
case "discordpath":
$("#discordPath").val(arg.path);
break;
case "locate-app.asar":
appendLog(arg.data);
break;
}
});*/
function ipcSendAsync(arg, data) {
ipcRenderer.send("async", { arg: arg, data: data });
}
function install() {
appendLog("Initiating installation");
appendLog("Locating Discord package");
ipcRenderer.send('async', { "arg": "install" });
}
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);
}
}
function updatePbar(cur, max) {
var pbar = $("#logpbar");
pbar.val(cur);
pbar.prop("max", max);
}

View File

@ -0,0 +1,15 @@
'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

@ -0,0 +1,16 @@
<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

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

View File

@ -0,0 +1,45 @@
'use strict';
var devMode = false;
const
electron = require('electron'),
app = electron.app,
BrowserWindow = electron.BrowserWindow,
ipcMain = electron.ipcMain,
utils = require('./utils'),
_utils = new utils();
var
mainWindow,
windowOptions = {
width: 300,
height: 100,
fullscreenable: false,
maximizable: false,
frame: false,
resizable: devMode ? true : false,
alwaysOnTop: devMode ? true : false,
transparent: false
};
class Index {
constructor() {
app.on("ready", () => this.appReady());
}
appReady() {
mainWindow = new BrowserWindow(windowOptions);
this.loadInstaller();
}
loadInstaller() {
this.installer = require('./installer_index');
this.installerInstance = new this.installer(app, mainWindow, ipcMain, _utils);
}
}
module.exports = new Index();

View File

@ -0,0 +1,269 @@
'use strict';
//Imports
const
path = require('path'),
dialog = require('electron').dialog,
fs = require("fs"),
fse = require("fs-extra"),
request = require('request'),
unzip = require('unzip'),
readline = require('readline'),
asar = require('./asar');
const platform = (process.platform !== "win32" && process.platform !== "darwin") ? "linux" : process.platform;
var
config = {
urls: {
package: "https://github.com/Jiiks/BetterDiscordApp/archive/stable16.zip",
finish: "https://betterdiscord.net/installed"
},
discord: {
lastKnownVersion: "0.0.292"
},
import: "BetterDiscordApp-stable16",
cache: [
"emotes_bttv.json",
"emotes_bttv_2.json",
"emotes_ffz.json",
"emotes_twitch_global.json",
"emotes_twitch_subscriber.json",
"user.json"
],
paths: {
installPath: "",
libPath: ""
}
};
class Installer {
constructor(app, mainWindow, ipc, utils) {
this.app = app;
this.utils = utils;
this.initConfig();
mainWindow.setSize(800, 400);
mainWindow.center();
mainWindow.loadURL(`file://${__dirname}/data/index.html`);
this.webContents = mainWindow.webContents;
ipc.on('async', (event, arg) => this.receiveAsync(event, arg));
}
initConfig() {
config.paths.installPath = path.normalize(this.utils.installPath(config.discord.lastKnownVersion));
config.paths.libPath = path.normalize(this.utils.libPath());
}
install() {
this.utils.log("Config: " + JSON.stringify(config));
this.appendLog("Initializing");
this.locateAppPackage();
}
locateAppPackage() {
var p = path.normalize(`${config.paths.installPath}/resources`);
var pkg = fs.readdirSync(p).filter(file => {
if(file === "app.asar") {
return true;
}
});
if(pkg.length <= 0) {
//App package not found
this.appendLog("Unable to locate app package, check the logs for errors");
return;
}
this.appendLog("Located app package");
this.downloadBd();
//this.extractAppPackage();
}
downloadBd() {
var self = this;
this.appendLog("Downloading BetterDiscord");
var error = false;
var size = 0;
var downloaded = 0;
var req = request({
method: 'GET',
uri: config.urls.package
});
req.pipe(unzip.Extract({ path: path.normalize(config.paths.libPath) }));
req.on('data', chunk => {
downloaded += chunk.length;
this.updatePb(downloaded, size);
});
req.on('response', data => {
size = data.headers['content-length'];
});
req.on('error', err => {
error = true;
self.utils.log(err);
self.appendLog("Failed to download BetterDiscord package, check the logs for errors");
});
req.on('end', () => {
console.log("got here?");
if(error) {
self.appendLog("Failed to download BetterDiscord package, check the logs for errors");
} else {
self.extractAppPackage();
}
});
}
extractAppPackage() {
var self = this;
try {
if(fs.existsSync(`${config.paths.installPath}/resources/app`)) {
self.appendLog("Deleting old app directory");
setTimeout(() => {
fse.removeSync(`${config.paths.installPath}/resources/app`);
extract();
}, 500);
} else {
extract();
}
} catch(err) {
self.appendLog("Could not delete old app directory, check the logs for errors");
return;
}
function extract() {
try {
self.appendLog("Extracting app package");
var a = new asar(`${config.paths.installPath}/resources/app.asar`);
a.extract(msg => {
self.appendLog(msg);
}, (curIndex, total) => {
self.updatePb(curIndex, total);
}, err => {
if(err === null) {
self.inject();
} else {
self.log(err);
self.appendLog("Failed to extract app package, check the logs for errors");
self.clean();
}
});
}catch(err) {
console.log(err);
}
}
}
inject() {
var self = this;
this.updatePb(0, 5);
this.appendLog("Injecting loader");
var lines = [];
var lr = readline.createInterface({
input: fs.createReadStream(`${config.paths.installPath}/resources/app/app/index.js`)
});
lr.on('line', line => {
lines.push(line);
if(line.indexOf("'use strict';") > -1) {
lines.push(path.normalize(`var _betterDiscord = require('${config.paths.libPath}/${config.import}');`).replace(/\\/g,"/"));
lines.push("var _betterDiscord2;");
}
if(line.indexOf("mainWindow = new BrowserWindow(mainWindowOptions);") > -1) {
lines.push(` _betterDiscord2 = new _betterDiscord.BetterDiscord(mainWindow, false);`);
}
});
lr.on('close', () => {
fs.writeFileSync(`${config.paths.installPath}/resources/app/app/index.js`, lines.join('\n'));
self.appendLog("Finished installing BetterDiscord");
self.updatePb(5, 5);
});
}
clean() {
this.appendLog("Cleaning installation");
try {
if(fs.existsSync(`${config.paths.installPath}/resources/app`)) {
self.appendLog("Deleting app directory");
setTimeout(() => {
fse.removeSync(`${config.paths.installPath}/resources/app`);
}, 500);
}
} catch(err) {
self.appendLog("Could not delete old app directory, check the logs for errors");
}
}
appendLog(msg) {
this.utils.log(msg);
this.webContents.executeJavaScript(`appendLog("${msg}");`);
}
updatePb(cur, max) {
this.webContents.executeJavaScript(`updatePbar(${cur}, ${max});`);
}
getData(e) {
switch(e) {
case "discordpath":
return config.paths.installPath;
case "libpath":
return config.paths.libPath;
}
}
receiveAsync(event, arg) {
var data = arg.data || '';
arg = arg.arg;
switch(arg) {
case "get":
this.replyAsync(event, data, this.getData(data));
break;
case "browsedialog":
var path = dialog.showOpenDialog({ properties: ['openDirectory'] });
switch(data) {
case "discordpath":
path = path === undefined ? config.paths.installPath : path[0];
config.paths.installPath = path;
break;
case "libpath":
path = path === undefined ? config.paths.libPath : path[0];
config.paths.libPath = path;
break;
}
this.replyAsync(event, data, path);
break;
case "install":
this.install();
break;
case "quit":
this.app.quit();
break;
}
}
replyAsync(event, arg, data) {
event.sender.send('async-reply', { "arg": arg, "data": data });
}
}
module.exports = Installer;

View File

@ -0,0 +1,10 @@
{
"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

@ -0,0 +1,75 @@
'use strict';
class Updater {
constructor(utils) {
this.utils = utils;
}
update() {
var self = this;
var promises = [
new Promise((resolve, reject) => {
downloadResource("/Jiiks/BetterDiscordApp/master/Installers/Electron/src/data/index.html", (error, data)
if(error) {
error(data, true);
reject();
return;
}
self.utils.log("Succesfully loaded index.html");
resolve();
});
}),
new Promise((resolve, reject) => {
downloadResource("/Jiiks/BetterDiscordApp/master/Installers/Electron/src/data/js/main.js", (error, data)
if(error) {
error(data, true);
reject();
return;
}
self.utils.log("Succesfully loaded main.js");
resolve();
});
}),
new Promise((resolve, reject) => {
downloadResource("/Jiiks/BetterDiscordApp/master/Installers/Electron/src/data/css/main.css", (error, dat
if(error) {
error(data, true);
reject();
return;
}
self.utils.log("Succesfully loaded main.css");
resolve();
});
})
];
return Promise.all(promises);
}
checkForUpdates(okCb, errorCb) {
_utils.downloadResource("/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;
}
});
}
}
module.exports = Updater;

View File

@ -0,0 +1,94 @@
'use strict';
const
https = require('https'),
fs = require('fs'),
eol = require('os').EOL,
platform = (process.platform !== "win32" && process.platform !== "darwin") ? "linux" : process.platform;
class Utils {
constructor() {
this.logs = "";
}
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}`);
this.logs += `[${ds}] ${message}${eol}`;
this.saveLogs();
}
printLogs() {
console.log(this.logs);
}
saveLogs() {
fs.writeFileSync("logs.log", this.logs);
}
downloadResource(resource, callback, host) {
https.get({
host: host || "raw.githubusercontent.com",
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);
});
}).on('error', (e) => {
callback(true, e);
});
}
installPath(lastKnownVersion) {
return {
"win32": () => {
var hver = lastKnownVersion;
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;
path = tpath;
});
return path;
},
"darwin": () => "/Applications/Discord.app",
"linux": () => "" // TODO
}[platform]();
}
libPath() {
return {
"win32": () => {
return `${process.env.APPDATA}/BetterDiscord/lib`;
},
"linux": () => {
return ""; // TODO
}
}[platform]();
}
}
module.exports = Utils;

496
NodeInstaller/index.js → Installers/Node/index.js Executable file → Normal file
View File

@ -1,248 +1,248 @@
/*
* BetterDiscordApp Installer v0.3.2
*/
var dver = "0.0.284";
var asar = require('asar');
var wrench = require('wrench');
var fs = require('fs');
var readline = require('readline');
var util = require('util');
var _importSplice;
var _functionSplice;
var _functionCallSplice;
var _discordPath;
var _appFolder = "/app";
var _appArchive = "/app.asar";
var _packageJson = _appFolder + "/package.json";
var _index = _appFolder + "/app/index.js";
var _force = false;
// Get Arguments
process.argv.forEach(function (val, index, array) {
if (val == "--force") {
_force = true;
}
if (val == "-d" || val == "--directory") {
_discordPath = array[(index+1)]
}
});
function install() {
if (typeof _discordPath == 'undefined') {
var _os = process.platform;
if (_os == "win32") {
_importSplice = 89;
_functionCallSplice = 497;
_functionSplice = 601;
_discordPath = process.env.LOCALAPPDATA + "/Discord/app-"+dver+"/resources";
} else if (_os == "darwin") {
_importSplice = 67;
_functionCallSplice = 446;
_functionSplice = 547;
_discordPath = "/Applications/Discord.app/Contents/Resources" // Defaults to Applications directory
}
}
console.log("Looking for discord resources at: " + _discordPath);
fs.exists(_discordPath, function(exists) {
if(exists) {
console.log("Discord resources found at: " + _discordPath + "\nLooking for app folder");
if(fs.existsSync(_discordPath + _appFolder)) {
console.log("Deleting " + _discordPath + _appFolder + " folder.");
wrench.rmdirSyncRecursive(_discordPath + _appFolder);
console.log("Deleted " + _discordPath + _appFolder + " folder.");
}
if(fs.existsSync(_discordPath + "/node_modules/BetterDiscord")) {
console.log("Deleting " + _discordPath + "/node_modules/BetterDiscord" + " folder.");
wrench.rmdirSyncRecursive(_discordPath + "/node_modules/BetterDiscord");
console.log("Deleted " + _discordPath + "/node_modules/BetterDiscord" + " folder.");
}
console.log("Looking for app archive");
if(fs.existsSync(_discordPath + _appArchive)) {
console.log("App archive found at: " + _discordPath + _appArchive);
} else {
console.log("Failed to locate app archive at: " + _discordPath + _appArchive);
process.exit();
}
console.log("Extracting app archive");
asar.extractAll(_discordPath + _appArchive, _discordPath + _appFolder);
console.log("Copying BetterDiscord");
fs.mkdirSync(_discordPath + "/node_modules/BetterDiscord");
wrench.copyDirSyncRecursive(__dirname + "/BetterDiscord/", _discordPath + _appFolder + "/node_modules/BetterDiscord/", {forceDelete: true});
if(!fs.existsSync("splice")) {
console.log("Missing splice file");
process.exit();
}
var splice = fs.readFileSync("splice");
fs.exists(_discordPath + _appFolder, function(exists) {
if(exists) {
console.log("Extracted to: " + _discordPath + _appFolder);
console.log("Injecting index.js");
var data = fs.readFileSync(_discordPath + _index).toString().split("\n");
data.splice(_importSplice, 0, 'var _betterDiscord = require(\'betterdiscord\');\n');
data.splice(_functionCallSplice, 0, splice);
fs.writeFile(_discordPath + _index, data.join("\n"), function(err) {
if(err) return console.log(err);
console.log("Injected index.js");
console.log("Deleting old cache files");
var counter = 0;
var _prefsPath = '/Library/Preferences/BetterDiscord/';
var emotes_twitch_global = 'emotes_twitch_global.json';
fs.exists(process.env.HOME + _prefsPath + emotes_twitch_global, (exists) => {
if (exists) {
console.log("Deleting " + emotes_twitch_global);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_twitch_global, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_twitch_global);
}
counter++;
finished();
});
var emotes_twitch_subscriber = 'emotes_twitch_subscriber.json';
fs.exists(process.env.HOME + _prefsPath + emotes_twitch_subscriber, (exists) => {
if (exists) {
console.log("Deleting " + emotes_twitch_subscriber);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_twitch_subscriber, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_twitch_subscriber);
}
counter++;
finished();
});
var emotes_bttv = 'emotes_bttv.json';
fs.exists(process.env.HOME + _prefsPath + emotes_bttv, (exists) => {
if (exists) {
console.log("Deleting " + emotes_bttv);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_bttv, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_bttv);
}
counter++;
finished();
});
var emotes_bttv_2 = "emotes_bttv_2.json";
fs.exists(process.env.HOME + _prefsPath + emotes_bttv_2, (exists) => {
if (exists) {
console.log("Deleting " + emotes_bttv_2);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_bttv_2, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_bttv_2);
}
counter++;
finished();
});
var emotes_ffz = "emotes_ffz.json";
fs.exists(process.env.HOME + _prefsPath + emotes_ffz, (exists) => {
if (exists) {
console.log("Deleting " + emotes_ffz);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_ffz, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_ffz);
}
counter++;
finished();
});
var user_pref = "user.json";
fs.exists(process.env.HOME + _prefsPath + user_pref, (exists) => {
if (exists) {
console.log("Deleting " + user_pref);
fs.unlinkSync(process.env.HOME + _prefsPath + user_pref, (err) => {
if(err) throw err;
});
console.log("Deleted " + user_pref);
}
counter++;
finished();
});
function finished() {
if(counter => 6) {
console.log("Looks like we're done here");
process.exit();
}
}
});
} else {
console.log("Something went wrong. Please try again.");
process.exit();
}
});
} else {
console.log("Discord resources not found at: " + _discordPath);
process.exit();
}
});
}
function init() {
console.log("BetterDiscord Simple Installer v0.3 for Discord "+dver+" by Jiiks.");
console.log("If Discord has updated then download the latest installer.");
var rl = readline.createInterface({ input: process.stdin, output: process.stdout });
if (_force == false) {
rl.question("The following directories will be deleted if they exists: discorpath/app, discordpath/node_modules/BetterDiscord, is this ok? Y/N", function(answer) {
var alc = answer.toLowerCase();
switch(alc) {
case "y":
install();
break;
case "yes":
install();
break;
case "n":
process.exit();
break;
case "no":
process.exit();
break;
}
});
} else {
install();
}
}
init();
/*
* BetterDiscordApp Installer v0.3.2
*/
var dver = "0.0.284";
var asar = require('asar');
var wrench = require('wrench');
var fs = require('fs');
var readline = require('readline');
var util = require('util');
var _importSplice;
var _functionSplice;
var _functionCallSplice;
var _discordPath;
var _appFolder = "/app";
var _appArchive = "/app.asar";
var _packageJson = _appFolder + "/package.json";
var _index = _appFolder + "/app/index.js";
var _force = false;
// Get Arguments
process.argv.forEach(function (val, index, array) {
if (val == "--force") {
_force = true;
}
if (val == "-d" || val == "--directory") {
_discordPath = array[(index+1)]
}
});
function install() {
if (typeof _discordPath == 'undefined') {
var _os = process.platform;
if (_os == "win32") {
_importSplice = 89;
_functionCallSplice = 497;
_functionSplice = 601;
_discordPath = process.env.LOCALAPPDATA + "/Discord/app-"+dver+"/resources";
} else if (_os == "darwin") {
_importSplice = 67;
_functionCallSplice = 446;
_functionSplice = 547;
_discordPath = "/Applications/Discord.app/Contents/Resources" // Defaults to Applications directory
}
}
console.log("Looking for discord resources at: " + _discordPath);
fs.exists(_discordPath, function(exists) {
if(exists) {
console.log("Discord resources found at: " + _discordPath + "\nLooking for app folder");
if(fs.existsSync(_discordPath + _appFolder)) {
console.log("Deleting " + _discordPath + _appFolder + " folder.");
wrench.rmdirSyncRecursive(_discordPath + _appFolder);
console.log("Deleted " + _discordPath + _appFolder + " folder.");
}
if(fs.existsSync(_discordPath + "/node_modules/BetterDiscord")) {
console.log("Deleting " + _discordPath + "/node_modules/BetterDiscord" + " folder.");
wrench.rmdirSyncRecursive(_discordPath + "/node_modules/BetterDiscord");
console.log("Deleted " + _discordPath + "/node_modules/BetterDiscord" + " folder.");
}
console.log("Looking for app archive");
if(fs.existsSync(_discordPath + _appArchive)) {
console.log("App archive found at: " + _discordPath + _appArchive);
} else {
console.log("Failed to locate app archive at: " + _discordPath + _appArchive);
process.exit();
}
console.log("Extracting app archive");
asar.extractAll(_discordPath + _appArchive, _discordPath + _appFolder);
console.log("Copying BetterDiscord");
fs.mkdirSync(_discordPath + "/node_modules/BetterDiscord");
wrench.copyDirSyncRecursive(__dirname + "/BetterDiscord/", _discordPath + _appFolder + "/node_modules/BetterDiscord/", {forceDelete: true});
if(!fs.existsSync("splice")) {
console.log("Missing splice file");
process.exit();
}
var splice = fs.readFileSync("splice");
fs.exists(_discordPath + _appFolder, function(exists) {
if(exists) {
console.log("Extracted to: " + _discordPath + _appFolder);
console.log("Injecting index.js");
var data = fs.readFileSync(_discordPath + _index).toString().split("\n");
data.splice(_importSplice, 0, 'var _betterDiscord = require(\'betterdiscord\');\n');
data.splice(_functionCallSplice, 0, splice);
fs.writeFile(_discordPath + _index, data.join("\n"), function(err) {
if(err) return console.log(err);
console.log("Injected index.js");
console.log("Deleting old cache files");
var counter = 0;
var _prefsPath = '/Library/Preferences/BetterDiscord/';
var emotes_twitch_global = 'emotes_twitch_global.json';
fs.exists(process.env.HOME + _prefsPath + emotes_twitch_global, (exists) => {
if (exists) {
console.log("Deleting " + emotes_twitch_global);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_twitch_global, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_twitch_global);
}
counter++;
finished();
});
var emotes_twitch_subscriber = 'emotes_twitch_subscriber.json';
fs.exists(process.env.HOME + _prefsPath + emotes_twitch_subscriber, (exists) => {
if (exists) {
console.log("Deleting " + emotes_twitch_subscriber);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_twitch_subscriber, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_twitch_subscriber);
}
counter++;
finished();
});
var emotes_bttv = 'emotes_bttv.json';
fs.exists(process.env.HOME + _prefsPath + emotes_bttv, (exists) => {
if (exists) {
console.log("Deleting " + emotes_bttv);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_bttv, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_bttv);
}
counter++;
finished();
});
var emotes_bttv_2 = "emotes_bttv_2.json";
fs.exists(process.env.HOME + _prefsPath + emotes_bttv_2, (exists) => {
if (exists) {
console.log("Deleting " + emotes_bttv_2);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_bttv_2, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_bttv_2);
}
counter++;
finished();
});
var emotes_ffz = "emotes_ffz.json";
fs.exists(process.env.HOME + _prefsPath + emotes_ffz, (exists) => {
if (exists) {
console.log("Deleting " + emotes_ffz);
fs.unlinkSync(process.env.HOME + _prefsPath + emotes_ffz, (err) => {
if(err) throw err;
});
console.log("Deleted " + emotes_ffz);
}
counter++;
finished();
});
var user_pref = "user.json";
fs.exists(process.env.HOME + _prefsPath + user_pref, (exists) => {
if (exists) {
console.log("Deleting " + user_pref);
fs.unlinkSync(process.env.HOME + _prefsPath + user_pref, (err) => {
if(err) throw err;
});
console.log("Deleted " + user_pref);
}
counter++;
finished();
});
function finished() {
if(counter => 6) {
console.log("Looks like we're done here");
process.exit();
}
}
});
} else {
console.log("Something went wrong. Please try again.");
process.exit();
}
});
} else {
console.log("Discord resources not found at: " + _discordPath);
process.exit();
}
});
}
function init() {
console.log("BetterDiscord Simple Installer v0.3 for Discord "+dver+" by Jiiks.");
console.log("If Discord has updated then download the latest installer.");
var rl = readline.createInterface({ input: process.stdin, output: process.stdout });
if (_force == false) {
rl.question("The following directories will be deleted if they exists: discorpath/app, discordpath/node_modules/BetterDiscord, is this ok? Y/N", function(answer) {
var alc = answer.toLowerCase();
switch(alc) {
case "y":
install();
break;
case "yes":
install();
break;
case "n":
process.exit();
break;
case "no":
process.exit();
break;
}
});
} else {
install();
}
}
init();

View File

View File

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 170 KiB

View File

@ -41,7 +41,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="asardotnet">
<HintPath>..\dlls\asardotnet.dll</HintPath>
<HintPath>..\..\..\..\WindowsInstaller\asardotnet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -144,6 +144,7 @@
<None Include="Resources\bd_logo_large_nobg.png" />
</ItemGroup>
<ItemGroup>
<Content Include="BetterDiscord-icon.ico" />
<Content Include="Resources\BetterDiscord-icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@ -4,35 +4,30 @@ using System.Windows.Forms;
using System.Xml;
using BetterDiscordWI.panels;
namespace BetterDiscordWI
{
public partial class FormMain : Form
{
namespace BetterDiscordWI {
public partial class FormMain : Form {
private readonly IPanel[] _panels = { new Panel0(), new Panel1(), new Panel2() };
private int _index;
public String DiscordPath;
public Boolean RestartDiscord = false;
public String Sha;
public Boolean finished = false;
public string DiscordPath;
public bool RestartDiscord = false;
public string Sha;
public bool Finished = false;
public XmlNodeList ResourceList;
public FormMain()
{
public FormMain() {
InitializeComponent();
Sha = Utils.GetHash();
if (Sha.Length < 1)
{
MessageBox.Show("Failed to get sha", "Error", MessageBoxButtons.OK);
if (Sha.Length < 1) {
MessageBox.Show(@"Failed to get sha", @"Error", MessageBoxButtons.OK);
Environment.Exit(0);
}
foreach (IPanel ipanel in _panels)
{
foreach (IPanel ipanel in _panels) {
panelContainer.Controls.Add((UserControl)ipanel);
((UserControl)ipanel).Dock = DockStyle.Fill;
((UserControl)ipanel).Hide();
@ -40,48 +35,35 @@ namespace BetterDiscordWI
((UserControl)_panels[_index]).Show();
_panels[_index].SetVisible();
btnCancel.Click += (sender, args) => Close();
btnNext.Click += (sender, args) => _panels[_index].BtnNext();
btnBack.Click += (sender, args) => _panels[_index].BtnPrev();
}
public void SwitchPanel(int index)
{
public void SwitchPanel(int index) {
((UserControl)_panels[_index]).Hide();
_index = index;
((UserControl)_panels[_index]).Show();
_panels[_index].SetVisible();
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
if (!finished)
{
DialogResult dr =
MessageBox.Show(
"Setup is not complete. If you exit now, BetterDiscord will not be installed.\n\nExit Setup?",
"Exit Setup?", MessageBoxButtons.YesNo);
if (dr == DialogResult.No)
{
e.Cancel = true;
}
protected override void OnFormClosing(FormClosingEventArgs e) {
if (Finished) return;
DialogResult dr = MessageBox.Show(@"Setup is not complete. If you exit now, BetterDiscord will not be installed. Exit Setup?", @"Exit Setup?", MessageBoxButtons.YesNo);
if (dr == DialogResult.No) {
e.Cancel = true;
}
}
readonly Pen borderPen = new Pen(Color.FromArgb(160,160,160));
protected override void OnPaint(PaintEventArgs e)
{
readonly Pen _borderPen = new Pen(Color.FromArgb(160, 160, 160));
protected override void OnPaint(PaintEventArgs e) {
Graphics g = e.Graphics;
g.FillRectangle(SystemBrushes.Window, new Rectangle(0,0, Width, 50) );
g.DrawLine(borderPen, 0, 50, Width, 50);
g.FillRectangle(SystemBrushes.Window, new Rectangle(0, 0, Width, 50));
g.DrawLine(_borderPen, 0, 50, Width, 50);
g.DrawLine(SystemPens.Window, 0, 51, Width, 51);
g.DrawLine(borderPen, 0, 310, Width, 310);
g.DrawLine(_borderPen, 0, 310, Width, 310);
g.DrawLine(SystemPens.Window, 0, 311, Width, 311);
base.OnPaint(e);
}

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BetterDiscordWI

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.6.0")]
[assembly: AssemblyFileVersion("0.2.6.0")]
[assembly: AssemblyVersion("0.2.8.0")]
[assembly: AssemblyFileVersion("0.2.8.0")]

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -1,29 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BetterDiscordWI
{
class Utils
{
public void StartDownload(ProgressBar pb, String url, String name)
public void StartDownload(ProgressBar pb, string url, string name)
{
Thread t = new Thread(() =>
{
WebClient webClient = new WebClient();
webClient.Headers["User-Agent"] = "Mozilla/5.0";
WebClient webClient = new WebClient {Headers = {["User-Agent"] = "Mozilla/5.0"}};
webClient.DownloadProgressChanged += delegate(object sender, DownloadProgressChangedEventArgs args)
{
double percentage = (double.Parse(args.BytesReceived.ToString()) /double.Parse(args.TotalBytesToReceive.ToString())) * 100;
@ -43,18 +32,15 @@ namespace BetterDiscordWI
t.Start();
}
public static String GetHash()
public static string GetHash()
{
WebClient wc = new WebClient();
wc.Headers["User-Agent"] = "Mozilla/5.0";
String result = wc.DownloadString("https://api.github.com/repos/Jiiks/BetterDiscordApp/commits/master");
WebClient wc = new WebClient {Headers = {["User-Agent"] = "Mozilla/5.0"}};
string result = wc.DownloadString(@"https://api.github.com/repos/Jiiks/BetterDiscordApp/commits/master");
int start = result.IndexOf("{\"sha\":");
int end = result.IndexOf("\",\"");
return result.Substring(start + 8, end - 8);
}
}
}
}

View File

@ -0,0 +1,8 @@
namespace BetterDiscordWI.panels {
interface IPanel {
void SetVisible();
FormMain GetParent();
void BtnNext();
void BtnPrev();
}
}

View File

@ -0,0 +1,31 @@
using System.Windows.Forms;
namespace BetterDiscordWI.panels {
public partial class Panel0 : UserControl, IPanel {
public Panel0() {
InitializeComponent();
radioAcceptLicense.CheckedChanged += (sender, args) => {
GetParent().btnNext.Enabled = radioAcceptLicense.Checked;
};
}
public void SetVisible() {
GetParent().btnBack.Visible = false;
GetParent().btnNext.Enabled = false;
GetParent().btnNext.Text = @"Next >";
GetParent().lblPanelTitle.Text = @"BetterDiscord License Agreement";
GetParent().btnNext.Enabled = radioAcceptLicense.Checked;
}
public FormMain GetParent() {
return (FormMain)ParentForm;
}
public void BtnNext() {
GetParent().SwitchPanel(1);
}
public void BtnPrev() {}
}
}

View File

@ -14,10 +14,10 @@ namespace BetterDiscordWI.panels {
GetParent().btnBack.Visible = true;
GetParent().btnNext.Enabled = true;
GetParent().btnBack.Enabled = true;
GetParent().btnNext.Text = "Install";
GetParent().lblPanelTitle.Text = "BetterDiscord Installation";
GetParent().btnNext.Text = @"Install";
GetParent().lblPanelTitle.Text = @"BetterDiscord Installation";
pickVersion();
PickVersion();
}
public FormMain GetParent() {
@ -42,51 +42,49 @@ namespace BetterDiscordWI.panels {
}
private void checkBox1_CheckedChanged(object sender, EventArgs e) {
pickVersion();
PickVersion();
}
private void checkBox2_CheckedChanged(object sender, EventArgs e) {
pickVersion();
PickVersion();
}
private void pickVersion() {
string dirPath = null;
if(checkBox1.Checked == true) {
dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\DiscordCanary";
private void PickVersion() {
string dirPath;
if(checkBox1.Checked) {
dirPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\DiscordCanary";
if(!Directory.Exists(dirPath)) checkBox1.Checked = false;
checkBox2.Checked = false;
} else if(checkBox2.Checked == true) {
dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\DiscordPTB";
} else if(checkBox2.Checked) {
dirPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\DiscordPTB";
if(!Directory.Exists(dirPath)) checkBox2.Checked = false;
checkBox1.Checked = false;
} else {
dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Discord";
dirPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Discord";
}
if(Directory.Exists(dirPath)) {
String[] directories = Directory.GetDirectories(dirPath);
if (!Directory.Exists(dirPath)) return;
string[] directories = Directory.GetDirectories(dirPath);
String highestVersion = null;
string highestVersion = null;
foreach(String s in directories) {
Debug.Print(s);
if(!s.Contains("app-"))
continue;
if(String.IsNullOrEmpty(highestVersion)) {
highestVersion = s;
continue;
}
if(String.CompareOrdinal(s, highestVersion) > 0) {
highestVersion = s;
}
foreach(string s in directories) {
Debug.Print(s);
if(!s.Contains("app-"))
continue;
if(string.IsNullOrEmpty(highestVersion)) {
highestVersion = s;
continue;
}
tbPath.Text = highestVersion;
if(string.CompareOrdinal(s, highestVersion) > 0) {
highestVersion = s;
}
}
tbPath.Text = highestVersion;
}
}
}
}

View File

@ -11,7 +11,7 @@ using asardotnet;
namespace BetterDiscordWI.panels {
public partial class Panel2: UserControl, IPanel {
private String _dataPath, _tempPath;
private string _dataPath, _tempPath;
private Utils _utils;
public Panel2() {
@ -35,41 +35,39 @@ namespace BetterDiscordWI.panels {
}
private void KillProcessIfInstalling(string app) {
if(GetParent().DiscordPath.Contains(app + "\\")) {
AppendLog("Killing " + app);
foreach(var process in Process.GetProcessesByName(app)) {
process.Kill();
}
if (!GetParent().DiscordPath.Contains(app + "\\")) return;
AppendLog("Killing " + app);
foreach(var process in Process.GetProcessesByName(app)) {
process.Kill();
}
}
private void CreateDirectories() {
Thread t = new Thread(() => {
_dataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BetterDiscord";
_tempPath = _dataPath + "\\temp";
_dataPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\BetterDiscord";
_tempPath = $"{_dataPath}\\temp";
AppendLog("Deleting old cached files");
try {
if(File.Exists(_dataPath + "\\emotes_bttv.json")) {
File.Delete(_dataPath + "\\emotes_bttv.json");
if(File.Exists($"{_dataPath}\\emotes_bttv.json")) {
File.Delete($"{_dataPath}\\emotes_bttv.json");
}
if(File.Exists(_dataPath + "\\emotes_bttv_2.json")) {
File.Delete(_dataPath + "\\emotes_bttv_2.json");
if(File.Exists($"{_dataPath}\\emotes_bttv_2.json")) {
File.Delete($"{_dataPath}\\emotes_bttv_2.json");
}
if(File.Exists(_dataPath + "\\emotes_ffz.json")) {
File.Delete(_dataPath + "\\emotes_ffz.json");
if(File.Exists($"{_dataPath}\\emotes_ffz.json")) {
File.Delete($"{_dataPath}\\emotes_ffz.json");
}
if(File.Exists(_dataPath + "\\emotes_twitch_global.json")) {
File.Delete(_dataPath + "\\emotes_twitch_global.json");
if(File.Exists($"{_dataPath}\\emotes_twitch_global.json")) {
File.Delete($"{_dataPath}\\emotes_twitch_global.json");
}
if(File.Exists(_dataPath + "\\emotes_twitch_subscriber.json")) {
File.Delete(_dataPath + "\\emotes_twitch_subscriber.json");
if(File.Exists($"{_dataPath}\\emotes_twitch_subscriber.json")) {
File.Delete($"{_dataPath}\\emotes_twitch_subscriber.json");
}
if(File.Exists(_dataPath + "\\user.json")) {
File.Delete(_dataPath + "\\user.json");
if(File.Exists($"{_dataPath}\\user.json")) {
File.Delete($"{_dataPath}\\user.json");
}
} catch(Exception e) { AppendLog("Failed to delete one or more cached files"); }
if(Directory.Exists(_tempPath)) {
AppendLog("Deleting temp path");
Directory.Delete(_tempPath, true);
@ -82,9 +80,9 @@ namespace BetterDiscordWI.panels {
Directory.CreateDirectory(_tempPath);
DownloadResource("BetterDiscord.zip", "https://github.com/Jiiks/BetterDiscordApp/archive/stable.zip");
DownloadResource("BetterDiscord.zip", "https://github.com/Jiiks/BetterDiscordApp/archive/stable16.zip");
while(!File.Exists(_tempPath + "\\BetterDiscord.zip")) {
while(!File.Exists($"{_tempPath}\\BetterDiscord.zip")) {
Debug.Print("Waiting for download");
Thread.Sleep(100);
}
@ -92,10 +90,8 @@ namespace BetterDiscordWI.panels {
AppendLog("Extracting BetterDiscord");
ZipArchive zar =
ZipFile.OpenRead(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
"\\BetterDiscord\\temp\\BetterDiscord.zip");
zar.ExtractToDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
"\\BetterDiscord\\temp\\");
ZipFile.OpenRead($"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\BetterDiscord\\temp\\BetterDiscord.zip");
zar.ExtractToDirectory($"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\BetterDiscord\\temp\\");
DeleteDirs();
});
@ -107,14 +103,14 @@ namespace BetterDiscordWI.panels {
private void DeleteDirs() {
int errors = 0;
Thread t = new Thread(() => {
String dir = GetParent().DiscordPath + "\\resources\\app";
string dir = $"{GetParent().DiscordPath}\\resources\\app";
if(Directory.Exists(dir)) {
try {
AppendLog("Deleting " + dir);
Directory.Delete(dir, true);
} catch {
AppendLog("Error: Failed to Delete the '" + dir + "\\resources\\app' Directory.");
AppendLog($"Error: Failed to Delete the '{dir}\\resources\\app' Directory.");
errors = 1;
Finalize(errors);
}
@ -125,11 +121,17 @@ namespace BetterDiscordWI.panels {
Thread.Sleep(100);
}
dir = GetParent().DiscordPath + "\\resources\\node_modules\\BetterDiscord";
if (!Directory.Exists($"{GetParent().DiscordPath}\\resources\\node_modules\\")) {
Debug.Print("node_modules doesn't exist, creating");
AppendLog("node_modules doesn't exist, creating");
Directory.CreateDirectory($"{GetParent().DiscordPath}\\resources\\node_modules\\");
}
dir = $"{GetParent().DiscordPath}\\resources\\node_modules\\BetterDiscord";
if(Directory.Exists(dir)) {
AppendLog("Deleting " + dir);
AppendLog($"Deleting {dir}");
Directory.Delete(dir, true);
}
@ -139,12 +141,12 @@ namespace BetterDiscordWI.panels {
}
AppendLog("Extracting app.asar");
string appAsarPath = GetParent().DiscordPath + "\\resources\\app.asar";
string appAsarPath = $"{GetParent().DiscordPath}\\resources\\app.asar";
if(File.Exists(appAsarPath)) {
AsarArchive archive = new AsarArchive(appAsarPath);
AsarExtractor extractor = new AsarExtractor();
extractor.ExtractAll(archive, GetParent().DiscordPath + "\\resources\\app\\");
extractor.ExtractAll(archive, $"{GetParent().DiscordPath}\\resources\\app\\");
} else {
AppendLog("Error: app.asar file couldn't be found in 'resources' folder. Installation cannot Continue.");
errors = 1;
@ -153,7 +155,7 @@ namespace BetterDiscordWI.panels {
if(errors == 0) {
AppendLog("Moving BetterDiscord to resources\\node_modules\\");
Directory.Move(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BetterDiscord\\temp\\BetterDiscordApp-stable", GetParent().DiscordPath + "\\resources\\node_modules\\BetterDiscord");
Directory.Move($"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\BetterDiscord\\temp\\BetterDiscordApp-stable16", $"{GetParent().DiscordPath}\\resources\\node_modules\\BetterDiscord");
try {
Splice();
@ -169,25 +171,47 @@ namespace BetterDiscordWI.panels {
t.Start();
}
private void DownloadResource(String resource, String url) {
private void DownloadResource(string resource, string url) {
AppendLog("Downloading Resource: " + resource);
WebClient webClient = new WebClient();
webClient.Headers["User-Agent"] = "Mozilla/5.0";
WebClient webClient = new WebClient {Headers = {["User-Agent"] = "Mozilla/5.0"}};
webClient.DownloadFile(new Uri(url), Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BetterDiscord\\temp\\" + resource);
webClient.DownloadFile(new Uri(url), $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\BetterDiscord\\temp\\{resource}");
}
private void Splice() {
String indexloc = GetParent().DiscordPath + "\\resources\\app\\app\\index.js";
string indexloc = null;
if(File.Exists($"{GetParent().DiscordPath}\\resources\\app\\app\\index.js"))
{
//Normal path
indexloc = $"{GetParent().DiscordPath}\\resources\\app\\app\\index.js";
} else if (File.Exists($"{GetParent().DiscordPath}\\resources\\app\\index.js"))
{
//Canary 0.0.138 changed path to app\\index.js
indexloc = $"{GetParent().DiscordPath}\\resources\\app\\index.js";
}
if(indexloc == null)
{
AppendLog($"Error: index.js not found");
Finalize(1);
return;
}
if(!File.Exists(@"splice"))
{
AppendLog($"Error: splice install file not found, this should be included with the installer.");
Finalize(1);
return;
}
Thread t = new Thread(() => {
List<String> lines = new List<string>();
List<string> lines = new List<string>();
AppendLog("Spicing index");
using(FileStream fs = new FileStream(indexloc, FileMode.Open)) {
using(StreamReader reader = new StreamReader(fs)) {
String line = "";
string line = "";
while((line = reader.ReadLine()) != null) {
//if(GetParent().DiscordPath.Contains("Discord\\")) {
//if(GetParent().DiscordPath.Contains("DiscordCanary\\")) {
@ -195,9 +219,10 @@ namespace BetterDiscordWI.panels {
if(line.Replace(" ", "").Contains("var_fs=")) {
lines.Add(line);
lines.Add("var _betterDiscord = require('betterdiscord');");
lines.Add("var _betterDiscord2;");
} else if(line.Replace(" ", "").Contains("mainWindow=new")) {
lines.Add(line);
lines.Add(File.ReadAllText("splice"));
lines.Add(File.ReadAllText(@"splice"));
} else {
lines.Add(line);
}
@ -210,35 +235,33 @@ namespace BetterDiscordWI.panels {
File.WriteAllLines(indexloc, lines.ToArray());
AppendLog("Finished installation, verifying installation...");
int errors = 0;
String curPath = GetParent().DiscordPath + "\\resources\\app\\app\\index.js";
if(!File.Exists(curPath)) {
AppendLog("ERROR: FILE: " + curPath + " DOES NOT EXIST!");
string curPath = $"{GetParent().DiscordPath}\\resources\\app\\app\\index.js";
string curPath2 = $"{GetParent().DiscordPath}\\resources\\app\\index.js";
if (!File.Exists(curPath) && !File.Exists(curPath2))
{
AppendLog($"ERROR: index.js not found in {curPath} or {curPath2}");
errors++;
}
curPath = GetParent().DiscordPath + "\\resources\\node_modules\\BetterDiscord";
curPath = $"{GetParent().DiscordPath}\\resources\\node_modules\\BetterDiscord";
if(!Directory.Exists(curPath)) {
AppendLog("ERROR: DIRECTORY: " + curPath + " DOES NOT EXIST");
AppendLog($"ERROR: DIRECTORY: {curPath} DOES NOT EXIST!");
errors++;
}
String basePath = GetParent().DiscordPath + "\\resources\\node_modules\\BetterDiscord";
String[] bdFiles = { "\\package.json", "\\betterdiscord.js", "\\lib\\BetterDiscord.js", "\\lib\\config.json", "\\lib\\Utils.js" };
string basePath = $"{GetParent().DiscordPath}\\resources\\node_modules\\BetterDiscord";
string[] bdFiles = { "\\package.json", "\\betterdiscord.js", "\\lib\\BetterDiscord.js", "\\lib\\config.json", "\\lib\\Utils.js" };
foreach(string s in bdFiles.Where(s => !File.Exists(basePath + s))) {
AppendLog("ERROR: FILE: " + basePath + s + " DOES NOT EXIST");
AppendLog($"ERROR: FILE: {basePath}{s} DOES NOT EXIST");
errors++;
}
Finalize(errors);
});
@ -246,24 +269,23 @@ namespace BetterDiscordWI.panels {
}
private void Finalize(int errors) {
AppendLog("Finished installing BetterDiscord with " + errors + " errors");
AppendLog($"Finished installing BetterDiscord with {errors} errors");
Invoke((MethodInvoker)delegate {
GetParent().finished = true;
GetParent().btnCancel.Text = "OK";
GetParent().Finished = true;
GetParent().btnCancel.Text = @"OK";
GetParent().btnCancel.Enabled = true;
});
if(GetParent().RestartDiscord) {
if(GetParent().DiscordPath.Contains("\\Discord\\")) {
Process.Start(GetParent().DiscordPath + "\\Discord.exe");
Process.Start($"{GetParent().DiscordPath}\\Discord.exe");
}
if(GetParent().DiscordPath.Contains("\\DiscordCanary\\")) {
Process.Start(GetParent().DiscordPath + "\\DiscordCanary.exe");
Process.Start($"{GetParent().DiscordPath}\\DiscordCanary.exe");
}
if(GetParent().DiscordPath.Contains("\\DiscordPTB\\")) {
Process.Start(GetParent().DiscordPath + "\\DiscordPTB.exe");
Process.Start($"{GetParent().DiscordPath}\\DiscordPTB.exe");
}
}
}
@ -272,15 +294,11 @@ namespace BetterDiscordWI.panels {
return (FormMain)ParentForm;
}
public void BtnNext() {
throw new NotImplementedException();
}
public void BtnNext() { }
public void BtnPrev() {
throw new NotImplementedException();
}
public void BtnPrev() { }
private void AppendLog(String message) {
private void AppendLog(string message) {
Invoke((MethodInvoker)delegate {
rtLog.AppendText(message + "\n");
rtLog.SelectionStart = rtLog.Text.Length;

View File

@ -6,7 +6,7 @@ var clockPlugin = function () {};
clockPlugin.prototype.start = function () {
BdApi.clearCSS("clockPluginCss");
BdApi.injectCSS("clockPluginCss", '#clockPluginClock { position:absolute; color:#FFF; background:#333333; padding:0 12px 0 10px; min-width:70px; }');
BdApi.injectCSS("clockPluginCss", '#clockPluginClock { position:absolute; color:#FFF; background:#333333; padding:0 12px 0 13px; min-width:55px; max-width:55px; z-index:100; }');
var self = this;
this.clock = $("<div/>", { id: "clockPluginClock" });
$("body").append(this.clock);
@ -23,6 +23,28 @@ clockPlugin.prototype.start = function () {
var current_time = [h,m,s].join(':');
self.clock.html(current_time);
};
this.ticktock12 = function() {
var suffix = "AM";
var d = new Date();
var h = d.getHours();
var m = self.pad(d.getMinutes());
var s = self.pad(d.getSeconds());
if(h >= 12) {
h -= 12;
suffix = "PM";
}
if(h == 0) {
h = 12;
}
h = self.pad(h);
var current_time = [h,m,s].join(":") + suffix;
self.clock.html(current_time);
};
this.ticktock();
this.interval = setInterval(this.ticktock, 1000);
};

View File

@ -13,13 +13,14 @@ dblClickEdit.prototype.start = function () {
var msg = target.parents(".message").first();
var opt = msg.find(".btn-option");
opt.click();
var popout = $(".option-popout");
if(popout.children().length == 2) {
popout.children().first().click();
} else {
popout.hide();
}
$.each($(".popout .btn-item"), (index, value) => {
var option = $(value);
if(option.text() === "Edit") {
option.click();
}
});
}
});
};
@ -42,7 +43,7 @@ dblClickEdit.prototype.getDescription = function () {
return "Double click messages to edit them";
};
dblClickEdit.prototype.getVersion = function () {
return "0.1.0";
return "0.1.1";
};
dblClickEdit.prototype.getAuthor = function () {
return "Jiiks";

View File

@ -23,9 +23,9 @@ mediaSupport.prototype.convert = function () {
}
if(video) {
t.replaceWith('<video width="480" height="320" src="'+href+'" type="video/'+type+'" controls></video>');
t.replaceWith('<video width="480" height="320" src="'+encodeURI(href)+'" type="video/'+type+'" controls></video>');
} else {
t.replaceWith('<audio src="'+href+'" type="audio/'+type+'" controls></audio>');
t.replaceWith('<audio src="'+encodeURI(href)+'" type="audio/'+type+'" controls></audio>');
}
});
};

View File

@ -0,0 +1,57 @@
//META{"name":"properTimestamps"}*//
var properTimestamps = function () {};
properTimestamps.prototype.convert = function () {
$(".timestamp").each(function() {
var t = $(this);
if(t.data("24") != undefined) return;
var text = t.text();
var matches = /(.*)?at\s+(\d{1,2}):(\d{1,2})\s+(.*)/.exec(text);
if(matches == null) return false;
if(matches.length < 5) return false;
var h = parseInt(matches[2]);
if(matches[4] == "AM") {
if(h == 12) h -= 12;
}else if(matches[4] == "PM") {
if(h < 12) h += 12;
}
matches[2] = ('0' + h).slice(-2);
t.text(matches[1] + matches[2] + ":" + matches[3]);
t.data("24", true);
});
};
properTimestamps.prototype.onMessage = function () {
this.convert();
};
properTimestamps.prototype.onSwitch = function () {
this.convert();
};
properTimestamps.prototype.start = function () {
this.convert();
};
properTimestamps.prototype.load = function () {};
properTimestamps.prototype.unload = function () {};
properTimestamps.prototype.stop = function () {};
properTimestamps.prototype.getSettingsPanel = function () {
return "";
};
properTimestamps.prototype.getName = function () {
return "Proper Timestamps";
};
properTimestamps.prototype.getDescription = function () {
return "24 hours timestamps";
};
properTimestamps.prototype.getVersion = function () {
return "0.1.0";
};
properTimestamps.prototype.getAuthor = function () {
return "Jiiks";
};

View File

@ -4,9 +4,11 @@ If you have issues then join the BD Discord server: [Here](https://discord.gg/0T
If your Discord breaks then uninstall BD and try again
# Do not contact Discord support about BD issues.
## Coming in 0.2.8 all plugins must be named `*.plugin.js` and all themes must be named `*.theme.css`
Better Discord App enhances Discord desktop app with new features.
![ss](http://i.imgur.com/P0XEyp6.jpg)
![ss](http://puu.sh/oIO58.png)
## Windows Universal Installer
* Download the latest installer from [releases](https://github.com/Jiiks/BetterDiscordApp/releases)

View File

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace BetterDiscordWI.panels
{
interface IPanel
{
void SetVisible();
FormMain GetParent();
void BtnNext();
void BtnPrev();
}
}

View File

@ -1,41 +0,0 @@
using System.Windows.Forms;
namespace BetterDiscordWI.panels
{
public partial class Panel0 : UserControl, IPanel
{
public Panel0()
{
InitializeComponent();
radioAcceptLicense.CheckedChanged += (sender, args) =>
{
GetParent().btnNext.Enabled = radioAcceptLicense.Checked;
};
}
public void SetVisible()
{
GetParent().btnBack.Visible = false;
GetParent().btnNext.Enabled = false;
GetParent().btnNext.Text = "Next >";
GetParent().lblPanelTitle.Text = "BetterDiscord License Agreement";
GetParent().btnNext.Enabled = radioAcceptLicense.Checked;
}
public FormMain GetParent()
{
return (FormMain) ParentForm;
}
public void BtnNext()
{
GetParent().SwitchPanel(1);
}
public void BtnPrev()
{
throw new System.NotImplementedException();
}
}
}

View File

@ -1,102 +0,0 @@
# BetterDiscordApp
If you have issues then join the BD Discord server: [Here](https://discord.gg/0Tmfo5ZbORCRqbAd)
If your Discord breaks then uninstall BD and try again
# Do not contact Discord support about BD issues.
Better Discord App enhances Discord desktop app with new features.
![ss](http://i.imgur.com/P0XEyp6.jpg)
## Windows Universal Installer
* Download the latest installer from [releases](https://github.com/Jiiks/BetterDiscordApp/releases)
* Follow the instructions
* .NET 4.0 required https://www.microsoft.com/en-us/download/details.aspx?id=30653
* Windows Installer users asar.net https://github.com/Jiiks/asar.net
## Auto Installation
* Download the latest package from [releases](https://github.com/Jiiks/BetterDiscordApp/releases)
* Run the installer
* Installer requires [node](https://nodejs.org/en/download/) download the binaries and place in the same folder as the installer if you don't have node installed.
* Installer uses [asar](https://github.com/atom/asar) which is bundled with the installer.
* Installer uses [wrench](https://github.com/ryanmcgrath/wrench-js) which is bundled with the installer.
## Manual Installation
* Extract app.asar
* Add BetterDiscord as a dependency
* Add init to Discord load event
* Move BetterDiscord to node_modules
## Features
**Emotes:**
BetterDiscord adds all [Twitch.tv](http://twitch.tv), most [FrankerFaceZ](http://frankerfacez.com) and [BetterTTV](http://betterttv.net) emotes to Discord. Supported emotes: https://betterdiscord.net/emotes
**Quick Emote Menu:**
Quick Emote Menu adds a menu for quickly adding twitch emotes and your favorite emotes.
**Emote Autocapitalize:**
Automatically capitalize [Twitch.tv](http://twitch.tv) global emotes.
**Emote Autocomplete:**
Automatically completes/suggests emotes.(soon)
**Minimal Mode:**
Minimal mode makes elements smaller and hides certain elements.
**Voice Chat Mode:**
Only display voice channels
**Public Servers:**
A menu for displaying public servers. [Serverlist](https://github.com/Jiiks/BetterDiscordApp/blob/master/data/serverlist.json)
**Custom CSS**
BetterDiscord supports custom CSS for styling Discord to your liking.
**Custom Themes**
BetterDiscord comes with a theme loader for loading your own or downloading themes made by others.
**Plugins**
BetterDiscord comes with a JavaSCript plugin loader for loading your own or downloading plugins made by others.
**Spoilers**
Add spoilers to your chat, simply add [!s] to your message.
**Save Logs Locally:**
Save chatlogs locally.(soon)
## Adding you server to public servers
Edit the [Serverlist](https://github.com/Jiiks/BetterDiscordApp/blob/master/data/serverlist.json) and submit a pull request.
## BetterDiscord Uses the following API's
* https://twitchemotes.com/apidocs for Twitch emotes
* https://api.betterttv.net/emotes for [BetterTTV](https://nightdev.com/betterttv/) emotes
## Credits
* MacOS Installer by [Candunc](https://github.com/Candunc)
* Emote titles by [pendo324](https://github.com/pendo324)
* Majority of FFZ emote work by [Pohky] (https://github.com/pohky)
## License
The MIT License (MIT)
Copyright (c) 2015 Jiiks | [Jiiks.net] (https://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.

Binary file not shown.

View File

@ -1,2 +0,0 @@
_betterDiscord = new _betterDiscord.BetterDiscord(mainWindow);
_betterDiscord.init();

View File

@ -1,19 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Newtonsoft.Json</id>
<version>7.0.1</version>
<title>Json.NET</title>
<authors>James Newton-King</authors>
<owners>James Newton-King</owners>
<licenseUrl>https://raw.github.com/JamesNK/Newtonsoft.Json/master/LICENSE.md</licenseUrl>
<projectUrl>http://www.newtonsoft.com/json</projectUrl>
<iconUrl>http://www.newtonsoft.com/content/images/nugeticon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Json.NET is a popular high-performance JSON framework for .NET</description>
<releaseNotes />
<copyright />
<language>en-US</language>
<tags>json</tags>
</metadata>
</package>

View File

@ -1,112 +0,0 @@
param($installPath, $toolsPath, $package, $project)
# open json.net splash page on package install
# don't open if json.net is installed as a dependency
try
{
$url = "http://www.newtonsoft.com/json/install?version=" + $package.Version
$dte2 = Get-Interface $dte ([EnvDTE80.DTE2])
if ($dte2.ActiveWindow.Caption -eq "Package Manager Console")
{
# user is installing from VS NuGet console
# get reference to the window, the console host and the input history
# show webpage if "install-package newtonsoft.json" was last input
$consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow])
$props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
$prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1
if ($prop -eq $null) { return }
$hostInfo = $prop.GetValue($consoleWindow)
if ($hostInfo -eq $null) { return }
$history = $hostInfo.WpfConsole.InputHistory.History
$lastCommand = $history | select -last 1
if ($lastCommand)
{
$lastCommand = $lastCommand.Trim().ToLower()
if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json"))
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
}
else
{
# user is installing from VS NuGet dialog
# get reference to the window, then smart output console provider
# show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation
$instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor `
[System.Reflection.BindingFlags]::NonPublic)
$consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
if ($instanceField -eq $null -or $consoleField -eq $null) { return }
$instance = $instanceField.GetValue($null)
if ($instance -eq $null) { return }
$consoleProvider = $consoleField.GetValue($instance)
if ($consoleProvider -eq $null) { return }
$console = $consoleProvider.CreateOutputConsole($false)
$messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor `
[System.Reflection.BindingFlags]::NonPublic)
if ($messagesField -eq $null) { return }
$messages = $messagesField.GetValue($console)
if ($messages -eq $null) { return }
$operations = $messages -split "=============================="
$lastOperation = $operations | select -last 1
if ($lastOperation)
{
$lastOperation = $lastOperation.ToLower()
$lines = $lastOperation -split "`r`n"
$installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json ") } | select -first 1
if ($installMatch)
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
}
}
catch
{
try
{
$pmPane = $dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Package Manager")
$selection = $pmPane.TextDocument.Selection
$selection.StartOfDocument($false)
$selection.EndOfDocument($true)
if ($selection.Text.StartsWith("Attempting to gather dependencies information for package 'Newtonsoft.Json." + $package.Version + "'"))
{
$dte2.ItemOperations.Navigate($url) | Out-Null
}
}
catch
{
# stop potential errors from bubbling up
# worst case the splash page won't open
}
}
# still yolo

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\BetterDiscordWI\packages.config" />
</repositories>

View File

@ -1,156 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac desktop service store files
.DS_Store

View File

@ -1,22 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinRepair", "WinRepair\WinRepair.csproj", "{B1DDA709-0EC8-43F5-AE94-7EBFD1CAAE5D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B1DDA709-0EC8-43F5-AE94-7EBFD1CAAE5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1DDA709-0EC8-43F5-AE94-7EBFD1CAAE5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1DDA709-0EC8-43F5-AE94-7EBFD1CAAE5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1DDA709-0EC8-43F5-AE94-7EBFD1CAAE5D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,2 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeStyle/LiveTemplatesUseVar/PreferVar/@EntryValue">False</s:Boolean></wpf:ResourceDictionary>

Binary file not shown.

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -1,113 +0,0 @@
using System;
using System.IO;
using System.Text.RegularExpressions;
namespace WinRepair
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("WinRepair will delete all nonessential BetterDiscord/Discord files that might cause problems");
Console.WriteLine("The following files/directories will be deleted");
String appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
String discordDir = appdata + "\\discord";
String bdDir = appdata + "\\betterdiscord";
Console.WriteLine(Environment.SpecialFolder.ApplicationData);
if (Directory.Exists(bdDir))
{
foreach (string directory in Directory.GetDirectories(bdDir))
{
Console.WriteLine(directory);
}
foreach (string file in Directory.GetFiles(bdDir))
{
Console.WriteLine(file);
}
}
if (Directory.Exists(discordDir))
{
if (Directory.Exists(discordDir + "\\cache"))
{
Console.WriteLine(discordDir + "\\cache and all it's contents");
}
}
if (Directory.Exists(discordDir + "\\Local Storage"))
{
if (File.Exists(discordDir + "\\Local Storage\\https_discordapp.com_0.localstorage"))
{
Console.WriteLine(discordDir + "\\Local Storage\\https_discordapp.com_0.localstorage");
}
}
Console.WriteLine("Is this ok? Y/N");
String response = Console.ReadLine().ToLower();
if (Regex.IsMatch(response, "(yes|y)"))
{
if (Directory.Exists(bdDir))
{
DeleteAndLogFiles(bdDir);
}
if (Directory.Exists(bdDir))
{
DeleteAndLogDirectories(bdDir);
}
if (Directory.Exists(discordDir + "\\cache"))
{
DeleteAndLogFiles(discordDir + "\\cache");
}
if (File.Exists(discordDir + "\\Local Storage\\https_discordapp.com_0.localstorage"))
{
Console.WriteLine("Deleting: " + discordDir + "\\Local Storage\\https_discordapp.com_0.localstorage");
File.Delete(discordDir + "\\Local Storage\\https_discordapp.com_0.localstorage");
}
Console.WriteLine("All done");
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
else
{
Console.WriteLine("Aborted");
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
private static void DeleteAndLogFiles(String directory)
{
foreach (String file in Directory.GetFiles(directory))
{
Console.WriteLine("Deleting: " + file);
File.Delete(file);
}
foreach (String dir in Directory.GetDirectories(directory))
{
DeleteAndLogFiles(dir);
}
}
private static void DeleteAndLogDirectories(String directory)
{
Console.WriteLine("Cleaning: " + directory);
Directory.Delete(directory, true);
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WinRepair")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WinRepair")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5b1dac68-94c6-4d74-bd41-66bbf2ab18a5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B1DDA709-0EC8-43F5-AE94-7EBFD1CAAE5D}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WinRepair</RootNamespace>
<AssemblyName>WinRepair</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,12 +0,0 @@
/*Note this is partial changes*/
var _betterDiscord = require('betterdiscord');
function launchMainAppWindow(isVisible) {
_betterDiscord = new _betterDiscord.BetterDiscord(mainWindow);
_betterDiscord.init();
}

View File

@ -1,12 +0,0 @@
{
"name": "discord",
"description": "Discord Client for Desktop",
"version": "0.0.277",
"releaseChannel": "stable",
"main": "app/index.js",
"private": true,
"dependencies": {
"react": "^0.13.0",
"betterdiscord": "^0.1.2"
}
}

Some files were not shown because too many files have changed in this diff Show More