Update 0BDFDB.plugin.js

This commit is contained in:
Mirco Wittrien 2021-04-07 18:52:48 +02:00
parent 1da9439fb6
commit 24e971dd28
1 changed files with 4 additions and 4 deletions

View File

@ -978,16 +978,16 @@ module.exports = (_ => {
const loadLibrary = tryAgain => { const loadLibrary = tryAgain => {
const request = require("request"), fs = require("fs"), path = require("path"); const request = require("request"), fs = require("fs"), path = require("path");
request.get(`${myGithub}/Library/_res/BDFDB.raw.css2`, (e, r, b) => { request.get(`${myGithub}/Library/_res/BDFDB.raw.css`, (e, r, b) => {
if ((e || !b || r.statusCode != 200) && tryAgain) return BDFDB.TimeUtils.timeout(_ => loadLibrary(), 10000); if ((e || !b || r.statusCode != 200) && tryAgain) return BDFDB.TimeUtils.timeout(_ => loadLibrary(), 10000);
const cssPath = path.join(BDFDB.BDUtils.getPluginsFolder(), "0BDFDB.raw.css"); const cssPath = path.join(BDFDB.BDUtils.getPluginsFolder(), "0BDFDB.raw.css");
const css = !e && b && r.statusCode == 200 ? b : fs.existsSync(cssPath) && fs.readFileSync(cssPath); const css = !e && b && r.statusCode == 200 ? b : fs.existsSync(cssPath) && (fs.readFileSync(cssPath) || "").toString();
request.get(`${myGithub}/Library/_res/BDFDB.data.json2`, BDFDB.TimeUtils.suppress((e2, r2, b2) => { request.get(`${myGithub}/Library/_res/BDFDB.data.json`, BDFDB.TimeUtils.suppress((e2, r2, b2) => {
const dataPath = path.join(BDFDB.BDUtils.getPluginsFolder(), "0BDFDB.data.json"); const dataPath = path.join(BDFDB.BDUtils.getPluginsFolder(), "0BDFDB.data.json");
if (e2 || !b2 || r2.statusCode != 200) { if (e2 || !b2 || r2.statusCode != 200) {
if (tryAgain) return BDFDB.TimeUtils.timeout(_ => loadLibrary(), 10000); if (tryAgain) return BDFDB.TimeUtils.timeout(_ => loadLibrary(), 10000);
else { else {
b2 = fs.existsSync(dataPath) && fs.readFileSync(dataPath) || null; b2 = fs.existsSync(dataPath) && (fs.readFileSync(dataPath) || "").toString() || null;
if (!b2) BdApi.alert("Error", "Could not initiate BDFDB Library Plugin. Check your Internet Connection and make sure GitHub isn't blocked by your Network or try disabling your VPN/Proxy."); if (!b2) BdApi.alert("Error", "Could not initiate BDFDB Library Plugin. Check your Internet Connection and make sure GitHub isn't blocked by your Network or try disabling your VPN/Proxy.");
} }
} }