lightcord broken + fix + sex 🤪
This commit is contained in:
parent
dae02359ee
commit
d6ff8c90ab
|
@ -483,7 +483,7 @@ export default class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeDa(className){
|
function removeDa(className){
|
||||||
if(!className)return className
|
if(typeof className !== "string" || !className)return className
|
||||||
return className.split(" ").filter(e => !e.startsWith("da-")).join(" ")
|
return className.split(" ").filter(e => !e.startsWith("da-")).join(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,6 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
if (!this.state.settings) return;
|
if (!this.state.settings) return;
|
||||||
if (typeof this.settingsPanel === "object") {
|
|
||||||
this.refs.settingspanel.appendChild(this.settingsPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!settingsCookie["fork-ps-3"]) return;
|
if (!settingsCookie["fork-ps-3"]) return;
|
||||||
setImmediate(() => {
|
setImmediate(() => {
|
||||||
|
@ -97,15 +94,28 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
||||||
try { this.settingsPanel = this.props.addon.plugin.getSettingsPanel(); }
|
try { this.settingsPanel = this.props.addon.plugin.getSettingsPanel(); }
|
||||||
catch (err) { Utils.err("Plugins", "Unable to get settings panel for " + this.name + ".", err); }
|
catch (err) { Utils.err("Plugins", "Unable to get settings panel for " + this.name + ".", err); }
|
||||||
|
|
||||||
|
let settingPanel
|
||||||
|
if(typeof this.settingsPanel === "object"){
|
||||||
|
if(this.settingsPanel instanceof Node){
|
||||||
|
settingPanel = BVD2.react.createElement("div", {id: `plugin-settings-${this.name}`, className: "plugin-settings", ref: (elem) => {
|
||||||
|
elem.appendChild(this.settingsPanel)
|
||||||
|
}})
|
||||||
|
}else{
|
||||||
|
settingPanel = BDV2.react.createElement("div", {id: `plugin-settings-${this.name}`, className: "plugin-settings"},
|
||||||
|
this.settingsPanel)
|
||||||
|
}
|
||||||
|
}else if(typeof this.settingsPanel === "string"){
|
||||||
|
settingPanel = BVD2.react.createElement("div", {id: `plugin-settings-${this.name}`, className: "plugin-settings", dangerouslySetInnerHTML: {__html: this.settingsPanel}})
|
||||||
|
}
|
||||||
return BDV2.react.createElement("div", {className: "bd-card bd-addon-card settings-open ui-switch-item", ref: "cardNode"},
|
return BDV2.react.createElement("div", {className: "bd-card bd-addon-card settings-open ui-switch-item", ref: "cardNode"},
|
||||||
BDV2.react.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => {
|
BDV2.react.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => {
|
||||||
this.refs.settingspanel.innerHTML = "";
|
this.setState({
|
||||||
this.setState({settings: false});
|
settings: false
|
||||||
|
});
|
||||||
}},
|
}},
|
||||||
BDV2.react.createElement(XSvg, null)
|
BDV2.react.createElement(XSvg, null)
|
||||||
),
|
),
|
||||||
typeof this.settingsPanel === "object" && BDV2.react.createElement("div", {id: `plugin-settings-${this.name}`, className: "plugin-settings", ref: "settingspanel"}),
|
settingPanel
|
||||||
typeof this.settingsPanel !== "object" && BDV2.react.createElement("div", {id: `plugin-settings-${this.name}`, className: "plugin-settings", ref: "settingspanel", dangerouslySetInnerHTML: {__html: this.settingsPanel}})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ export default class BDErrorBoundary extends BDV2.reactComponent {
|
||||||
this.state = {hasError: false};
|
this.state = {hasError: false};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidCatch() {
|
componentDidCatch(error, errorStack) {
|
||||||
|
console.log(error, errorStack)
|
||||||
this.setState({hasError: true});
|
this.setState({hasError: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ export default class EmulatedTooltip {
|
||||||
|
|
||||||
/** Container where the tooltip will be appended. */
|
/** Container where the tooltip will be appended. */
|
||||||
get container() {
|
get container() {
|
||||||
return document.querySelector("."+Utils.removeDa(BDModules.get(e => e.popouts)[0].popouts)+" ~ ."+Utils.removeDa(BDModules.get(e => e.layerContainer)[0].layerContainer));
|
return document.querySelector("."+Utils.removeDa(BDModules.get(e => typeof e.popouts === "string")[0].popouts)+" ~ ."+Utils.removeDa(BDModules.get(e => typeof e.layerContainer === "string")[0].layerContainer));
|
||||||
}
|
}
|
||||||
/** Boolean representing if the tooltip will fit on screen above the element */
|
/** Boolean representing if the tooltip will fit on screen above the element */
|
||||||
get canShowAbove() { return this.node.getBoundingClientRect().top - this.element.offsetHeight >= 0; }
|
get canShowAbove() { return this.node.getBoundingClientRect().top - this.element.offsetHeight >= 0; }
|
||||||
|
|
Binary file not shown.
|
@ -20,9 +20,11 @@ const localStorage = window.localStorage
|
||||||
const UserAgent = electron.ipcRenderer.sendSync("LIGHTCORD_GET_USER_AGENT").replace(/lightcord\/[^ ]+/g, "discord/"+require("../discord_native/renderer/app").getVersion())
|
const UserAgent = electron.ipcRenderer.sendSync("LIGHTCORD_GET_USER_AGENT").replace(/lightcord\/[^ ]+/g, "discord/"+require("../discord_native/renderer/app").getVersion())
|
||||||
electron.ipcRenderer.sendSync("LIGHTCORD_SET_USER_AGENT", UserAgent)
|
electron.ipcRenderer.sendSync("LIGHTCORD_SET_USER_AGENT", UserAgent)
|
||||||
|
|
||||||
exports.init = function(){
|
exports.init = function({
|
||||||
|
isTab
|
||||||
|
}){
|
||||||
if(hasInit == true){
|
if(hasInit == true){
|
||||||
console.warn(new Error("Lightcord has already inited."))
|
console.warn(new Error("Lightcord has already started."))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
formatLogger.log("The app is", isPackaged ? "packaged." : "not packaged.")
|
formatLogger.log("The app is", isPackaged ? "packaged." : "not packaged.")
|
||||||
|
@ -33,6 +35,7 @@ exports.init = function(){
|
||||||
try{
|
try{
|
||||||
if(!global.webpackJsonp)return
|
if(!global.webpackJsonp)return
|
||||||
if(isTab && !hasReplacedLocalstorage){
|
if(isTab && !hasReplacedLocalstorage){
|
||||||
|
console.log("Replacing localStorage...")
|
||||||
hasReplacedLocalstorage = true
|
hasReplacedLocalstorage = true
|
||||||
const localstr = require("localstorage-polyfill")
|
const localstr = require("localstorage-polyfill")
|
||||||
Object.defineProperty(window, "localStorage", {
|
Object.defineProperty(window, "localStorage", {
|
||||||
|
@ -66,10 +69,10 @@ async function privateInit(){
|
||||||
ModuleLoader.get(e => e.getCurrentHub)[0].getCurrentHub().getClient().getOptions().enabled = false
|
ModuleLoader.get(e => e.getCurrentHub)[0].getCurrentHub().getClient().getOptions().enabled = false
|
||||||
|
|
||||||
// setting react in require cache
|
// setting react in require cache
|
||||||
const React = ModuleLoader.get(e => !["Component", "PureComponent", "Children", "createElement", "cloneElement"].find(k => !e[k]))[0]
|
const React = await ensureExported(e => !["Component", "PureComponent", "Children", "createElement", "cloneElement"].find(k => !e[k]))
|
||||||
window.React = React
|
window.React = React
|
||||||
|
|
||||||
const ReactDOM = ModuleLoader.get(e => e.findDOMNode)[0]
|
const ReactDOM = await ensureExported(e => e.findDOMNode)
|
||||||
window.ReactDOM = ReactDOM
|
window.ReactDOM = ReactDOM
|
||||||
|
|
||||||
//stop here if betterdiscord is disabled.
|
//stop here if betterdiscord is disabled.
|
||||||
|
@ -108,7 +111,7 @@ async function privateInit(){
|
||||||
// fix notifications here
|
// fix notifications here
|
||||||
let dispatcher = ModuleLoader.get(m=>m.Dispatcher&&m.default&&m.default.dispatch)[0].default
|
let dispatcher = ModuleLoader.get(m=>m.Dispatcher&&m.default&&m.default.dispatch)[0].default
|
||||||
dispatcher.subscribe("USER_SETTINGS_UPDATE", (data) => {
|
dispatcher.subscribe("USER_SETTINGS_UPDATE", (data) => {
|
||||||
DiscordNative.ipc.send("UPDATE_THEME", data.settings.theme)
|
ipcRenderer.send("DISCORD_UPDATE_THEME", data.settings.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
let constants = ModuleLoader.get(m=>m.API_HOST)[0]
|
let constants = ModuleLoader.get(m=>m.API_HOST)[0]
|
||||||
|
@ -153,11 +156,12 @@ async function privateInit(){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let createSoundOriginal = ModuleLoader.get((e) => e.createSound)[0].createSound
|
let soundModule = await ensureExported((e) => e.createSound)
|
||||||
ModuleLoader.get((e) => e.createSound)[0].createSound = function(sound){
|
let createSound = soundModule.createSound
|
||||||
|
soundModule.createSound = function(sound){
|
||||||
let isCalling = sound === "call_ringing_beat" || sound === "call_ringing"
|
let isCalling = sound === "call_ringing_beat" || sound === "call_ringing"
|
||||||
if(isCalling){
|
if(isCalling){
|
||||||
let returned = createSoundOriginal.call(this, ...arguments)
|
let returned = createSound.call(this, ...arguments)
|
||||||
Object.defineProperty(returned, "name", {
|
Object.defineProperty(returned, "name", {
|
||||||
get(){
|
get(){
|
||||||
return window.Lightcord.Settings.callRingingBeat ? "call_ringing_beat" : "call_ringing"
|
return window.Lightcord.Settings.callRingingBeat ? "call_ringing_beat" : "call_ringing"
|
||||||
|
@ -169,7 +173,7 @@ async function privateInit(){
|
||||||
})
|
})
|
||||||
return returned
|
return returned
|
||||||
}else{
|
}else{
|
||||||
return createSoundOriginal(...arguments)
|
return createSound(...arguments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +191,7 @@ async function privateInit(){
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
window.$ = window.jQuery = require("./jquery.min.js")
|
window.$ = window.jQuery = require("./jquery-3.6.0.slim.min.js")
|
||||||
require("./ace.js")
|
require("./ace.js")
|
||||||
installReactDevtools()
|
installReactDevtools()
|
||||||
|
|
||||||
|
@ -305,7 +309,7 @@ async function privateInit(){
|
||||||
})
|
})
|
||||||
|
|
||||||
dispatcher.subscribe("USER_SETTINGS_UPDATE", (data) => {
|
dispatcher.subscribe("USER_SETTINGS_UPDATE", (data) => {
|
||||||
DiscordNative.ipc.send("UPDATE_THEME", data.settings.theme)
|
ipcRenderer.send("DISCORD_UPDATE_THEME", data.settings.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
require(formatMinified("lightcordapi/js/main{min}.js"))
|
require(formatMinified("lightcordapi/js/main{min}.js"))
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
||||||
const ipcRenderer = require("../discord_native/renderer/ipc")
|
const ipcRenderer = require("electron").ipcRenderer
|
||||||
|
|
||||||
|
|
||||||
if(process.platform === "win32"){
|
if(process.platform === "win32"){
|
||||||
|
@ -98,5 +98,5 @@ let settingStore
|
||||||
ensureExported((e => e.default && e.default.theme))
|
ensureExported((e => e.default && e.default.theme))
|
||||||
.then(themeStore => {
|
.then(themeStore => {
|
||||||
settingStore = themeStore
|
settingStore = themeStore
|
||||||
ipcRenderer.send("UPDATE_THEME", themeStore.default.theme)
|
ipcRenderer.send("DISCORD_UPDATE_THEME", themeStore.default.theme)
|
||||||
}).catch(console.error)
|
}).catch(console.error)
|
|
@ -13,7 +13,7 @@ const {
|
||||||
} = require('electron');
|
} = require('electron');
|
||||||
const fetch = require("node-fetch").default
|
const fetch = require("node-fetch").default
|
||||||
|
|
||||||
let mainScreen;
|
let mainScreen
|
||||||
|
|
||||||
function startup(bootstrapModules) {
|
function startup(bootstrapModules) {
|
||||||
// below modules are required and initted
|
// below modules are required and initted
|
||||||
|
@ -109,7 +109,7 @@ function startup(bootstrapModules) {
|
||||||
global.mainWindowId = Constants.DEFAULT_MAIN_WINDOW_ID;
|
global.mainWindowId = Constants.DEFAULT_MAIN_WINDOW_ID;
|
||||||
global.moduleUpdater = moduleUpdater;
|
global.moduleUpdater = moduleUpdater;
|
||||||
|
|
||||||
const applicationMenu = require('./applicationMenu');
|
let applicationMenu = require('./applicationMenu');
|
||||||
|
|
||||||
if(appSettings().get("isTabs", false)){
|
if(appSettings().get("isTabs", false)){
|
||||||
applicationMenu = applicationMenu.map(e => {
|
applicationMenu = applicationMenu.map(e => {
|
||||||
|
@ -180,7 +180,7 @@ function startup(bootstrapModules) {
|
||||||
let initByUpdate = false
|
let initByUpdate = false
|
||||||
|
|
||||||
if(Date.now() - global.appSettings.get("LAST_UPDATE_CHECK_TIMESTAMP", 0) < 6.48e+8){
|
if(Date.now() - global.appSettings.get("LAST_UPDATE_CHECK_TIMESTAMP", 0) < 6.48e+8){
|
||||||
console.log("Starting with version "+version+" because it haven't been 1 week since the last check.")
|
console.log("Starting with version "+version+" because it hasn't been 1 week since the last check.")
|
||||||
mainScreen.init(false)
|
mainScreen.init(false)
|
||||||
|
|
||||||
const { getWindow: getPopoutWindowByKey } = require('./popoutWindows');
|
const { getWindow: getPopoutWindowByKey } = require('./popoutWindows');
|
||||||
|
|
|
@ -83,13 +83,6 @@ const connectionBackoff = new _Backoff.default(1000, 20000);
|
||||||
const DISCORD_NAMESPACE = 'DISCORD_';
|
const DISCORD_NAMESPACE = 'DISCORD_';
|
||||||
|
|
||||||
let isTabs = false
|
let isTabs = false
|
||||||
function checkCanMigrate() {
|
|
||||||
return _fs.default.existsSync(_path.default.join(paths.getUserData(), 'userDataCache.json'));
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkAlreadyMigrated() {
|
|
||||||
return _fs.default.existsSync(_path.default.join(paths.getUserData(), 'domainMigrated'));
|
|
||||||
}
|
|
||||||
|
|
||||||
const getWebappEndpoint = () => {
|
const getWebappEndpoint = () => {
|
||||||
isTabs = settings.get("isTabs", false)
|
isTabs = settings.get("isTabs", false)
|
||||||
|
@ -447,7 +440,7 @@ function launchMainAppWindow(isVisible) {
|
||||||
} : {
|
} : {
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
webviewTag: false,
|
webviewTag: false,
|
||||||
contextIsolation: true,
|
contextIsolation: false,
|
||||||
preload: _path.default.join(__dirname, 'mainScreenPreload.js')
|
preload: _path.default.join(__dirname, 'mainScreenPreload.js')
|
||||||
}),
|
}),
|
||||||
// NB: this is required in order to give popouts (or any child window opened via window.open w/ nativeWindowOpen)
|
// NB: this is required in order to give popouts (or any child window opened via window.open w/ nativeWindowOpen)
|
||||||
|
@ -494,7 +487,7 @@ function launchMainAppWindow(isVisible) {
|
||||||
mainWindow.webContents.on('new-window', (e, windowURL, frameName, disposition, options) => {
|
mainWindow.webContents.on('new-window', (e, windowURL, frameName, disposition, options) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (frameNames.tartsWith(DISCORD_NAMESPACE) && checkUrlOriginMatches(windowURL, WEBAPP_ENDPOINT) && getSanitizedPath(windowURL) === '/popout') {
|
if (frameName.startsWith(DISCORD_NAMESPACE) && checkUrlOriginMatches(windowURL, WEBAPP_ENDPOINT) && getSanitizedPath(windowURL) === '/popout') {
|
||||||
popoutWindows.openOrFocusWindow(e, windowURL, frameName, options);
|
popoutWindows.openOrFocusWindow(e, windowURL, frameName, options);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ const DiscordNative = {
|
||||||
|
|
||||||
DiscordNative.remoteApp = DiscordNative.app;
|
DiscordNative.remoteApp = DiscordNative.app;
|
||||||
DiscordNative.remotePowerMonitor = DiscordNative.powerMonitor;
|
DiscordNative.remotePowerMonitor = DiscordNative.powerMonitor;
|
||||||
contextBridge.exposeInMainWorld('DiscordNative', DiscordNative);
|
window.DiscordNative = DiscordNative
|
||||||
|
|
||||||
const BetterDiscord = require("./BetterDiscord")
|
const BetterDiscord = require("./BetterDiscord")
|
||||||
process.once('loaded', () => {
|
process.once('loaded', () => {
|
||||||
|
@ -64,7 +64,7 @@ process.once('loaded', () => {
|
||||||
let startTime = Date.now()
|
let startTime = Date.now()
|
||||||
BetterDiscord.init({
|
BetterDiscord.init({
|
||||||
// Detect if tabPreload was used.
|
// Detect if tabPreload was used.
|
||||||
isTab: require.main !== module
|
isTab: false
|
||||||
})
|
})
|
||||||
BetterDiscord.events.on("debug", BetterDiscord.logger.log.bind(BetterDiscord.logger))
|
BetterDiscord.events.on("debug", BetterDiscord.logger.log.bind(BetterDiscord.logger))
|
||||||
BetterDiscord.events.on("ready", () => {
|
BetterDiscord.events.on("ready", () => {
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
const VoiceEngine = require('./discord_voice_'+process.platform+'.node');
|
const VoiceEngine = require('./discord_voice.node');
|
||||||
const ChildProcess = require('child_process');
|
const ChildProcess = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
@ -82,6 +82,7 @@ features.declareSupported('experiment_config');
|
||||||
features.declareSupported('remote_locus_network_control');
|
features.declareSupported('remote_locus_network_control');
|
||||||
features.declareSupported('connection_replay');
|
features.declareSupported('connection_replay');
|
||||||
features.declareSupported('simulcast');
|
features.declareSupported('simulcast');
|
||||||
|
features.declareSupported('direct_video');
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
features.declareSupported('voice_legacy_subsystem');
|
features.declareSupported('voice_legacy_subsystem');
|
||||||
|
@ -120,6 +121,7 @@ function bindConnectionInstance(instance) {
|
||||||
configureConnectionRetries: (baseDelay, maxDelay, maxAttempts) =>
|
configureConnectionRetries: (baseDelay, maxDelay, maxAttempts) =>
|
||||||
instance.configureConnectionRetries(baseDelay, maxDelay, maxAttempts),
|
instance.configureConnectionRetries(baseDelay, maxDelay, maxAttempts),
|
||||||
setOnSpeakingCallback: (callback) => instance.setOnSpeakingCallback(callback),
|
setOnSpeakingCallback: (callback) => instance.setOnSpeakingCallback(callback),
|
||||||
|
setOnSpeakingWhileMutedCallback: (callback) => instance.setOnSpeakingWhileMutedCallback(callback),
|
||||||
setPingInterval: (interval) => instance.setPingInterval(interval),
|
setPingInterval: (interval) => instance.setPingInterval(interval),
|
||||||
setPingCallback: (callback) => instance.setPingCallback(callback),
|
setPingCallback: (callback) => instance.setPingCallback(callback),
|
||||||
setPingTimeoutCallback: (callback) => instance.setPingTimeoutCallback(callback),
|
setPingTimeoutCallback: (callback) => instance.setPingTimeoutCallback(callback),
|
||||||
|
@ -166,7 +168,7 @@ VoiceEngine.createReplayConnection = function (audioEngineId, callback, replayLo
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new VoiceEngine.VoiceReplayConnection(replayLog, audioEngineId, callback);
|
return bindConnectionInstance(new VoiceEngine.VoiceReplayConnection(replayLog, audioEngineId, callback));
|
||||||
};
|
};
|
||||||
|
|
||||||
VoiceEngine.setAudioSubsystem = function (subsystem) {
|
VoiceEngine.setAudioSubsystem = function (subsystem) {
|
||||||
|
|
Binary file not shown.
|
@ -1,5 +1,7 @@
|
||||||
import * as path from "path"
|
import * as path from "path"
|
||||||
|
|
||||||
|
global["modulePath"] = path.join(__dirname, "..", "modules")
|
||||||
|
|
||||||
export default function requireNativeDiscordModule(id){
|
export default function requireNativeDiscordModule(id){
|
||||||
return require(path.join(__dirname, "..", "modules", id))
|
return require(path.join(__dirname, "..", "modules", id))
|
||||||
}
|
}
|
Loading…
Reference in New Issue