Client base and restrucutre
This commit is contained in:
parent
273a4ae50b
commit
78952f190c
|
@ -0,0 +1,216 @@
|
|||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
/**
|
||||
* BetterDiscord Client Core
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var _require = __webpack_require__(1),
|
||||
Logger = _require.Logger;
|
||||
|
||||
var BetterDiscord = function BetterDiscord() {
|
||||
_classCallCheck(this, BetterDiscord);
|
||||
};
|
||||
|
||||
var bdInstance = new BetterDiscord();
|
||||
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _utils = __webpack_require__(2);
|
||||
|
||||
Object.defineProperty(exports, 'Logger', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _utils.Logger;
|
||||
}
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 2 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* BetterDiscord Client Utils Module
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
var _require = __webpack_require__(3),
|
||||
Module = _require.Module;
|
||||
|
||||
var Logger = function () {
|
||||
function Logger() {
|
||||
_classCallCheck(this, Logger);
|
||||
}
|
||||
|
||||
_createClass(Logger, null, [{
|
||||
key: 'log',
|
||||
value: function log(message) {
|
||||
console.log(message);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Logger;
|
||||
}();
|
||||
|
||||
module.exports = { Logger: Logger };
|
||||
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* BetterDiscord Module Base
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/*
|
||||
Base Module that every non-static module should extend
|
||||
*/
|
||||
|
||||
var Module = function () {
|
||||
function Module(args) {
|
||||
_classCallCheck(this, Module);
|
||||
|
||||
this.__ = {
|
||||
state: args,
|
||||
args: args
|
||||
};
|
||||
this.init();
|
||||
}
|
||||
|
||||
_createClass(Module, [{
|
||||
key: "init",
|
||||
value: function init() {
|
||||
if (this.bindings) this.bindings();
|
||||
if (this.setInitialState) this.setInitialState(this.state);
|
||||
}
|
||||
}, {
|
||||
key: "args",
|
||||
set: function set(t) {},
|
||||
get: function get() {
|
||||
return this.__.args;
|
||||
}
|
||||
}, {
|
||||
key: "state",
|
||||
get: function get() {
|
||||
return this.__.state;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Module;
|
||||
}();
|
||||
|
||||
module.exports = { Module: Module };
|
||||
|
||||
/***/ })
|
||||
/******/ ]);
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "bdclient",
|
||||
"description": "BetterDiscord client package",
|
||||
"author": "Jiiks",
|
||||
"version": "0.4.0",
|
||||
"homepage": "https://betterdiscord.net",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"contributors": [
|
||||
"Jiiks",
|
||||
"Pohky"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Jiiks/BetterDiscordApp.git"
|
||||
},
|
||||
"private": false,
|
||||
"devDependencies": {
|
||||
"webpack": "^3.10.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-loader": "^7.1.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --progress --colors"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* BetterDiscord Client Core
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const { Logger } = require('./modules');
|
||||
|
||||
class BetterDiscord {
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let bdInstance = new BetterDiscord();
|
|
@ -0,0 +1 @@
|
|||
export { Logger } from './utils';
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* BetterDiscord Module Base
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/*
|
||||
Base Module that every non-static module should extend
|
||||
*/
|
||||
|
||||
class Module {
|
||||
|
||||
constructor(args) {
|
||||
this.__ = {
|
||||
state: args,
|
||||
args
|
||||
}
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
if (this.bindings) this.bindings();
|
||||
if (this.setInitialState) this.setInitialState(this.state);
|
||||
}
|
||||
|
||||
set args(t) { }
|
||||
get args() { return this.__.args; }
|
||||
get state() { return this.__.state; }
|
||||
|
||||
}
|
||||
|
||||
module.exports = { Module };
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* BetterDiscord Client Utils Module
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const { Module } = require('./modulebase');
|
||||
|
||||
class Logger {
|
||||
|
||||
static log(message) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = { Logger }
|
|
@ -0,0 +1,23 @@
|
|||
const
|
||||
path = require('path'),
|
||||
webpack = require('webpack');
|
||||
|
||||
const jsLoader = {
|
||||
test: /\.(js|jsx)$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
query: {
|
||||
presets: ['es2015', 'react']
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
entry: './src/index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'betterdiscord.client.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [jsLoader]
|
||||
}
|
||||
};
|
|
@ -2,6 +2,16 @@
|
|||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
/**
|
||||
* BetterDiscord Core Entry
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const { Utils, FileUtils, BDIpc, Config } = require('./modules');
|
||||
|
||||
const Common = {};
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* BetterDiscord IPC Module
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const { Module } = require('./modulebase');
|
||||
|
||||
const { ipcMain } = require('electron');
|
||||
|
||||
class BDIpcEvent {
|
||||
class BDIpcEvent extends Module {
|
||||
|
||||
constructor(event, args) {
|
||||
this.bindings();
|
||||
super(args);
|
||||
this.ipcEvent = event;
|
||||
this.args = args;
|
||||
this.__eid = args.__eid;
|
||||
delete this.args.__eid;
|
||||
}
|
||||
|
||||
bindings() {
|
||||
|
@ -18,8 +26,7 @@ class BDIpcEvent {
|
|||
}
|
||||
|
||||
send(message) {
|
||||
console.log(this.__eid);
|
||||
this.ipcEvent.sender.send(this.__eid, message);
|
||||
this.ipcEvent.sender.send(this.args.__eid, message);
|
||||
}
|
||||
|
||||
reply(message) {
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
class Config {
|
||||
/**
|
||||
* BetterDiscord Config Module
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
constructor(args) {
|
||||
this.args = args;
|
||||
}
|
||||
const { Module } = require('./modulebase');
|
||||
|
||||
class Config extends Module {
|
||||
|
||||
get version() {
|
||||
return this.args.version;
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* BetterDiscord Module Base
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/*
|
||||
Base Module that every non-static module should extend
|
||||
*/
|
||||
|
||||
class Module {
|
||||
|
||||
constructor(args) {
|
||||
this.__ = {
|
||||
state: args,
|
||||
args
|
||||
};
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
if (this.bindings) this.bindings();
|
||||
if (this.setInitialState) this.setInitialState(this.state);
|
||||
}
|
||||
|
||||
set args(t) {}
|
||||
get args() {
|
||||
return this.__.args;
|
||||
}
|
||||
get state() {
|
||||
return this.__.state;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = { Module };
|
|
@ -2,6 +2,16 @@
|
|||
|
||||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
||||
|
||||
/**
|
||||
* BetterDiscord Utils Module
|
||||
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://github.com/JsSucks - https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const path = require('path'),
|
||||
fs = require('fs');
|
||||
|
||||
|
|
Loading…
Reference in New Issue