mirror of
https://github.com/Lightcord/Lightcord.git
synced 2025-04-12 00:55:40 +02:00
lightcord broken + fix + sex 🤪
This commit is contained in:
parent
dae02359ee
commit
d6ff8c90ab
@ -483,7 +483,7 @@ export default class Utils {
|
||||
}
|
||||
|
||||
function removeDa(className){
|
||||
if(!className)return className
|
||||
if(typeof className !== "string" || !className)return className
|
||||
return className.split(" ").filter(e => !e.startsWith("da-")).join(" ")
|
||||
}
|
||||
|
||||
|
@ -52,9 +52,6 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
||||
|
||||
componentDidUpdate() {
|
||||
if (!this.state.settings) return;
|
||||
if (typeof this.settingsPanel === "object") {
|
||||
this.refs.settingspanel.appendChild(this.settingsPanel);
|
||||
}
|
||||
|
||||
if (!settingsCookie["fork-ps-3"]) return;
|
||||
setImmediate(() => {
|
||||
@ -97,15 +94,28 @@ export default class V2C_PluginCard extends BDV2.reactComponent {
|
||||
try { this.settingsPanel = this.props.addon.plugin.getSettingsPanel(); }
|
||||
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"},
|
||||
BDV2.react.createElement("div", {style: {"float": "right", "cursor": "pointer"}, onClick: () => {
|
||||
this.refs.settingspanel.innerHTML = "";
|
||||
this.setState({settings: false});
|
||||
this.setState({
|
||||
settings: false
|
||||
});
|
||||
}},
|
||||
BDV2.react.createElement(XSvg, null)
|
||||
),
|
||||
typeof this.settingsPanel === "object" && BDV2.react.createElement("div", {id: `plugin-settings-${this.name}`, className: "plugin-settings", ref: "settingspanel"}),
|
||||
typeof this.settingsPanel !== "object" && BDV2.react.createElement("div", {id: `plugin-settings-${this.name}`, className: "plugin-settings", ref: "settingspanel", dangerouslySetInnerHTML: {__html: this.settingsPanel}})
|
||||
settingPanel
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,8 @@ export default class BDErrorBoundary extends BDV2.reactComponent {
|
||||
this.state = {hasError: false};
|
||||
}
|
||||
|
||||
componentDidCatch() {
|
||||
componentDidCatch(error, errorStack) {
|
||||
console.log(error, errorStack)
|
||||
this.setState({hasError: true});
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ export default class EmulatedTooltip {
|
||||
|
||||
/** Container where the tooltip will be appended. */
|
||||
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 */
|
||||
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())
|
||||
electron.ipcRenderer.sendSync("LIGHTCORD_SET_USER_AGENT", UserAgent)
|
||||
|
||||
exports.init = function(){
|
||||
exports.init = function({
|
||||
isTab
|
||||
}){
|
||||
if(hasInit == true){
|
||||
console.warn(new Error("Lightcord has already inited."))
|
||||
console.warn(new Error("Lightcord has already started."))
|
||||
return
|
||||
}
|
||||
formatLogger.log("The app is", isPackaged ? "packaged." : "not packaged.")
|
||||
@ -33,6 +35,7 @@ exports.init = function(){
|
||||
try{
|
||||
if(!global.webpackJsonp)return
|
||||
if(isTab && !hasReplacedLocalstorage){
|
||||
console.log("Replacing localStorage...")
|
||||
hasReplacedLocalstorage = true
|
||||
const localstr = require("localstorage-polyfill")
|
||||
Object.defineProperty(window, "localStorage", {
|
||||
@ -66,10 +69,10 @@ async function privateInit(){
|
||||
ModuleLoader.get(e => e.getCurrentHub)[0].getCurrentHub().getClient().getOptions().enabled = false
|
||||
|
||||
// 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
|
||||
|
||||
const ReactDOM = ModuleLoader.get(e => e.findDOMNode)[0]
|
||||
const ReactDOM = await ensureExported(e => e.findDOMNode)
|
||||
window.ReactDOM = ReactDOM
|
||||
|
||||
//stop here if betterdiscord is disabled.
|
||||
@ -108,7 +111,7 @@ async function privateInit(){
|
||||
// fix notifications here
|
||||
let dispatcher = ModuleLoader.get(m=>m.Dispatcher&&m.default&&m.default.dispatch)[0].default
|
||||
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]
|
||||
@ -153,11 +156,12 @@ async function privateInit(){
|
||||
return
|
||||
}
|
||||
|
||||
let createSoundOriginal = ModuleLoader.get((e) => e.createSound)[0].createSound
|
||||
ModuleLoader.get((e) => e.createSound)[0].createSound = function(sound){
|
||||
let soundModule = await ensureExported((e) => e.createSound)
|
||||
let createSound = soundModule.createSound
|
||||
soundModule.createSound = function(sound){
|
||||
let isCalling = sound === "call_ringing_beat" || sound === "call_ringing"
|
||||
if(isCalling){
|
||||
let returned = createSoundOriginal.call(this, ...arguments)
|
||||
let returned = createSound.call(this, ...arguments)
|
||||
Object.defineProperty(returned, "name", {
|
||||
get(){
|
||||
return window.Lightcord.Settings.callRingingBeat ? "call_ringing_beat" : "call_ringing"
|
||||
@ -169,7 +173,7 @@ async function privateInit(){
|
||||
})
|
||||
return returned
|
||||
}else{
|
||||
return createSoundOriginal(...arguments)
|
||||
return createSound(...arguments)
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +191,7 @@ async function privateInit(){
|
||||
return undefined
|
||||
}
|
||||
|
||||
window.$ = window.jQuery = require("./jquery.min.js")
|
||||
window.$ = window.jQuery = require("./jquery-3.6.0.slim.min.js")
|
||||
require("./ace.js")
|
||||
installReactDevtools()
|
||||
|
||||
@ -305,7 +309,7 @@ async function privateInit(){
|
||||
})
|
||||
|
||||
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"))
|
||||
|
2
modules/discord_desktop_core/core/app/BetterDiscord/jquery-3.6.0.slim.min.js
vendored
Normal file
2
modules/discord_desktop_core/core/app/BetterDiscord/jquery-3.6.0.slim.min.js
vendored
Normal file
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"){
|
||||
@ -98,5 +98,5 @@ let settingStore
|
||||
ensureExported((e => e.default && e.default.theme))
|
||||
.then(themeStore => {
|
||||
settingStore = themeStore
|
||||
ipcRenderer.send("UPDATE_THEME", themeStore.default.theme)
|
||||
ipcRenderer.send("DISCORD_UPDATE_THEME", themeStore.default.theme)
|
||||
}).catch(console.error)
|
@ -13,7 +13,7 @@ const {
|
||||
} = require('electron');
|
||||
const fetch = require("node-fetch").default
|
||||
|
||||
let mainScreen;
|
||||
let mainScreen
|
||||
|
||||
function startup(bootstrapModules) {
|
||||
// below modules are required and initted
|
||||
@ -109,7 +109,7 @@ function startup(bootstrapModules) {
|
||||
global.mainWindowId = Constants.DEFAULT_MAIN_WINDOW_ID;
|
||||
global.moduleUpdater = moduleUpdater;
|
||||
|
||||
const applicationMenu = require('./applicationMenu');
|
||||
let applicationMenu = require('./applicationMenu');
|
||||
|
||||
if(appSettings().get("isTabs", false)){
|
||||
applicationMenu = applicationMenu.map(e => {
|
||||
@ -180,7 +180,7 @@ function startup(bootstrapModules) {
|
||||
let initByUpdate = false
|
||||
|
||||
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)
|
||||
|
||||
const { getWindow: getPopoutWindowByKey } = require('./popoutWindows');
|
||||
|
@ -83,13 +83,6 @@ const connectionBackoff = new _Backoff.default(1000, 20000);
|
||||
const DISCORD_NAMESPACE = 'DISCORD_';
|
||||
|
||||
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 = () => {
|
||||
isTabs = settings.get("isTabs", false)
|
||||
@ -447,7 +440,7 @@ function launchMainAppWindow(isVisible) {
|
||||
} : {
|
||||
nodeIntegration: false,
|
||||
webviewTag: false,
|
||||
contextIsolation: true,
|
||||
contextIsolation: false,
|
||||
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)
|
||||
@ -494,7 +487,7 @@ function launchMainAppWindow(isVisible) {
|
||||
mainWindow.webContents.on('new-window', (e, windowURL, frameName, disposition, options) => {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ const DiscordNative = {
|
||||
|
||||
DiscordNative.remoteApp = DiscordNative.app;
|
||||
DiscordNative.remotePowerMonitor = DiscordNative.powerMonitor;
|
||||
contextBridge.exposeInMainWorld('DiscordNative', DiscordNative);
|
||||
window.DiscordNative = DiscordNative
|
||||
|
||||
const BetterDiscord = require("./BetterDiscord")
|
||||
process.once('loaded', () => {
|
||||
@ -64,7 +64,7 @@ process.once('loaded', () => {
|
||||
let startTime = Date.now()
|
||||
BetterDiscord.init({
|
||||
// Detect if tabPreload was used.
|
||||
isTab: require.main !== module
|
||||
isTab: false
|
||||
})
|
||||
BetterDiscord.events.on("debug", BetterDiscord.logger.log.bind(BetterDiscord.logger))
|
||||
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 fs = require('fs');
|
||||
const path = require('path');
|
||||
@ -82,6 +82,7 @@ features.declareSupported('experiment_config');
|
||||
features.declareSupported('remote_locus_network_control');
|
||||
features.declareSupported('connection_replay');
|
||||
features.declareSupported('simulcast');
|
||||
features.declareSupported('direct_video');
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
features.declareSupported('voice_legacy_subsystem');
|
||||
@ -120,6 +121,7 @@ function bindConnectionInstance(instance) {
|
||||
configureConnectionRetries: (baseDelay, maxDelay, maxAttempts) =>
|
||||
instance.configureConnectionRetries(baseDelay, maxDelay, maxAttempts),
|
||||
setOnSpeakingCallback: (callback) => instance.setOnSpeakingCallback(callback),
|
||||
setOnSpeakingWhileMutedCallback: (callback) => instance.setOnSpeakingWhileMutedCallback(callback),
|
||||
setPingInterval: (interval) => instance.setPingInterval(interval),
|
||||
setPingCallback: (callback) => instance.setPingCallback(callback),
|
||||
setPingTimeoutCallback: (callback) => instance.setPingTimeoutCallback(callback),
|
||||
@ -166,7 +168,7 @@ VoiceEngine.createReplayConnection = function (audioEngineId, callback, replayLo
|
||||
return null;
|
||||
}
|
||||
|
||||
return new VoiceEngine.VoiceReplayConnection(replayLog, audioEngineId, callback);
|
||||
return bindConnectionInstance(new VoiceEngine.VoiceReplayConnection(replayLog, audioEngineId, callback));
|
||||
};
|
||||
|
||||
VoiceEngine.setAudioSubsystem = function (subsystem) {
|
||||
|
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
import * as path from "path"
|
||||
|
||||
global["modulePath"] = path.join(__dirname, "..", "modules")
|
||||
|
||||
export default function requireNativeDiscordModule(id){
|
||||
return require(path.join(__dirname, "..", "modules", id))
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user