rework before upgrade
This commit is contained in:
parent
9d31dfe221
commit
a84efe77ce
File diff suppressed because one or more lines are too long
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"LatestVersion":"0.3.2",
|
||||
"CDN":"cdn.rawgit.com"
|
||||
}
|
26
gulpfile.js
26
gulpfile.js
|
@ -1,33 +1,15 @@
|
|||
const gulp = require("gulp");
|
||||
const rename = require("gulp-rename");
|
||||
const minify = require("gulp-babel-minify");
|
||||
const csso = require("gulp-csso");
|
||||
|
||||
gulp.task("minify-js", minifyJS);
|
||||
gulp.task("minify-css", minifyCSS);
|
||||
|
||||
gulp.task("watch-js", function() {
|
||||
return gulp.watch(["./js/main.js"], minifyJS);
|
||||
});
|
||||
|
||||
gulp.task("watch-css", function() {
|
||||
return gulp.watch(["./css/main.css"], minifyCSS);
|
||||
return gulp.watch(["./src/styles/index.css"], minifyCSS);
|
||||
});
|
||||
|
||||
gulp.task("watch", function() {
|
||||
return gulp.watch(["./js/main.js", "./css/main.css"], gulp.series(minifyJS, minifyCSS));
|
||||
});
|
||||
|
||||
function minifyJS() {
|
||||
return gulp.src("./js/main.js")
|
||||
.pipe(minify({mangle: {keepClassName: true}}))
|
||||
.pipe(rename("main.min.js"))
|
||||
.pipe(gulp.dest("./js"));
|
||||
}
|
||||
|
||||
function minifyCSS() {
|
||||
return gulp.src("./css/main.css")
|
||||
return gulp.src("./src/styles/index.css")
|
||||
.pipe(csso({restructure: false}))
|
||||
.pipe(rename("main.min.css"))
|
||||
.pipe(gulp.dest("./css"));
|
||||
.pipe(rename("style.css"))
|
||||
.pipe(gulp.dest("./dist"));
|
||||
}
|
933
js/main.js
933
js/main.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
|
@ -1,18 +1,16 @@
|
|||
{
|
||||
"name": "bandagedbd",
|
||||
"version": "0.2.3",
|
||||
"version": "0.3.5",
|
||||
"description": "Enhances Discord adding functionality and themes.",
|
||||
"main": "js/main.js",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"build": "webpack --progress --colors",
|
||||
"watch": "webpack --progress --colors --watch",
|
||||
"build-prod": "webpack --progress --colors --mode production -o js/main.min.js --devtool none",
|
||||
"build-prod": "webpack --progress --colors --mode production -o dist/remote.js --devtool none",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"minify": "gulp minify-js && gulp minify-css",
|
||||
"minify-js": "gulp minify-js",
|
||||
"minify-css": "gulp minify-css",
|
||||
"watch-js": "gulp watch-js",
|
||||
"watch-css": "gulp watch-css"
|
||||
"watch-css": "gulp watch-css",
|
||||
"deploy": "npm run build-prod && npm run minify-css"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -25,17 +23,16 @@
|
|||
},
|
||||
"homepage": "https://github.com/rauenzi/BetterDiscordApp#readme",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/preset-env": "^7.3.4",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"@babel/register": "^7.0.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"circular-dependency-plugin": "^5.0.2",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-babel-minify": "^0.5.1",
|
||||
"gulp-csso": "^3.0.1",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"webpack": "^4.29.6",
|
||||
"webpack-cli": "^3.2.3"
|
||||
"@babel/core": "^7.10.5",
|
||||
"@babel/preset-env": "^7.10.4",
|
||||
"@babel/preset-react": "^7.10.4",
|
||||
"@babel/register": "^7.10.5",
|
||||
"babel-loader": "^8.1.0",
|
||||
"circular-dependency-plugin": "^5.2.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-csso": "^4.0.1",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.12"
|
||||
}
|
||||
}
|
||||
|
|
56
src/index.js
56
src/index.js
|
@ -4,15 +4,6 @@ localStorageFix();
|
|||
loadingIcon();
|
||||
|
||||
const deprecateGlobal = (key, value) => {
|
||||
// value = typeof(value) !== "object" ? value : new Proxy(value, {
|
||||
// get: function(obj, mod) {
|
||||
// if (!obj.hasOwnProperty(mod)) return undefined;
|
||||
// return obj[mod];
|
||||
// },
|
||||
// set: function(obj, mod) {
|
||||
// if (obj.hasOwnProperty(mod)) return Utils.err("Deprecated Global", "Trying to overwrite deprecated BD globals");
|
||||
// }
|
||||
// });
|
||||
Object.defineProperty(window, key, {
|
||||
get() {
|
||||
Utils.warn("Deprecated Global", `"${key}" will be removed in future versions. Please only use BdApi.`);
|
||||
|
@ -54,49 +45,4 @@ deprecateGlobal("ClassNormalizer", ClassNormalizer);
|
|||
window.BdApi = BdApi;
|
||||
|
||||
import Core from "./modules/core";
|
||||
deprecateGlobal("mainCore", Core);
|
||||
export default class CoreWrapper {
|
||||
constructor(bdConfig) {
|
||||
Core.setConfig(bdConfig);
|
||||
}
|
||||
|
||||
init() {
|
||||
// deprecateGlobal("mainCore", this.mainCore);
|
||||
Core.init();
|
||||
}
|
||||
}
|
||||
|
||||
// function patchModuleLoad() {
|
||||
// const namespace = "betterdiscord";
|
||||
// const prefix = `${namespace}/`;
|
||||
// const Module = require("module");
|
||||
// const load = Module._load;
|
||||
// // const resolveFilename = Module._resolveFilename;
|
||||
|
||||
// Module._load = function(request) {
|
||||
// if (request === namespace || request.startsWith(prefix)) {
|
||||
// const requested = request.substr(prefix.length);
|
||||
// if (requested == "api") return BdApi;
|
||||
// }
|
||||
|
||||
// return load.apply(this, arguments);
|
||||
// };
|
||||
|
||||
// // Module._resolveFilename = function (request, parent, isMain) {
|
||||
// // if (request === "betterdiscord" || request.startsWith("betterdiscord/")) {
|
||||
// // const contentPath = PluginManager.getPluginPathByModule(parent);
|
||||
// // if (contentPath) return request;
|
||||
// // }
|
||||
|
||||
// // return resolveFilename.apply(this, arguments);
|
||||
// // };
|
||||
|
||||
// return function() {
|
||||
// Module._load = load;
|
||||
// };
|
||||
// }
|
||||
|
||||
// patchModuleLoad();
|
||||
|
||||
// var settingsPanel, emoteModule, quickEmoteMenu, voiceMode,, dMode, publicServersModule;
|
||||
// var bdConfig = null;
|
||||
deprecateGlobal("mainCore", Core);
|
|
@ -25,8 +25,8 @@ const dependencies = [
|
|||
{
|
||||
name: "bd-stylesheet",
|
||||
type: "style",
|
||||
url: "//cdn.staticaly.com/gh/{{repo}}/BetterDiscordApp/{{hash}}/dist/style{{minified}}.css",
|
||||
backup: "//rauenzi.github.io/BetterDiscordApp/dist/style{{minified}}.css",
|
||||
url: "//betterdiscord.zerebos.com/dist/style.css",
|
||||
backup: "//rauenzi.github.io/BetterDiscordApp/dist/style.css",
|
||||
local: "{{localServer}}/BetterDiscordApp/dist/style.css"
|
||||
}
|
||||
];
|
||||
|
|
|
@ -23,31 +23,31 @@ EmoteModule.prototype.init = async function () {
|
|||
|
||||
const emoteInfo = {
|
||||
TwitchGlobal: {
|
||||
url: `https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_global.json`,
|
||||
url: `https://betterdiscord.zerebos.com/assets/emotedata_twitch_global.json`,
|
||||
variable: "TwitchGlobal",
|
||||
oldVariable: "emotesTwitch",
|
||||
getEmoteURL: (e) => `https://static-cdn.jtvnw.net/emoticons/v1/${e}/1.0`
|
||||
},
|
||||
TwitchSubscriber: {
|
||||
url: `https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_subscriber.json`,
|
||||
url: `https://betterdiscord.zerebos.com/assets/emotedata_twitch_subscriber.json`,
|
||||
variable: "TwitchSubscriber",
|
||||
oldVariable: "subEmotesTwitch",
|
||||
getEmoteURL: (e) => `https://static-cdn.jtvnw.net/emoticons/v1/${e}/1.0`
|
||||
},
|
||||
FrankerFaceZ: {
|
||||
url: `https://rauenzi.github.io/BetterDiscordApp/data/emotedata_ffz.json`,
|
||||
url: `https://betterdiscord.zerebos.com/assets/emotedata_ffz.json`,
|
||||
variable: "FrankerFaceZ",
|
||||
oldVariable: "emotesFfz",
|
||||
getEmoteURL: (e) => `https://cdn.frankerfacez.com/emoticon/${e}/1`
|
||||
},
|
||||
BTTV: {
|
||||
url: `https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv.json`,
|
||||
url: `https://betterdiscord.zerebos.com/assets/emotedata_bttv.json`,
|
||||
variable: "BTTV",
|
||||
oldVariable: "emotesBTTV",
|
||||
getEmoteURL: (e) => `https://cdn.betterttv.net/emote/${e}/1x`
|
||||
},
|
||||
BTTV2: {
|
||||
url: `https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv2.json`,
|
||||
url: `https://betterdiscord.zerebos.com/assets/emotedata_bttv2.json`,
|
||||
variable: "BTTV2",
|
||||
oldVariable: "emotesBTTV2",
|
||||
getEmoteURL: (e) => `https://cdn.betterttv.net/emote/${e}/1x`
|
||||
|
@ -248,7 +248,7 @@ EmoteModule.prototype.downloadEmotes = function(emoteMeta) {
|
|||
|
||||
EmoteModule.prototype.getBlacklist = function () {
|
||||
return new Promise(resolve => {
|
||||
require("request").get({url: "https://rauenzi.github.io/BetterDiscordApp/data/emotefilter.json", json: true}, function (err, resp, data) {
|
||||
require("request").get({url: "https://betterdiscord.zerebos.com/assets/emotefilter.json", json: true}, function (err, resp, data) {
|
||||
if (err) return resolve(bemotes);
|
||||
resolve(bemotes.splice(0, 0, ...data.blacklist));
|
||||
});
|
||||
|
|
|
@ -8,11 +8,8 @@ module.exports = {
|
|||
devtool: "eval-cheap-source-map",
|
||||
entry: "./src/index.js",
|
||||
output: {
|
||||
filename: "main.js",
|
||||
path: path.resolve(__dirname, "js"),
|
||||
library: "Core",
|
||||
libraryTarget: "var",
|
||||
libraryExport: "default"
|
||||
filename: "remote.js",
|
||||
path: path.resolve(__dirname, "dist")
|
||||
},
|
||||
externals: {
|
||||
electron: `require("electron")`,
|
||||
|
|
Loading…
Reference in New Issue