2020-07-28 03:29:41 +02:00
module . exports =
/******/ ( 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 , { enumerable : true , get : getter } ) ;
/******/ }
/******/ } ;
/******/
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = function ( exports ) {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
/******/ } ;
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ _ _webpack _require _ _ . t = function ( value , mode ) {
/******/ if ( mode & 1 ) value = _ _webpack _require _ _ ( value ) ;
/******/ if ( mode & 8 ) return value ;
/******/ if ( ( mode & 4 ) && typeof value === 'object' && value && value . _ _esModule ) return value ;
/******/ var ns = Object . create ( null ) ;
/******/ _ _webpack _require _ _ . r ( ns ) ;
/******/ Object . defineProperty ( ns , 'default' , { enumerable : true , value : value } ) ;
/******/ if ( mode & 2 && typeof value != 'string' ) for ( var key in value ) _ _webpack _require _ _ . d ( ns , key , function ( key ) { return value [ key ] ; } . bind ( null , key ) ) ;
/******/ return ns ;
/******/ } ;
/******/
/******/ // 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__
2020-08-20 13:42:23 +02:00
/******/ _ _webpack _require _ _ . p = "" ;
2020-07-28 03:29:41 +02:00
/******/
/******/
/******/ // Load entry module and return exports
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = "./src/index.js" ) ;
/******/ } )
/************************************************************************/
/******/ ( {
/***/ "./src/0globals.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / 0 globals . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * /
2020-08-14 21:58:19 +02:00
/*! exports provided: minimumDiscordVersion, currentDiscordVersion, minSupportedVersion, bbdVersion, bbdChangelog, settings, defaultCookie, settingsCookie, settingsRPC, defaultRPC, lightcordSettings, defaultLightcordSettings, bdpluginErrors, bdthemeErrors, bdConfig, bdthemes, bdplugins, pluginCookie, themeCookie */
2020-07-28 03:29:41 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "minimumDiscordVersion" , function ( ) { return minimumDiscordVersion ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "currentDiscordVersion" , function ( ) { return currentDiscordVersion ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "minSupportedVersion" , function ( ) { return minSupportedVersion ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "bbdVersion" , function ( ) { return bbdVersion ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "bbdChangelog" , function ( ) { return bbdChangelog ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "settings" , function ( ) { return settings ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "defaultCookie" , function ( ) { return defaultCookie ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "settingsCookie" , function ( ) { return settingsCookie ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "settingsRPC" , function ( ) { return settingsRPC ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "defaultRPC" , function ( ) { return defaultRPC ; } ) ;
2020-08-14 21:58:19 +02:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "lightcordSettings" , function ( ) { return lightcordSettings ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "defaultLightcordSettings" , function ( ) { return defaultLightcordSettings ; } ) ;
2020-07-28 03:29:41 +02:00
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "bdpluginErrors" , function ( ) { return bdpluginErrors ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "bdthemeErrors" , function ( ) { return bdthemeErrors ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "bdConfig" , function ( ) { return bdConfig ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "bdthemes" , function ( ) { return bdthemes ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "bdplugins" , function ( ) { return bdplugins ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "pluginCookie" , function ( ) { return pluginCookie ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "themeCookie" , function ( ) { return themeCookie ; } ) ;
2020-09-12 14:52:50 +02:00
const minimumDiscordVersion = "0.0.308" ;
const currentDiscordVersion = window . DiscordNative && window . DiscordNative . remoteApp && window . DiscordNative . remoteApp . getVersion && window . DiscordNative . remoteApp . getVersion ( ) || "0.0.308" ;
2020-07-28 03:29:41 +02:00
const minSupportedVersion = "0.3.0" ;
const bbdVersion = "0.3.5" ;
const bbdChangelog = {
2020-07-28 18:55:37 +02:00
description : "Big things are coming." ,
2020-07-28 03:29:41 +02:00
changes : [ {
title : "Bug Fixes" ,
type : "fixed" ,
items : [ "Some fixes related to showing modals in the `BdApi`." , "Fixed the open folder buttons for plugins and themes" ]
} ]
} ;
const settings = {
"Custom css live update" : {
id : "bda-css-0" ,
info : "" ,
implemented : true ,
hidden : true ,
cat : "core"
} ,
"Custom css auto udpate" : {
id : "bda-css-1" ,
info : "" ,
implemented : true ,
hidden : true ,
cat : "core"
} ,
"BetterDiscord Blue" : {
id : "bda-gs-b" ,
info : "Replace Discord blue with BD Blue" ,
implemented : false ,
hidden : false ,
cat : "core"
} ,
/* Core */
/* ====== */
"Public Servers" : {
id : "bda-gs-1" ,
info : "Display public servers button" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Minimal Mode" : {
id : "bda-gs-2" ,
info : "Hide elements and reduce the size of elements." ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Voice Mode" : {
id : "bda-gs-4" ,
info : "Only show voice chat" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Hide Channels" : {
id : "bda-gs-3" ,
info : "Hide channels in minimal mode" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Dark Mode" : {
id : "bda-gs-5" ,
info : "Make certain elements dark by default(wip)" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Voice Disconnect" : {
id : "bda-dc-0" ,
info : "Disconnect from voice server when closing Discord" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"24 Hour Timestamps" : {
id : "bda-gs-6" ,
info : "Replace 12hr timestamps with proper ones" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Colored Text" : {
id : "bda-gs-7" ,
info : "Make text color the same as role color" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
"Normalize Classes" : {
id : "fork-ps-4" ,
info : "Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "modules"
} ,
/* Content */
"Content Error Modal" : {
id : "fork-ps-1" ,
info : "Shows a modal with plugin/theme errors" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
"Scan Plugins" : {
id : "fork-ps-6" ,
info : "Scan plugins for any threat that can be hidden inside." ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
"Show Toasts" : {
id : "fork-ps-2" ,
info : "Shows a small notification for important information" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
"Scroll To Settings" : {
id : "fork-ps-3" ,
info : "Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
"Automatic Loading" : {
id : "fork-ps-5" ,
info : "Automatically loads, reloads, and unloads plugins and themes" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
"Enable Edit Button" : {
id : "fork-ps-7" ,
info : "Enable an Edit Button on the plugin and theme panel." ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager"
} ,
"Themes in Popout Window" : {
id : "lightcord-9" ,
info : "Enable themes in Popout Window. (For example, when detaching screenshare.)" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "content manager" ,
experimental : true
} ,
/* Developer */
"Developer Mode" : {
id : "bda-gs-8" ,
info : "Developer Mode Toggle" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "developer settings"
} ,
"Copy Selector" : {
id : "fork-dm-1" ,
info : "Adds a \"Copy Selector\" option to context menus when developer mode is active" ,
implemented : true ,
hidden : false ,
cat : "core" ,
category : "developer settings"
} ,
/** Lightcord */
"Disable BetterDiscord" : {
id : "bd-disable" ,
info : "Disable Betterdiscord (plugins, themes, etc) (Not implemented)." ,
implemented : false ,
hidden : false ,
cat : "lightcord" ,
category : "Lightcord"
} ,
"Blur Personal Information" : {
id : "lightcord-6" ,
info : "Blur sensitive informations like email, payment infos and more." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
category : "Lightcord"
} ,
"Calling Ring Beat" : {
id : "lightcord-2" ,
info : "Enable Discord's special calling beat." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
category : "Lightcord"
} ,
"Developer Options" : {
id : "lightcord-1" ,
info : "Enable Discord's & Lightcord's Internal Developer Options. This allow the \"Experiments\" tab, the \"Developer Options\" tab and the \"Lightcord Api\" section." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
category : "Lightcord"
} ,
"Ad Block" : {
id : "lightcord-4" ,
info : "Block any BOT that dms you with an invite link. Even in an embed." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
category : "Lightcord"
} ,
"Enable Lightcord Servers" : {
id : "lightcord-5" ,
info : "Enable Lightcord's servers. Disabling this will disable custom badges." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
category : "Lightcord"
} ,
"Disable typing" : {
id : "lightcord-7" ,
info : "Don't let other see you're typing." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
category : "Lightcord"
} ,
"Lightcord Tabs" : {
id : "lightcord-8" ,
info : "Allows you to launch multiple instances of Lightcord in the same window." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
category : "Lightcord" ,
experimental : true
} ,
"Use Notification Shim" : {
id : "lightcord-10" ,
info : "Basically don't use Windows's Notifications." ,
implemented : true ,
hidden : process . platform !== "win32" ,
cat : "lightcord" ,
2020-09-17 12:06:02 +02:00
category : "Lightcord"
} ,
"Emoji Prefix" : {
id : "lightcord-11" ,
info : "Change the prefix used for free nitros emojis. Please put only one character. Default: ." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
2020-07-28 03:29:41 +02:00
category : "Lightcord" ,
2020-09-17 12:06:02 +02:00
default : "."
2020-07-28 03:29:41 +02:00
} ,
/** Lightcord Window */
"Always-on-Top" : {
id : "lightcord-3" ,
info : "Enable the window's Always-on-Top mode, where Lightcord stays on top of other applications." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
category : "Window"
} ,
"No Window Bounds" : {
id : "no_window_bound" ,
info : "Disable Window Bounds. Can be useful if you use a window manager." ,
implemented : true ,
hidden : process . platform !== "linux" ,
cat : "lightcord" ,
category : "Window"
} ,
"Enable Glasstron" : {
id : "enable_glasstron" ,
info : "Enable Glasstron. If you're not using transparent themes, this can reduce lag." ,
implemented : true ,
hidden : false ,
cat : "lightcord" ,
category : "Window"
} ,
/** RichPresence */
"Enable" : {
id : "lightcord-presence-1" ,
info : "Enable RichPresence below." ,
implemented : true ,
hidden : false ,
cat : "status"
}
} ;
const defaultCookie = {
"bda-gs-1" : true ,
"bda-gs-2" : false ,
"bda-gs-3" : false ,
"bda-gs-4" : false ,
"bda-gs-5" : true ,
"bda-gs-6" : false ,
"bda-gs-7" : false ,
2020-07-28 18:55:37 +02:00
"bda-gs-8" : false ,
2020-07-28 03:29:41 +02:00
"bda-es-0" : true ,
"bda-es-1" : true ,
"bda-es-2" : true ,
"bda-es-4" : false ,
"bda-es-6" : true ,
"bda-es-7" : true ,
"bda-gs-b" : false ,
"bda-es-8" : true ,
"bda-dc-0" : false ,
"bda-css-0" : false ,
"bda-css-1" : false ,
"bda-es-9" : true ,
"fork-dm-1" : false ,
"fork-ps-1" : true ,
"fork-ps-2" : true ,
"fork-ps-3" : true ,
"fork-ps-4" : true ,
"fork-ps-5" : true ,
"fork-ps-6" : true ,
"fork-ps-7" : false ,
"fork-es-2" : false ,
"fork-es-3" : true ,
"fork-wp-1" : false ,
"fork-wp-2" : false ,
"fork-beta" : true ,
"lightcord-1" : false ,
"lightcord-2" : true ,
"lightcord-presence-1" : false ,
"lightcord-3" : false ,
"lightcord-4" : false ,
"lightcord-5" : true ,
"lightcord-6" : true ,
"lightcord-7" : false ,
"lightcord-8" : false ,
"lightcord-9" : false ,
"lightcord-10" : false ,
"no_window_bound" : false
} ;
const settingsCookie = { } ;
const settingsRPC = { } ;
const defaultRPC = {
"name" : "Lightcord" ,
"application_id" : "711416957718757418" ,
"state" : "Lightcord Client" ,
"details" : "Browsing Discord" ,
"timestamps.start" : Date . now ( ) ,
"assets.small" : null ,
"assets.large" : "712323821037682791"
} ;
2020-08-14 21:58:19 +02:00
const lightcordSettings = { } ;
const defaultLightcordSettings = { } ;
2020-07-28 03:29:41 +02:00
const bdpluginErrors = [ ] ;
const bdthemeErrors = [ ] ; // define for backwards compatibility
const bdConfig = Object . create ( BetterDiscordConfig ) ;
const bdthemes = { } ;
const bdplugins = { } ;
const pluginCookie = { } ;
const themeCookie = { } ;
/***/ } ) ,
/***/ "./src/index.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / index . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return CoreWrapper ; } ) ;
/* harmony import */ var _localStorageFix _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./localStorageFix */ "./src/localStorageFix.js" ) ;
/* harmony import */ var _loadingIcon _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./loadingIcon */ "./src/loadingIcon.js" ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _modules _bdApi _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./modules/bdApi */ "./src/modules/bdApi.js" ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _modules _pluginModule _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./modules/pluginModule */ "./src/modules/pluginModule.js" ) ;
/* harmony import */ var _modules _themeModule _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./modules/themeModule */ "./src/modules/themeModule.js" ) ;
/* harmony import */ var _modules _utils _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./modules/utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _modules _bdEvents _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./modules/bdEvents */ "./src/modules/bdEvents.js" ) ;
/* harmony import */ var _modules _settingsPanel _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./modules/settingsPanel */ "./src/modules/settingsPanel.js" ) ;
/* harmony import */ var _modules _dataStore _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ./modules/dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _modules _contentManager _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ./modules/contentManager */ "./src/modules/contentManager.js" ) ;
/* harmony import */ var _modules _classNormalizer _ _WEBPACK _IMPORTED _MODULE _12 _ _ = _ _webpack _require _ _ ( /*! ./modules/classNormalizer */ "./src/modules/classNormalizer.js" ) ;
/* harmony import */ var _modules _core _ _WEBPACK _IMPORTED _MODULE _13 _ _ = _ _webpack _require _ _ ( /*! ./modules/core */ "./src/modules/core.js" ) ;
Object ( _localStorageFix _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] ) ( ) ;
Object ( _loadingIcon _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] ) ( ) ;
const deprecateGlobal = ( key , value ) => {
Object . defineProperty ( window , key , {
get ( ) {
_modules _utils _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . warn ( "Deprecated Global" , ` " ${ key } " will be removed in future versions. Please only use BdApi. ` ) ;
return value ;
}
} ) ;
} ;
const globalKeys = Object . keys ( _0globals _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
for ( const key of globalKeys ) deprecateGlobal ( key , _0globals _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ key ] ) ;
deprecateGlobal ( "BDV2" , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] ) ;
deprecateGlobal ( "pluginModule" , _modules _pluginModule _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] ) ;
deprecateGlobal ( "themeModule" , _modules _themeModule _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] ) ;
deprecateGlobal ( "Utils" , _modules _utils _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] ) ;
deprecateGlobal ( "BDEvents" , _modules _bdEvents _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] ) ;
deprecateGlobal ( "settingsPanel" , _modules _settingsPanel _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] ) ;
deprecateGlobal ( "DataStore" , _modules _dataStore _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] ) ;
deprecateGlobal ( "ContentManager" , _modules _contentManager _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] ) ;
deprecateGlobal ( "ClassNormalizer" , _modules _classNormalizer _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] ) ;
window . BdApi = _modules _bdApi _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] ;
deprecateGlobal ( "mainCore" , _modules _core _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] ) ; // TODO: Change Init mode and stop using CoreWrapper.
class CoreWrapper {
constructor ( bdConfig , methods ) {
_modules _core _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] . setConfig ( bdConfig ) ;
_modules _core _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] . setMethods ( methods ) ;
}
init ( ) {
// deprecateGlobal("mainCore", this.mainCore);
_modules _core _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] . init ( ) ;
}
}
/***/ } ) ,
/***/ "./src/loadingIcon.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / loadingIcon . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( ( ) => {
const v2Loader = document . createElement ( "div" ) ;
v2Loader . className = "bd-loaderv2" ;
v2Loader . title = "BandagedBD is loading..." ;
document . body . appendChild ( v2Loader ) ;
} ) ;
/***/ } ) ,
/***/ "./src/localStorageFix.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / localStorageFix . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( function ( ) {
const contentWindowGetter = Object . getOwnPropertyDescriptor ( HTMLIFrameElement . prototype , "contentWindow" ) . get ;
Object . defineProperty ( HTMLIFrameElement . prototype , "contentWindow" , {
get : function ( ) {
const contentWindow = Reflect . apply ( contentWindowGetter , this , arguments ) ;
return new Proxy ( contentWindow , {
getOwnPropertyDescriptor : function ( obj , prop ) {
if ( prop === "localStorage" ) return undefined ;
return Object . getOwnPropertyDescriptor ( obj , prop ) ;
} ,
get : function ( obj , prop ) {
if ( prop === "localStorage" ) return null ;
const val = obj [ prop ] ;
if ( typeof val === "function" ) return val . bind ( obj ) ;
return val ;
}
} ) ;
}
} ) ; // Prevent interception by patching Reflect.apply and Function.prototype.bind
Object . defineProperty ( Reflect , "apply" , {
value : Reflect . apply ,
writable : false ,
configurable : false
} ) ;
Object . defineProperty ( Function . prototype , "bind" , {
value : Function . prototype . bind ,
writable : false ,
configurable : false
} ) ;
const oOpen = XMLHttpRequest . prototype . open ;
XMLHttpRequest . prototype . open = function ( ) {
const url = arguments [ 1 ] ;
if ( url . toLowerCase ( ) . includes ( "api/webhooks" ) ) return null ;
return Reflect . apply ( oOpen , this , arguments ) ;
} ;
} ) ;
/***/ } ) ,
/***/ "./src/modules/24hour.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / 24 hour . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class TFHour {
inject24Hour ( ) {
if ( this . cancel24Hour ) return ;
const twelveHour = new RegExp ( ` ([0-9]{1,2}):([0-9]{1,2}) \\ s(AM|PM) ` ) ;
const convert = data => {
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-6" ] ) return ;
const matched = data . returnValue . match ( twelveHour ) ;
if ( ! matched || matched . length !== 4 ) return ;
if ( matched [ 3 ] === "AM" ) return data . returnValue = data . returnValue . replace ( matched [ 0 ] , ` ${ matched [ 1 ] === "12" ? "00" : matched [ 1 ] . padStart ( 2 , "0" ) } : ${ matched [ 2 ] } ` ) ;
return data . returnValue = data . returnValue . replace ( matched [ 0 ] , ` ${ matched [ 1 ] === "12" ? "12" : parseInt ( matched [ 1 ] ) + 12 } : ${ matched [ 2 ] } ` ) ;
} ;
const cancelCozy = _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . monkeyPatch ( _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . TimeFormatter , "calendarFormat" , {
after : convert
} ) ; // Called in Cozy mode
const cancelCompact = _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . monkeyPatch ( _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . TimeFormatter , "dateFormat" , {
after : convert
} ) ; // Called in Compact mode
this . cancel24Hour = ( ) => {
cancelCozy ( ) ;
cancelCompact ( ) ;
} ; // Cancel both
}
remove24Hour ( ) {
if ( this . cancel24Hour ) this . cancel24Hour ( ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/AntiAdDM.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / AntiAdDM . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
const dispatcher = window . Lightcord . DiscordModules . dispatcher ;
const ChannelModule = BDModules . get ( e => e . default && e . default . getChannel && e . default . hasChannel ) [ 0 ] . default ;
let relationShipModule = BDModules . get ( e => e . default && e . default . addRelationship ) [ 0 ] ;
let DMModule = BDModules . get ( e => e . default && e . default . closePrivateChannel ) [ 0 ] ;
const blocked = { } ;
let userModule = BDModules . get ( e => e . default && e . default . getCurrentUser ) [ 0 ] ;
function getCurrentUser ( ) {
if ( userModule ) return userModule . default . getCurrentUser ( ) ;
return null ;
}
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class AntiBotDM {
constructor ( ) {
this . antiDM = this . antiDM . bind ( this ) ;
this . enabled = false ;
}
enable ( ) {
if ( this . enabled ) return ;
this . enabled = true ;
dispatcher . subscribe ( "MESSAGE_CREATE" , this . antiDM ) ;
}
disable ( ) {
if ( ! this . enabled ) return ;
this . enabled = false ;
dispatcher . unsubscribe ( "MESSAGE_CREATE" , this . antiDM ) ;
}
antiDM ( ev ) {
if ( ! ev . message . author . bot ) return ;
if ( ev . message . author . id === getCurrentUser ( ) . id ) if ( ev . message . guild _id ) return ;
const channel = ChannelModule . getChannel ( ev . message . channel _id ) ;
if ( ! channel ) return ; // might be broken
if ( channel . type !== 1 ) return ;
if ( blocked [ ev . message . author . id ] ) return ; // If the user unblock the bot, Don't block it again.
if ( scanMessage ( ev . message ) ) {
blocked [ ev . message . author . id ] = true ;
_utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . showToast ( ` [AdBlock]: Blocked ${ ev . message . author . username } # ${ ev . message . author . discriminator } ` , {
"type" : "warning"
} ) ;
if ( ! relationShipModule ) relationShipModule = BDModules . get ( e => e . default && e . default . addRelationship ) [ 0 ] ;
relationShipModule . default . addRelationship ( ev . message . author . id , {
location : "ContextMenu"
} , 2 ) ;
if ( ! DMModule ) DMModule = BDModules . get ( e => e . default && e . default . closePrivateChannel ) [ 0 ] ;
DMModule . default . closePrivateChannel ( channel . id , false ) ;
}
}
} ( ) ) ;
function scanMessage ( message ) {
if ( /(discord\.gg|discord\.com\/invite\/|discordapp\.com\/invite\/)/g . test ( message . content ) ) return true ;
if ( EmbedsContains ( message , "discord.gg/" ) || EmbedsContains ( message , "discord.com/invite/" ) || EmbedsContains ( message , "discordapp.com/invite/" ) ) return true ;
return false ;
}
function EmbedsContains ( message , search ) {
let embeds = message . embeds || [ ] ;
if ( embeds . length === 0 ) return false ;
return embeds . map ( embed => {
if ( embed . type !== "rich" ) return false ;
if ( ( embed . title || "" ) . includes ( search ) ) return true ;
if ( ( embed . description || "" ) . includes ( search ) ) return true ;
if ( ( ( embed . footer || "" ) && embed . footer . text || "" ) . includes ( search ) ) return true ;
if ( ( embed . fields || [ ] ) . map ( e => {
return e . value . includes ( search ) || e . name . includes ( search ) ;
} ) . includes ( true ) ) return true ;
return false ;
} ) . includes ( true ) ;
}
/***/ } ) ,
/***/ "./src/modules/CustomRichPresence.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / CustomRichPresence . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
const dispatcher = BDModules . get ( m => m . Dispatcher && m . default && m . default . dispatch ) [ 0 ] . default ;
const ActionTypes = BDModules . get ( m => m . ActionTypes ) [ 0 ] . ActionTypes ;
const socketId = "lightcord-spoof-socket" ;
const pid = process . pid ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class CustomRichPresence {
constructor ( ) {
this . enabled = false ;
this . game = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsRPC" ] ;
}
get formatedGame ( ) {
if ( ! this . game ) return null ;
if ( this . enabled === false ) return null ;
let game = {
name : this . game . name || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "defaultRPC" ] . name ,
application _id : this . game . application _id || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "defaultRPC" ] . application _id ,
details : this . game . details || undefined ,
state : this . game . state || undefined ,
timestamps : this . game [ "timestamps.start" ] ? {
start : this . game [ "timestamps.start" ]
} : undefined ,
assets : this . game [ "assets.large" ] ? {
large _image : this . game [ "assets.large" ] ,
small _image : this . game [ "assets.small" ] || undefined
} : undefined
} ;
return game ;
}
sendGame ( ) {
dispatcher . dispatch ( {
type : ActionTypes . LOCAL _ACTIVITY _UPDATE ,
socketId ,
pid ,
activity : this . formatedGame
} ) ;
}
enable ( ) {
if ( this . enabled ) return ;
this . enabled = true ;
console . log ( "Enabling custom RichPresence" ) ;
this . set ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsRPC" ] || Object . create ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "defaultRPC" ] ) ) ;
this . sendGame ( ) ;
}
disable ( ) {
if ( ! this . enabled ) return ;
this . enabled = false ;
console . log ( "Disabling custom RichPresence" ) ;
this . sendGame ( ) ;
}
async fetchAssets ( applicationId ) {
let assets = await BDModules . get ( e => e . getAssets ) [ 0 ] . getAssets ( applicationId ) ;
if ( assets . undefined && typeof assets . undefined === "number" ) {
throw new Error ( "Unknown Application" ) ;
}
return assets ;
}
set ( activity ) {
this . game = activity ;
this . sendGame ( ) ;
}
} ( ) ) ;
/***/ } ) ,
2020-08-12 01:28:21 +02:00
/***/ "./src/modules/Layers.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / Layers . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default, Layer */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Layer" , function ( ) { return Layer ; } ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _distant _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./distant */ "./src/modules/distant.js" ) ;
/* harmony import */ var crypto _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! crypto */ "crypto" ) ;
/* harmony import */ var crypto _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( crypto _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
function _extends ( ) { _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ; return _extends . apply ( this , arguments ) ; }
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class Layers {
constructor ( ) {
this . layers = [ ] ;
window . Lightcord . BetterDiscord . Layers = this ;
}
get isInjected ( ) {
return ! ! document . querySelector ( "div.Layers.injected" ) ;
}
inject ( ) {
if ( this . isInjected ) return ;
let [ classNameLayers ] = [ _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . removeDa ( _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . WebpackModules . find ( e => e . layers && e . layer ) . layers ) ] ;
const layers = document . querySelector ( "." + classNameLayers ) ;
if ( ! layers ) return false ;
const ReactInstance = Lightcord . Api . Utils . FindReact ( layers , 1 ) ;
if ( ! ReactInstance ) return layers ;
this . ReactInstance = ReactInstance ;
let render = ReactInstance . render ;
ReactInstance . render = ( ) => {
let returnValue = render . call ( ReactInstance ) ;
let classList = returnValue . props . children [ 1 ] . props . className . split ( " " ) ;
classList . push ( "Layers" ) ;
classList . push ( "injected" ) ;
returnValue . props . children [ 1 ] . props . className = classList . join ( " " ) ;
this . layers . forEach ( layer => {
returnValue . props . children [ 1 ] . props . children . push ( layer [ 1 ] ) ;
} ) ;
return returnValue ;
} ;
ReactInstance . forceUpdate ( ) ;
}
createLayer ( children , props = { } ) {
let id = Object ( _distant _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "uuidv4" ] ) ( ) ;
let layer = null ;
this . layers . push ( [ id , /*#__PURE__*/ React . createElement ( Layer , _extends ( { } , props , {
getLayer : lay => {
layer = lay ;
} ,
key : id ,
id : id ,
remove : ( ) => {
let index = this . layers . findIndex ( e => e [ 0 ] === id ) ;
if ( index === - 1 ) return ;
this . layers . splice ( index , 1 ) ;
layer = null ;
if ( this . ReactInstance ) this . ReactInstance . forceUpdate ( ) ;
this . inject ( ) ;
}
} ) , children ) ] ) ;
if ( this . ReactInstance ) this . ReactInstance . forceUpdate ( ) ;
this . inject ( ) ;
return {
remove : ( ) => {
if ( ! layer ) {
let index = this . layers . findIndex ( e => e [ 0 ] === id ) ;
if ( index === - 1 ) return ;
this . layers . splice ( index , 1 ) ;
layer = null ;
if ( this . ReactInstance ) this . ReactInstance . forceUpdate ( ) ;
this . inject ( ) ;
} else {
layer . remove ( ) ;
}
}
} ;
}
} ( ) ) ;
let LayerModules ;
class Layer extends React . Component {
constructor ( ) {
super ( ... arguments ) ;
this . state = {
animation : new this . modules [ 0 ] . default . Value ( 0 )
} ;
this . props . getLayer ( this ) ;
this . keydown = this . keydown . bind ( this ) ;
}
keydown ( e ) {
if ( e . which === 27 ) {
this . remove ( ) ;
}
}
get modules ( ) {
return LayerModules || ( LayerModules = [ _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . WebpackModules . find ( e => e . default && e . default . Value && e . default . div ) ] ) ;
}
componentWillUnmount ( ) {
window . removeEventListener ( "keydown" , this . keydown ) ;
}
componentDidMount ( ev ) {
window . addEventListener ( "keydown" , this . keydown ) ;
}
remove ( ) {
this . props . remove ( ) ;
}
componentWillEnter ( ev ) {
this . modules [ 0 ] . default . timing ( this . state . animation , {
toValue : 1 ,
duration : 100
} ) . start ( ev ) ;
}
componentWillLeave ( ev ) {
this . modules [ 0 ] . default . timing ( this . state . animation , {
toValue : 0 ,
duration : 100
} ) . start ( ev ) ;
}
render ( ) {
let interpolation = this . state . animation . interpolate ( {
inputRange : [ 0 , 1 ] ,
outputRange : [ 1.07 , 1 ]
} ) ;
let style = {
opacity : this . state . animation ,
transform : [ {
scale : interpolation
} ]
} ;
let Div = this . modules [ 0 ] . default . div ;
return /*#__PURE__*/ React . createElement ( Div , {
className : [ _ _SECRET _EMOTION _ _ . css ( {
backgroundColor : "var(--background-primary)" ,
position : "absolute" ,
top : 0 ,
right : 0 ,
bottom : 0 ,
left : 0 ,
display : "flex" ,
overflow : "hidden" ,
WebkitBoxOrient : "vertical" ,
WebkitBoxDirection : "normal" ,
msFlexDirection : "column" ,
flexDirection : "column" ,
zIndex : 101
} ) , process . platform === "win32" ? _ _SECRET _EMOTION _ _ . css ( {
top : "-22px" ,
paddingTop : "22px"
} ) : null , ... ( this . props . className ? this . props . className . split ( " " ) : [ ] ) ] . filter ( e => e ) . join ( " " ) || null ,
style : style
} , this . props . children ( ( ) => {
this . remove ( ) ;
} ) ) ;
}
}
Layer . defaultProps = {
id : null ,
children : null
} ;
/***/ } ) ,
2020-07-28 03:29:41 +02:00
/***/ "./src/modules/bdApi.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / bdApi . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _core _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./core */ "./src/modules/core.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _pluginModule _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./pluginModule */ "./src/modules/pluginModule.js" ) ;
/* harmony import */ var _themeModule _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./themeModule */ "./src/modules/themeModule.js" ) ;
/* harmony import */ var _settingsPanel _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./settingsPanel */ "./src/modules/settingsPanel.js" ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
const BdApi = {
get React ( ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . React ;
} ,
get ReactDOM ( ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . ReactDom ;
} ,
get ReactComponent ( ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . ReactComponent ;
} ,
get WindowConfigFile ( ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . WindowConfigFile ;
} ,
get settings ( ) {
return _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settings" ] ;
} ,
get emotes ( ) {
2020-07-28 18:55:37 +02:00
return null ;
2020-07-28 03:29:41 +02:00
} ,
// deprecated, deleted all emotes from betterdiscord.
get screenWidth ( ) {
return Math . max ( document . documentElement . clientWidth , window . innerWidth || 0 ) ;
} ,
get screenHeight ( ) {
return Math . max ( document . documentElement . clientHeight , window . innerHeight || 0 ) ;
}
} ;
BdApi . getAllWindowPreferences = function ( ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getAllWindowPreferences ( ) ;
} ;
BdApi . getWindowPreference = function ( key ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getWindowPreference ( key ) ;
} ;
BdApi . setWindowPreference = function ( key , value ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . setWindowPreference ( key , value ) ;
} ; //Inject CSS to document head
//id = id of element
//css = custom css
BdApi . injectCSS = function ( id , css ) {
_domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . addStyle ( _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . escapeID ( id ) , css ) ;
} ; //Clear css/remove any element
//id = id of element
BdApi . clearCSS = function ( id ) {
_domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . removeStyle ( _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . escapeID ( id ) ) ;
} ; //Inject CSS to document head
//id = id of element
//css = custom css
BdApi . linkJS = function ( id , url ) {
_domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . addScript ( _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . escapeID ( id ) , url ) ;
} ; //Clear css/remove any element
//id = id of element
BdApi . unlinkJS = function ( id ) {
_domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . removeScript ( _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . escapeID ( id ) ) ;
} ; //Get another plugin
//name = name of plugin
BdApi . getPlugin = function ( name ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] . hasOwnProperty ( name ) ) {
return _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ name ] . plugin ;
}
return null ;
} ; //Get BetterDiscord Core
BdApi . getCore = function ( ) {
_utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . warn ( "Deprecation Notice" , ` BdApi.getCore() will be removed in future versions. ` ) ;
return _core _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] ;
} ;
2020-09-05 22:50:45 +02:00
/ * *
* Shows a generic but very customizable modal .
* @ param { string } title - title of the modal
* @ param { string } content - a string of text to display in the modal
2020-07-28 03:29:41 +02:00
* /
BdApi . alert = function ( title , content ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . showConfirmationModal ( title , content , {
cancelText : null
} ) ;
} ;
2020-09-05 22:50:45 +02:00
/ * *
* Shows a generic but very customizable confirmation modal with optional confirm and cancel callbacks .
* @ param { string } title - title of the modal
* @ param { ( string | ReactElement | Array < string | ReactElement > ) } children - a single or mixed array of react elements and strings . Every string is wrapped in Discord ' s ` Markdown ` component so strings will show and render properly .
* @ param { object } [ options ] - options to modify the modal
* @ param { boolean } [ options . danger = false ] - whether the main button should be red or not
* @ param { string } [ options . confirmText = Okay ] - text for the confirmation / submit button
* @ param { string } [ options . cancelText = Cancel ] - text for the cancel button
* @ param { callable } [ options . onConfirm = NOOP ] - callback to occur when clicking the submit button
* @ param { callable } [ options . onCancel = NOOP ] - callback to occur when clicking the cancel button
* @ param { string } [ options . key ] - key used to identify the modal . If not provided , one is generated and returned
* @ returns { string } - the key used for this modal
2020-07-28 03:29:41 +02:00
* /
BdApi . showConfirmationModal = function ( title , content , options = { } ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . showConfirmationModal ( title , content , options ) ;
} ; //Show toast alert
BdApi . showToast = function ( content , options = { } ) {
_utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . showToast ( content , options ) ;
} ; // Finds module
BdApi . findModule = function ( filter ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . WebpackModules . find ( filter ) ;
} ; // Finds module
BdApi . findAllModules = function ( filter ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . WebpackModules . findAll ( filter ) ;
} ; // Finds module
BdApi . findModuleByProps = function ( ... props ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . WebpackModules . findByUniqueProperties ( props ) ;
} ;
BdApi . findModuleByPrototypes = function ( ... protos ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . WebpackModules . findByPrototypes ( protos ) ;
} ;
BdApi . findModuleByDisplayName = function ( name ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . WebpackModules . findByDisplayName ( name ) ;
} ; // Gets react instance
BdApi . getInternalInstance = function ( node ) {
if ( ! ( node instanceof window . jQuery ) && ! ( node instanceof Element ) ) return undefined ;
if ( node instanceof jQuery ) node = node [ 0 ] ;
return _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . getInternalInstance ( node ) ;
} ; // Gets data
BdApi . loadData = function ( pluginName , key ) {
return _dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . getPluginData ( pluginName , key ) ;
} ;
BdApi . getData = BdApi . loadData ; // Sets data
BdApi . saveData = function ( pluginName , key , data ) {
return _dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . setPluginData ( pluginName , key , data ) ;
} ;
BdApi . setData = BdApi . saveData ; // Deletes data
BdApi . deleteData = function ( pluginName , key ) {
return _dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . deletePluginData ( pluginName , key ) ;
} ; // Patches other functions
BdApi . monkeyPatch = function ( what , methodName , options ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . monkeyPatch ( what , methodName , options ) ;
} ; // Event when element is removed
BdApi . onRemoved = function ( node , callback ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . onRemoved ( node , callback ) ;
} ; // Wraps function in try..catch
BdApi . suppressErrors = function ( method , message ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . suppressErrors ( method , message ) ;
} ; // Tests for valid JSON
BdApi . testJSON = function ( data ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . testJSON ( data ) ;
} ;
BdApi . isPluginEnabled = function ( name ) {
return ! ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ name ] ;
} ;
BdApi . isThemeEnabled = function ( name ) {
return ! ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ name ] ;
} ;
BdApi . isSettingEnabled = function ( id ) {
return ! ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ id ] ;
} ;
BdApi . enableSetting = function ( id ) {
return _settingsPanel _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . onChange ( id , true ) ;
} ;
BdApi . disableSetting = function ( id ) {
return _settingsPanel _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . onChange ( id , false ) ;
} ;
BdApi . toggleSetting = function ( id ) {
return _settingsPanel _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . onChange ( id , ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ id ] ) ;
} ; // Gets data
BdApi . getBDData = function ( key ) {
return _dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . getBDData ( key ) ;
} ; // Sets data
BdApi . setBDData = function ( key , data ) {
return _dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . setBDData ( key , data ) ;
} ;
const makeAddonAPI = ( cookie , list , manager ) => new class AddonAPI {
get folder ( ) {
return manager . folder ;
}
isEnabled ( name ) {
return ! ! cookie [ name ] ;
}
enable ( name ) {
return manager . enable ( name ) ;
}
disable ( name ) {
return manager . disable ( name ) ;
}
toggle ( name ) {
if ( cookie [ name ] ) this . disable ( name ) ; else this . enable ( name ) ;
}
reload ( name ) {
return manager . reload ( name ) ;
}
get ( name ) {
if ( list . hasOwnProperty ( name ) ) {
if ( list [ name ] . plugin ) return list [ name ] . plugin ;
return list [ name ] ;
}
return null ;
}
getAll ( ) {
return Object . keys ( list ) . map ( k => this . get ( k ) ) . filter ( a => a ) ;
}
} ( ) ;
BdApi . Plugins = makeAddonAPI ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] , _pluginModule _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] ) ;
BdApi . Themes = makeAddonAPI ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] , _themeModule _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( BdApi ) ;
window . Lightcord . BetterDiscord . BdApi = BdApi ;
/***/ } ) ,
/***/ "./src/modules/bdEvents.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / bdEvents . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* BDEvents */
const EventEmitter = _ _webpack _require _ _ ( /*! events */ "events" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class BDEvents extends EventEmitter {
constructor ( ) {
super ( ) ;
window . Lightcord . BetterDiscord . BDEvents = this ;
}
dispatch ( eventName , ... args ) {
this . emit ( eventName , ... args ) ;
}
off ( eventName , eventAction ) {
this . removeListener ( eventName , eventAction ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/blurPrivate.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / blurPrivate . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
2020-09-05 22:50:45 +02:00
/ * *
* Credits to @ hellbound1337 on github for the css
2020-07-28 03:29:41 +02:00
* /
let selectors ;
const removeDa = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . removeDa ;
function getSelectors ( ) {
let standardSidebarView = BDModules . get ( e => e . standardSidebarView ) [ 0 ] ;
if ( ! standardSidebarView ) return null ;
let defaultClassName = removeDa ( standardSidebarView . standardSidebarView ) ;
let selects = [ ] ;
let userSettingsAccount = BDModules . get ( e => e . userSettingsAccount ) [ 0 ] ;
const children = BDModules . get ( e => typeof e . children === "string" ) [ 0 ] ;
selects . push ( ` #app-mount . ${ defaultClassName } .payment-info . ${ removeDa ( BDModules . get ( e => e . description && typeof e . description === "string" && e . description . includes ( "formText" ) ) [ 0 ] . description ) } ` ) ;
selects . push ( ` #app-mount . ${ defaultClassName } . ${ removeDa ( BDModules . get ( e => e . paymentSourceRow ) [ 0 ] . paymentSourceRow ) } . ${ removeDa ( BDModules . get ( e => e . subText && e . descriptionWrapper ) [ 0 ] . subText ) } ` ) ;
if ( userSettingsAccount ) {
selects . push ( ` #app-mount . ${ defaultClassName } . ${ removeDa ( userSettingsAccount . userSettingsAccount ) } div:nth-child(2)>div:nth-child(2)>. ${ removeDa ( BDModules . get ( e => e . viewBody ) [ 0 ] . viewBody ) } ` ) ;
selects . push ( ` . ${ removeDa ( userSettingsAccount . userSettingsSecurity ) } . ${ removeDa ( children . children ) } > div:nth-child(2) ` ) ;
}
return selects ;
}
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class BlurPrivate {
constructor ( ) {
this . enabled = false ;
}
enable ( ) {
if ( this . enabled ) return ;
this . enabled = true ;
selectors = selectors || getSelectors ( ) ;
if ( ! selectors ) console . error ( new Error ( "Couldn't find selectors to blur personnal informations." ) ) ;
_domtools _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . addStyle ( "blurPrivate" , `
$ { selectors . join ( ", " ) } {
transition : all 150 ms cubic - bezier ( . 55 , . 085 , . 68 , . 53 ) ;
filter : blur ( 4 px ) ;
opacity : . 8 ;
}
$ { selectors . map ( e => e + ":hover" ) . join ( ", " ) } {
transition : all 150 ms cubic - bezier ( . 55 , . 09 , . 68 , . 53 ) ;
filter : none ;
opacity : 1 ;
} ` );
}
disable ( ) {
if ( ! this . enabled ) return ;
this . enabled = false ;
_domtools _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . removeStyle ( "blurPrivate" ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/classNormalizer.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / classNormalizer . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _webpackModules _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./webpackModules */ "./src/modules/webpackModules.js" ) ;
const normalizedPrefix = "da" ;
const randClass = new RegExp ( ` ^(?! ${ normalizedPrefix } -)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6} $ ` ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class ClassNormalizer {
constructor ( ) {
window . Lightcord . BetterDiscord . ClassNormalizer = this ;
}
stop ( ) {
if ( ! this . hasPatched ) return ;
this . unpatchClassModules ( _webpackModules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . findAll ( this . moduleFilter . bind ( this ) ) ) ;
this . revertElement ( document . querySelector ( "#app-mount" ) ) ;
this . hasPatched = false ;
}
start ( ) {
if ( this . hasPatched ) return ;
this . patchClassModules ( _webpackModules _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . findAll ( this . moduleFilter . bind ( this ) ) ) ;
this . normalizeElement ( document . querySelector ( "#app-mount" ) ) ;
this . hasPatched = true ;
this . patchDOMMethods ( ) ;
}
patchClassModules ( modules ) {
for ( const module of modules ) {
this . patchClassModule ( normalizedPrefix , module ) ;
}
}
unpatchClassModules ( modules ) {
for ( const module of modules ) {
this . unpatchClassModule ( normalizedPrefix , module ) ;
}
}
shouldIgnore ( value ) {
if ( ! isNaN ( value ) ) return true ;
if ( value . endsWith ( "px" ) || value . endsWith ( "ch" ) || value . endsWith ( "em" ) || value . endsWith ( "ms" ) ) return true ;
if ( value . startsWith ( "layerContainer-" ) ) return true ;
if ( value . startsWith ( "#" ) && ( value . length == 7 || value . length == 4 ) ) return true ;
if ( value . includes ( "calc(" ) || value . includes ( "rgba" ) ) return true ;
return false ;
}
moduleFilter ( module ) {
if ( typeof module !== "object" || Array . isArray ( module ) ) return false ;
if ( module . _ _esModule ) return false ;
if ( ! Object . keys ( module ) . length ) return false ;
for ( const baseClassName in module ) {
const value = module [ baseClassName ] ;
if ( typeof value !== "string" ) return false ;
if ( this . shouldIgnore ( value ) ) continue ;
if ( value . split ( "-" ) . length === 1 ) return false ;
if ( ! randClass . test ( value . split ( " " ) [ 0 ] ) ) return false ;
}
return true ;
}
patchClassModule ( componentName , classNames ) {
for ( const baseClassName in classNames ) {
const value = classNames [ baseClassName ] ;
if ( this . shouldIgnore ( value ) ) continue ;
const classList = value . split ( " " ) ;
for ( const normalClass of classList ) {
const match = normalClass . match ( randClass ) ;
if ( ! match || ! match . length || match . length < 2 ) continue ; // Shouldn't ever happen since they passed the moduleFilter, but you never know
const camelCase = match [ 1 ] . split ( "-" ) . map ( ( s , i ) => i ? s [ 0 ] . toUpperCase ( ) + s . slice ( 1 ) : s ) . join ( "" ) ;
classNames [ baseClassName ] += ` ${ componentName } - ${ camelCase } ` ;
}
}
}
unpatchClassModule ( componentName , classNames ) {
for ( const baseClassName in classNames ) {
const value = classNames [ baseClassName ] ;
if ( this . shouldIgnore ( value ) ) continue ;
let newString = "" ;
const classList = value . split ( " " ) ;
for ( const normalClass of classList ) {
if ( normalClass . startsWith ( ` ${ componentName } - ` ) ) continue ;
newString += ` ${ normalClass } ` ;
}
classNames [ baseClassName ] = newString . trim ( ) ;
}
}
normalizeElement ( element ) {
if ( ! ( element instanceof Element ) ) return ;
const classes = element . classList ;
for ( let c = 0 , clen = classes . length ; c < clen ; c ++ ) {
if ( ! randClass . test ( classes [ c ] ) ) continue ;
const match = classes [ c ] . match ( randClass ) [ 1 ] ;
const newClass = match . split ( "-" ) . map ( ( s , i ) => i ? s [ 0 ] . toUpperCase ( ) + s . slice ( 1 ) : s ) . join ( "" ) ;
element . classList . add ( ` ${ normalizedPrefix } - ${ newClass } ` ) ;
}
for ( const child of element . children ) this . normalizeElement ( child ) ;
}
revertElement ( element ) {
if ( ! ( element instanceof Element ) ) return ;
if ( element . children && element . children . length ) this . revertElement ( element . children [ 0 ] ) ;
if ( element . nextElementSibling ) this . revertElement ( element . nextElementSibling ) ;
const classes = element . classList ;
const toRemove = [ ] ;
for ( let c = 0 ; c < classes . length ; c ++ ) {
if ( classes [ c ] . startsWith ( ` ${ normalizedPrefix } - ` ) ) toRemove . push ( classes [ c ] ) ;
}
element . classList . remove ( ... toRemove ) ;
}
patchDOMMethods ( ) {
const contains = DOMTokenList . prototype . contains ;
DOMTokenList . prototype . contains = function ( token ) {
// const tokens = token.split(" ");
return Reflect . apply ( contains , this , [ token . split ( " " ) [ 0 ] ] ) ; // return tokens.every(t => contains.call(this, t));
} ;
const add = DOMTokenList . prototype . add ;
DOMTokenList . prototype . add = function ( ... tokens ) {
for ( let t = 0 ; t < tokens . length ; t ++ ) {
tokens [ t ] = tokens [ t ] . split ( " " ) [ 0 ] ;
}
return Reflect . apply ( add , this , tokens ) ;
} ;
const remove = DOMTokenList . prototype . remove ;
DOMTokenList . prototype . remove = function ( ... tokens ) {
for ( let t = 0 ; t < tokens . length ; t ++ ) {
tokens [ t ] = tokens [ t ] . split ( " " ) [ 0 ] ;
}
return Reflect . apply ( remove , this , tokens ) ;
} ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/coloredText.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / coloredText . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class ColoredText {
injectColoredText ( ) {
if ( this . cancelColoredText ) return ;
if ( ! _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . MessageComponent ) return ;
this . cancelColoredText = _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . monkeyPatch ( _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . MessageComponent , "default" , {
before : data => {
const props = data . methodArguments [ 0 ] ;
if ( ! props || ! props . childrenMessageContent ) return ;
const messageContent = props . childrenMessageContent ;
if ( ! messageContent . type || ! messageContent . type . type || messageContent . type . type . displayName != "MessageContent" ) return ;
const originalType = messageContent . type . type ;
if ( originalType . _ _originalMethod ) return ; // Don't patch again
messageContent . type . type = function ( props ) {
const returnValue = originalType ( props ) ;
const roleColor = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-7" ] ? props . message . colorString || "" : "" ;
returnValue . props . style = {
color : roleColor
} ;
return returnValue ;
} ;
messageContent . type . type . _ _originalMethod = originalType ;
Object . assign ( messageContent . type . type , originalType ) ;
}
} ) ;
}
removeColoredText ( ) {
let classNameMarkup = BDModules . get ( e => e . markup ) [ 0 ] . markup ;
document . querySelectorAll ( "." + classNameMarkup . split ( " " ) [ 0 ] ) . forEach ( elem => {
elem . style . setProperty ( "color" , "" ) ;
} ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/contentManager.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / contentManager . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: addonCache, default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "addonCache" , function ( ) { return addonCache ; } ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _pluginModule _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./pluginModule */ "./src/modules/pluginModule.js" ) ;
/* harmony import */ var _themeModule _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./themeModule */ "./src/modules/themeModule.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
2020-07-28 18:55:37 +02:00
/* harmony import */ var _dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _pluginCertifier _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./pluginCertifier */ "./src/modules/pluginCertifier.js" ) ;
2020-09-12 14:52:50 +02:00
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! electron */ "electron" ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( electron _ _WEBPACK _IMPORTED _MODULE _6 _ _ ) ;
2020-07-28 03:29:41 +02:00
const path = _ _webpack _require _ _ ( /*! path */ "path" ) ;
const fs = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
const Module = _ _webpack _require _ _ ( /*! module */ "module" ) . Module ;
2020-09-12 14:52:50 +02:00
Module . globalPaths . push ( path . resolve ( electron _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "ipcRenderer" ] . sendSync ( "LIGHTCORD_GET_APP_PATH" ) , "node_modules" ) ) ;
2020-07-28 03:29:41 +02:00
class MetaError extends Error {
constructor ( message ) {
super ( message ) ;
this . name = "MetaError" ;
}
}
const originalJSRequire = Module . _extensions [ ".js" ] ;
const originalCSSRequire = Module . _extensions [ ".css" ] ? Module . _extensions [ ".css" ] : ( ) => {
return null ;
} ;
const splitRegex = /[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/ ;
const escapedAtRegex = /^\\@/ ;
let addonCache = { } ;
let hasPatched = false ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class ContentManager {
constructor ( ) {
this . timeCache = { } ;
this . watchers = { } ;
}
patchExtensions ( ) {
if ( hasPatched ) return ;
hasPatched = true ;
Module . _extensions [ ".js" ] = this . getContentRequire ( "plugin" ) ;
Module . _extensions [ ".css" ] = this . getContentRequire ( "theme" ) ;
}
get pluginsFolder ( ) {
return this . _pluginsFolder || ( this . _pluginsFolder = fs . realpathSync ( path . resolve ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . dataPath + "plugins/" ) ) ) ;
}
get themesFolder ( ) {
return this . _themesFolder || ( this . _themesFolder = fs . realpathSync ( path . resolve ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . dataPath + "themes/" ) ) ) ;
}
loadAddonCertifierCache ( ) {
2020-07-28 18:55:37 +02:00
if ( typeof _dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . getSettingGroup ( "PluginCertifierHashes" ) !== "string" ) {
_dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . setSettingGroup ( "PluginCertifierHashes" , Object ( _pluginCertifier _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "encryptSettingsCache" ] ) ( "{}" ) ) ;
2020-07-28 03:29:41 +02:00
} else {
try {
2020-07-28 18:55:37 +02:00
addonCache = JSON . parse ( Object ( _pluginCertifier _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "decryptSettingsCache" ] ) ( _dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . getSettingGroup ( "PluginCertifierHashes" ) ) ) ;
2020-07-28 03:29:41 +02:00
} catch ( e ) {
2020-07-28 18:55:37 +02:00
_dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . setSettingGroup ( "PluginCertifierHashes" , Object ( _pluginCertifier _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "encryptSettingsCache" ] ) ( "{}" ) ) ;
2020-07-28 03:29:41 +02:00
addonCache = { } ;
}
}
Object . keys ( addonCache ) . forEach ( key => {
let value = addonCache [ key ] ;
if ( ! value || typeof value !== "object" || Array . isArray ( value ) ) return delete addonCache [ key ] ;
let props = [ {
key : "timestamp" ,
type : "number"
} , {
key : "result" ,
type : "object"
} , {
key : "hash" ,
type : "string"
} ] ;
for ( let prop of props ) {
if ( ! ( prop . key in value ) || typeof value [ prop . key ] !== prop . type ) {
delete addonCache [ key ] ;
return ;
}
}
if ( value . hash !== key ) {
delete addonCache [ key ] ;
return ;
}
if ( value . result . suspect ) {
// refetch from remote to be sure you're up to date.
delete addonCache [ key ] ;
return ;
}
} ) ;
this . saveAddonCache ( ) ;
}
saveAddonCache ( ) {
2020-07-28 18:55:37 +02:00
_dataStore _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . setSettingGroup ( "PluginCertifierHashes" , Object ( _pluginCertifier _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "encryptSettingsCache" ] ) ( JSON . stringify ( addonCache ) ) ) ;
2020-07-28 03:29:41 +02:00
}
watchContent ( contentType ) {
if ( this . watchers [ contentType ] ) return ;
const isPlugin = contentType === "plugin" ;
const baseFolder = isPlugin ? this . pluginsFolder : this . themesFolder ;
const fileEnding = isPlugin ? ".plugin.js" : ".theme.css" ;
this . watchers [ contentType ] = fs . watch ( baseFolder , {
persistent : false
} , async ( eventType , filename ) => {
if ( ! eventType || ! filename || ! filename . endsWith ( fileEnding ) ) return ;
await new Promise ( r => setTimeout ( r , 50 ) ) ;
try {
fs . statSync ( path . resolve ( baseFolder , filename ) ) ;
} catch ( err ) {
if ( err . code !== "ENOENT" ) return ;
delete this . timeCache [ filename ] ;
if ( isPlugin ) return _pluginModule _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . unloadPlugin ( filename ) ;
return _themeModule _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . unloadTheme ( filename ) ;
}
if ( ! fs . statSync ( path . resolve ( baseFolder , filename ) ) . isFile ( ) ) return ;
const stats = fs . statSync ( path . resolve ( baseFolder , filename ) ) ;
if ( ! stats || ! stats . mtime || ! stats . mtime . getTime ( ) ) return ;
if ( typeof stats . mtime . getTime ( ) !== "number" ) return ;
if ( this . timeCache [ filename ] == stats . mtime . getTime ( ) ) return ;
this . timeCache [ filename ] = stats . mtime . getTime ( ) ;
if ( eventType == "rename" ) {
if ( isPlugin ) await _pluginModule _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadPlugin ( filename ) ; else await _themeModule _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . loadTheme ( filename ) ;
}
if ( eventType == "change" ) {
if ( isPlugin ) await _pluginModule _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . reloadPlugin ( filename ) ; else await _themeModule _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . reloadTheme ( filename ) ;
}
} ) ;
}
unwatchContent ( contentType ) {
if ( ! this . watchers [ contentType ] ) return ;
this . watchers [ contentType ] . close ( ) ;
delete this . watchers [ contentType ] ;
}
extractMeta ( content ) {
const firstLine = content . split ( "\n" ) [ 0 ] ;
const hasOldMeta = firstLine . includes ( "//META" ) ;
if ( hasOldMeta ) return this . parseOldMeta ( content ) ;
const hasNewMeta = firstLine . includes ( "/**" ) ;
if ( hasNewMeta ) return this . parseNewMeta ( content ) ;
throw new MetaError ( "META was not found." ) ;
}
parseOldMeta ( content ) {
const meta = content . split ( "\n" ) [ 0 ] ;
const rawMeta = meta . substring ( meta . lastIndexOf ( "//META" ) + 6 , meta . lastIndexOf ( "*//" ) ) ;
if ( meta . indexOf ( "META" ) < 0 ) throw new MetaError ( "META was not found." ) ;
const parsed = _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . testJSON ( rawMeta ) ;
if ( ! parsed ) throw new MetaError ( "META could not be parsed." ) ;
if ( ! parsed . name ) throw new MetaError ( "META missing name data." ) ;
parsed . format = "json" ;
return parsed ;
}
parseNewMeta ( content ) {
const block = content . split ( "/**" , 2 ) [ 1 ] . split ( "*/" , 1 ) [ 0 ] ;
const out = { } ;
let field = "" ;
let accum = "" ;
for ( const line of block . split ( splitRegex ) ) {
if ( line . length === 0 ) continue ;
if ( line . charAt ( 0 ) === "@" && line . charAt ( 1 ) !== " " ) {
out [ field ] = accum ;
const l = line . indexOf ( " " ) ;
field = line . substr ( 1 , l - 1 ) ;
accum = line . substr ( l + 1 ) ;
} else {
accum += " " + line . replace ( "\\n" , "\n" ) . replace ( escapedAtRegex , "@" ) ;
}
}
out [ field ] = accum . trim ( ) ;
delete out [ "" ] ;
out . format = "jsdoc" ;
return out ;
}
getContentRequire ( type ) {
const isPlugin = type === "plugin" ;
const self = this ;
const originalRequire = isPlugin ? originalJSRequire : originalCSSRequire ;
return function ( module , filename ) {
const baseFolder = isPlugin ? self . pluginsFolder : self . themesFolder ;
const possiblePath = path . resolve ( baseFolder , path . basename ( filename ) ) ;
if ( ! fs . existsSync ( possiblePath ) || filename !== fs . realpathSync ( possiblePath ) ) return Reflect . apply ( originalRequire , this , arguments ) ;
let content = fs . readFileSync ( filename , "utf8" ) ;
content = _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . stripBOM ( content ) ;
const stats = fs . statSync ( filename ) ;
const meta = self . extractMeta ( content ) ;
meta . filename = path . basename ( filename ) ;
meta . added = stats . atimeMs ;
meta . modified = stats . mtimeMs ;
meta . size = stats . size ;
if ( ! isPlugin ) {
meta . css = content ;
if ( meta . format == "json" ) meta . css = meta . css . split ( "\n" ) . slice ( 1 ) . join ( "\n" ) ;
content = ` module.exports = ${ JSON . stringify ( meta ) } ; ` ;
}
if ( isPlugin ) {
module . _compile ( content , module . filename ) ;
const didExport = ! _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . isEmpty ( module . exports ) ;
if ( didExport ) {
meta . type = module . exports ;
module . exports = meta ;
content = "" ;
} else {
_utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . warn ( "Module Not Exported" , ` ${ meta . name } , please start setting module.exports ` ) ;
content += ` \n module.exports = ${ JSON . stringify ( meta ) } ; \n module.exports.type = ${ meta . exports || meta . name } ; ` ;
}
}
module . _compile ( content , filename ) ;
} ;
}
makePlaceholderPlugin ( data ) {
return {
plugin : {
start : ( ) => { } ,
getName : ( ) => {
return data . name || data . filename ;
} ,
getAuthor : ( ) => {
return "???" ;
} ,
getDescription : ( ) => {
return data . message ? data . message : "This plugin was unable to be loaded. Check the author's page for updates." ;
} ,
getVersion : ( ) => {
return "???" ;
}
} ,
name : data . name || data . filename ,
filename : data . filename ,
source : data . source ? data . source : "" ,
website : data . website ? data . website : ""
} ;
}
async loadContent ( filename , type ) {
if ( typeof filename === "undefined" || typeof type === "undefined" ) return ;
const isPlugin = type === "plugin" ;
const baseFolder = isPlugin ? this . pluginsFolder : this . themesFolder ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-6" ] ) {
let result = await new Promise ( resolve => {
2020-07-28 18:55:37 +02:00
Object ( _pluginCertifier _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "processFile" ] ) ( path . resolve ( baseFolder , filename ) , result => {
2020-07-28 03:29:41 +02:00
console . log ( result ) ;
resolve ( result ) ;
} , hash => {
resolve ( {
suspect : false ,
hash : hash ,
filename : filename ,
name : filename
} ) ;
} , true ) ;
} ) ;
if ( result ) {
addonCache [ result . hash ] = {
timestamp : Date . now ( ) ,
hash : result . hash ,
result : result
} ;
this . saveAddonCache ( ) ;
if ( result . suspect ) {
return {
name : filename ,
file : filename ,
message : "This plugin might be dangerous (" + result . harm + ")." ,
error : new Error ( "This plugin might be dangerous (" + result . harm + ")." )
} ;
}
}
}
try {
2020-09-12 14:52:50 +02:00
require ( path . resolve ( baseFolder , filename ) ) ;
2020-07-28 03:29:41 +02:00
} catch ( error ) {
return {
name : filename ,
file : filename ,
message : "Could not be compiled." ,
error : {
message : error . message ,
stack : error . stack
}
} ;
}
2020-09-12 14:52:50 +02:00
const content = require ( path . resolve ( baseFolder , filename ) ) ;
2020-07-28 03:29:41 +02:00
if ( ! content . name ) return {
name : filename ,
file : filename ,
message : "Cannot escape the ID." ,
2020-07-29 18:29:36 +02:00
error : new Error ( "Cannot read property 'replace' of undefined" )
2020-07-28 03:29:41 +02:00
} ;
2020-07-29 18:29:36 +02:00
content . id = _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . escapeID ( content . name ) ; //if(!id)return {name: filename, file: filename, message: "Invalid ID", error: new Error("Please fix the name of "+filename+". BetterDiscord can't escape an ID.")}
2020-07-28 03:29:41 +02:00
if ( isPlugin ) {
if ( ! content . type ) return ;
try {
content . plugin = new content . type ( ) ;
delete _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ content . plugin . getName ( ) ] ;
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ content . plugin . getName ( ) ] = content ;
} catch ( error ) {
return {
name : filename ,
file : filename ,
message : "Could not be constructed." ,
error : {
message : error . message ,
stack : error . stack
}
} ;
}
} else {
delete _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ content . name ] ;
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ content . name ] = content ;
}
}
unloadContent ( filename , type ) {
if ( typeof filename === "undefined" || typeof type === "undefined" ) return ;
const isPlugin = type === "plugin" ;
const baseFolder = isPlugin ? this . pluginsFolder : this . themesFolder ;
try {
2020-09-12 14:52:50 +02:00
delete require . cache [ require . resolve ( path . resolve ( baseFolder , filename ) ) ] ;
2020-07-28 03:29:41 +02:00
} catch ( err ) {
return {
name : filename ,
file : filename ,
message : "Could not be unloaded." ,
error : {
message : err . message ,
stack : err . stack
}
} ;
}
}
isLoaded ( filename , type ) {
const isPlugin = type === "plugin" ;
const baseFolder = isPlugin ? this . pluginsFolder : this . themesFolder ;
try {
2020-09-12 14:52:50 +02:00
require . cache [ require . resolve ( path . resolve ( baseFolder , filename ) ) ] ;
2020-07-28 03:29:41 +02:00
} catch ( err ) {
return false ;
}
return true ;
}
async reloadContent ( filename , type ) {
const cantUnload = this . unloadContent ( filename , type ) ;
if ( cantUnload ) return cantUnload ;
return await this . loadContent ( filename , type ) ;
}
loadNewContent ( type ) {
const isPlugin = type === "plugin" ;
const fileEnding = isPlugin ? ".plugin.js" : ".theme.css" ;
const basedir = isPlugin ? this . pluginsFolder : this . themesFolder ;
const files = fs . readdirSync ( basedir ) ;
const contentList = Object . values ( isPlugin ? _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] ) ;
const removed = contentList . filter ( t => ! files . includes ( t . filename ) ) . map ( c => isPlugin ? c . plugin . getName ( ) : c . name ) ;
const added = files . filter ( f => ! contentList . find ( t => t . filename == f ) && f . endsWith ( fileEnding ) && fs . statSync ( path . resolve ( basedir , f ) ) . isFile ( ) ) ;
return {
added ,
removed
} ;
}
async loadAllContent ( type ) {
this . patchExtensions ( ) ;
const isPlugin = type === "plugin" ;
const fileEnding = isPlugin ? ".plugin.js" : ".theme.css" ;
const basedir = isPlugin ? this . pluginsFolder : this . themesFolder ;
const errors = [ ] ;
const files = fs . readdirSync ( basedir ) ;
for ( const filename of files ) {
if ( ! fs . statSync ( path . resolve ( basedir , filename ) ) . isFile ( ) || ! filename . endsWith ( fileEnding ) ) continue ;
const error = await this . loadContent ( filename , type ) ;
if ( error ) errors . push ( error ) ;
}
return errors ;
}
loadPlugins ( ) {
return this . loadAllContent ( "plugin" ) ;
}
loadThemes ( ) {
return this . loadAllContent ( "theme" ) ;
}
} ( ) ) ;
2020-09-05 22:50:45 +02:00
/ * *
* Don ' t expose contentManager - could be dangerous for now
2020-07-28 03:29:41 +02:00
* /
/***/ } ) ,
/***/ "./src/modules/core.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / core . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _settingsPanel _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./settingsPanel */ "./src/modules/settingsPanel.js" ) ;
/* harmony import */ var _pluginModule _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./pluginModule */ "./src/modules/pluginModule.js" ) ;
/* harmony import */ var _themeModule _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./themeModule */ "./src/modules/themeModule.js" ) ;
/* harmony import */ var _dataStore _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./webpackModules */ "./src/modules/webpackModules.js" ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
/* harmony import */ var _ui _bdLogo _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ../ui/bdLogo */ "./src/ui/bdLogo.js" ) ;
/* harmony import */ var _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ../ui/tooltipWrap */ "./src/ui/tooltipWrap.js" ) ;
2020-09-05 12:14:21 +02:00
/* harmony import */ var _svg _Lightcord _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ../svg/Lightcord */ "./src/svg/Lightcord.jsx" ) ;
2020-07-28 03:29:41 +02:00
/* harmony import */ var _pluginCertifier _ _WEBPACK _IMPORTED _MODULE _12 _ _ = _ _webpack _require _ _ ( /*! ./pluginCertifier */ "./src/modules/pluginCertifier.js" ) ;
/* harmony import */ var _distant _ _WEBPACK _IMPORTED _MODULE _13 _ _ = _ _webpack _require _ _ ( /*! ./distant */ "./src/modules/distant.js" ) ;
/* harmony import */ var _emojiModule _ _WEBPACK _IMPORTED _MODULE _14 _ _ = _ _webpack _require _ _ ( /*! ./emojiModule */ "./src/modules/emojiModule.js" ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _15 _ _ = _ _webpack _require _ _ ( /*! electron */ "electron" ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _15 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( electron _ _WEBPACK _IMPORTED _MODULE _15 _ _ ) ;
/* harmony import */ var _contentManager _ _WEBPACK _IMPORTED _MODULE _16 _ _ = _ _webpack _require _ _ ( /*! ./contentManager */ "./src/modules/contentManager.js" ) ;
let methods ;
2020-07-28 18:55:37 +02:00
function Core ( ) { }
2020-07-28 03:29:41 +02:00
Core . prototype . setConfig = function ( config ) {
if ( this . hasStarted ) return ;
Object . assign ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] , config ) ;
} ;
Object . defineProperty ( Core . prototype , "methods" , {
get ( ) {
return methods ;
}
} ) ;
Core . prototype . setMethods = function ( m ) {
if ( this . hasStarted ) return ;
methods = m ;
} ;
Core . prototype . init = async function ( ) {
if ( this . hasStarted ) return ;
this . hasStarted = true ;
if ( ! Array . prototype . flat ) {
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . alert ( "Not Supported" , "BetterDiscord v" + _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bbdVersion" ] + " does not support this old version (" + _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "currentDiscordVersion" ] + ") of Discord. Please update your Discord installation before proceeding." ) ;
return ;
}
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . version < _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "minSupportedVersion" ] ) {
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . alert ( "Not Supported" , "BetterDiscord v" + _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . version + " (your version)" + " is not supported by the latest js (" + _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bbdVersion" ] + ").<br><br> Please download the latest version from <a href='https://github.com/rauenzi/BetterDiscordApp/releases/latest' target='_blank'>GitHub</a>" ) ;
return ;
}
if ( window . ED ) {
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . alert ( "Not Supported" , "BandagedBD does not work with EnhancedDiscord. Please uninstall one of them." ) ;
return ;
}
if ( window . WebSocket && window . WebSocket . name && window . WebSocket . name . includes ( "Patched" ) ) {
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . alert ( "Not Supported" , "BandagedBD does not work with Powercord. Please uninstall one of them." ) ;
return ;
}
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchAttributes . bind ( this ) , "LC Plugin Certifier Patch" ) ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Initializing Settings" ) ;
this . initSettings ( ) ;
await this . checkForGuilds ( ) ;
_v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . initialize ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Updating Settings" ) ;
_settingsPanel _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . initializeSettings ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Loading Addons Cache" ) ;
await _contentManager _ _WEBPACK _IMPORTED _MODULE _16 _ _ [ "default" ] . loadAddonCertifierCache ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Loading Plugins" ) ;
await _pluginModule _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . loadPlugins ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Loading Themes" ) ;
await _themeModule _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . loadThemes ( ) ;
2020-08-04 13:43:22 +02:00
_domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . addStyle ( "customcss" , Buffer . from ( _dataStore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . getBDData ( "bdcustomcss" ) , "base64" ) . toString ( "utf8" ) ) ;
2020-07-28 03:29:41 +02:00
window . addEventListener ( "beforeunload" , function ( ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-dc-0" ] ) document . querySelector ( ".btn.btn-disconnect" ) . click ( ) ;
} ) ;
_pluginCertifier _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] . start ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Removing Loading Icon" ) ;
if ( document . getElementsByClassName ( "bd-loaderv2" ) . length ) document . getElementsByClassName ( "bd-loaderv2" ) [ 0 ] . remove ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Initializing Main Observer" ) ;
this . initObserver ( ) ; // Show loading errors
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-1" ] ) {
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . log ( "Startup" , "Collecting Startup Errors" ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . showContentErrors ( {
plugins : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdpluginErrors" ] ,
themes : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemeErrors" ]
} ) ;
}
const previousVersion = _dataStore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . getBDData ( "version" ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bbdVersion" ] > previousVersion ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bbdChangelog" ] ) this . showChangelogModal ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bbdChangelog" ] ) ;
_dataStore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . setBDData ( "version" , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bbdVersion" ] ) ;
}
_emojiModule _ _WEBPACK _IMPORTED _MODULE _14 _ _ [ "default" ] . start ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchSocial . bind ( this ) , "BD Social Patch" ) ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchGuildPills . bind ( this ) , "BD Guild Pills Patch" ) ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchGuildListItems . bind ( this ) , "BD Guild List Items Patch" ) ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchGuildSeparator . bind ( this ) , "BD Guild Separator Patch" ) ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchMessageHeader . bind ( this ) , "BD Badge Chat Patch" ) ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchMemberList . bind ( this ) , "BD Badge Member List Patch" ) ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . suppressErrors ( this . patchAttachment . bind ( this ) , "LC Plugin Certifier Patch" ) ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . haveInstalledDefault ) {
let alert = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . alert ( "First Installation" , "As it is the first time you install Lightcord, We added two default themes and one default plugin in your plugin/theme folder. Check it in the Plugin/Theme settings." ) ;
await new Promise ( resolve => {
alert . onClose ( resolve ) ;
} ) ;
}
const logo = document . querySelector ( "#app-mount > div.typeWindows-1za-n7.withFrame-haYltI.titleBar-AC4pGV.horizontalReverse-3tRjY7.flex-1O1GKY.directionRowReverse-m8IjIq.justifyStart-2NDFzi.alignStretch-DpGPf3.da-typeWindows.da-withFrame.da-titleBar.da-horizontalReverse.da-flex.da-directionRowReverse.da-justifyStart.da-alignStretch > div.wordmarkWindows-1v0lYD.wordmark-2iDDfm.da-wordmarkWindows.da-wordmark" ) ;
if ( logo ) {
logo . style . top = "3px" ;
logo . innerHTML = ` <svg xmlns="http://www.w3.org/2000/svg" height="10" width="70" viewBox="0 0 72.54 10" style="margin-left: -5px, margin-top: 10px">
< path fill = "currentColor" d = "M44.81,9.67V6.33c0-1.21,2.13-1.49,2.78-.28l2-.81A3.53,3.53,0,0,0,46.2,3c-1.92,0-3.81,1.13-3.81,3.33V9.67c0,2.21,1.89,3.33,3.77,3.33a3.87,3.87,0,0,0,3.45-2.18l-2.12-1C47,11.17,44.81,10.85,44.81,9.67ZM10.68,12.89h2.41V3.17H10.68ZM71.76,3.14H68.19V7.23L70.57,9.4v-4h1.27c.81,0,1.21.41,1.21,1v3c0,.63-.38,1.05-1.21,1.05H68.18v2.31h3.57c1.92,0,3.72-1,3.72-3.2V6.39C75.48,4.13,73.68,3.14,71.76,3.14ZM54.22,3c-2,0-4,1.1-4,3.34V9.66c0,2.23,2,3.34,4,3.34s3.95-1.11,3.95-3.34V6.34C58.19,4.11,56.2,3,54.22,3Zm1.55,6.66c0,.7-.78,1.06-1.54,1.06s-1.55-.35-1.55-1.06V6.34c0-.72.75-1.1,1.5-1.1s1.59.35,1.59,1.1ZM66.84,6.34c0-2.29-1.58-3.2-3.55-3.2H59.46v9.73h2.45V9.77h.43l2.22,3.09h3L65,9.52C66.13,9.15,66.84,8.14,66.84,6.34ZM63.33,7.65H61.91V5.43h1.42A1.11,1.11,0,1,1,63.33,7.65ZM29.83,13h2.42V3.06H29.83V6.73l-3,0V3.09H24.7v9.78h2.14V8.68l3,0ZM17.16,9.76V6.42c0-1.21,2.13-1.49,2.78-.28l2-.81a3.55,3.55,0,0,0-3.36-2.24c-1.92,0-3.81,1.13-3.81,3.33V9.76c0,2.21,2,3.15,3.9,3.15s3.58-1,3.58-3V7.58H18.79l0,1.36H20.3v.77C20.3,10.92,17.16,10.94,17.16,9.76Z" transform = "translate(-2.93 -3)" / >
< polygon fill = "currentColor" points = "35.91 0.06 38.43 0.06 38.43 1.84 35.92 1.81 35.97 10 33.55 10 33.49 1.75 30.98 1.74 30.98 0.06 33.49 0.06 35.91 0.06" / >
< polygon fill = "currentColor" points = "0 9.97 6.5 10 6.5 7.63 2.41 7.63 2.41 0.26 0 2.26 0 9.97" / >
< / s v g > ` ;
}
} ;
Core . prototype . patchAttributes = async function ( ) {
let attribsPatchs = [ ] ;
this . cancelPatchAttributes = function ( ) {
attribsPatchs . forEach ( e => e ( ) ) ;
} ;
while ( ! _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . MessageComponent ) await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ; // TODO: try to patch correctly the user popout on a next update
const Anchor = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . find ( m => m . displayName == "Anchor" ) ;
window . Lightcord . Api . ensureExported ( e => e . default && e . default . displayName === "DiscordTag" ) . then ( DiscordTag => {
let DiscordTagComp = DiscordTag . default ;
DiscordTag . default = function ( props ) {
let returnValue = DiscordTagComp ( props ) ;
let id = Object ( _distant _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "uuidv4" ] ) ( ) ;
let badgeDiv = _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( "div" , {
style : {
display : "inline" ,
marginTop : "5px"
}
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( "span" , {
id : "badges-" + id ,
key : "badges-" + id ,
style : {
display : "inherit"
}
} ) ) ;
let children = [ returnValue ] ;
if ( props . user . id === "249746236008169473" ) {
// Rauenzi: BandagedBD Developer
children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : "BandagedBD Developer"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( Anchor , {
className : "bd-chat-badge" ,
href : "https://github.com/rauenzi/BetterDiscordApp" ,
title : "BandagedBD" ,
target : "_blank"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _bdLogo _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] , {
size : "16px" ,
className : "bd-logo"
} ) ) ) ) ;
} else if ( props . user . id === "696481194443014174" || props . user . id === "696003456611385396" ) {
// Not Thomiz: Lightcord Developer, Phorcys: Lightcord Developer
children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : "Lightcord Developer"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( Anchor , {
className : "bd-chat-badge" ,
href : "https://github.com/Lightcord/Lightcord" ,
title : "Lightcord" ,
target : "_blank"
2020-09-05 12:14:21 +02:00
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _svg _Lightcord _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
size : "16px" ,
className : "bd-logo"
} ) ) ) ) ;
}
children . push ( badgeDiv ) ;
let div = _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( "div" , {
style : {
display : "block"
}
} , children ) ;
applyBadges ( id , props . user , false ) ;
return div ;
} ;
2020-09-05 12:14:21 +02:00
DiscordTag . default . displayName = DiscordTagComp . displayName ;
2020-07-28 03:29:41 +02:00
} ) ;
attribsPatchs . push ( _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . MessageComponent , "default" , {
after : data => {
if ( data . methodArguments [ 0 ] . childrenMessageContent . props . message ) {
// this can be a blocked message (not opened)
data . returnValue . props [ "data-message-id" ] = data . methodArguments [ 0 ] . childrenMessageContent . props . message . id ;
}
}
} ) ) ;
2020-09-05 22:50:45 +02:00
/ *
attribsPatchs . push ( Utils . monkeyPatch ( v2 . MessageComponent , "default" , { after : ( data ) => {
data . returnValue . props [ "message-id" ] = data . methodArguments [ 0 ] . childrenMessageContent . props . message . id
2020-07-28 03:29:41 +02:00
} } ) ) * /
} ;
Core . prototype . checkForGuilds = function ( ) {
let timesChecked = 0 ;
return new Promise ( resolve => {
const checkForGuilds = function ( ) {
const wrapper = _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . guildClasses . wrapper . split ( " " ) [ 0 ] ;
if ( document . querySelectorAll ( ` . ${ wrapper } ` ) . length > 0 ) timesChecked ++ ;
const guild = _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . guildClasses . listItem . split ( " " ) [ 0 ] ;
const blob = _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . guildClasses . blobContainer . split ( " " ) [ 0 ] ;
if ( document . querySelectorAll ( ` . ${ wrapper } . ${ guild } . ${ blob } ` ) . length > 0 ) return resolve ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . deferLoaded = true ) ; else if ( timesChecked >= 50 ) return resolve ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . deferLoaded = true ) ;
setTimeout ( checkForGuilds , 100 ) ;
} ;
if ( document . readyState != "loading" ) setTimeout ( checkForGuilds , 100 ) ;
document . addEventListener ( "DOMContentLoaded" , ( ) => {
setTimeout ( checkForGuilds , 100 ) ;
} ) ;
} ) ;
} ;
Core . prototype . injectExternals = async function ( ) { // No externals
} ;
Core . prototype . initSettings = function ( ) {
_dataStore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . initialize ( ) ;
2020-08-14 21:58:19 +02:00
if ( ! _dataStore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . getSettingGroup ( "rpc" ) ) {
Object . assign ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsRPC" ] , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "defaultRPC" ] ) ;
}
2020-07-28 03:29:41 +02:00
2020-08-14 21:58:19 +02:00
if ( ! _dataStore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . getSettingGroup ( "settings" ) ) {
Object . assign ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "defaultCookie" ] ) ;
2020-07-28 03:29:41 +02:00
_settingsPanel _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . saveSettings ( ) ;
} else {
_settingsPanel _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . loadSettings ( ) ;
for ( const setting in _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "defaultCookie" ] ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ setting ] == undefined ) {
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ setting ] = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "defaultCookie" ] [ setting ] ;
_settingsPanel _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . saveSettings ( ) ;
}
}
}
window . Lightcord . Api . ensureExported ( e => e . default && e . default . prototype && e . default . prototype . getPredicateSections ) . then ( settingModule => {
let getPredicateSections = settingModule . default . prototype . getPredicateSections ;
settingModule . default . prototype . getPredicateSections = function ( ) {
let result = getPredicateSections . call ( this , ... arguments ) ;
if ( ! result [ 1 ] ) return result ;
if ( result [ 1 ] . section === "My Account" ) {
// user settings, not guild settings
let poped = [ ] ;
poped . push ( result . pop ( ) ) ;
poped . push ( result . pop ( ) ) ;
poped . push ( result . pop ( ) ) ;
poped . push ( result . pop ( ) ) ;
result . push ( ... _settingsPanel _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . renderSidebar ( this ) ) ;
while ( poped [ 0 ] ) {
result . push ( poped . pop ( ) ) ;
}
}
2020-09-05 12:14:21 +02:00
console . log ( result ) ;
2020-07-28 03:29:41 +02:00
return result ;
} ;
} ) ;
} ;
let classNameLayer ;
let classNameSocialLinks ;
let classNameModal ;
Core . prototype . initObserver = function ( ) {
const mainObserver = new MutationObserver ( mutations => {
for ( let i = 0 , mlen = mutations . length ; i < mlen ; i ++ ) {
const mutation = mutations [ i ] ;
if ( typeof _pluginModule _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] !== "undefined" ) _pluginModule _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . rawObserver ( mutation ) ; // if there was nothing added, skip
if ( ! mutation . addedNodes . length || ! ( mutation . addedNodes [ 0 ] instanceof Element ) ) continue ;
const node = mutation . addedNodes [ 0 ] ;
if ( ! classNameLayer ) classNameLayer = BDModules . get ( e => e . layer && typeof e . layer === "string" && e . animating ) [ 0 ] . layer ;
if ( ! classNameSocialLinks ) classNameSocialLinks = BDModules . get ( e => e . socialLinks && typeof e . socialLinks === "string" ) [ 0 ] . socialLinks ;
if ( ! classNameModal ) classNameModal = BDModules . get ( e => e . modal && typeof e . modal === "string" && e . inner && typeof e . inner === "string" && ! e . responsiveWidthMobile ) [ 0 ] . modal ;
if ( node . classList . contains ( classNameLayer ) ) {
if ( node . getAttribute ( "aria-label" ) === "GUILD_SETTINGS" ) {
node . setAttribute ( "layer-id" , "server-settings" ) ;
node . setAttribute ( "id" , "server-settings" ) ;
}
if ( node . getElementsByClassName ( classNameSocialLinks ) . length ) {
node . setAttribute ( "layer-id" , "user-settings" ) ;
node . setAttribute ( "id" , "user-settings" ) ;
}
}
if ( node . parentElement == document . body && node . querySelector ( "#ace_settingsmenu" ) ) node . id = "ace_settingsmenu_container" ; // Emoji Picker
//node.getElementsByClassName("emojiPicker-3m1S-j").length && !node.querySelector(".emojiPicker-3m1S-j").parentElement.classList.contains("animatorLeft-1EQxU0")
//if (node.classList.contains(classNameLayer2) && node.getElementsByClassName(classNameEmojiPicker).length && !node.querySelector("."+classNameEmojiPicker).parentElement.classList.contains(classNameAnimatorLeft)) quickEmoteMenu.obsCallback(node);
}
} ) ;
mainObserver . observe ( document , {
childList : true ,
subtree : true
} ) ;
} ;
Core . prototype . showChangelogModal = function ( options = { } ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . showChangelogModal ( options ) ;
} ;
Core . prototype . alert = function ( title , content ) {
return _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . alert ( title , content ) ;
} ;
Core . prototype . patchSocial = function ( ) {
if ( this . socialPatch ) return ;
const TabBar = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . find ( m => m . displayName == "TabBar" ) ;
const Anchor = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . find ( m => m . displayName == "Anchor" ) ;
if ( ! TabBar ) return ;
this . socialPatch = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( TabBar . prototype , "render" , {
after : data => {
const children = data . returnValue . props . children ;
if ( ! children || ! children . length || children . length < 3 ) return ;
if ( children [ children . length - 3 ] . type . displayName !== "Separator" ) return ;
if ( ! children [ children . length - 2 ] . type . toString ( ) . includes ( "socialLinks" ) ) return ;
if ( Anchor ) {
let socialModule1 = BDModules . get ( e => e . socialLinks ) [ 0 ] ;
const original = children [ children . length - 2 ] . type ;
const newOne = function ( ) {
const returnVal = original ( ... arguments ) ;
returnVal . props . children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : "Lightcord"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( Anchor , {
className : "bd-social-link " + socialModule1 . link ,
href : "https://github.com/Lightcord/Lightcord" ,
title : "Lightcord" ,
target : "_blank"
2020-09-05 12:14:21 +02:00
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _svg _Lightcord _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
size : "16px" ,
className : "bd-social-logo"
} ) ) ) ) ;
returnVal . props . children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : "BandagedBD"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( Anchor , {
className : "bd-social-link " + socialModule1 . link ,
href : "https://github.com/rauenzi/BetterDiscordApp" ,
title : "BandagedBD" ,
target : "_blank"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _bdLogo _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] , {
size : "16px" ,
className : "bd-social-logo"
} ) ) ) ) ;
return returnVal ;
} ;
children [ children . length - 2 ] . type = newOne ;
}
let [ classNameColorMuted , sizes , classNameVersionHash ] = [ BDModules . get ( e => e . colorMuted ) [ 0 ] . colorMuted , BDModules . get ( e => e . size32 ) [ 0 ] , BDModules . get ( e => e . versionHash ) [ 0 ] . versionHash ] ;
const versionHash = ` ( ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . hash ? _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . hash . substring ( 0 , 7 ) : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdConfig" ] . branch } ) ` ;
2020-09-12 14:52:50 +02:00
const buildInfo = electron _ _WEBPACK _IMPORTED _MODULE _15 _ _ [ "ipcRenderer" ] . sendSync ( "LIGHTCORD_GET_BUILD_INFOS" ) ;
2020-07-28 03:29:41 +02:00
const additional = [ _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
className : ` ${ classNameColorMuted } ${ sizes . size12 } `
2020-09-12 14:52:50 +02:00
} , ` Lightcord ${ buildInfo . version } ` , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "span" , {
2020-07-28 03:29:41 +02:00
className : classNameVersionHash + " da-versionHash"
2020-09-12 14:52:50 +02:00
} , ` ( ${ ( buildInfo . commit || "Unknown" ) . slice ( 0 , 7 ) } ) ` ) ) , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
2020-07-28 03:29:41 +02:00
className : ` ${ classNameColorMuted } ${ sizes . size12 } `
} , ` BBD ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bbdVersion" ] } ` , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "span" , {
className : classNameVersionHash + " da-versionHash"
} , versionHash ) ) ] ;
const originalVersions = children [ children . length - 1 ] . type ;
children [ children . length - 1 ] . type = function ( ) {
const returnVal = originalVersions ( ... arguments ) ;
returnVal . props . children . splice ( 1 , 0 , additional ) ;
return returnVal ;
} ;
}
} ) ;
} ;
const getGuildClasses = function ( ) {
const guildsWrapper = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . findByProps ( "wrapper" , "unreadMentionsBar" ) ;
const guilds = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . findByProps ( "guildsError" , "selected" ) ;
const pill = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . findByProps ( "blobContainer" ) ;
return Object . assign ( { } , guildsWrapper , guilds , pill ) ;
} ;
Core . prototype . patchGuildListItems = function ( ) {
if ( this . guildListItemsPatch ) return ;
const GuildClasses = getGuildClasses ( ) ;
const listItemClass = GuildClasses . listItem . split ( " " ) [ 0 ] ;
const blobClass = GuildClasses . blobContainer . split ( " " ) [ 0 ] ;
const reactInstance = _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getInternalInstance ( document . querySelector ( ` . ${ listItemClass } . ${ blobClass } ` ) . parentElement ) ;
const GuildComponent = reactInstance . return . type ;
if ( ! GuildComponent ) return ;
this . guildListItemsPatch = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( GuildComponent . prototype , "render" , {
after : data => {
if ( data . returnValue && data . thisObject ) {
const returnValue = data . returnValue ;
const guildData = data . thisObject . props ;
let className = returnValue . props . className ;
className += " bd-guild" ;
if ( guildData . unread ) className += " bd-unread" ;
if ( guildData . selected ) className += " bd-selected" ;
if ( guildData . audio ) className += " bd-audio" ;
if ( guildData . video ) className += " bd-video" ;
if ( guildData . badge ) className += " bd-badge" ;
if ( guildData . animatable ) className += " bd-animatable" ;
returnValue . props . className = className ;
return returnValue ;
}
}
} ) ;
} ;
Core . prototype . patchGuildPills = function ( ) {
if ( this . guildPillPatch ) return ;
const guildPill = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . find ( m => m . default && ! m . default . displayName && m . default . toString && m . default . toString ( ) . includes ( "translate3d" ) ) ;
if ( ! guildPill ) return ;
this . guildPillPatch = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( guildPill , "default" , {
after : data => {
const props = data . methodArguments [ 0 ] ;
if ( props . unread ) data . returnValue . props . className += " bd-unread" ;
if ( props . selected ) data . returnValue . props . className += " bd-selected" ;
if ( props . hovered ) data . returnValue . props . className += " bd-hovered" ;
return data . returnValue ;
}
} ) ;
} ;
Core . prototype . patchGuildSeparator = function ( ) {
if ( this . guildSeparatorPatch ) return ;
const Guilds = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . findByDisplayName ( "Guilds" ) ;
const guildComponents = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . findByProps ( "renderListItem" ) ;
if ( ! guildComponents || ! Guilds ) return ;
const GuildSeparator = function ( ) {
const returnValue = guildComponents . Separator ( ... arguments ) ;
returnValue . props . className += " bd-guild-separator" ;
return returnValue ;
} ;
this . guildSeparatorPatch = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( Guilds . prototype , "render" , {
after : data => {
data . returnValue . props . children [ 1 ] . props . children [ 3 ] . type = GuildSeparator ;
}
} ) ;
} ;
Core . prototype . patchAttachment = function ( ) {
if ( this . AttachmentPatch ) return ;
const Attachment = BDModules . get ( e => e . default && e . default . displayName === "Attachment" ) [ 0 ] ; // temporary
const Anchor = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . find ( m => m . displayName == "Anchor" ) ;
if ( ! Anchor || ! Attachment || ! Attachment . default ) return ;
this . AttachmentPatch = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( Attachment , "default" , {
after : data => {
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-6" ] ) return ;
const attachment = data . methodArguments [ 0 ] || null ;
const children = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getNestedProp ( data . returnValue , "props.children" ) ;
if ( ! children || ! attachment || ! attachment . url ) return ;
if ( ! Array . isArray ( children ) ) return ;
const id = Object ( _distant _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "uuidv4" ] ) ( ) ;
children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "span" , {
id : "certified-" + id
} ) ) ;
_pluginCertifier _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] . patch ( attachment , "certified-" + id ) ;
}
} ) ;
} ;
Core . prototype . patchMessageHeader = function ( ) {
if ( this . messageHeaderPatch ) return ;
const MessageHeader = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . findByProps ( "MessageTimestamp" ) ;
const Anchor = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . find ( m => m . displayName == "Anchor" ) ;
if ( ! Anchor || ! MessageHeader || ! MessageHeader . default ) return ;
this . messageHeaderPatch = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( MessageHeader , "default" , {
after : data => {
const author = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getNestedProp ( data . methodArguments [ 0 ] , "message.author" ) ; // const header = Utils.getNestedProp(data.returnValue, "props.children.1.props");
const children = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getNestedProp ( data . returnValue , "props.children.1.props.children.1.props.children" ) ;
if ( ! children || ! author || ! author . id ) return ; // if (header && header.className) header.className += " "
if ( ! Array . isArray ( children ) ) return ;
if ( author . id === "249746236008169473" ) {
// Rauenzi: BandagedBD Developer
children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : "BandagedBD Developer"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( Anchor , {
className : "bd-chat-badge" ,
href : "https://github.com/rauenzi/BetterDiscordApp" ,
title : "BandagedBD" ,
target : "_blank"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _bdLogo _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] , {
size : "16px" ,
className : "bd-logo"
} ) ) ) ) ;
} else if ( author . id === "696481194443014174" || author . id === "696003456611385396" ) {
// Not Thomiz: Lightcord Developer, Phorcys: Lightcord Developer
children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : "Lightcord Developer"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( Anchor , {
className : "bd-chat-badge" ,
href : "https://github.com/Lightcord/Lightcord" ,
title : "Lightcord" ,
target : "_blank"
2020-09-05 12:14:21 +02:00
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _svg _Lightcord _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
size : "16px" ,
className : "bd-logo"
} ) ) ) ) ;
}
const id = Object ( _distant _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "uuidv4" ] ) ( ) ;
children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( "div" , {
id : "badges-" + id ,
style : {
display : "inline"
}
} ) ) ;
applyBadges ( id , author , true ) ;
}
} ) ;
} ;
function applyBadges ( id , user , chat ) {
process . nextTick ( ( ) => {
const div = document . getElementById ( "badges-" + id ) ;
if ( ! div || div . childNodes . length > 0 ) return ;
if ( div . childNodes . length ) return ;
let blockDiv = document . createElement ( "div" ) ;
blockDiv . style . display = "none" ;
div . appendChild ( blockDiv ) ;
const Anchor = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . find ( m => m . displayName == "Anchor" ) ;
_distant _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] . getBadges ( user . id ) . then ( badges => {
badges . forEach ( badge => {
const props = {
svg : {
size : "16px" ,
className : "bd-logo" ,
width : "16px"
}
} ;
badge . scopes . forEach ( scope => {
if ( scope === "user" ) {
// require user
props . user = user ;
}
} ) ;
if ( ! badge . href ) {
props . Anchor = Anchor ;
props . href = {
className : chat ? "bd-chat-badge" : "bd-member-badge" ,
title : badge . name ,
target : "_blank"
} ;
}
const element = _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : badge . name
} , badge . href ? _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( Anchor , {
href : badge . href ,
className : chat ? "bd-chat-badge" : "bd-member-badge" ,
title : badge . name ,
target : "_blank"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( badge . component , props ) ) : _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( badge . component , props ) ) ;
const div2 = document . createElement ( "div" ) ;
_v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . reactDom . render ( element , div2 ) ;
div2 . childNodes . forEach ( node => {
div . appendChild ( node ) ;
} ) ;
} ) ;
} ) ;
} ) ;
}
Core . prototype . patchMemberList = function ( ) {
if ( this . memberListPatch ) return ;
const MemberListItem = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . findByDisplayName ( "MemberListItem" ) ;
const Anchor = _webpackModules _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . find ( m => m . displayName == "Anchor" ) ;
if ( ! Anchor || ! MemberListItem || ! MemberListItem . prototype || ! MemberListItem . prototype . renderDecorators ) return ;
this . memberListPatch = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( MemberListItem . prototype , "renderDecorators" , {
after : data => {
const user = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getNestedProp ( data . thisObject , "props.user" ) ;
const children = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getNestedProp ( data . returnValue , "props.children" ) ;
if ( ! children || ! user || ! user . id ) return ; // if (header && header.className) header.className += " "
if ( ! Array . isArray ( children ) ) return ;
if ( user . id === "249746236008169473" ) {
children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : "BandagedBD Developer"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( Anchor , {
className : "bd-member-badge" ,
href : "https://github.com/rauenzi/BetterDiscordApp" ,
title : "BandagedBD" ,
target : "_blank"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _bdLogo _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] , {
size : "16px" ,
className : "bd-logo"
} ) ) ) ) ;
} else if ( user . id === "696481194443014174" || user . id === "696003456611385396" ) {
children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : "Lightcord Developer"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( Anchor , {
className : "bd-member-badge" ,
href : "https://github.com/Lightcord/Lightcord" ,
title : "Lightcord" ,
target : "_blank"
2020-09-05 12:14:21 +02:00
} , _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( _svg _Lightcord _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
size : "16px" ,
className : "bd-logo"
} ) ) ) ) ;
}
const id = Object ( _distant _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "uuidv4" ] ) ( ) ;
children . push ( _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( "div" , {
id : "badges-" + id
} ) ) ;
applyBadges ( id , user , false ) ;
}
} ) ;
} ;
Core . prototype . updateInjector = async function ( ) {
2020-07-28 18:55:37 +02:00
// There will never be an injection path, so we do not need the code below.
// Insert comments so it will be erased when production.
2020-07-28 03:29:41 +02:00
const injectionPath = _dataStore _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . injectionPath ;
if ( ! injectionPath ) return false ;
2020-09-05 22:50:45 +02:00
/ *
2020-09-06 00:11:14 +02:00
const fs = require ( "fs" ) ;
2020-09-05 22:50:45 +02:00
const path = require ( "path" ) ;
const rmrf = require ( "rimraf" ) ;
const yauzl = require ( "yauzl" ) ;
const mkdirp = require ( "mkdirp" ) ;
const request = require ( "request" ) ;
2020-09-06 00:11:14 +02:00
const parentPath = path . resolve ( injectionPath , ".." ) ;
2020-09-05 22:50:45 +02:00
const folderName = path . basename ( injectionPath ) ;
const zipLink = "https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip" ;
const savedZip = path . resolve ( parentPath , "injector.zip" ) ;
const extractedFolder = path . resolve ( parentPath , "BetterDiscordApp-injector" ) ;
2020-09-06 00:11:14 +02:00
// Download the injector zip file
2020-09-05 22:50:45 +02:00
Utils . log ( "InjectorUpdate" , "Downloading " + zipLink ) ;
let success = await new Promise ( resolve => {
request . get ( { url : zipLink , encoding : null } , async ( error , response , body ) => {
if ( error || response . statusCode !== 200 ) return resolve ( false ) ;
// Save a backup in case someone has their own copy
const alreadyExists = await new Promise ( res => fs . exists ( savedZip , res ) ) ;
if ( alreadyExists ) await new Promise ( res => fs . rename ( savedZip , ` ${ savedZip } .bak ${ Math . round ( performance . now ( ) ) } ` , res ) ) ;
2020-09-06 00:11:14 +02:00
Utils . log ( "InjectorUpdate" , "Writing " + savedZip ) ;
2020-09-05 22:50:45 +02:00
fs . writeFile ( savedZip , body , err => resolve ( ! err ) ) ;
} ) ;
} ) ;
if ( ! success ) return success ;
2020-09-06 00:11:14 +02:00
// Check and delete rename extraction
2020-09-05 22:50:45 +02:00
const alreadyExists = await new Promise ( res => fs . exists ( extractedFolder , res ) ) ;
if ( alreadyExists ) await new Promise ( res => fs . rename ( extractedFolder , ` ${ extractedFolder } .bak ${ Math . round ( performance . now ( ) ) } ` , res ) ) ;
// Unzip the downloaded zip file
const zipfile = await new Promise ( r => yauzl . open ( savedZip , { lazyEntries : true } , ( err , zip ) => r ( zip ) ) ) ;
zipfile . on ( "entry" , function ( entry ) {
// Skip directories, they are handled with mkdirp
if ( entry . fileName . endsWith ( "/" ) ) return zipfile . readEntry ( ) ;
2020-09-06 00:11:14 +02:00
Utils . log ( "InjectorUpdate" , "Extracting " + entry . fileName ) ;
2020-09-05 22:50:45 +02:00
// Make any needed parent directories
const fullPath = path . resolve ( parentPath , entry . fileName ) ;
mkdirp . sync ( path . dirname ( fullPath ) ) ;
zipfile . openReadStream ( entry , function ( err , readStream ) {
if ( err ) return success = false ;
readStream . on ( "end" , function ( ) { zipfile . readEntry ( ) ; } ) ; // Go to next file after this
readStream . pipe ( fs . createWriteStream ( fullPath ) ) ;
} ) ;
} ) ;
zipfile . readEntry ( ) ; // Start reading
2020-09-06 00:11:14 +02:00
// Wait for the final file to finish
2020-09-05 22:50:45 +02:00
await new Promise ( resolve => zipfile . once ( "end" , resolve ) ) ;
2020-09-06 00:11:14 +02:00
// Save a backup in case something goes wrong during final step
2020-09-05 22:50:45 +02:00
const backupFolder = path . resolve ( parentPath , ` ${ folderName } .bak ${ Math . round ( performance . now ( ) ) } ` ) ;
await new Promise ( resolve => fs . rename ( injectionPath , backupFolder , resolve ) ) ;
2020-09-06 00:11:14 +02:00
// Rename the extracted folder to what it should be
2020-09-05 22:50:45 +02:00
Utils . log ( "InjectorUpdate" , ` Renaming ${ path . basename ( extractedFolder ) } to ${ folderName } ` ) ;
success = await new Promise ( resolve => fs . rename ( extractedFolder , injectionPath , err => resolve ( ! err ) ) ) ;
if ( ! success ) {
Utils . err ( "InjectorUpdate" , "Failed to rename the final directory" ) ;
return success ;
}
2020-09-06 00:11:14 +02:00
// If rename had issues, delete what we tried to rename and restore backup
2020-09-05 22:50:45 +02:00
if ( ! success ) {
Utils . err ( "InjectorUpdate" , "Something went wrong... restoring backups." ) ;
await new Promise ( resolve => rmrf ( extractedFolder , resolve ) ) ;
await new Promise ( resolve => fs . rename ( backupFolder , injectionPath , resolve ) ) ;
return success ;
}
2020-09-06 00:11:14 +02:00
// If we've gotten to this point, everything should have gone smoothly.
2020-09-05 22:50:45 +02:00
// Cleanup the backup folder then remove the zip
await new Promise ( resolve => rmrf ( backupFolder , resolve ) ) ;
await new Promise ( resolve => fs . unlink ( savedZip , resolve ) ) ;
2020-09-06 00:11:14 +02:00
Utils . log ( "InjectorUpdate" , "Injector Updated!" ) ;
2020-07-28 18:55:37 +02:00
return success ; * /
2020-07-28 03:29:41 +02:00
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new Core ( ) ) ;
2020-09-05 22:50:45 +02:00
/ * *
* Don ' t expose core - could be dangerous for now
2020-07-28 03:29:41 +02:00
* /
/***/ } ) ,
/***/ "./src/modules/dataStore.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / dataStore . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
2020-07-28 18:55:37 +02:00
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./contentManager */ "./src/modules/contentManager.js" ) ;
2020-07-28 03:29:41 +02:00
const fs = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
const path = _ _webpack _require _ _ ( /*! path */ "path" ) ;
const releaseChannel = DiscordNative . globals ? DiscordNative . globals . releaseChannel : DiscordNative . app ? DiscordNative . app . getReleaseChannel ( ) : "stable" ;
let dataPath = "" ;
2020-07-28 03:32:49 +02:00
if ( process . platform === "win32" ) dataPath = process . env . APPDATA ; else if ( process . platform === "darwin" ) dataPath = path . join ( process . env . HOME , "Library" , "Preferences" ) ; else dataPath = process . env . XDG _CONFIG _HOME ? process . env . XDG _CONFIG _HOME : path . join ( process . env . HOME , ".config" ) ;
2020-07-28 03:31:08 +02:00
dataPath = path . join ( dataPath , "BetterDiscord" ) ;
2020-07-28 03:29:41 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class DataStore {
constructor ( ) {
this . data = {
settings : {
stable : { } ,
canary : { } ,
ptb : { }
}
} ;
this . pluginData = { } ;
window . Lightcord . BetterDiscord . DataStore = this ;
}
initialize ( ) {
try {
2020-08-04 13:43:22 +02:00
if ( ! fs . existsSync ( this . BDFile ) ) fs . writeFileSync ( this . BDFile , JSON . stringify ( this . data , null , 4 ) , "utf-8" ) ;
const data = JSON . parse ( fs . readFileSync ( this . BDFile , "utf-8" ) ) ;
2020-07-28 03:29:41 +02:00
if ( data . hasOwnProperty ( "settings" ) ) this . data = data ;
if ( ! fs . existsSync ( this . settingsFile ) ) return ;
2020-09-12 14:52:50 +02:00
let settings = require ( this . settingsFile ) ;
2020-07-28 03:29:41 +02:00
fs . unlinkSync ( this . settingsFile ) ;
if ( settings . hasOwnProperty ( "settings" ) ) settings = Object . assign ( {
stable : { } ,
canary : { } ,
ptb : { }
} , {
[ releaseChannel ] : settings
} ) ; else settings = Object . assign ( {
stable : { } ,
canary : { } ,
ptb : { }
} , settings ) ;
this . setBDData ( "settings" , settings ) ;
} catch ( err ) {
console . error ( err ) ;
2020-07-28 18:55:37 +02:00
_utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . alert ( "Corrupt Storage" , "The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload." ) ;
2020-07-28 03:29:41 +02:00
}
}
get injectionPath ( ) {
return this . _injectionPath = null ;
}
get configFile ( ) {
return this . _configFile || ( this . _configFile = path . resolve ( this . injectionPath , "betterdiscord" , "config.json" ) ) ;
}
get BDFile ( ) {
return this . _BDFile || ( this . _BDFile = path . resolve ( dataPath , "bdstorage.json" ) ) ;
}
get settingsFile ( ) {
return this . _settingsFile || ( this . _settingsFile = path . resolve ( dataPath , "bdsettings.json" ) ) ;
}
getPluginFile ( pluginName ) {
2020-07-28 18:55:37 +02:00
return path . resolve ( _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . pluginsFolder , pluginName + ".config.json" ) ;
2020-07-28 03:29:41 +02:00
}
getSettingGroup ( key ) {
return this . data . settings [ releaseChannel ] [ key ] || null ;
}
setSettingGroup ( key , data ) {
this . data . settings [ releaseChannel ] [ key ] = data ;
2020-08-04 13:43:22 +02:00
fs . writeFileSync ( this . BDFile , JSON . stringify ( this . data , null , 4 ) , "utf-8" ) ;
2020-07-28 03:29:41 +02:00
}
getBDData ( key ) {
return this . data [ key ] || "" ;
}
setBDData ( key , value ) {
this . data [ key ] = value ;
2020-08-04 13:43:22 +02:00
fs . writeFileSync ( this . BDFile , JSON . stringify ( this . data , null , 4 ) , "utf-8" ) ;
2020-07-28 03:29:41 +02:00
}
getPluginData ( pluginName , key ) {
if ( this . pluginData [ pluginName ] !== undefined ) return this . pluginData [ pluginName ] [ key ] ;
if ( ! fs . existsSync ( this . getPluginFile ( pluginName ) ) ) return undefined ;
this . pluginData [ pluginName ] = JSON . parse ( fs . readFileSync ( this . getPluginFile ( pluginName ) ) ) ;
return this . pluginData [ pluginName ] [ key ] ;
}
setPluginData ( pluginName , key , value ) {
if ( value === undefined ) return ;
if ( this . pluginData [ pluginName ] === undefined ) this . pluginData [ pluginName ] = { } ;
this . pluginData [ pluginName ] [ key ] = value ;
2020-08-04 13:43:22 +02:00
fs . writeFileSync ( this . getPluginFile ( pluginName ) , JSON . stringify ( this . pluginData [ pluginName ] , null , 4 ) , "utf-8" ) ;
2020-07-28 03:29:41 +02:00
}
deletePluginData ( pluginName , key ) {
if ( this . pluginData [ pluginName ] === undefined ) this . pluginData [ pluginName ] = { } ;
delete this . pluginData [ pluginName ] [ key ] ;
2020-08-04 13:43:22 +02:00
fs . writeFileSync ( this . getPluginFile ( pluginName ) , JSON . stringify ( this . pluginData [ pluginName ] , null , 4 ) , "utf-8" ) ;
2020-07-28 03:29:41 +02:00
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/devMode.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / devMode . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class DevMode {
constructor ( ) {
this . debugListener = this . debugListener . bind ( this ) ;
this . copySelectorListener = this . copySelectorListener . bind ( this ) ;
}
start ( ) {
this . startDebugListener ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-dm-1" ] ) this . startCopySelector ( ) ;
}
stop ( ) {
this . stopDebugListener ( ) ;
this . stopCopySelector ( ) ;
}
startDebugListener ( ) {
this . stopDebugListener ( ) ;
document . addEventListener ( "keydown" , this . debugListener ) ;
}
stopDebugListener ( ) {
document . removeEventListener ( "keydown" , this . debugListener ) ;
}
startCopySelector ( ) {
this . stopCopySelector ( ) ;
document . addEventListener ( "contextmenu" , this . copySelectorListener ) ;
}
stopCopySelector ( ) {
document . removeEventListener ( "contextmenu" , this . copySelectorListener ) ;
}
debugListener ( e ) {
if ( e . which === 119 || e . which == 118 ) {
//F8
console . log ( "%c[%cDevMode%c] %cBreak/Resume" , "color: red;" , "color: #303030; font-weight:700;" , "color:red;" , "" ) ;
debugger ; // eslint-disable-line no-debugger
e . preventDefault ( ) ;
e . stopImmediatePropagation ( ) ;
}
}
copySelectorListener ( e ) {
try {
e . stopPropagation ( ) ;
const selector = this . getSelector ( e . target ) ;
let [ classLayer , classItems ] = [ BDModules . get ( e => e . layer && typeof e . layer === "string" && e . disabledPointerEvents ) [ 0 ] , BDModules . get ( e => e . menu ) [ 0 ] ] ;
function attach ( ) {
if ( ! classItems || ! classLayer . layer ) return console . log ( classItems , classLayer . layer ) ;
let cm = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . query ( "." + _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . removeDa ( classItems . menu ) ) ;
if ( ! cm ) {
const container = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . query ( "#app-mount > ." + _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . removeDa ( classLayer . layerContainer ) ) ;
const cmWrap = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . createElement ( ` <div class=" ${ classLayer . layer } "> ` ) ;
cm = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . createElement ( ` <div class=" ${ classItems . menu } ${ classItems . styleFlexible } ${ classItems . accommodateScrollbar } bd-context-menu" style=""></div> ` ) ;
cmWrap . append ( cm ) ;
container . append ( cmWrap ) ;
cmWrap . style . top = e . clientY + "px" ;
cmWrap . style . left = e . clientX + "px" ;
cmWrap . setAttribute ( "role" , "menu" ) ;
cmWrap . setAttribute ( "tabindex" , "-1" ) ;
cmWrap . id = "bd-copy-selector-context" ;
cmWrap . setAttribute ( "aria-label" , "Copy Selector Actions" ) ;
const scrollerClasses = BDModules . get ( e => e . scrollerWrap ) [ 0 ] ;
const scrollerWrap = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . createElement ( ` <div class=" ${ scrollerClasses . scrollerWrap } ${ scrollerClasses . scrollerThemed } ${ scrollerClasses . themeGhostHairline } "></div> ` ) ;
const scroller = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . createElement ( ` <div class=" ${ BDModules . get ( e => e . scroller ) [ 0 ] . scroller } ${ classItems . scroller } "></div> ` ) ;
scrollerWrap . append ( scroller ) ;
cm . append ( scrollerWrap ) ;
const removeCM = function ( e ) {
if ( e . keyCode && e . keyCode !== 27 ) return ;
cmWrap . remove ( ) ;
document . removeEventListener ( "click" , removeCM ) ;
document . removeEventListener ( "contextmenu" , removeCM ) ;
document . removeEventListener ( "keyup" , removeCM ) ;
} ;
document . addEventListener ( "click" , removeCM ) ;
document . addEventListener ( "contextmenu" , removeCM ) ;
document . addEventListener ( "keyup" , removeCM ) ;
}
const cmWrap = cm . parentElement ;
const scroller = cm . childNodes [ 0 ] . childNodes [ 0 ] ;
const cmg = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . createElement ( ` <div role="group"></div> ` ) ;
2020-09-05 22:50:45 +02:00
/ * *
* @ type { HTMLElement }
2020-07-28 03:29:41 +02:00
* /
const cmi = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . createElement ( ` <div class=" ${ classItems . item } ${ classItems . labelContainer } ${ classItems . colorDefault } " role="menuitem" id="bd-copy-selector-item-cm"></div> ` ) ;
cmi . append ( _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . createElement ( ` <div class=" ${ classItems . label } ">Copy Selector</div> ` ) ) ;
cmi . addEventListener ( "click" , ( ) => {
_v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . NativeModule . copy ( selector ) ;
cmWrap . style . display = "none" ;
} ) ;
cmi . addEventListener ( "mouseover" , e => {
let elements = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . queryAll ( "div[role=menuitem]." + _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . removeDa ( classItems . focused ) ) ;
elements && elements . forEach ( elem => elem . classList . remove ( classItems . focused ) ) ;
cmi . classList . add ( classItems . focused ) ;
} ) ;
cmi . addEventListener ( "mouseout" , e => {
cmi . classList . remove ( classItems . focused ) ;
} ) ;
cmg . append ( cmi ) ;
if ( scroller . childNodes . length ) {
// apend a separator
const separator = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . createElement ( ` <div role="separator" class=" ${ classItems . separator } "></div> ` ) ;
scroller . append ( separator ) ;
}
scroller . append ( cmg ) ;
if ( cmWrap . clientHeight < cmWrap . scrollHeight ) {
console . log ( "overflowing " + cmWrap . style . top ) ;
cmWrap . style . top = cmWrap . style . top - cmg . clientHeight + "px" ;
console . log ( "overflowing" + cmWrap . style . top ) ;
}
}
setTimeout ( attach , 1 ) ;
} catch ( e ) {
console . error ( e ) ;
}
}
getSelector ( element ) {
if ( element . id ) return ` # ${ element . id } ` ;
2020-09-05 22:50:45 +02:00
/ * *
*
* @ param { HTMLElement } el
2020-07-28 03:29:41 +02:00
* /
function fullPath ( el ) {
var names = [ ] ;
while ( el . parentNode ) {
if ( el . id ) {
names . unshift ( '#' + el . id ) ;
break ;
} else {
if ( el == el . ownerDocument . documentElement ) names . unshift ( el . tagName . toLowerCase ( ) + Array . from ( el . classList . entries ( ) ) . map ( e => "." + e ) . join ( "" ) ) ; else {
for ( var c = 1 , e = el ; e . previousElementSibling ; e = e . previousElementSibling , c ++ ) ;
names . unshift ( el . tagName . toLowerCase ( ) + ( typeof el . className === "string" && el . className || "" ) . split ( " " ) . filter ( e => ! ! e ) . map ( e => "." + e ) . join ( "" ) + ":nth-child(" + c + ")" ) ;
}
el = el . parentNode ;
}
}
return names . join ( " > " ) ;
}
return fullPath ( element ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/disableTyping.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / disableTyping . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class DisableTyping {
constructor ( ) {
window . Lightcord . Api . ensureExported ( e => e . default && e . default . startTyping ) . then ( typingModule => {
let self = this ;
const startTyping = typingModule . default . startTyping ;
typingModule . default . startTyping = function ( ) {
if ( self . disabled ) return startTyping . call ( this , ... arguments ) ;
} ;
const stopTyping = typingModule . default . stopTyping ;
typingModule . default . stopTyping = function ( ) {
if ( self . disabled ) return stopTyping . call ( this , ... arguments ) ;
} ;
this . disabled = true ;
} ) ;
window . Lightcord . BetterDiscord . DisableTyping = this ;
}
disable ( ) {
this . disabled = true ;
}
enable ( ) {
this . disabled = false ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/distant.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / distant . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: uuidv4, default, Constants, Routes */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "uuidv4" , function ( ) { return uuidv4 ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Constants" , function ( ) { return Constants ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Routes" , function ( ) { return Routes ; } ) ;
/* harmony import */ var _svg _bug _hunter _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../svg/bug_hunter */ "./src/svg/bug_hunter.jsx" ) ;
2020-07-28 18:55:37 +02:00
/* harmony import */ var node _fetch _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! node-fetch */ "node-fetch" ) ;
/* harmony import */ var node _fetch _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( node _fetch _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _svg _circus _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../svg/circus */ "./src/svg/circus.jsx" ) ;
2020-07-28 03:29:41 +02:00
function uuidv4 ( ) {
// Generate UUID (No crypto rng)
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' . replace ( /[xy]/g , function ( c ) {
var r = Math . random ( ) * 16 | 0 ,
v = c == 'x' ? r : r & 0x3 | 0x8 ;
return v . toString ( 16 ) ;
} ) ;
}
const awaitingBadgesPromises = { } ;
let badgesToFetch = [ ] ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class DistantServer {
constructor ( ) {
this . _cache = {
badges : { }
} ;
window . Lightcord . BetterDiscord . DistantServer = this ;
}
get cache ( ) {
return this . _cache ;
}
set cache ( data ) {
if ( typeof data !== "object" || typeof this . _cache !== "object" ) return this . _cache = data ;
return this . _cache = Object . assign ( this . _cache , data ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Get custom badges from the user ID .
* @ param { string } user The user ID
* @ returns { Promise < Constants [ "badges" ] > }
2020-07-28 03:29:41 +02:00
* /
async getBadges ( user ) {
if ( this . cache . badges [ user ] ) return this . cache . badges [ user ] ;
if ( awaitingBadgesPromises [ user ] ) return awaitingBadgesPromises [ user ] ;
let resolve ;
const newPromise = new Promise ( res => resolve = res ) ;
awaitingBadgesPromises [ user ] = newPromise ;
const badges = [ ] ;
for ( let badge of Constants . badges ) {
if ( badge . defaultUsers . includes ( user ) ) badges . push ( badge ) ;
}
const fetchedBadges = await new Promise ( resolve => {
2020-07-28 18:55:37 +02:00
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "settingsCookie" ] [ "lightcord-5" ] ) return resolve ( [ ] ) ;
2020-07-28 03:29:41 +02:00
badgesToFetch . push ( [ user , resolve ] ) ;
setTimeout ( ( ) => {
let users = badgesToFetch ;
if ( users . length === 0 ) return ;
badgesToFetch = [ ] ;
handleRequest ( Routes . badges , "POST" , JSON . stringify ( users . map ( e => e [ 0 ] ) ) ) . then ( async res => {
if ( res . status !== 200 ) {
// Couldn't fetch badges: server error
users . forEach ( data => {
data [ 1 ] ( [ ] ) ; // resolve no badge fetched
} ) ;
}
const responseBody = await res . json ( ) ;
for ( let user of responseBody ) {
let promise = users . find ( promise => promise [ 0 ] === user . user _id ) ;
promise [ 1 ] ( user . badges ) ;
}
} ) . catch ( err => {
// Couldn't fetch badges: error
if ( ! ( err instanceof LightcordError ) ) console . error ( err ) ;
users . forEach ( data => {
data [ 1 ] ( [ ] ) ; // resolve no badge fetched
} ) ;
} ) ;
} , 0 ) ;
} ) ;
for ( let badge of fetchedBadges ) {
if ( ! Constants . badges . find ( e => e . id === badge ) ) continue ; // We do not have the Component, skip it.
if ( badges . find ( e => e . id === badge ) ) continue ; // Already inserted.
badges . push ( Constants . badges . find ( e => e . id === badge ) ) ;
}
this . cache = {
badges : Object . assign ( this . cache . badges , {
[ user ] : badges
} )
} ;
setTimeout ( ( ) => {
delete this . cache . badges [ user ] ;
} , 600000 ) ;
resolve ( badges ) ;
delete awaitingBadgesPromises [ user ] ;
return badges ;
}
} ( ) ) ;
const handleRequest = function ( route , method , data ) {
2020-07-28 18:55:37 +02:00
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "settingsCookie" ] [ "lightcord-5" ] ) {
2020-07-28 03:29:41 +02:00
return Promise . reject ( new LightcordError ( "The current settings blocked the request." ) ) ;
}
2020-07-28 18:55:37 +02:00
return node _fetch _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( ` ${ Constants . SERVER _URL } /api/v1 ${ route } ` , {
2020-07-28 03:29:41 +02:00
method ,
headers : {
"CLIENT" : "Lightcord" ,
"Authorization" : window . Lightcord . Api . Authorization || "None::Anonymous"
} ,
... ( data ? {
body : data
} : { } )
} ) ;
} ;
class LightcordError extends Error {
constructor ( ) {
super ( ... arguments ) ;
this . name = "LightcordError" ;
}
}
const Constants = {
2020-10-14 00:50:42 +02:00
SERVER _URL : "https://lightcord.org" ,
2020-07-28 03:29:41 +02:00
badges : [ // TODO: Add more badges + server side svg
{
name : "Lightcord Bug Hunter" ,
id : "f04698f5-816b-41e3-bd01-92291193d7a5" ,
defaultUsers : [ "696481194443014174" , "696003456611385396" ] ,
scopes : [ ] ,
component : _svg _bug _hunter _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] ,
href : "https://github.com/lightcord/lightcord/wiki/badges#bug_hunter"
} , {
name : "Buffoon" ,
id : "06904d31-65b4-41ec-a50c-8658bbd1af96" ,
defaultUsers : [ "389016895543705602" , "664600134528663565" , "625350657829896224" ] ,
scopes : [ ] ,
2020-07-28 18:55:37 +02:00
component : _svg _circus _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] ,
2020-07-28 03:29:41 +02:00
href : "https://youtu.be/EJtb6z-dlT8?t=145"
} ]
} ;
const Routes = {
badges : ` /users/badges `
} ;
/***/ } ) ,
/***/ "./src/modules/domtools.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / domtools . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return DOMTools ; } ) ;
2020-09-05 22:50:45 +02:00
/ * *
* Copyright 2018 Zachary Rauen
*
* Permission is hereby granted , free of charge , to any person obtaining
* a copy of this software and associated documentation files ( the "Software" ) ,
* to deal in the Software without restriction , including without limitation the
* rights to use , copy , modify , merge , publish , distribute , sublicense , and / or sell
* copies of the Software , and to permit persons to whom the Software is furnished
* to do so , subject to the following conditions :
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software .
*
* THE SOFTWARE IS PROVIDED "AS IS" , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR IMPLIED ,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF
* CONTRACT , TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE .
*
* From : https : //github.com/rauenzi/BDPluginLibrary
2020-07-28 03:29:41 +02:00
* /
2020-09-05 22:50:45 +02:00
/ * *
* @ interface
* @ name Offset
* @ property { number } top - Top offset of the target element .
* @ property { number } right - Right offset of the target element .
* @ property { number } bottom - Bottom offset of the target element .
* @ property { number } left - Left offset of the target element .
* @ property { number } height - Outer height of the target element .
* @ property { number } width - Outer width of the target element .
2020-07-28 03:29:41 +02:00
* /
2020-09-05 22:50:45 +02:00
/ * *
* Function that automatically removes added listener .
* @ callback module : DOMTools ~ CancelListener
2020-07-28 03:29:41 +02:00
* /
class DOMTools {
static escapeID ( id ) {
return id . replace ( /^[^a-z]+|[^\w-]+/gi , "-" ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Adds a style to the document .
* @ param { string } id - identifier to use as the element id
* @ param { string } css - css to add to the document
2020-07-28 03:29:41 +02:00
* /
static addStyle ( id , css ) {
document . head . append ( DOMTools . createElement ( ` <style id=" ${ id } "> ${ css } </style> ` ) ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Removes a style from the document .
* @ param { string } id - original identifier used
2020-07-28 03:29:41 +02:00
* /
static removeStyle ( id ) {
const element = document . getElementById ( id ) ;
if ( element ) element . remove ( ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Adds / requires a remote script to be loaded
* @ param { string } id - identifier to use for this script
* @ param { string } url - url from which to load the script
* @ returns { Promise } promise that resolves when the script is loaded
2020-07-28 03:29:41 +02:00
* /
static addScript ( id , url ) {
return new Promise ( resolve => {
const script = document . createElement ( "script" ) ;
script . id = id ;
script . src = url ;
script . type = "text/javascript" ;
script . onload = resolve ;
document . head . append ( script ) ;
} ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Removes a remote script from the document .
* @ param { string } id - original identifier used
2020-07-28 03:29:41 +02:00
* /
static removeScript ( id ) {
id = this . escapeID ( id ) ;
const element = document . getElementById ( id ) ;
if ( element ) element . remove ( ) ;
} // https://javascript.info/js-animation
static animate ( {
timing = _ => _ ,
update ,
duration
} ) {
const start = performance . now ( ) ;
requestAnimationFrame ( function animate ( time ) {
// timeFraction goes from 0 to 1
let timeFraction = ( time - start ) / duration ;
if ( timeFraction > 1 ) timeFraction = 1 ; // calculate the current animation state
const progress = timing ( timeFraction ) ;
update ( progress ) ; // draw it
if ( timeFraction < 1 ) {
requestAnimationFrame ( animate ) ;
}
} ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* This is my shit version of not having to use ` $ ` from jQuery . Meaning
* that you can pass a selector and it will automatically run { @ link module : DOMTools . query } .
* It also means that you can pass a string of html and it will perform and return ` parseHTML ` .
* @ see module : DOMTools . parseHTML
* @ see module : DOMTools . query
* @ param { string } selector - Selector to query or HTML to parse
* @ returns { ( DocumentFragment | NodeList | HTMLElement ) } - Either the result of ` parseHTML ` or ` query `
2020-07-28 03:29:41 +02:00
* /
static Q ( selector ) {
const element = this . parseHTML ( selector ) ;
const isHTML = element instanceof NodeList ? Array . from ( element ) . some ( n => n . nodeType === 1 ) : element . nodeType === 1 ;
if ( isHTML ) return element ;
return this . query ( selector ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Essentially a shorthand for ` document.querySelector ` . If the ` baseElement ` is not provided
* ` document ` is used by default .
* @ param { string } selector - Selector to query
* @ param { Element } [ baseElement ] - Element to base the query from
* @ returns { ( Element | null ) } - The found element or null if not found
2020-07-28 03:29:41 +02:00
* /
2020-08-14 21:58:19 +02:00
static query ( selector , baseElement = document ) {
2020-07-28 03:29:41 +02:00
return baseElement . querySelector ( selector ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Essentially a shorthand for ` document.querySelectorAll ` . If the ` baseElement ` is not provided
* ` document ` is used by default .
* @ param { string } selector - Selector to query
* @ param { Element } [ baseElement ] - Element to base the query from
* @ returns { Array < Element > } - Array of all found elements
2020-07-28 03:29:41 +02:00
* /
2020-08-14 21:58:19 +02:00
static queryAll ( selector , baseElement = document ) {
2020-07-28 03:29:41 +02:00
return baseElement . querySelectorAll ( selector ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Parses a string of HTML and returns the results . If the second parameter is true ,
* the parsed HTML will be returned as a document fragment { @ see https : //developer.mozilla.org/en-US/docs/Web/API/DocumentFragment}.
* This is extremely useful if you have a list of elements at the top level , they can then be appended all at once to another node .
*
* If the second parameter is false , then the return value will be the list of parsed
* nodes and there were multiple top level nodes , otherwise the single node is returned .
* @ param { string } html - HTML to be parsed
* @ param { boolean } [ fragment = false ] - Whether or not the return should be the raw ` DocumentFragment `
* @ returns { ( DocumentFragment | NodeList | HTMLElement ) } - The result of HTML parsing
2020-07-28 03:29:41 +02:00
* /
static parseHTML ( html , fragment = false ) {
const template = document . createElement ( "template" ) ;
template . innerHTML = html ;
const node = template . content . cloneNode ( true ) ;
if ( fragment ) return node ;
return node . childNodes . length > 1 ? node . childNodes : node . childNodes [ 0 ] ;
}
/** Alternate name for {@link module:DOMTools.parseHTML} */
static createElement ( html , fragment = false ) {
return this . parseHTML ( html , fragment ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Takes a string of html and escapes it using the brower ' s own escaping mechanism .
* @ param { String } html - html to be escaped
2020-07-28 03:29:41 +02:00
* /
static escapeHTML ( html ) {
const textNode = document . createTextNode ( "" ) ;
const spanElement = document . createElement ( "span" ) ;
spanElement . append ( textNode ) ;
textNode . nodeValue = html ;
return spanElement . innerHTML ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Adds a list of classes from the target element .
* @ param { Element } element - Element to edit classes of
* @ param { ... string } classes - Names of classes to add
* @ returns { Element } - ` element ` to allow for chaining
2020-07-28 03:29:41 +02:00
* /
static addClass ( element , ... classes ) {
classes = classes . flat ( ) . filter ( c => c ) ;
for ( let c = 0 ; c < classes . length ; c ++ ) classes [ c ] = classes [ c ] . toString ( ) . split ( " " ) ;
classes = classes . flat ( ) . filter ( c => c ) ;
element . classList . add ( ... classes ) ;
return element ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Removes a list of classes from the target element .
* @ param { Element } element - Element to edit classes of
* @ param { ... string } classes - Names of classes to remove
* @ returns { Element } - ` element ` to allow for chaining
2020-07-28 03:29:41 +02:00
* /
static removeClass ( element , ... classes ) {
for ( let c = 0 ; c < classes . length ; c ++ ) classes [ c ] = classes [ c ] . toString ( ) . split ( " " ) ;
classes = classes . flat ( ) . filter ( c => c ) ;
element . classList . remove ( ... classes ) ;
return element ;
}
2020-09-05 22:50:45 +02:00
/ * *
* When only one argument is present : Toggle class value ;
* i . e . , if class exists then remove it and return false , if not , then add it and return true .
* When a second argument is present :
* If the second argument evaluates to true , add specified class value , and if it evaluates to false , remove it .
* @ param { Element } element - Element to edit classes of
* @ param { string } classname - Name of class to toggle
* @ param { boolean } [ indicator ] - Optional indicator for if the class should be toggled
* @ returns { Element } - ` element ` to allow for chaining
2020-07-28 03:29:41 +02:00
* /
static toggleClass ( element , classname , indicator ) {
classname = classname . toString ( ) . split ( " " ) . filter ( c => c ) ;
if ( typeof indicator !== "undefined" ) classname . forEach ( c => element . classList . toggle ( c , indicator ) ) ; else classname . forEach ( c => element . classList . toggle ( c ) ) ;
return element ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Checks if an element has a specific class
* @ param { Element } element - Element to edit classes of
* @ param { string } classname - Name of class to check
* @ returns { boolean } - ` true ` if the element has the class , ` false ` otherwise .
2020-07-28 03:29:41 +02:00
* /
static hasClass ( element , classname ) {
return classname . toString ( ) . split ( " " ) . filter ( c => c ) . every ( c => element . classList . contains ( c ) ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Replaces one class with another
* @ param { Element } element - Element to edit classes of
* @ param { string } oldName - Name of class to replace
* @ param { string } newName - New name for the class
* @ returns { Element } - ` element ` to allow for chaining
2020-07-28 03:29:41 +02:00
* /
static replaceClass ( element , oldName , newName ) {
element . classList . replace ( oldName , newName ) ;
return element ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Appends ` thisNode ` to ` thatNode `
* @ param { Node } thisNode - Node to be appended to another node
* @ param { Node } thatNode - Node for ` thisNode ` to be appended to
* @ returns { Node } - ` thisNode ` to allow for chaining
2020-07-28 03:29:41 +02:00
* /
static appendTo ( thisNode , thatNode ) {
if ( typeof thatNode == "string" ) thatNode = this . query ( thatNode ) ;
if ( ! thatNode ) return null ;
thatNode . append ( thisNode ) ;
return thisNode ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Prepends ` thisNode ` to ` thatNode `
* @ param { Node } thisNode - Node to be prepended to another node
* @ param { Node } thatNode - Node for ` thisNode ` to be prepended to
* @ returns { Node } - ` thisNode ` to allow for chaining
2020-07-28 03:29:41 +02:00
* /
static prependTo ( thisNode , thatNode ) {
if ( typeof thatNode == "string" ) thatNode = this . query ( thatNode ) ;
if ( ! thatNode ) return null ;
thatNode . prepend ( thisNode ) ;
return thisNode ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Insert after a specific element , similar to jQuery ' s ` thisElement.insertAfter(otherElement) ` .
* @ param { Node } thisNode - The node to insert
* @ param { Node } targetNode - Node to insert after in the tree
* @ returns { Node } - ` thisNode ` to allow for chaining
2020-07-28 03:29:41 +02:00
* /
static insertAfter ( thisNode , targetNode ) {
targetNode . parentNode . insertBefore ( thisNode , targetNode . nextSibling ) ;
return thisNode ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Insert after a specific element , similar to jQuery ' s ` thisElement.after(newElement) ` .
* @ param { Node } thisNode - The node to insert
* @ param { Node } newNode - Node to insert after in the tree
* @ returns { Node } - ` thisNode ` to allow for chaining
2020-07-28 03:29:41 +02:00
* /
static after ( thisNode , newNode ) {
thisNode . parentNode . insertBefore ( newNode , thisNode . nextSibling ) ;
return thisNode ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets the next sibling element that matches the selector .
* @ param { Element } element - Element to get the next sibling of
* @ param { string } [ selector = "" ] - Optional selector
* @ returns { Element } - The sibling element
2020-07-28 03:29:41 +02:00
* /
static next ( element , selector = "" ) {
return selector ? element . querySelector ( "+ " + selector ) : element . nextElementSibling ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets all subsequent siblings .
* @ param { Element } element - Element to get next siblings of
* @ returns { NodeList } - The list of siblings
2020-07-28 03:29:41 +02:00
* /
static nextAll ( element ) {
return element . querySelectorAll ( "~ *" ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets the subsequent siblings until an element matches the selector .
* @ param { Element } element - Element to get the following siblings of
* @ param { string } selector - Selector to stop at
* @ returns { Array < Element > } - The list of siblings
2020-07-28 03:29:41 +02:00
* /
static nextUntil ( element , selector ) {
const next = [ ] ;
while ( element . nextElementSibling && ! element . nextElementSibling . matches ( selector ) ) next . push ( element = element . nextElementSibling ) ;
return next ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets the previous sibling element that matches the selector .
* @ param { Element } element - Element to get the previous sibling of
* @ param { string } [ selector = "" ] - Optional selector
* @ returns { Element } - The sibling element
2020-07-28 03:29:41 +02:00
* /
static previous ( element , selector = "" ) {
const previous = element . previousElementSibling ;
if ( selector ) return previous && previous . matches ( selector ) ? previous : null ;
return previous ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets all preceeding siblings .
* @ param { Element } element - Element to get preceeding siblings of
* @ returns { NodeList } - The list of siblings
2020-07-28 03:29:41 +02:00
* /
static previousAll ( element ) {
const previous = [ ] ;
while ( element . previousElementSibling ) previous . push ( element = element . previousElementSibling ) ;
return previous ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets the preceeding siblings until an element matches the selector .
* @ param { Element } element - Element to get the preceeding siblings of
* @ param { string } selector - Selector to stop at
* @ returns { Array < Element > } - The list of siblings
2020-07-28 03:29:41 +02:00
* /
static previousUntil ( element , selector ) {
const previous = [ ] ;
while ( element . previousElementSibling && ! element . previousElementSibling . matches ( selector ) ) previous . push ( element = element . previousElementSibling ) ;
return previous ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Find which index in children a certain node is . Similar to jQuery ' s ` $ .index() `
* @ param { HTMLElement } node - The node to find its index in parent
* @ returns { number } Index of the node
2020-07-28 03:29:41 +02:00
* /
static indexInParent ( node ) {
const children = node . parentNode . childNodes ;
let num = 0 ;
for ( let i = 0 ; i < children . length ; i ++ ) {
if ( children [ i ] == node ) return num ;
if ( children [ i ] . nodeType == 1 ) num ++ ;
}
return - 1 ;
}
/** Shorthand for {@link module:DOMTools.indexInParent} */
static index ( node ) {
return this . indexInParent ( node ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets the parent of the element if it matches the selector ,
* otherwise returns null .
* @ param { Element } element - Element to get parent of
* @ param { string } [ selector = "" ] - Selector to match parent
* @ returns { ( Element | null ) } - The sibling element or null
2020-07-28 03:29:41 +02:00
* /
static parent ( element , selector = "" ) {
return ! selector || element . parentElement . matches ( selector ) ? element . parentElement : null ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets all children of Element that match the selector if provided .
* @ param { Element } element - Element to get all children of
* @ param { string } selector - Selector to match the children to
* @ returns { Array < Element > } - The list of children
2020-07-28 03:29:41 +02:00
* /
static findChild ( element , selector ) {
return element . querySelector ( ":scope > " + selector ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets all children of Element that match the selector if provided .
* @ param { Element } element - Element to get all children of
* @ param { string } selector - Selector to match the children to
* @ returns { Array < Element > } - The list of children
2020-07-28 03:29:41 +02:00
* /
static findChildren ( element , selector ) {
return element . querySelectorAll ( ":scope > " + selector ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets all ancestors of Element that match the selector if provided .
* @ param { Element } element - Element to get all parents of
* @ param { string } [ selector = "" ] - Selector to match the parents to
* @ returns { Array < Element > } - The list of parents
2020-07-28 03:29:41 +02:00
* /
static parents ( element , selector = "" ) {
const parents = [ ] ;
if ( selector ) while ( element . parentElement && element . parentElement . closest ( selector ) ) parents . push ( element = element . parentElement . closest ( selector ) ) ; else while ( element . parentElement ) parents . push ( element = element . parentElement ) ;
return parents ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets the ancestors until an element matches the selector .
* @ param { Element } element - Element to get the ancestors of
* @ param { string } selector - Selector to stop at
* @ returns { Array < Element > } - The list of parents
2020-07-28 03:29:41 +02:00
* /
static parentsUntil ( element , selector ) {
const parents = [ ] ;
while ( element . parentElement && ! element . parentElement . matches ( selector ) ) parents . push ( element = element . parentElement ) ;
return parents ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets all siblings of the element that match the selector .
* @ param { Element } element - Element to get all siblings of
* @ param { string } [ selector = "*" ] - Selector to match the siblings to
* @ returns { Array < Element > } - The list of siblings
2020-07-28 03:29:41 +02:00
* /
static siblings ( element , selector = "*" ) {
return Array . from ( element . parentElement . children ) . filter ( e => e != element && e . matches ( selector ) ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Sets or gets css styles for a specific element . If ` value ` is provided
* then it sets the style and returns the element to allow for chaining ,
* otherwise returns the style .
* @ param { Element } element - Element to set the CSS of
* @ param { string } attribute - Attribute to get or set
* @ param { string } [ value ] - Value to set for attribute
* @ returns { Element | string } - When setting a value , element is returned for chaining , otherwise the value is returned .
2020-07-28 03:29:41 +02:00
* /
static css ( element , attribute , value ) {
if ( typeof value == "undefined" ) return global . getComputedStyle ( element ) [ attribute ] ;
element . style [ attribute ] = value ;
return element ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Sets or gets the width for a specific element . If ` value ` is provided
* then it sets the width and returns the element to allow for chaining ,
* otherwise returns the width .
* @ param { Element } element - Element to set the CSS of
* @ param { string } [ value ] - Width to set
* @ returns { Element | string } - When setting a value , element is returned for chaining , otherwise the value is returned .
2020-07-28 03:29:41 +02:00
* /
static width ( element , value ) {
if ( typeof value == "undefined" ) return parseInt ( getComputedStyle ( element ) . width ) ;
element . style . width = value ;
return element ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Sets or gets the height for a specific element . If ` value ` is provided
* then it sets the height and returns the element to allow for chaining ,
* otherwise returns the height .
* @ param { Element } element - Element to set the CSS of
* @ param { string } [ value ] - Height to set
* @ returns { Element | string } - When setting a value , element is returned for chaining , otherwise the value is returned .
2020-07-28 03:29:41 +02:00
* /
static height ( element , value ) {
if ( typeof value == "undefined" ) return parseInt ( getComputedStyle ( element ) . height ) ;
element . style . height = value ;
return element ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Sets the inner text of an element if given a value , otherwise returns it .
* @ param { Element } element - Element to set the text of
* @ param { string } [ text ] - Content to set
* @ returns { string } - Either the string set by this call or the current text content of the node .
2020-07-28 03:29:41 +02:00
* /
static text ( element , text ) {
if ( typeof text == "undefined" ) return element . textContent ;
return element . textContent = text ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Returns the innerWidth of the element .
* @ param { Element } element - Element to retrieve inner width of
* @ return { number } - The inner width of the element .
2020-07-28 03:29:41 +02:00
* /
static innerWidth ( element ) {
return element . clientWidth ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Returns the innerHeight of the element .
* @ param { Element } element - Element to retrieve inner height of
* @ return { number } - The inner height of the element .
2020-07-28 03:29:41 +02:00
* /
static innerHeight ( element ) {
return element . clientHeight ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Returns the outerWidth of the element .
* @ param { Element } element - Element to retrieve outer width of
* @ return { number } - The outer width of the element .
2020-07-28 03:29:41 +02:00
* /
static outerWidth ( element ) {
return element . offsetWidth ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Returns the outerHeight of the element .
* @ param { Element } element - Element to retrieve outer height of
* @ return { number } - The outer height of the element .
2020-07-28 03:29:41 +02:00
* /
static outerHeight ( element ) {
return element . offsetHeight ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Gets the offset of the element in the page .
* @ param { Element } element - Element to get offset of
* @ return { Offset } - The offset of the element
2020-07-28 03:29:41 +02:00
* /
static offset ( element ) {
return element . getBoundingClientRect ( ) ;
}
static get listeners ( ) {
return this . _listeners || ( this . _listeners = { } ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* This is similar to jQuery ' s ` on ` function and can * hopefully * be used in the same way .
*
* Rather than attempt to explain , I ' ll show some example usages .
*
* The following will add a click listener ( in the ` myPlugin ` namespace ) to ` element ` .
* ` DOMTools.on(element, "click.myPlugin", () => {console.log("clicked!");}); `
*
* The following will add a click listener ( in the ` myPlugin ` namespace ) to ` element ` that only fires when the target is a ` .block ` element .
* ` DOMTools.on(element, "click.myPlugin", ".block", () => {console.log("clicked!");}); `
*
* The following will add a click listener ( without namespace ) to ` element ` .
* ` DOMTools.on(element, "click", () => {console.log("clicked!");}); `
*
* The following will add a click listener ( without namespace ) to ` element ` that only fires once .
* ` const cancel = DOMTools.on(element, "click", () => {console.log("fired!"); cancel();}); `
*
* @ param { Element } element - Element to add listener to
* @ param { string } event - Event to listen to with option namespace ( e . g . "event.namespace" )
* @ param { ( string | callable ) } delegate - Selector to run on element to listen to
* @ param { callable } [ callback ] - Function to fire on event
* @ returns { module : DOMTools ~ CancelListener } - A function that will undo the listener
2020-07-28 03:29:41 +02:00
* /
static on ( element , event , delegate , callback ) {
const [ type , namespace ] = event . split ( "." ) ;
const hasDelegate = delegate && callback ;
if ( ! callback ) callback = delegate ;
const eventFunc = ! hasDelegate ? callback : function ( event ) {
if ( event . target . matches ( delegate ) ) {
callback ( event ) ;
}
} ;
element . addEventListener ( type , eventFunc ) ;
const cancel = ( ) => {
element . removeEventListener ( type , eventFunc ) ;
} ;
if ( namespace ) {
if ( ! this . listeners [ namespace ] ) this . listeners [ namespace ] = [ ] ;
const newCancel = ( ) => {
cancel ( ) ;
this . listeners [ namespace ] . splice ( this . listeners [ namespace ] . findIndex ( l => l . event == type && l . element == element ) , 1 ) ;
} ;
this . listeners [ namespace ] . push ( {
event : type ,
element : element ,
cancel : newCancel
} ) ;
return newCancel ;
}
return cancel ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Functionality for this method matches { @ link module : DOMTools . on } but automatically cancels itself
* and removes the listener upon the first firing of the desired event .
*
* @ param { Element } element - Element to add listener to
* @ param { string } event - Event to listen to with option namespace ( e . g . "event.namespace" )
* @ param { ( string | callable ) } delegate - Selector to run on element to listen to
* @ param { callable } [ callback ] - Function to fire on event
* @ returns { module : DOMTools ~ CancelListener } - A function that will undo the listener
2020-07-28 03:29:41 +02:00
* /
static once ( element , event , delegate , callback ) {
const [ type , namespace ] = event . split ( "." ) ;
const hasDelegate = delegate && callback ;
if ( ! callback ) callback = delegate ;
const eventFunc = ! hasDelegate ? function ( event ) {
callback ( event ) ;
element . removeEventListener ( type , eventFunc ) ;
} : function ( event ) {
if ( ! event . target . matches ( delegate ) ) return ;
callback ( event ) ;
element . removeEventListener ( type , eventFunc ) ;
} ;
element . addEventListener ( type , eventFunc ) ;
const cancel = ( ) => {
element . removeEventListener ( type , eventFunc ) ;
} ;
if ( namespace ) {
if ( ! this . listeners [ namespace ] ) this . listeners [ namespace ] = [ ] ;
const newCancel = ( ) => {
cancel ( ) ;
this . listeners [ namespace ] . splice ( this . listeners [ namespace ] . findIndex ( l => l . event == type && l . element == element ) , 1 ) ;
} ;
this . listeners [ namespace ] . push ( {
event : type ,
element : element ,
cancel : newCancel
} ) ;
return newCancel ;
}
return cancel ;
}
static _ _offAll ( event , element ) {
const [ type , namespace ] = event . split ( "." ) ;
let matchFilter = listener => listener . event == type ,
defaultFilter = _ => _ ;
if ( element ) matchFilter = l => l . event == type && l . element == element , defaultFilter = l => l . element == element ;
const listeners = this . listeners [ namespace ] || [ ] ;
const list = type ? listeners . filter ( matchFilter ) : listeners . filter ( defaultFilter ) ;
for ( let c = 0 ; c < list . length ; c ++ ) list [ c ] . cancel ( ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* This is similar to jQuery ' s ` off ` function and can * hopefully * be used in the same way .
*
* Rather than attempt to explain , I ' ll show some example usages .
*
* The following will remove a click listener called ` onClick ` ( in the ` myPlugin ` namespace ) from ` element ` .
* ` DOMTools.off(element, "click.myPlugin", onClick); `
*
* The following will remove a click listener called ` onClick ` ( in the ` myPlugin ` namespace ) from ` element ` that only fired when the target is a ` .block ` element .
* ` DOMTools.off(element, "click.myPlugin", ".block", onClick); `
*
* The following will remove a click listener ( without namespace ) from ` element ` .
* ` DOMTools.off(element, "click", onClick); `
*
* The following will remove all listeners in namespace ` myPlugin ` from ` element ` .
* ` DOMTools.off(element, ".myPlugin"); `
*
* The following will remove all click listeners in namespace ` myPlugin ` from * all elements * .
* ` DOMTools.off("click.myPlugin"); `
*
* The following will remove all listeners in namespace ` myPlugin ` from * all elements * .
* ` DOMTools.off(".myPlugin"); `
*
* @ param { ( Element | string ) } element - Element to remove listener from
* @ param { string } [ event ] - Event to listen to with option namespace ( e . g . "event.namespace" )
* @ param { ( string | callable ) } [ delegate ] - Selector to run on element to listen to
* @ param { callable } [ callback ] - Function to fire on event
* @ returns { Element } - The original element to allow for chaining
2020-07-28 03:29:41 +02:00
* /
static off ( element , event , delegate , callback ) {
if ( typeof element == "string" ) return this . _ _offAll ( element ) ;
const [ type , namespace ] = event . split ( "." ) ;
if ( namespace ) return this . _ _offAll ( event , element ) ;
const hasDelegate = delegate && callback ;
if ( ! callback ) callback = delegate ;
const eventFunc = ! hasDelegate ? callback : function ( event ) {
if ( event . target . matches ( delegate ) ) {
callback ( event ) ;
}
} ;
element . removeEventListener ( type , eventFunc ) ;
return element ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Adds a listener for when the node is added / removed from the document body .
* The listener is automatically removed upon firing .
* @ param { HTMLElement } node - node to wait for
* @ param { callable } callback - function to be performed on event
* @ param { boolean } onMount - determines if it should fire on Mount or on Unmount
2020-07-28 03:29:41 +02:00
* /
static onMountChange ( node , callback , onMount = true ) {
const wrappedCallback = ( ) => {
this . observer . unsubscribe ( wrappedCallback ) ;
callback ( ) ;
} ;
this . observer . subscribe ( wrappedCallback , mutation => {
const nodes = Array . from ( onMount ? mutation . addedNodes : mutation . removedNodes ) ;
const directMatch = nodes . indexOf ( node ) > - 1 ;
const parentMatch = nodes . some ( parent => parent . contains ( node ) ) ;
return directMatch || parentMatch ;
} ) ;
return node ;
}
/** Shorthand for {@link module:DOMTools.onMountChange} with third parameter `true` */
static onMount ( node , callback ) {
return this . onMountChange ( node , callback ) ;
}
/** Shorthand for {@link module:DOMTools.onMountChange} with third parameter `false` */
static onUnmount ( node , callback ) {
return this . onMountChange ( node , callback , false ) ;
}
/** Alias for {@link module:DOMTools.onMount} */
static onAdded ( node , callback ) {
return this . onMount ( node , callback ) ;
}
/** Alias for {@link module:DOMTools.onUnmount} */
static onRemoved ( node , callback ) {
return this . onUnmount ( node , callback , false ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Helper function which combines multiple elements into one parent element
* @ param { Array < HTMLElement > } elements - array of elements to put into a single parent
2020-07-28 03:29:41 +02:00
* /
static wrap ( elements ) {
const domWrapper = this . parseHTML ( ` <div class="dom-wrapper"></div> ` ) ;
for ( let e = 0 ; e < elements . length ; e ++ ) domWrapper . appendChild ( elements [ e ] ) ;
return domWrapper ;
}
2020-09-05 22:50:45 +02:00
/ * *
* Resolves the node to an HTMLElement . This is mainly used by library modules .
* @ param { ( jQuery | Element ) } node - node to resolve
2020-07-28 03:29:41 +02:00
* /
static resolveElement ( node ) {
if ( ! ( node instanceof jQuery ) && ! ( node instanceof Element ) ) return undefined ;
return node instanceof jQuery ? node [ 0 ] : node ;
}
}
window . Lightcord . BetterDiscord . DOM = DOMTools ;
/***/ } ) ,
/***/ "./src/modules/emojiModule.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / emojiModule . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
2020-09-17 12:06:02 +02:00
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
2020-07-28 03:29:41 +02:00
const Constants = {
EmojiRegex : /<a?\.(\w+)\.(\d+)>/g
} ;
let CustomEmojiModule = BDModules . get ( e => e . CustomEmoji ) [ 0 ] ;
let EmojiModuleApi = BDModules . get ( e => e . default && e . default . getCustomEmojiById ) [ 0 ] ;
let AutocompleteModule = BDModules . get ( e => e . default && e . default . displayName === "Autocomplete" ) [ 0 ] ;
let AutoCompletionTemplates = BDModules . get ( e => e . getAutocompleteOptions ) [ 0 ] ;
let EmojiModuleQuery = BDModules . get ( e => e . default && e . default . queryEmojiResults ) [ 0 ] ;
let Messages = BDModules . get ( e => e . default && e . default . Messages && e . default . Messages . EMOJI _MATCHING ) [ 0 ] ;
let guildModule = BDModules . get ( e => e . default && e . default . getGuild && e . default . getGuilds && ! e . default . isFetching ) [ 0 ] ;
let emojiSearch = BDModules . get ( e => e . default && e . default . getDisambiguatedEmojiContext ) ;
2020-09-17 12:06:02 +02:00
const appSettings = Lightcord . Api . settings ;
2020-07-28 03:29:41 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class EmojiModule {
constructor ( ) {
this . init ( ) . catch ( err => _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . err ( "EmojiModule" , "An error occured" , err ) ) ; // better logging
}
async init ( ) {
/** Emoji AutoComplete */
if ( ! AutocompleteModule ) AutocompleteModule = await window . Lightcord . Api . ensureExported ( e => e . default && e . default . displayName === "Autocomplete" ) ;
if ( ! AutoCompletionTemplates ) AutoCompletionTemplates = await window . Lightcord . Api . ensureExported ( e => e . getAutocompleteOptions ) ;
if ( ! EmojiModuleQuery ) EmojiModuleQuery = await window . Lightcord . Api . ensureExported ( e => e . default && e . default . queryEmojiResults ) ;
if ( ! Messages ) Messages = await window . Lightcord . Api . ensureExported ( e => e . default && e . default . Messages && e . default . Messages . EMOJI _MATCHING ) ;
if ( ! guildModule ) guildModule = await window . Lightcord . Api . ensureExported ( e => e . default && e . default . getGuild && e . default . getGuilds && ! e . default . isFetching ) ;
if ( ! emojiSearch ) emojiSearch = await window . Lightcord . Api . ensureExported ( e => e . default && e . default . getDisambiguatedEmojiContext ) ;
2020-09-17 12:06:02 +02:00
const setting = _0globals _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "settings" ] [ "Emoji Prefix" ] ;
const getValue = ( ) => {
const value = appSettings . get ( "BD_" + setting . id , setting . default ) ;
if ( typeof value !== "string" ) return setting . default ;
return value ;
} ;
2020-07-28 03:29:41 +02:00
if ( AutocompleteModule && AutoCompletionTemplates && EmojiModuleQuery && Messages && guildModule && emojiSearch ) {
console . log ( ` Patching getAutocompleteOptions of AutoCompletionTemplates ` , AutoCompletionTemplates ) ;
const getAutocompleteOptions = AutoCompletionTemplates . getAutocompleteOptions ;
AutoCompletionTemplates . getAutocompleteOptions = function ( e , t , n , r , a ) {
const value = getAutocompleteOptions . call ( this , ... arguments ) ;
value . LIGHTCORD _EMOJIS = {
matches ( arg1 , arg2 ) {
2020-09-17 12:06:02 +02:00
let condition = arg2 . length > 1 && getValue ( ) === arg1 ;
2020-07-28 03:29:41 +02:00
setEmojiUsable ( condition ) ;
return condition ;
} ,
queryResults ( t ) {
let results = EmojiModuleQuery . default . queryEmojiResults ( t , e ) ;
return results ;
} ,
renderResults ( e , t , n , r , a ) {
return D ( e , t , a . emojis , n , r , Messages . default . Messages . EMOJI _MATCHING , Messages . default . Messages . EMOJI , AutocompleteModule . default . Emoji , function ( e ) {
return {
emoji : e ,
key : e . id || e . uniqueName || e . name ,
2020-09-17 12:06:02 +02:00
sentinel : getValue ( ) ,
2020-07-28 03:29:41 +02:00
guild : null != e . guildId ? guildModule . default . getGuild ( e . guildId ) : null
} ;
} , function ( e ) {
2020-09-17 12:06:02 +02:00
return getValue ( ) + e + getValue ( ) ;
2020-07-28 03:29:41 +02:00
} ) ;
} ,
getPlainText ( id , guild ) {
var emojis = guild . emojis ;
if ( null == emojis || null == emojis [ id ] ) return "" ;
var emoji = emojis [ id ] ,
isAnimated = emoji . animated ? "a" : "" ;
return emoji . managed || null == emoji . id ? "." + emoji . name + "." : "<" + isAnimated + "." + ( emoji . originalName || emoji . name ) + "." + emoji . id + ">" ;
} ,
getRawText ( id , guild ) {
var emojis = guild . emojis ;
if ( null == emojis || null == emojis [ id ] ) return "" ;
var emoji = emojis [ id ] ,
isAnimated = emoji . animated ? "a" : "" ;
return emoji . managed || null == emoji . id ? "." + emoji . name + "." : "<" + isAnimated + "." + ( emoji . originalName || emoji . name ) + "." + emoji . id + ">" ;
}
} ;
return value ;
} ;
} else {
console . error ( new Error ( "Couldn't start autocompletion of Lightcord's emojis." ) ) ;
}
/** Emoji display */
while ( ! _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . MessageComponent ) await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
if ( ! this . cancelEmojiRender ) {
// TODO: Proper emoji formatting / rendering
this . cancelEmoteRender = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . monkeyPatch ( _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . MessageComponent , "default" , {
before : data => {
const message = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getNestedProp ( data . methodArguments [ 0 ] , "childrenMessageContent.props.message" ) ;
if ( ! message ) return ;
const content = _utils _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getNestedProp ( data . methodArguments [ 0 ] , "childrenMessageContent.props.content" ) ;
if ( ! content || ! content . length ) return ;
2020-09-05 22:50:45 +02:00
/ * *
* @ type { {
* raw : string ,
* name : string ,
* id : string ,
* animated : boolean
* } [ ] }
2020-07-28 03:29:41 +02:00
* /
let emojis = [ ] ;
const newContent = [ ] ;
for ( let node of content ) {
if ( typeof node !== "string" ) {
newContent . push ( node ) ;
continue ;
}
;
let parsed ;
let hasParsed = false ;
do {
parsed = Constants . EmojiRegex . exec ( node ) ;
if ( parsed ) {
hasParsed = true ;
if ( ! EmojiModuleApi ) EmojiModuleApi = BDModules . get ( e => e . default && e . default . getCustomEmojiById ) [ 0 ] ;
const emoji = EmojiModuleApi . default . getCustomEmojiById ( parsed [ 2 ] ) ;
if ( emoji ) {
emojis . push ( {
animated : emoji . animated ,
name : emoji . name ,
id : emoji . id ,
raw : parsed [ 0 ]
} ) ;
} else {
emojis . push ( {
animated : parsed [ 0 ] . startsWith ( "<a" ) ,
name : parsed [ 1 ] ,
id : parsed [ 2 ] ,
raw : parsed [ 0 ]
} ) ;
}
}
} while ( parsed ) ;
if ( hasParsed ) {
const words = node . split ( " " ) . map ( ( word , index , arr ) => {
if ( ! word ) return "" ;
const emoji = emojis . find ( e => e . raw == word ) ;
if ( ! emoji ) return word ;
if ( ! CustomEmojiModule ) CustomEmojiModule = BDModules . get ( e => e . CustomEmoji ) [ 0 ] ;
return React . createElement ( CustomEmojiModule . CustomEmoji , {
emoji : {
2020-09-17 12:06:02 +02:00
name : ` ${ getValue ( ) } ${ emoji . name } ${ getValue ( ) } ` ,
2020-07-28 03:29:41 +02:00
emojiId : emoji . id ,
animated : emoji . animated ,
jumboable : arr . length === 1 && content . length === 1
}
} ) ;
} ) . reduce ( ( previous , current ) => {
if ( previous . length === 0 ) return [ current ] ;
if ( typeof current === "string" ) {
if ( typeof previous [ previous . length - 1 ] === "string" ) {
previous [ previous . length - 1 ] += ` ${ current } ` ;
return previous ;
}
previous . push ( " " + current ) ;
return previous ;
}
previous . push ( " " , current ) ;
return previous ;
} , [ ] ) ;
newContent . push ( ... words ) ;
} else {
newContent . push ( node ) ;
}
}
while ( data . methodArguments [ 0 ] . childrenMessageContent . props . content [ 0 ] ) {
data . methodArguments [ 0 ] . childrenMessageContent . props . content . shift ( ) ;
}
while ( newContent [ 0 ] ) {
data . methodArguments [ 0 ] . childrenMessageContent . props . content . push ( newContent . shift ( ) ) ;
}
}
} ) ;
}
2020-09-05 22:50:45 +02:00
/ *
let userModule
window . Lightcord . Api . ensureExported ( e => e . default && e . default . displayName === "EmojiPickerListRow" )
. then ( EmojiPickerListRow => {
let classs = EmojiPickerListRow . default
EmojiPickerListRow . default = class EmojiPickerListRow extends React . Component {
constructor ( props ) {
super ( props )
}
2020-09-14 11:38:34 +02:00
render ( ) {
2020-09-05 22:50:45 +02:00
if ( ! userModule ) userModule = BDModules . get ( e => e . default && e . default . getCurrentUser ) [ 0 ]
if ( ! userModule ) return React . createElement ( classs , this . props )
let user = userModule . default . getCurrentUser ( )
if ( ! user . hasPremiumSubscription ) return React . createElement ( classs , this . props )
2020-09-14 11:38:34 +02:00
return React . createElement ( classs , Object . assign ( { } , this . props , {
2020-09-05 22:50:45 +02:00
emojiDescriptors : this . props . emojiDescriptors . map ( e => {
e . isDisabled = false
} )
} ) )
}
}
EmojiPickerListRow . default . displayName = "EmojiPickerListRow"
2020-07-28 03:29:41 +02:00
} ) * /
}
disable ( ) {
if ( ! this . cancelEmoteRender ) return ;
this . cancelEmoteRender ( ) ;
this . cancelEmoteRender = null ;
}
start ( ) { }
} ( ) ) ;
function D ( e , t , n , r , o , i , s , u , l , c ) {
if ( null == n || 0 === n . length ) return null ;
var d = n . map ( function ( e , n ) {
return React . createElement ( u , Object . assign ( {
onClick : o ,
onHover : r ,
selected : t === n ,
index : n
} , l ( e , n ) ) ) ;
} ) ;
return [ R ( i , s , e , c ) , d ] ;
}
function R ( e , t , n , r ) {
var a = n . length > 0 ? e . format ( {
prefix : r ( n )
} ) : t ;
if ( Array . isArray ( a ) ) {
a . unshift ( React . createElement ( "strong" , { } , "[Lightcord] " ) ) ;
} else {
a = "[LIGHTCORD] " + a ;
}
return React . createElement ( AutocompleteModule . default . Title , {
title : a
} , a ) ;
}
R . displayName = "renderHeader" ;
let EmojiFilterModule = BDModules . get ( e => e . default && e . default . isEmojiDisabled ) [ 0 ] ;
let isEmojiDisabled = EmojiFilterModule && EmojiFilterModule . default . isEmojiDisabled ;
let isUsable = false ;
let hasPatched = false ;
function setEmojiUsable ( usable ) {
isUsable = usable ;
if ( hasPatched ) return ;
if ( ! EmojiFilterModule ) EmojiFilterModule = BDModules . get ( e => e . default && e . default . isEmojiDisabled ) [ 0 ] ;
if ( ! EmojiFilterModule ) return ;
if ( ! isEmojiDisabled ) isEmojiDisabled = EmojiFilterModule . default . isEmojiDisabled ;
hasPatched = true ;
EmojiFilterModule . default . isEmojiDisabled = function ( emoji ) {
if ( isUsable ) {
if ( emoji . surrogates || emoji . diversity ) return true ;
return false ;
}
return isEmojiDisabled . call ( this , ... arguments ) ;
} ;
}
/***/ } ) ,
2020-09-05 12:14:21 +02:00
/***/ "./src/modules/hooks.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / hooks . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: useForceUpdate */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "useForceUpdate" , function ( ) { return useForceUpdate ; } ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
const {
useState
} = _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react ;
function useForceUpdate ( ) {
2020-10-14 00:50:42 +02:00
const [ , setValue ] = useState ( 0 ) ;
return function forceUpdate ( ) {
setValue ( e => e + 1 ) ;
} ;
2020-09-05 12:14:21 +02:00
}
/***/ } ) ,
2020-07-28 03:29:41 +02:00
/***/ "./src/modules/pluginCertifier.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / pluginCertifier . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default, checkViruses, checkHash, processFile, processAttachment, decryptSettingsCache, encryptSettingsCache */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "checkViruses" , function ( ) { return checkViruses ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "checkHash" , function ( ) { return checkHash ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "processFile" , function ( ) { return processFile ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "processAttachment" , function ( ) { return processAttachment ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "decryptSettingsCache" , function ( ) { return decryptSettingsCache ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "encryptSettingsCache" , function ( ) { return encryptSettingsCache ; } ) ;
/* harmony import */ var node _fetch _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! node-fetch */ "node-fetch" ) ;
/* harmony import */ var node _fetch _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( node _fetch _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! electron */ "electron" ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( electron _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var crypto _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! crypto */ "crypto" ) ;
/* harmony import */ var crypto _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( crypto _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ../ui/tooltipWrap */ "./src/ui/tooltipWrap.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var fs _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
/* harmony import */ var fs _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( fs _ _WEBPACK _IMPORTED _MODULE _6 _ _ ) ;
/* harmony import */ var path _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! path */ "path" ) ;
/* harmony import */ var path _ _WEBPACK _IMPORTED _MODULE _7 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( path _ _WEBPACK _IMPORTED _MODULE _7 _ _ ) ;
/* harmony import */ var _contentManager _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./contentManager */ "./src/modules/contentManager.js" ) ;
const cache = { } ;
const cache2 = { } ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class PluginCertifier {
constructor ( ) {
window . Lightcord . BetterDiscord . PluginCertifier = this ;
}
patch ( attachment , id ) {
process . nextTick ( ( ) => {
processAttachment ( attachment , id ) ;
} ) ;
}
start ( ) { }
isTrusted ( hash ) {
return cache [ hash ] && ! cache [ hash ] . suspect ;
}
} ( ) ) ;
2020-09-20 14:16:02 +02:00
const tests = [ [ /token/gi , 0 , 0 ] , [ /email/gi , 0 , 0 ] , [ /mfa\./gi , 0 , 0 ] , [ /2fa/gi , 0 , 0 ] , [ /phone/gi , 0 , 0 ] , [ /child_process/gi , 0 , 0 ] , [ /localStorage/gi , 0 , 0 ] , [ /getGlobal/gi , 0 , 0 ] , [ /BrowserWindow/gi , 0 , 0 ] , [ /system32/gi , 0 , 0 ] , [ /password/gi , 0 , 0 ] , [ /eval/gi , 0 , 0 ] , [ /WebAssembly/gi , 0 , 0 ] , [ /XMLHttpRequest(\.|\[["'`])prototype/gi , 0 , 0 ] , [ /window\.fetch( +)?=/gi , 0 , 0 ] ,
2020-08-20 13:42:23 +02:00
/** Obfuscation / hidden / workarounds */
2020-09-14 11:38:34 +02:00
[ /(["'`]\+)["'`]\w["'`]/gi , 1 , 1 ] , [ /["'`]\w["'`](\+["'`])/gi , 1 , 1 ] , [ /\${["'`]\w+["'`]}/gi , 1 , 1 ] ,
2020-08-20 13:42:23 +02:00
/** hexadecimal */
2020-09-14 11:38:34 +02:00
[ /_0x\w{4}\('0x[\dabcdef]+'\)/g , 1 , 1 ] , [ /_0x\w{4}\('0x[\dabcdef]+'( +)?,( +)?'[^']{4}'\)/g , 1 , 1 ] , // _0x8db7('0x0', 'x1]f')
2020-08-20 13:42:23 +02:00
/** mangled */
2020-09-14 11:38:34 +02:00
[ /\w+\('0x[\dabcdef]+'\)/g , 1 , 1 ] , // b('0x0')
[ /\w+\('0x[\dabcdef]+'( +)?,( +)?'[^']{4}'\)/g , 1 , 1 ] , // b('0x0', 'x1]f')
2020-08-20 13:42:23 +02:00
/** string array at start */
2020-09-14 11:38:34 +02:00
[ /^var [\w\d_$]+=\["/gi , 1 , 1 ] ] ;
2020-08-20 13:42:23 +02:00
const threats = [ "Account Stealer/Virus" , "Obfuscation/Hidden code" ] ;
2020-07-28 03:29:41 +02:00
function checkViruses ( hash , data , resultCallback , removeCallback , filename ) {
data = data . toString ( "utf8" ) ;
let isHarmful = false ;
2020-09-05 22:50:45 +02:00
/ * *
* @ type { string }
2020-08-20 13:42:23 +02:00
* /
2020-07-28 03:29:41 +02:00
2020-08-20 13:42:23 +02:00
const no _comments = data . replace ( /\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm , "" ) . trim ( ) ; // removing all comments from plugins (remove meta and other.)
2020-07-28 03:29:41 +02:00
2020-09-14 11:38:34 +02:00
for ( const [ test , type , removeComment ] of tests ) {
const scrpt = removeComment === 1 ? no _comments : data ;
2020-07-28 03:29:41 +02:00
2020-08-20 13:42:23 +02:00
if ( test . exec ( scrpt ) ) {
isHarmful = threats [ type ] ;
2020-09-14 11:38:34 +02:00
console . log ( ` ${ hashToUrl [ hash ] . split ( "/" ) . pop ( ) } failed at test ` , test , ". Marked as" , threats [ type ] ) ;
2020-08-20 13:42:23 +02:00
break ;
2020-07-28 03:29:41 +02:00
}
}
if ( ! isHarmful ) return removeCallback ( hash ) ;
cache [ hash ] = {
suspect : true ,
name : hashToUrl [ hash ] . split ( "/" ) . pop ( ) ,
type : hashToUrl [ hash ] . endsWith ( ".js" ) ? "Plugin" : "Theme" ,
harm : isHarmful ,
hash : hash ,
filename
} ;
console . log ( ` Found potentially dangerous ${ cache [ hash ] . type . toLowerCase ( ) } : ${ cache [ hash ] . name } ` ) ;
resultCallback ( cache [ hash ] ) ;
}
const hashToUrl = { } ;
function checkHash ( hash , data , filename , resultCallback , removeCallback ) {
console . log ( ` File: ${ filename } hash: ${ hash } ` ) ;
if ( ! cache [ hash ] ) {
node _fetch _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( "https://cdn.jsdelivr.net/gh/Lightcord/filehashes@master/hashes/" + hash , {
// Using node-fetch to bypass cors
headers : {
2020-09-12 14:52:50 +02:00
"User-Agent" : electron _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ipcRenderer" ] . sendSync ( "LIGHTCORD_GET_USER_AGENT" ) // have to set user-agent
2020-07-28 03:29:41 +02:00
}
} ) . then ( async res => {
if ( res . status !== 200 ) {
if ( filename . endsWith ( ".theme.css" ) ) return removeCallback ( hash ) ;
2020-08-20 13:42:23 +02:00
try {
checkViruses ( hash , data , resultCallback , removeCallback , filename ) ;
} catch ( e ) {
console . error ( e ) ;
removeCallback ( ) ;
}
2020-07-28 03:29:41 +02:00
return ;
}
const result = await res . json ( ) ;
result . hash = hash ;
result . filename = filename ;
cache [ hash ] = result ;
resultCallback ( result ) ;
2020-08-07 12:49:05 +02:00
} ) . catch ( err => {
console . error ( ` Could not read from github. ${ err } ` ) ;
if ( filename . endsWith ( ".theme.css" ) ) return removeCallback ( hash ) ;
checkViruses ( hash , data , resultCallback , removeCallback , filename ) ;
} ) ;
2020-07-28 03:29:41 +02:00
} else {
const result = cache [ hash ] ;
resultCallback ( result ) ;
}
}
function processFile ( _ _path , resultCallback , removeCallback = hash => { } , isFromLoader = false ) {
const hash = crypto _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "createHash" ] ( "sha256" ) ;
let data = Buffer . alloc ( 0 ) ;
Object ( fs _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "createReadStream" ] ) ( _ _path ) . on ( "data" , chunk => {
data = Buffer . concat ( [ data , chunk ] ) ;
hash . update ( chunk ) ;
} ) . on ( "end" , ( ) => {
const hashResult = hash . digest ( "hex" ) ;
hashToUrl [ hashResult ] = _ _path ;
if ( isFromLoader && _contentManager _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "addonCache" ] [ hashResult ] ) {
let value = _contentManager _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "addonCache" ] [ hashResult ] ;
if ( value . timestamp < Date . now ( ) - 6.048 e + 8 ) {
delete _contentManager _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "addonCache" ] [ hashResult ] ;
_contentManager _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . saveAddonCache ( ) ;
} else {
resultCallback ( value . result ) ;
return ;
}
}
checkHash ( hashResult , data , Object ( path _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "basename" ] ) ( _ _path ) , resultCallback , removeCallback ) ;
} ) ;
}
function processAttachment ( attachment , id ) {
if ( ! document . getElementById ( id ) ) return ;
if ( ! attachment . url . startsWith ( "https://cdn.discordapp.com/" ) ) return document . getElementById ( id ) . remove ( ) ;
if ( ! attachment . filename . endsWith ( ".plugin.js" ) && ! attachment . filename . endsWith ( ".theme.css" ) ) return document . getElementById ( id ) . remove ( ) ;
node _fetch _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( attachment . url , {
headers : {
2020-09-12 14:52:50 +02:00
"User-Agent" : electron _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ipcRenderer" ] . sendSync ( "LIGHTCORD_GET_USER_AGENT" )
2020-07-28 03:29:41 +02:00
}
} ) . then ( res => {
if ( res . status !== 200 ) throw new Error ( "File doesn't exist." ) ;
const hash = crypto _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "createHash" ] ( "sha256" ) ;
let data = Buffer . alloc ( 0 ) ;
res . body . on ( "data" , chunk => {
data = Buffer . concat ( [ data , chunk ] ) ;
hash . update ( chunk ) ;
} ) ;
res . body . on ( "end" , ( ) => {
const hashResult = hash . digest ( "hex" ) ;
cache2 [ attachment . url ] = hashResult ;
hashToUrl [ hashResult ] = attachment . url ;
checkHash ( hashResult , data , attachment . filename , result => {
renderToElements ( id , result , attachment . filename ) ;
} , ( ) => {
let elem = document . getElementById ( id ) ;
if ( elem ) elem . remove ( ) ;
} ) ;
} ) ;
} ) . catch ( ( ) => { } ) ;
}
let flowerStarModule = BDModules . get ( e => e . flowerStarContainer ) [ 0 ] ;
let childModule = BDModules . get ( e => e . childContainer ) [ 0 ] ;
2020-09-05 22:50:45 +02:00
/ * *
*
* @ param { HTMLDivElement [ ] } elements
* @ param { { type : "Theme" | "Plugin" , name : string , official ? : boolean } | { suspect : true , type : "Theme" | "Plugin" , name : string , harm : string } } result
2020-07-28 03:29:41 +02:00
* /
function renderToElements ( id , result , filename ) {
const div = document . getElementById ( id ) ;
if ( ! div || div . childNodes . length > 0 ) return ; // already certified/div does not exist anymore.
if ( ! flowerStarModule ) flowerStarModule = BDModules . get ( e => e . flowerStarContainer ) [ 0 ] ;
if ( ! childModule ) childModule = BDModules . get ( e => e . childContainer ) [ 0 ] ;
if ( result . suspect ) {
try {
div . parentNode . style . borderColor = "rgb(240, 71, 71)" ;
2020-09-05 22:50:45 +02:00
/ * *
*
* @ param { HTMLElement } node
2020-07-28 03:29:41 +02:00
* /
let nextNode = node => {
for ( let child of node . children ) {
if ( child . tagName === "A" ) {
child . addEventListener ( "click" , e => {
e . preventDefault ( ) ;
e . stopImmediatePropagation ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . showConfirmationModal ( "Are you sure you want to download this ?" , "The " + result . type . toLowerCase ( ) + " **" + filename + "** might be dangerous **(" + result . harm + ")**. \n\n**We don't recommand to download it**. However, you can still do it below." , {
confirmText : "Download Anyway" ,
cancelText : "Don't !" ,
danger : true ,
onCancel : ( ) => { } ,
onConfirm : ( ) => {
2020-09-12 14:52:50 +02:00
electron _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "ipcRenderer" ] . sendSync ( "LIGHTCORD_OPEN_EXTERNAL" , child . href ) ;
2020-07-28 03:29:41 +02:00
}
} ) ;
} ) ;
} else if ( [ "div" ] . includes ( child . tagName . toLowerCase ( ) ) ) {
nextNode ( child ) ;
}
}
} ;
nextNode ( div . parentNode ) ;
} catch ( e ) {
console . error ( e ) ;
}
_v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . reactDom . render ( _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
text : result . type + " " + result . name + " is potentially dangerous."
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "div" , {
className : flowerStarModule . flowerStarContainer ,
style : {
width : "20px" ,
height : "20px"
}
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "svg" , {
className : BDModules . get ( e => e . svg ) [ 0 ] . svg ,
"aria-hidden" : "false" ,
width : "20px" ,
height : "20px" ,
viewBox : "0 0 40 32"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "rect" , {
x : "0" ,
y : "0" ,
width : "32" ,
height : "32" ,
mask : "url(#svg-mask-avatar-status-round-32)" ,
fill : "#f04747" ,
mask : "url(#svg-mask-status-dnd)" ,
className : BDModules . get ( e => e . pointerEvents ) [ 0 ] . pointerEvents
} ) ) ) ) , div ) ;
} else if ( ! result . official ) {
div . parentNode . style . borderColor = "#4087ed" ;
let span = _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "span" , {
style : {
display : "inherit"
}
} , [ _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
text : result . type + " " + result . name + " is certified by Lightcord."
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "div" , {
className : flowerStarModule . flowerStarContainer ,
style : {
width : "20px" ,
height : "20px" ,
float : "left"
}
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "svg" , {
className : flowerStarModule . flowerStar ,
"aria-hidden" : "false" ,
width : "20px" ,
height : "20px" ,
viewBox : "0 0 16 15.2"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "path" , {
fill : "#4f545c" ,
"fill-rule" : "evenodd" ,
d : "m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"
} ) ) , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "div" , {
className : childModule . childContainer
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "svg" , {
"aria-hidden" : "false" ,
width : "20px" ,
height : "20px" ,
viewBox : "0 0 16 15.2"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "path" , {
fill : "#ffffff" ,
d : "M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z"
} ) ) ) ) ) , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
text : "Install this " + result . type . toLowerCase ( ) + " on Lightcord."
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "div" , {
className : flowerStarModule . flowerStarContainer ,
style : {
width : "20px" ,
height : "20px"
} ,
onClick ( ) {
_utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . showConfirmationModal ( "Are you sure you want to download this " + result . type . toLowerCase ( ) + " ?" , "Lightcord will automatically install and launch this " + result . type . toLowerCase ( ) + ". You don't have anything to do." , {
confirmText : "Download and Install" ,
cancelText : "I've changed my mind" ,
danger : false ,
onCancel : ( ) => { } ,
onConfirm : ( ) => {
let link = getKeyedArray ( cache2 ) . find ( e => e [ 1 ] === result . hash ) [ 0 ] ;
console . log ( link ) ;
node _fetch _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( link ) . then ( async res => {
if ( res . status !== 200 ) throw new Error ( "Status was not 200" ) ;
let content = await res . buffer ( ) ;
let installPath = Object ( path _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "join" ] ) ( result . type === "Plugin" ? _contentManager _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . _pluginsFolder : _contentManager _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . _themesFolder , result . filename ) ;
console . log ( installPath ) ;
Object ( fs _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "writeFileSync" ] ) ( installPath , content ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . showToast ( result . type + " succesfully installed." ) ;
} ) . catch ( err => {
err = err instanceof Error ? err : new Error ( err ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . showToast ( err . message , {
type : "error"
} ) ;
} ) ;
}
} ) ;
}
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "svg" , {
className : flowerStarModule . flowerStar ,
"aria-hidden" : "false" ,
width : "20px" ,
height : "20px" ,
viewBox : "0 0 24 24" ,
style : {
color : "rgb(67, 181, 129)" ,
cursor : "pointer"
}
} , /*#__PURE__*/ React . createElement ( "g" , {
fill : "none" ,
"fill-rule" : "evenodd"
} , /*#__PURE__*/ React . createElement ( "path" , {
d : "M0 0h24v24H0z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
class : "fill" ,
fill : "currentColor" ,
d : "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"
} ) ) ) ) ) ] ) ;
_v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . reactDom . render ( span , div ) ;
} else {
div . parentNode . style . borderColor = "#4087ed" ;
let span = _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "span" , {
style : {
display : "inherit"
}
} , [ _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
text : result . type + " " + result . name + " was made by the developers of Lightcord." ,
style : "brand"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "div" , {
className : flowerStarModule . flowerStarContainer ,
style : {
width : "20px" ,
height : "20px" ,
float : "left"
}
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "svg" , {
className : flowerStarModule . flowerStar ,
"aria-hidden" : "false" ,
width : "20px" ,
height : "20px" ,
viewBox : "0 0 16 15.2" ,
stroke : "#36393f" ,
style : {
color : "#4087ed"
}
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "path" , {
fill : "currentColor" ,
"fill-rule" : "evenodd" ,
d : "m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"
} ) ) , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "div" , {
className : childModule . childContainer
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "svg" , {
"aria-hidden" : "false" ,
width : "20px" ,
height : "20px" ,
viewBox : "0 0 16 15.2"
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "path" , {
fill : "#ffffff" ,
d : "M10.7,5.28a2.9,2.9,0,0,0-2.11.86.11.11,0,0,0,0,.16l1.05.94a.11.11,0,0,0,.15,0,1.27,1.27,0,0,1,.9-.33c.65,0,.65.73.65.73a.64.64,0,0,1-.65.65,1.73,1.73,0,0,1-1.18-.54c-.31-.26-.36-.32-.73-.66S7.06,5.28,5.65,5.28A2.26,2.26,0,0,0,3.37,7.56,2.59,2.59,0,0,0,3.82,9a2.18,2.18,0,0,0,1.83.89,2.94,2.94,0,0,0,2.1-.81.11.11,0,0,0,0-.16L6.74,8A.11.11,0,0,0,6.6,8a1.58,1.58,0,0,1-.94.29h0A.71.71,0,0,1,5,7.56H5a.63.63,0,0,1,.65-.64c.71,0,1.42.75,1.94,1.27.75.76,1.66,1.79,3.11,1.74A2.28,2.28,0,0,0,13,7.64a2.59,2.59,0,0,0-.45-1.47A2.14,2.14,0,0,0,10.7,5.28Z"
} ) ) ) ) ) , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
text : "Install this " + result . type . toLowerCase ( ) + " on Lightcord."
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "div" , {
className : flowerStarModule . flowerStarContainer ,
style : {
width : "20px" ,
height : "20px"
} ,
onClick ( ) {
_utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . showConfirmationModal ( "Are you sure you want to download this " + result . type . toLowerCase ( ) + " ?" , "Lightcord will automatically download and load this " + result . type . toLowerCase ( ) + ". You must enable it in the settings." , {
confirmText : "Download and Install" ,
cancelText : "I've changed my mind" ,
danger : false ,
onCancel : ( ) => { } ,
onConfirm : ( ) => {
let link = getKeyedArray ( cache2 ) . find ( e => e [ 1 ] === result . hash ) [ 0 ] ;
node _fetch _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( link ) . then ( async res => {
if ( res . status !== 200 ) throw new Error ( "Status was not 200" ) ;
let content = await res . buffer ( ) ;
let installPath = Object ( path _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "join" ] ) ( result . type === "Plugin" ? _contentManager _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . _pluginsFolder : _contentManager _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . _themesFolder , result . filename ) ;
Object ( fs _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "writeFileSync" ] ) ( installPath , content ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . showToast ( result . type + " succesfully installed." ) ;
} ) . catch ( err => {
err = err instanceof Error ? err : new Error ( err ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . showToast ( err . message , {
type : "error"
} ) ;
} ) ;
}
} ) ;
}
} , _v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . react . createElement ( "svg" , {
className : flowerStarModule . flowerStar ,
"aria-hidden" : "false" ,
width : "20px" ,
height : "20px" ,
viewBox : "0 0 24 24" ,
style : {
color : "rgb(67, 181, 129)" ,
cursor : "pointer"
}
} , /*#__PURE__*/ React . createElement ( "g" , {
fill : "none" ,
"fill-rule" : "evenodd"
} , /*#__PURE__*/ React . createElement ( "path" , {
d : "M0 0h24v24H0z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
class : "fill" ,
fill : "currentColor" ,
d : "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"
} ) ) ) ) ) ] ) ;
_v2 _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . reactDom . render ( span , div ) ;
}
}
function getKeyedArray ( obj ) {
let arr = [ ] ;
Object . keys ( obj ) . forEach ( k => {
arr . push ( [ k , obj [ k ] ] ) ;
} ) ;
return arr ;
}
let key = null ;
let save = null ;
window . Lightcord . Api . ensureExported ( m => m . ObjectStorage ) . then ( localStorageModule => {
let localStorage = localStorageModule . impl ;
save = function ( ) {
localStorage . set ( "PluginCertifierKeyEncryption__" , btoa ( JSON . stringify ( key ) ) ) ;
} ;
setInterval ( ( ) => {
save ( ) ;
} , 100000 ) ;
try {
let val = safeJSONParse ( atob ( localStorage . get ( "PluginCertifierKeyEncryption__" ) ) ) ;
if ( val instanceof Error || ! Array . isArray ( val ) || val . length !== 2 || val . find ( e => typeof e !== "string" ) || Buffer . from ( val [ 0 ] , "base64" ) . length !== 16 || Buffer . from ( val [ 1 ] , "base64" ) . length !== 32 ) {
generateKey ( ) ;
save ( ) ;
return ;
}
key = val ;
} catch ( e ) {
generateKey ( ) ;
save ( ) ;
}
} ) ;
function generateKey ( ) {
key = [ crypto _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "randomBytes" ] ( 16 ) . toString ( "base64" ) , crypto _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "randomBytes" ] ( 32 ) . toString ( "base64" ) ] ;
}
function safeJSONParse ( json ) {
try {
return JSON . parse ( json ) ;
} catch ( e ) {
return e instanceof Error ? new Error ( e ) : e ;
}
}
function decryptSettingsCache ( data ) {
try {
let decipher = crypto _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "createDecipheriv" ] ( "aes-256-cbc" , Buffer . from ( key [ 1 ] , "base64" ) , Buffer . from ( key [ 0 ] , "base64" ) ) ;
let decrypted = decipher . update ( Buffer . from ( data , "base64" ) ) ;
decrypted = Buffer . concat ( [ decrypted , decipher . final ( ) ] ) ;
return decrypted . toString ( "utf8" ) ;
} catch ( e ) {
return "{}" ;
}
}
function encryptSettingsCache ( data ) {
let args = [ Buffer . from ( key [ 1 ] , "base64" ) , Buffer . from ( key [ 0 ] , "base64" ) ] ;
let cipher = crypto _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "createCipheriv" ] ( 'aes-256-cbc' , ... args ) ;
let encrypted = cipher . update ( Buffer . from ( data , "utf8" ) ) ;
encrypted = Buffer . concat ( [ encrypted , cipher . final ( ) ] ) ;
return encrypted . toString ( "base64" ) ;
}
/***/ } ) ,
/***/ "./src/modules/pluginModule.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / pluginModule . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./contentManager */ "./src/modules/contentManager.js" ) ;
/* harmony import */ var _dataStore _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./bdEvents */ "./src/modules/bdEvents.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
class PluginModule {
constructor ( ) {
window . Lightcord . BetterDiscord . PluginModule = this ;
}
get folder ( ) {
return _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . pluginsFolder ;
}
}
PluginModule . prototype . loadPlugins = async function ( ) {
this . loadPluginData ( ) ;
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdpluginErrors" ] . splice ( 0 , 0 , ... ( await _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadPlugins ( ) ) ) ;
const plugins = Object . keys ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] ) ;
for ( let i = 0 ; i < plugins . length ; i ++ ) {
let plugin , name ;
try {
plugin = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugins [ i ] ] . plugin ;
name = plugin . getName ( ) ;
if ( plugin . load && typeof plugin . load == "function" ) plugin . load ( ) ;
} catch ( err ) {
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ name ] = false ;
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "Plugins" , name + " could not be loaded." , err ) ;
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdpluginErrors" ] . push ( {
name : name ,
file : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugins [ i ] ] . filename ,
message : "load() could not be fired." ,
error : {
message : err . message ,
stack : err . stack
}
} ) ;
continue ;
}
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ name ] ) _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ name ] = false ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ name ] ) {
try {
plugin . start ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin . getName ( ) } v ${ plugin . getVersion ( ) } has started. ` ) ;
} catch ( err ) {
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ name ] = false ;
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "Plugins" , name + " could not be started." , err ) ;
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdpluginErrors" ] . push ( {
name : name ,
file : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugins [ i ] ] . filename ,
message : "start() could not be fired." ,
error : {
message : err . message ,
stack : err . stack
}
} ) ;
}
}
await new Promise ( resolve => setTimeout ( resolve , 10 ) ) ;
}
this . savePluginData ( ) ;
_ _webpack _require _ _ ( /*! electron */ "electron" ) . remote . getCurrentWebContents ( ) . on ( "did-navigate-in-page" , this . channelSwitch . bind ( this ) ) ; // if (settingsCookie["fork-ps-5"]) ContentManager.watchContent("plugin");
} ;
PluginModule . prototype . startPlugin = function ( plugin , reload = false ) {
try {
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . start ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] && ! reload ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getName ( ) } v ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getVersion ( ) } has started. ` ) ;
} catch ( err ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] && ! reload ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getName ( ) } v ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getVersion ( ) } could not be started. ` , {
type : "error"
} ) ;
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin ] = false ;
this . savePluginData ( ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "Plugins" , plugin + " could not be started." , err ) ;
}
} ;
PluginModule . prototype . stopPlugin = function ( plugin , reload = false ) {
try {
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . stop ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] && ! reload ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getName ( ) } v ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getVersion ( ) } has stopped. ` ) ;
} catch ( err ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] && ! reload ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getName ( ) } v ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getVersion ( ) } could not be stopped. ` , {
type : "error"
} ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "Plugins" , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getName ( ) + " could not be stopped." , err ) ;
}
} ;
PluginModule . prototype . enablePlugin = function ( plugin , reload = false ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin ] ) return ;
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin ] = true ;
this . savePluginData ( ) ;
this . startPlugin ( plugin , reload ) ;
} ;
PluginModule . prototype . enable = function ( plugin , reload = false ) {
return this . enablePlugin ( plugin , reload ) ;
} ;
PluginModule . prototype . disablePlugin = function ( plugin , reload = false ) {
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin ] ) return ;
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin ] = false ;
this . savePluginData ( ) ;
this . stopPlugin ( plugin , reload ) ;
} ;
PluginModule . prototype . disable = function ( plugin , reload = false ) {
return this . disablePlugin ( plugin , reload ) ;
} ;
PluginModule . prototype . togglePlugin = function ( plugin ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin ] ) this . disablePlugin ( plugin ) ; else this . enablePlugin ( plugin ) ;
} ;
PluginModule . prototype . toggle = function ( plugin , reload = false ) {
return this . togglePlugin ( plugin , reload ) ;
} ;
PluginModule . prototype . loadPlugin = async function ( filename ) {
const error = await _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadContent ( filename , "plugin" ) ;
if ( error ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-1" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showContentErrors ( {
plugins : [ error ]
} ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ filename } could not be loaded. ` , {
type : "error"
} ) ;
return _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "ContentManager" , ` ${ filename } could not be loaded. ` , error ) ;
}
const plugin = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] ) . find ( p => console . log ( p . filename , filename ) || p . filename == filename ) . plugin ;
try {
if ( plugin . load && typeof plugin . load == "function" ) plugin . load ( ) ;
} catch ( err ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-1" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showContentErrors ( {
plugins : [ err ]
} ) ;
}
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . log ( "ContentManager" , ` ${ plugin . getName ( ) } v ${ plugin . getVersion ( ) } was loaded. ` ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin . getName ( ) } v ${ plugin . getVersion ( ) } was loaded. ` , {
type : "success"
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . dispatch ( "plugin-loaded" , plugin . getName ( ) ) ;
} ;
PluginModule . prototype . unloadPlugin = function ( filenameOrName ) {
const bdplugin = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] ) . find ( p => p . filename == filenameOrName ) || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ filenameOrName ] ;
if ( ! bdplugin ) return ;
const plugin = bdplugin . plugin . getName ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin ] ) this . disablePlugin ( plugin , true ) ;
const error = _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . unloadContent ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . filename , "plugin" ) ;
delete _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] ;
if ( error ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-1" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showContentErrors ( {
plugins : [ error ]
} ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin } could not be unloaded. It may have not been loaded yet. ` , {
type : "error"
} ) ;
return _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "ContentManager" , ` ${ plugin } could not be unloaded. It may have not been loaded yet. ` , error ) ;
}
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . log ( "ContentManager" , ` ${ plugin } was unloaded. ` ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin } was unloaded. ` , {
type : "success"
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . dispatch ( "plugin-unloaded" , plugin ) ;
} ;
PluginModule . prototype . delete = function ( filenameOrName ) {
const bdplugin = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] ) . find ( p => p . filename == filenameOrName ) || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ filenameOrName ] ;
if ( ! bdplugin ) return ;
this . unloadPlugin ( bdplugin . filename ) ;
const fullPath = _ _webpack _require _ _ ( /*! path */ "path" ) . resolve ( _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . pluginsFolder , bdplugin . filename ) ;
_ _webpack _require _ _ ( /*! fs */ "fs" ) . unlinkSync ( fullPath ) ;
} ;
PluginModule . prototype . reloadPlugin = async function ( filenameOrName ) {
const bdplugin = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] ) . find ( p => p . filename == filenameOrName ) || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ filenameOrName ] ;
if ( ! bdplugin ) return this . loadPlugin ( filenameOrName ) ;
const plugin = bdplugin . plugin . getName ( ) ;
const enabled = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin ] ;
if ( enabled ) this . stopPlugin ( plugin , true ) ;
const error = await _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . reloadContent ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . filename , "plugin" ) ;
if ( error ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-1" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showContentErrors ( {
plugins : [ error ]
} ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin } could not be reloaded. ` , {
type : "error"
} ) ;
return _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "ContentManager" , ` ${ plugin } could not be reloaded. ` , error ) ;
}
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . load && typeof _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . load == "function" ) _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . load ( ) ;
if ( enabled ) this . startPlugin ( plugin , true ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . log ( "ContentManager" , ` ${ plugin } v ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getVersion ( ) } was reloaded. ` ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ plugin } v ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugin ] . plugin . getVersion ( ) } was reloaded. ` , {
type : "success"
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . dispatch ( "plugin-reloaded" , plugin ) ;
} ;
PluginModule . prototype . reload = function ( name ) {
return this . reloadPlugin ( name ) ;
} ;
PluginModule . prototype . edit = function ( filenameOrName ) {
const bdplugin = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] ) . find ( p => p . filename == filenameOrName ) || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ filenameOrName ] ;
if ( ! bdplugin ) return ;
const fullPath = _ _webpack _require _ _ ( /*! path */ "path" ) . resolve ( _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . pluginsFolder , bdplugin . filename ) ;
2020-09-20 14:16:02 +02:00
_ _webpack _require _ _ ( /*! electron */ "electron" ) . shell . openExternal ( ` ${ fullPath } ` ) ;
2020-07-28 03:29:41 +02:00
} ;
PluginModule . prototype . updatePluginList = function ( ) {
const results = _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadNewContent ( "plugin" ) ;
for ( const filename of results . added ) this . loadPlugin ( filename ) ;
for ( const name of results . removed ) this . unloadPlugin ( name ) ;
} ;
PluginModule . prototype . loadPluginData = function ( ) {
const saved = _dataStore _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getSettingGroup ( "plugins" ) ;
if ( saved ) {
Object . assign ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] , saved ) ;
}
} ;
PluginModule . prototype . savePluginData = function ( ) {
_dataStore _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . setSettingGroup ( "plugins" , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] ) ;
} ;
PluginModule . prototype . newMessage = function ( ) {
const plugins = Object . keys ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] ) ;
for ( let i = 0 ; i < plugins . length ; i ++ ) {
const plugin = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugins [ i ] ] . plugin ;
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin . getName ( ) ] ) continue ;
if ( typeof plugin . onMessage === "function" ) {
try {
plugin . onMessage ( ) ;
} catch ( err ) {
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "Plugins" , "Unable to fire onMessage for " + plugin . getName ( ) + "." , err ) ;
}
}
}
} ;
PluginModule . prototype . channelSwitch = function ( ) {
const plugins = Object . keys ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] ) ;
for ( let i = 0 ; i < plugins . length ; i ++ ) {
const plugin = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugins [ i ] ] . plugin ;
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin . getName ( ) ] ) continue ;
if ( typeof plugin . onSwitch === "function" ) {
try {
plugin . onSwitch ( ) ;
} catch ( err ) {
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "Plugins" , "Unable to fire onSwitch for " + plugin . getName ( ) + "." , err ) ;
}
}
}
} ;
PluginModule . prototype . rawObserver = function ( e ) {
const plugins = Object . keys ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] ) ;
for ( let i = 0 ; i < plugins . length ; i ++ ) {
const plugin = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdplugins" ] [ plugins [ i ] ] . plugin ;
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "pluginCookie" ] [ plugin . getName ( ) ] ) continue ;
if ( typeof plugin . observer === "function" ) {
try {
plugin . observer ( e ) ;
} catch ( err ) {
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "Plugins" , "Unable to fire observer for " + plugin . getName ( ) + "." , err ) ;
}
}
}
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new PluginModule ( ) ) ;
/***/ } ) ,
2020-08-10 13:44:02 +02:00
/***/ "./src/modules/popoutWindow.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / popoutWindow . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _bdEvents _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./bdEvents */ "./src/modules/bdEvents.js" ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class popoutWindow {
constructor ( ) {
2020-09-05 22:50:45 +02:00
/ * *
* @ type { Map < string , Window > }
2020-08-10 13:44:02 +02:00
* /
this . windows = new Map ( ) ;
this . enabled = false ;
this . init ( ) ;
}
async init ( ) {
let popoutModule = await window . Lightcord . Api . ensureExported ( e => e . default && e . default . getWindow ) ;
window . Lightcord . DiscordModules . dispatcher . subscribe ( "POPOUT_WINDOW_OPEN" , ev => {
setImmediate ( ( ) => {
2020-09-05 22:50:45 +02:00
/ * *
* @ type { Window }
2020-08-10 13:44:02 +02:00
* /
const window = popoutModule . default . getWindow ( ev . key ) ;
this . windows . set ( ev . key , window ) ;
let classList = window . document . body . classList ;
classList . add ( "window-popout" ) ;
classList . add ( "lightcord" ) ;
classList . add ( "lightcord" ) ;
this . update ( ev . key ) ;
} ) ;
} ) ;
window . Lightcord . DiscordModules . dispatcher . subscribe ( "POPOUT_WINDOW_CLOSE" , ev => {
setImmediate ( ( ) => {
this . windows . delete ( ev . key ) ;
} ) ;
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . on ( "theme-enabled" , ( ) => {
this . update ( ) ;
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . on ( "theme-disabled" , ( ) => {
this . update ( ) ;
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . on ( "theme-reloaded" , ( ) => {
this . update ( ) ;
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . on ( "theme-unloaded" , ( ) => {
this . update ( ) ;
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . on ( "theme-loaded" , ( ) => {
this . update ( ) ;
} ) ;
}
enable ( ) {
this . enabled = true ;
this . update ( ) ;
}
disable ( ) {
this . enabled = false ;
this . update ( ) ;
}
update ( key ) {
if ( ! this . windows . size ) return ;
if ( ! this . enabled ) {
return this . removeThemes ( key ) ;
} else {
return this . applyThemes ( key ) ;
}
}
removeThemes ( key ) {
if ( this . enabled ) return ;
if ( key ) {
let window = this . windows . get ( key ) ;
if ( ! window ) return ;
let document = window . document ;
for ( let style of document . querySelectorAll ( "style[data-lightcord-theme=true]" ) ) {
style . remove ( ) ;
}
} else {
for ( let key of this . windows . keys ( ) ) {
this . removeThemes ( key ) ;
}
}
}
applyThemes ( key ) {
if ( ! this . enabled ) return ;
if ( key ) {
let window = this . windows . get ( key ) ;
if ( ! window ) return ;
let document = window . document ;
for ( let style of document . querySelectorAll ( "style[data-lightcord-theme=true]" ) ) {
style . setAttribute ( "will-remove" , "true" ) ;
}
Object . keys ( bdthemes ) . forEach ( themeName => {
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ themeName ] ) return ; // theme disabled
const theme = bdthemes [ themeName ] ;
if ( ! theme ) return ; //:shrug:
let existing = document . querySelector ( "style[data-lightcord-theme=true]#" + _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . escapeID ( theme . id ) ) ;
if ( existing ) {
existing . innerHTML = unescape ( theme . css ) ;
existing . removeAttribute ( "will-remove" ) ;
} else {
const style = document . createElement ( "style" ) ;
style . id = _domtools _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . escapeID ( theme . id ) ;
style . innerHTML = unescape ( theme . css ) ;
style . setAttribute ( "data-lightcord-theme" , "true" ) ;
document . head . append ( style ) ;
}
} ) ;
for ( let style of document . querySelectorAll ( "style[will-remove=true]" ) ) {
style . remove ( ) ;
}
} else {
for ( let key of this . windows . keys ( ) ) {
this . applyThemes ( key ) ;
}
}
}
} ( ) ) ;
/***/ } ) ,
2020-07-28 03:29:41 +02:00
/***/ "./src/modules/publicServers.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / publicServers . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _webpackModules _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./webpackModules */ "./src/modules/webpackModules.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
/* harmony import */ var _ui _publicservers _publicServers _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ../ui/publicservers/publicServers */ "./src/ui/publicservers/publicServers.js" ) ;
2020-08-12 01:28:21 +02:00
/* harmony import */ var _Layers _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./Layers */ "./src/modules/Layers.jsx" ) ;
2020-07-28 03:29:41 +02:00
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class V2 _PublicServers {
constructor ( ) {
this . _appendButton = this . _appendButton . bind ( this ) ;
window . Lightcord . BetterDiscord . V2 _PublicServers = this ;
}
render ( ) {
2020-08-12 01:28:21 +02:00
_Layers _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . createLayer ( close => {
return _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( _ui _publicservers _publicServers _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] , {
rootId : "pubslayerroot" ,
close
} ) ;
} ) ;
2020-07-28 03:29:41 +02:00
}
get button ( ) {
const btn = _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . createElement ( ` <div id="bd-pub-li" class=" ${ _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . guildClasses . listItem } "> ` ) ;
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-1" ] ) btn . style . display = "none" ;
const label = _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . createElement ( ` <div id="bd-pub-button" class=" ${ "wrapper-25eVIn " + _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . guildClasses . circleButtonMask } ">public</div> ` ) ;
label . addEventListener ( "click" , ( ) => {
this . render ( ) ;
} ) ;
btn . append ( label ) ;
return btn ;
}
_appendButton ( ) {
let [ classNametutorialContainer ] = [ _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . removeDa ( BDModules . get ( e => e . downloadProgress && e . tutorialContainer ) [ 0 ] . tutorialContainer ) ] ;
if ( _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( "#bd-pub-li" ) ) return ;
const guilds = _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( ` div. ${ classNametutorialContainer } > div ` ) ;
_domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . after ( guilds , this . button ) ;
}
addButton ( ) {
if ( this . guildPatch ) return ;
const GuildList = _webpackModules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . find ( m => m . default && m . default . displayName == "NavigableGuilds" ) ;
const GuildListOld = _webpackModules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . findByDisplayName ( "Guilds" ) ;
if ( ! GuildList && ! GuildListOld ) _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . warn ( "PublicServer" , "Can't find GuildList component" ) ;
this . guildPatch = _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . monkeyPatch ( GuildList ? GuildList : GuildListOld . prototype , GuildList ? "default" : "render" , {
after : this . _appendButton
} ) ;
this . _appendButton ( ) ;
}
removeButton ( ) {
this . guildPatch ( ) ;
delete this . guildPatch ;
2020-07-28 18:55:37 +02:00
const button = _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( "#bd-pub-li" ) ;
if ( button ) button . remove ( ) ;
2020-07-28 03:29:41 +02:00
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/settingsPanel.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / settingsPanel . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _dataStore _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _settingsPanelSidebar _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./settingsPanelSidebar */ "./src/modules/settingsPanelSidebar.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _contentManager _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./contentManager */ "./src/modules/contentManager.js" ) ;
/* harmony import */ var _coloredText _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./coloredText */ "./src/modules/coloredText.js" ) ;
/* harmony import */ var _24hour _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./24hour */ "./src/modules/24hour.js" ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
/* harmony import */ var _publicServers _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./publicServers */ "./src/modules/publicServers.js" ) ;
/* harmony import */ var _voiceMode _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ./voiceMode */ "./src/modules/voiceMode.js" ) ;
/* harmony import */ var _classNormalizer _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ./classNormalizer */ "./src/modules/classNormalizer.js" ) ;
/* harmony import */ var _devMode _ _WEBPACK _IMPORTED _MODULE _12 _ _ = _ _webpack _require _ _ ( /*! ./devMode */ "./src/modules/devMode.js" ) ;
/* harmony import */ var _ui _sectionedSettingsPanel _ _WEBPACK _IMPORTED _MODULE _13 _ _ = _ _webpack _require _ _ ( /*! ../ui/sectionedSettingsPanel */ "./src/ui/sectionedSettingsPanel.js" ) ;
/* harmony import */ var _ui _cssEditor _ _WEBPACK _IMPORTED _MODULE _14 _ _ = _ _webpack _require _ _ ( /*! ../ui/cssEditor */ "./src/ui/cssEditor.js" ) ;
/* harmony import */ var _ui _addonlist _ _WEBPACK _IMPORTED _MODULE _15 _ _ = _ _webpack _require _ _ ( /*! ../ui/addonlist */ "./src/ui/addonlist.jsx" ) ;
/* harmony import */ var _ui _presenceSettings _ _WEBPACK _IMPORTED _MODULE _16 _ _ = _ _webpack _require _ _ ( /*! ../ui/presenceSettings */ "./src/ui/presenceSettings.jsx" ) ;
/* harmony import */ var _CustomRichPresence _ _WEBPACK _IMPORTED _MODULE _17 _ _ = _ _webpack _require _ _ ( /*! ./CustomRichPresence */ "./src/modules/CustomRichPresence.js" ) ;
/* harmony import */ var _ui _AccountInfos _ _WEBPACK _IMPORTED _MODULE _18 _ _ = _ _webpack _require _ _ ( /*! ../ui/AccountInfos */ "./src/ui/AccountInfos.jsx" ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ = _ _webpack _require _ _ ( /*! electron */ "electron" ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ ) ;
/* harmony import */ var _AntiAdDM _ _WEBPACK _IMPORTED _MODULE _20 _ _ = _ _webpack _require _ _ ( /*! ./AntiAdDM */ "./src/modules/AntiAdDM.js" ) ;
/* harmony import */ var _blurPrivate _ _WEBPACK _IMPORTED _MODULE _21 _ _ = _ _webpack _require _ _ ( /*! ./blurPrivate */ "./src/modules/blurPrivate.js" ) ;
/* harmony import */ var _disableTyping _ _WEBPACK _IMPORTED _MODULE _22 _ _ = _ _webpack _require _ _ ( /*! ./disableTyping */ "./src/modules/disableTyping.js" ) ;
/* harmony import */ var _ui _ApiPreview _ _WEBPACK _IMPORTED _MODULE _23 _ _ = _ _webpack _require _ _ ( /*! ../ui/ApiPreview */ "./src/ui/ApiPreview.jsx" ) ;
/* harmony import */ var _ui _switch _ _WEBPACK _IMPORTED _MODULE _24 _ _ = _ _webpack _require _ _ ( /*! ../ui/switch */ "./src/ui/switch.js" ) ;
/* harmony import */ var _ui _margintop _ _WEBPACK _IMPORTED _MODULE _25 _ _ = _ _webpack _require _ _ ( /*! ../ui/margintop */ "./src/ui/margintop.jsx" ) ;
/* harmony import */ var _webpackModules _ _WEBPACK _IMPORTED _MODULE _26 _ _ = _ _webpack _require _ _ ( /*! ./webpackModules */ "./src/modules/webpackModules.js" ) ;
/* harmony import */ var _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _27 _ _ = _ _webpack _require _ _ ( /*! ../ui/tooltipWrap */ "./src/ui/tooltipWrap.js" ) ;
/* harmony import */ var _ui _icons _history _ _WEBPACK _IMPORTED _MODULE _28 _ _ = _ _webpack _require _ _ ( /*! ../ui/icons/history */ "./src/ui/icons/history.jsx" ) ;
/* harmony import */ var _core _ _WEBPACK _IMPORTED _MODULE _29 _ _ = _ _webpack _require _ _ ( /*! ./core */ "./src/modules/core.js" ) ;
2020-08-10 13:44:02 +02:00
/* harmony import */ var _popoutWindow _ _WEBPACK _IMPORTED _MODULE _30 _ _ = _ _webpack _require _ _ ( /*! ./popoutWindow */ "./src/modules/popoutWindow.js" ) ;
2020-09-17 12:06:02 +02:00
/* harmony import */ var _ui _TextInputSetting _ _WEBPACK _IMPORTED _MODULE _31 _ _ = _ _webpack _require _ _ ( /*! ../ui/TextInputSetting */ "./src/ui/TextInputSetting.jsx" ) ;
2020-10-14 00:50:42 +02:00
/* harmony import */ var _hooks _ _WEBPACK _IMPORTED _MODULE _32 _ _ = _ _webpack _require _ _ ( /*! ./hooks */ "./src/modules/hooks.js" ) ;
2020-09-17 12:06:02 +02:00
2020-08-10 13:44:02 +02:00
2020-07-28 03:29:41 +02:00
class BDSidebarHeader extends React . PureComponent {
render ( ) {
let sidebarComponents = _webpackModules _ _WEBPACK _IMPORTED _MODULE _26 _ _ [ "default" ] . find ( e => e . Separator && e . Header && e . Item ) ;
const changelogButton = React . createElement ( _ui _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _27 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : "Changelog"
} , React . createElement ( "span" , {
style : {
float : "right" ,
cursor : "pointer"
} ,
className : "bd-changelog-button" ,
onClick : ( ) => {
_utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showChangelogModal ( bbdChangelog ) ;
}
} , React . createElement ( _ui _icons _history _ _WEBPACK _IMPORTED _MODULE _28 _ _ [ "default" ] , {
className : "bd-icon" ,
size : "16px"
} ) ) ) ;
let rendered = new sidebarComponents . Header ( {
children : React . createElement ( "span" , null , "Bandaged BD" , changelogButton ) ,
className : "ui-tab-bar-header"
} ) ;
return rendered ;
}
}
let isClearingCache = false ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class V2 _SettingsPanel {
constructor ( ) {
this . onChange = this . onChange . bind ( this ) ;
this . updateSettings = this . updateSettings . bind ( this ) ;
this . sidebar = new _settingsPanelSidebar _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] ( ) ;
this . registerComponents ( ) ;
}
registerComponents ( ) {
/** Lightcord */
this . sidebar . register ( "lightcord" , makeComponent ( this . lightcordComponent . bind ( this ) ) ) ;
this . sidebar . register ( "status" , makeComponent ( this . PresenceComponent . bind ( this ) ) ) ;
this . sidebar . register ( "accountinfo" , makeComponent ( this . AccountInfosComponent . bind ( this ) ) ) ;
this . sidebar . register ( "lcapipreview" , makeComponent ( this . ApiPreviewComponent . bind ( this ) ) ) ;
/* Bandaged BD */
this . sidebar . register ( "BDChangelogTitle" , makeComponent ( ( ) => {
return new BDSidebarHeader ( ) . render ( ) ;
} ) ) ;
this . sidebar . register ( "core" , makeComponent ( this . coreComponent . bind ( this ) ) ) ;
this . sidebar . register ( "customcss" , makeComponent ( this . customCssComponent . bind ( this ) ) ) ;
this . sidebar . register ( "plugins" , makeComponent ( this . renderAddonPane ( "plugins" ) ) ) ;
this . sidebar . register ( "themes" , makeComponent ( this . renderAddonPane ( "themes" ) ) ) ;
}
get coreSettings ( ) {
const settings = this . getSettings ( "core" ) ;
const categories = [ ... new Set ( settings . map ( s => s . category ) ) ] ;
const sections = categories . map ( c => {
return {
title : c ,
settings : settings . filter ( s => s . category == c )
} ;
} ) ;
return sections ;
}
get lightcordSettings ( ) {
const settings = this . getSettings ( "lightcord" ) ;
const categories = [ ... new Set ( settings . map ( s => s . category ) ) ] ;
const sections = categories . map ( c => {
return {
title : c ,
settings : settings . filter ( s => s . category == c )
} ;
} ) ;
return sections ;
}
get PresenceSettings ( ) {
return this . getSettings ( "status" ) ;
}
getSettings ( category ) {
return Object . keys ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settings" ] ) . reduce ( ( arr , key ) => {
const setting = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settings" ] [ key ] ;
if ( setting . cat === category && setting . implemented && ! setting . hidden ) {
setting . text = key ;
arr . push ( setting ) ;
}
return arr ;
} , [ ] ) ;
}
onChange ( id , checked , sidebar ) {
this . updateSettings ( id , checked , sidebar ) ;
}
updateSettings ( id , enabled , sidebar ) {
2020-09-17 12:06:02 +02:00
if ( ! [ "lightcord-8" , "no_window_bound" , "enable_glasstron" , "lightcord-10" , "lightcord-11" ] . includes ( id ) ) _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ id ] = enabled ;
2020-07-28 03:29:41 +02:00
if ( id == "bda-gs-2" ) {
if ( enabled ) _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . addClass ( document . body , "bd-minimal" ) ; else _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . removeClass ( document . body , "bd-minimal" ) ;
}
if ( id == "bda-gs-3" ) {
if ( enabled ) _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . addClass ( document . body , "bd-minimal-chan" ) ; else _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . removeClass ( document . body , "bd-minimal-chan" ) ;
}
if ( id == "bda-gs-1" ) {
if ( enabled ) _publicServers _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] . addButton ( ) ; else _publicServers _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] . removeButton ( ) ;
}
if ( id == "bda-gs-4" ) {
if ( enabled ) _voiceMode _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] . start ( ) ; else _voiceMode _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] . stop ( ) ;
}
if ( id == "bda-gs-5" ) {
if ( enabled ) _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . addClass ( _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . query ( "#app-mount" ) , "bda-dark" ) ; else _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . removeClass ( _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . query ( "#app-mount" ) , "bda-dark" ) ;
}
if ( enabled && id == "bda-gs-6" ) _24hour _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . inject24Hour ( ) ;
if ( id == "bda-gs-7" ) {
if ( enabled ) _coloredText _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . injectColoredText ( ) ; else _coloredText _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . removeColoredText ( ) ;
}
if ( id == "fork-ps-4" ) {
if ( enabled ) _classNormalizer _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] . start ( ) ; else _classNormalizer _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] . stop ( ) ;
}
if ( id == "fork-ps-5" ) {
if ( enabled ) {
_contentManager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . watchContent ( "plugin" ) ;
_contentManager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . watchContent ( "theme" ) ;
} else {
_contentManager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . unwatchContent ( "plugin" ) ;
_contentManager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . unwatchContent ( "theme" ) ;
}
}
if ( id == "fork-wp-1" ) {
_utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . setWindowPreference ( "transparent" , enabled ) ;
if ( enabled ) _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . setWindowPreference ( "backgroundColor" , null ) ; else _utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . setWindowPreference ( "backgroundColor" , "#2f3136" ) ;
}
if ( id == "bda-gs-8" ) {
if ( enabled ) _devMode _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] . startDebugListener ( ) ; else _devMode _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] . stopDebugListener ( ) ;
}
if ( id == "fork-dm-1" ) {
if ( enabled ) _devMode _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] . startCopySelector ( ) ; else _devMode _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] . stopCopySelector ( ) ;
}
if ( id === "lightcord-1" ) {
if ( enabled ) window . Lightcord . Settings . devMode = true ; else window . Lightcord . Settings . devMode = false ;
sidebar . forceUpdate ( ) ;
}
if ( id === "lightcord-2" ) {
if ( enabled ) window . Lightcord . Settings . callRingingBeat = true ; else window . Lightcord . Settings . callRingingBeat = false ;
}
if ( id === "lightcord-presence-1" ) {
if ( enabled ) {
_CustomRichPresence _ _WEBPACK _IMPORTED _MODULE _17 _ _ [ "default" ] . enable ( ) ;
const settingsStore = BDModules . get ( e => e . default && typeof e . default === "object" && "showCurrentGame" in e . default ) [ 0 ] ;
if ( settingsStore && ! settingsStore . default . showCurrentGame ) {
BDModules . get ( e => e . default && e . default . updateRemoteSettings ) [ 0 ] . default . updateRemoteSettings ( {
showCurrentGame : true
} ) ;
}
} else _CustomRichPresence _ _WEBPACK _IMPORTED _MODULE _17 _ _ [ "default" ] . disable ( ) ;
}
if ( id === "lightcord-3" ) {
2020-09-12 14:52:50 +02:00
electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ [ "ipcRenderer" ] . sendSync ( "LIGHTCORD_SET_ALWAYS_ON_TOP" , enabled ) ;
2020-07-28 03:29:41 +02:00
}
if ( id === "lightcord-4" ) {
if ( enabled ) {
_AntiAdDM _ _WEBPACK _IMPORTED _MODULE _20 _ _ [ "default" ] . enable ( ) ;
} else {
_AntiAdDM _ _WEBPACK _IMPORTED _MODULE _20 _ _ [ "default" ] . disable ( ) ;
}
}
if ( id === "lightcord-6" ) {
if ( enabled ) {
_blurPrivate _ _WEBPACK _IMPORTED _MODULE _21 _ _ [ "default" ] . enable ( ) ;
} else {
_blurPrivate _ _WEBPACK _IMPORTED _MODULE _21 _ _ [ "default" ] . disable ( ) ;
}
}
if ( id === "lightcord-7" ) {
if ( enabled ) {
_disableTyping _ _WEBPACK _IMPORTED _MODULE _22 _ _ [ "default" ] . enable ( ) ;
} else {
_disableTyping _ _WEBPACK _IMPORTED _MODULE _22 _ _ [ "default" ] . disable ( ) ;
}
}
if ( id === "lightcord-8" ) {
2020-09-12 14:52:50 +02:00
let appSettings = window . Lightcord . Api . settings ;
2020-07-28 03:29:41 +02:00
appSettings . set ( "isTabs" , enabled ) ;
appSettings . save ( ) ;
2020-09-12 14:52:50 +02:00
DiscordNative . app . relaunch ( ) ;
2020-07-28 03:29:41 +02:00
}
2020-08-10 13:44:02 +02:00
if ( id === "lightcord-9" ) {
_popoutWindow _ _WEBPACK _IMPORTED _MODULE _30 _ _ [ "default" ] [ enabled ? "enable" : "disable" ] ( ) ;
}
2020-07-28 03:29:41 +02:00
if ( id === "lightcord-10" ) {
_core _ _WEBPACK _IMPORTED _MODULE _29 _ _ [ "default" ] . methods . NotificationsUseShim ( enabled ) ;
return ;
}
if ( id === "no_window_bound" ) {
2020-09-12 14:52:50 +02:00
let appSettings = window . Lightcord . Api . settings ;
2020-07-28 03:29:41 +02:00
appSettings . set ( "NO_WINDOWS_BOUND" , enabled ) ;
2020-08-04 13:43:22 +02:00
appSettings . delete ( "IS_MAXIMIZED" ) ;
appSettings . delete ( "IS_MINIMIZED" ) ;
appSettings . delete ( "WINDOW_BOUNDS" ) ;
2020-07-28 03:29:41 +02:00
appSettings . save ( ) ;
2020-09-12 14:52:50 +02:00
DiscordNative . app . relaunch ( ) ;
2020-07-28 03:29:41 +02:00
}
if ( id === "enable_glasstron" ) {
2020-09-12 14:52:50 +02:00
let appSettings = window . Lightcord . Api . settings ;
2020-07-28 03:29:41 +02:00
appSettings . set ( "GLASSTRON" , enabled ) ;
appSettings . save ( ) ;
2020-09-12 14:52:50 +02:00
DiscordNative . app . relaunch ( ) ;
2020-07-28 03:29:41 +02:00
}
2020-09-17 12:06:02 +02:00
if ( id === "lightcord-11" ) {
let appSettings = window . Lightcord . Api . settings ;
if ( ! enabled ) {
appSettings . delete ( "BD_" + id ) ;
appSettings . save ( ) ;
return ;
}
appSettings . set ( "BD_" + id , enabled ) ;
appSettings . save ( ) ;
return ;
}
2020-07-28 03:29:41 +02:00
this . saveSettings ( ) ;
}
async initializeSettings ( ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-2" ] ) _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . addClass ( document . body , "bd-minimal" ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-3" ] ) _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . addClass ( document . body , "bd-minimal-chan" ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-1" ] ) _publicServers _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] . addButton ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-4" ] ) _voiceMode _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] . start ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-5" ] ) _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . addClass ( _domtools _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . query ( "#app-mount" ) , "bda-dark" ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-6" ] ) _24hour _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . inject24Hour ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-7" ] ) _coloredText _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] . injectColoredText ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-4" ] ) _classNormalizer _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] . start ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "lightcord-1" ] ) window . Lightcord . Settings . devMode = true ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "lightcord-2" ] ) window . Lightcord . Settings . callRingingBeat = true ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "lightcord-presence-1" ] ) _CustomRichPresence _ _WEBPACK _IMPORTED _MODULE _17 _ _ [ "default" ] . enable ( ) ;
2020-09-12 14:52:50 +02:00
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "lightcord-3" ] ) electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ [ "ipcRenderer" ] . sendSync ( "LIGHTCORD_SET_ALWAYS_ON_TOP" , true ) ;
2020-07-28 03:29:41 +02:00
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "lightcord-4" ] ) _AntiAdDM _ _WEBPACK _IMPORTED _MODULE _20 _ _ [ "default" ] . enable ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "lightcord-6" ] ) _blurPrivate _ _WEBPACK _IMPORTED _MODULE _21 _ _ [ "default" ] . enable ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "lightcord-7" ] ) _disableTyping _ _WEBPACK _IMPORTED _MODULE _22 _ _ [ "default" ] . enable ( ) ;
2020-08-10 13:44:02 +02:00
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "lightcord-9" ] ) _popoutWindow _ _WEBPACK _IMPORTED _MODULE _30 _ _ [ "default" ] . enable ( ) ;
2020-07-28 03:29:41 +02:00
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-5" ] ) {
_contentManager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . watchContent ( "plugin" ) ;
_contentManager _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . watchContent ( "theme" ) ;
}
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-gs-8" ] ) _devMode _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] . startDebugListener ( ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-dm-1" ] ) _devMode _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] . startCopySelector ( ) ;
this . saveSettings ( ) ;
}
saveSettings ( ) {
_dataStore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . setSettingGroup ( "settings" , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] ) ;
_dataStore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . setSettingGroup ( "rpc" , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsRPC" ] ) ;
}
loadSettings ( ) {
Object . assign ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] , _dataStore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getSettingGroup ( "settings" ) ) ;
Object . assign ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsRPC" ] , _dataStore _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . getSettingGroup ( "rpc" ) ) ;
}
renderSidebar ( sidebar ) {
return this . sidebar . render ( sidebar ) ;
}
coreComponent ( ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( _ui _sectionedSettingsPanel _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] , {
key : "cspanel" ,
onChange : this . onChange ,
sections : this . coreSettings
} ) ;
}
lightcordComponent ( sidebar , forceUpdate ) {
2020-09-12 14:52:50 +02:00
let appSettings = window . Lightcord . Api . settings ;
2020-07-28 03:29:41 +02:00
return [ this . lightcordSettings . map ( ( section , i ) => {
return [ i === 0 ? null : _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( _ui _margintop _ _WEBPACK _IMPORTED _MODULE _25 _ _ [ "default" ] ) , _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( "h2" , {
className : "ui-form-title h2 margin-reset margin-bottom-20"
} , section . title ) , section . settings . map ( setting => {
2020-10-14 00:50:42 +02:00
return React . createElement ( ( ) => {
const forceUpdate = Object ( _hooks _ _WEBPACK _IMPORTED _MODULE _32 _ _ [ "useForceUpdate" ] ) ( ) ;
let isChecked = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ setting . id ] ;
if ( setting . id === "lightcord-8" ) isChecked = appSettings . get ( "isTabs" , false ) ;
if ( setting . id === "no_window_bound" ) isChecked = appSettings . get ( "NO_WINDOWS_BOUND" , false ) ;
if ( setting . id === "enable_glasstron" ) isChecked = appSettings . get ( "GLASSTRON" , true ) ;
if ( setting . id === "lightcord-10" ) isChecked = ! appSettings . get ( "DEFAULT_NOTIFICATIONS" , true ) ;
let returnValue ;
if ( [ "lightcord-11" ] . includes ( setting . id ) ) {
let value = appSettings . get ( "BD_" + setting . id , setting . default || "" ) ;
returnValue = _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( _ui _TextInputSetting _ _WEBPACK _IMPORTED _MODULE _31 _ _ [ "default" ] , {
id : setting . id ,
key : setting . id ,
data : setting ,
value ,
placeholder : setting . default || null ,
onChange : ( id , value ) => {
this . onChange ( id , value , sidebar ) ;
}
} ) ;
} else {
returnValue = _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( _ui _switch _ _WEBPACK _IMPORTED _MODULE _24 _ _ [ "default" ] , {
id : setting . id ,
key : setting . id ,
data : setting ,
checked : isChecked ,
onChange : ( id , checked ) => {
this . onChange ( id , checked , sidebar ) ;
forceUpdate ( ) ;
}
} ) ;
}
2020-07-28 03:29:41 +02:00
2020-10-14 00:50:42 +02:00
if ( setting . id == "lightcord-8" && isChecked ) {
return [ returnValue , React . createElement ( Lightcord . Api . Components . inputs . Button , {
color : "green" ,
look : "outlined" ,
size : "small" ,
hoverColor : "brand" ,
onClick : ( ) => {
DiscordNative . ipc . send ( "NEW_TAB" ) ;
} ,
wrapper : false ,
disabled : false
} , "Open a new Tab" ) ] ;
}
2020-07-28 03:29:41 +02:00
2020-10-14 00:50:42 +02:00
if ( setting . id === "enable_glasstron" && isChecked ) {
if ( process . platform !== "linux" ) {
let choices = [ ] ;
let actual = null ;
if ( process . platform === "win32" ) {
choices . push ( "blurbehind" , "acrylic" , "transparent" ) ;
actual = appSettings . get ( "GLASSTRON_BLUR" , "blurbehind" ) ;
} else if ( process . platform === "darwin" ) {
choices . push ( "titlebar" , "selection" , "menu" , "popover" , "sidebar" , "header" , "sheet" , "window" , "hud" , "fullscreen-ui" , "tooltip" , "content" , "under-window" , "under-page" , "none" ) ;
actual = appSettings . get ( "GLASSTRON_VIBRANCY" , "fullscreen-ui" ) ;
}
2020-09-06 12:50:52 +02:00
2020-10-14 00:50:42 +02:00
return [ returnValue , React . createElement ( Lightcord . Api . Components . general . SettingSubTitle , { } , "Glasstron Blur" ) , React . createElement ( Lightcord . Api . Components . inputs . Dropdown , {
options : choices . map ( e => {
return {
value : e ,
label : e
} ;
} ) ,
value : actual ,
disabled : false ,
searchable : true ,
clearable : false ,
onChange : value => {
if ( process . platform === "win32" ) {
electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ [ "ipcRenderer" ] . invoke ( "LIGHTCORD_SET_BLUR_TYPE" , value ) ;
} else {
electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ [ "ipcRenderer" ] . invoke ( "LIGHTCORD_SET_VIBRANCY" , value ) ;
}
2020-09-06 12:50:52 +02:00
}
2020-10-14 00:50:42 +02:00
} , null ) ] ;
}
2020-09-06 12:50:52 +02:00
}
2020-10-14 00:50:42 +02:00
return returnValue ;
} ) ;
2020-07-28 03:29:41 +02:00
} ) ] ;
} ) , _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( window . Lightcord . Api . Components . inputs . Button , {
color : "yellow" ,
look : "ghost" ,
size : "medium" ,
hoverColor : "red" ,
onClick ( ) {
2020-09-12 14:52:50 +02:00
electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ [ "ipcRenderer" ] . sendSync ( "LIGHTCORD_RELAUNCH_APP" , {
2020-07-28 03:29:41 +02:00
args : electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ [ "remote" ] . process . argv . slice ( 1 ) . concat ( [ "--disable-betterdiscord" ] )
} ) ;
} ,
wrapper : true
} , "Relaunch without BetterDiscord" ) , React . createElement ( Lightcord . Api . Components . inputs . Button , {
color : "yellow" ,
look : "ghost" ,
size : "medium" ,
hoverColor : "red" ,
onClick : ( ) => {
if ( isClearingCache ) return ;
isClearingCache = true ;
_utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( "Clearing cache..." , {
type : "info"
} ) ;
forceUpdate ( ) ;
electron _ _WEBPACK _IMPORTED _MODULE _19 _ _ [ "remote" ] . getCurrentWebContents ( ) . session . clearCache ( ) . then ( ( ) => {
_utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( "Cache is cleared !" , {
type : "success"
} ) ;
isClearingCache = false ;
forceUpdate ( ) ;
} ) . catch ( err => {
console . error ( err ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . showToast ( "An error occured. Check console for more informations." , {
type : "error"
} ) ;
isClearingCache = false ;
forceUpdate ( ) ;
} ) ;
} ,
wrapper : true ,
disabled : isClearingCache
} , "Clear cache" ) ] ;
}
PresenceComponent ( ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( _ui _presenceSettings _ _WEBPACK _IMPORTED _MODULE _16 _ _ [ "default" ] , {
key : "lppannel" ,
onChange : this . onChange ,
settings : this . PresenceSettings
} ) ;
}
AccountInfosComponent ( ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( _ui _AccountInfos _ _WEBPACK _IMPORTED _MODULE _18 _ _ [ "default" ] , {
key : "lapannel"
} ) ;
}
ApiPreviewComponent ( ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( _ui _ApiPreview _ _WEBPACK _IMPORTED _MODULE _23 _ _ [ "default" ] , {
key : "lapipannel"
} ) ;
}
customCssComponent ( ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( _ui _cssEditor _ _WEBPACK _IMPORTED _MODULE _14 _ _ [ "default" ] , {
key : "csseditor"
} ) ;
}
renderAddonPane ( type ) {
// I know this shouldn't be here, but when it isn't,
// React refuses to change the button when going
// between plugins and themes page... something
// to debug later.
class ContentList extends _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . Component {
constructor ( props ) {
super ( props ) ;
this . prefix = this . props . type . replace ( "s" , "" ) ;
}
onChange ( ) {
this . props . onChange ( this . props . type ) ;
}
render ( ) {
return this . props . children ;
}
}
const originalRender = ContentList . prototype . render ;
Object . defineProperty ( ContentList . prototype , "render" , {
enumerable : false ,
configurable : false ,
set : function ( ) {
console . warn ( "Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins" ) ;
} ,
get : ( ) => originalRender
} ) ;
return function ( ) {
return _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( ContentList , {
type
} , _v2 _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . react . createElement ( _ui _addonlist _ _WEBPACK _IMPORTED _MODULE _15 _ _ [ "default" ] , {
type
} ) ) ;
} ;
}
} ( ) ) ;
2020-09-05 22:50:45 +02:00
/ * *
* No need to export settingsPanel on window
2020-07-28 03:29:41 +02:00
* /
function makeComponent ( children ) {
class SettingComponent extends React . Component {
render ( ) {
return children ( sidebar , ( ) => this . forceUpdate ( ) ) ;
}
}
let sidebar ;
return s => {
sidebar = s ;
return SettingComponent ;
} ;
}
/***/ } ) ,
/***/ "./src/modules/settingsPanelSidebar.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / settingsPanelSidebar . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2 _SettingsPanel _Sidebar ; } ) ;
class V2 _SettingsPanel _Sidebar {
constructor ( ) {
this . panels = { } ;
}
register ( panel , component ) {
this . panels [ panel ] = component ;
}
getComponent ( panel , sidebar ) {
return this . panels [ panel ] ( sidebar ) ;
}
get items ( ) {
return [ {
text : "BetterDiscord Settings" ,
id : "core"
} , {
text : "Plugins" ,
id : "plugins"
} , {
text : "Themes" ,
id : "themes"
} , {
text : "Custom CSS" ,
id : "customcss"
} ] ;
}
get LCitems ( ) {
let items = [ {
text : "Lightcord Settings" ,
id : "lightcord"
} , {
text : "RichPresence" ,
id : "status"
} , {
text : "Account Info" ,
id : "accountinfo"
} ] ;
return items ;
}
get LCDevItems ( ) {
let items = [ ] ;
if ( ! window . Lightcord . Settings . devMode ) return items ;
items . push ( ... [ {
section : "DIVIDER"
} , {
section : "HEADER" ,
label : "Lightcord Api"
} , {
text : "Components Preview" ,
id : "lcapipreview"
} ] ) ;
return items ;
}
render ( sidebar ) {
return [ {
section : "HEADER" ,
label : "Lightcord"
} , ... this . LCitems . map ( e => {
return {
section : e . id ,
label : e . text ,
element : this . getComponent ( e . id , sidebar )
} ;
} ) , ... this . LCDevItems . map ( e => {
if ( e . section ) return e ;
return {
section : e . id ,
label : e . text ,
element : this . getComponent ( e . id , sidebar )
} ;
} ) , {
section : "DIVIDER"
} , {
section : "CUSTOM" ,
element : this . getComponent ( "BDChangelogTitle" )
} , ... this . items . map ( e => {
return {
section : e . id ,
label : e . text ,
element : this . getComponent ( e . id , sidebar )
} ;
} ) , {
section : "DIVIDER"
} ] ;
}
}
2020-09-05 22:50:45 +02:00
/ * *
* No need to export settingsPanelSidebar on window
2020-07-28 03:29:41 +02:00
* /
/***/ } ) ,
/***/ "./src/modules/themeModule.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / themeModule . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./contentManager */ "./src/modules/contentManager.js" ) ;
/* harmony import */ var _dataStore _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./bdEvents */ "./src/modules/bdEvents.js" ) ;
/* harmony import */ var _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
2020-08-10 13:44:02 +02:00
2020-07-28 03:29:41 +02:00
class ThemeModule {
constructor ( ) {
window . Lightcord . BetterDiscord . ThemeModule = this ;
}
get folder ( ) {
return _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . themesFolder ;
}
}
ThemeModule . prototype . loadThemes = async function ( ) {
this . loadThemeData ( ) ;
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemeErrors" ] . splice ( 0 , 0 , ... ( await _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadThemes ( ) ) ) ;
const themes = Object . keys ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] ) ;
for ( let i = 0 ; i < themes . length ; i ++ ) {
const theme = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ themes [ i ] ] ;
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ theme . name ] ) _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ theme . name ] = false ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ theme . name ] ) _domtools _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . addStyle ( _domtools _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . escapeID ( theme . id ) , unescape ( theme . css ) ) ;
await new Promise ( resolve => setTimeout ( resolve , 10 ) ) ;
}
for ( const theme in _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] ) {
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ theme ] ) delete _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ theme ] ;
}
this . saveThemeData ( ) ; // if (settingsCookie["fork-ps-5"]) ContentManager.watchContent("theme");
} ;
ThemeModule . prototype . enableTheme = function ( name , reload = false ) {
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ name ] = true ;
this . saveThemeData ( ) ;
const theme = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ name ] ;
_domtools _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . addStyle ( _domtools _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . escapeID ( theme . id ) , unescape ( theme . css ) ) ;
2020-08-10 13:44:02 +02:00
_bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . dispatch ( "theme-enabled" ) ;
2020-07-28 03:29:41 +02:00
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] && ! reload ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme . name } v ${ theme . version } has been applied. ` ) ;
} ;
ThemeModule . prototype . enable = function ( name , reload = false ) {
return this . enableTheme ( name , reload ) ;
} ;
ThemeModule . prototype . disableTheme = function ( name , reload = false ) {
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ name ] = false ;
this . saveThemeData ( ) ;
const theme = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ name ] ;
_domtools _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . removeStyle ( _domtools _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . escapeID ( theme . id ) ) ;
2020-08-10 13:44:02 +02:00
_bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . dispatch ( "theme-disabled" ) ;
2020-07-28 03:29:41 +02:00
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] && ! reload ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme . name } v ${ theme . version } has been disabled. ` ) ;
} ;
ThemeModule . prototype . disable = function ( name , reload = false ) {
return this . disableTheme ( name , reload ) ;
} ;
ThemeModule . prototype . toggleTheme = function ( theme ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ theme ] ) this . disableTheme ( theme ) ; else this . enableTheme ( theme ) ;
} ;
2020-08-10 13:44:02 +02:00
ThemeModule . prototype . toggle = function ( name ) {
return this . toggleTheme ( name ) ;
2020-07-28 03:29:41 +02:00
} ;
ThemeModule . prototype . loadTheme = async function ( filename ) {
const error = await _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadContent ( filename , "theme" ) ;
if ( error ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-1" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showContentErrors ( {
themes : [ error ]
} ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ filename } could not be loaded. It may not have been loaded. ` , {
type : "error"
} ) ;
return _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "ContentManager" , ` ${ filename } could not be loaded. ` , error ) ;
}
const theme = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] ) . find ( p => p . filename == filename ) ;
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . log ( "ContentManager" , ` ${ theme . name } v ${ theme . version } was loaded. ` ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme . name } v ${ theme . version } was loaded. ` , {
type : "success"
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . dispatch ( "theme-loaded" , theme . name ) ;
} ;
ThemeModule . prototype . unloadTheme = function ( filenameOrName ) {
const bdtheme = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] ) . find ( p => p . filename == filenameOrName ) || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ filenameOrName ] ;
if ( ! bdtheme ) return ;
const theme = bdtheme . name ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ theme ] ) this . disableTheme ( theme , true ) ;
const error = _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . unloadContent ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ theme ] . filename , "theme" ) ;
delete _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ theme ] ;
if ( error ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-1" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showContentErrors ( {
themes : [ error ]
} ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme } could not be unloaded. It may have not been loaded yet. ` , {
type : "error"
} ) ;
return _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "ContentManager" , ` ${ theme } could not be unloaded. It may have not been loaded yet. ` , error ) ;
}
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . log ( "ContentManager" , ` ${ theme } was unloaded. ` ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme } was unloaded. ` , {
type : "success"
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . dispatch ( "theme-unloaded" , theme ) ;
} ;
ThemeModule . prototype . delete = function ( filenameOrName ) {
const bdtheme = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] ) . find ( p => p . filename == filenameOrName ) || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ filenameOrName ] ;
if ( ! bdtheme ) return ;
this . unloadTheme ( bdtheme . filename ) ;
const fullPath = _ _webpack _require _ _ ( /*! path */ "path" ) . resolve ( _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . themesFolder , bdtheme . filename ) ;
_ _webpack _require _ _ ( /*! fs */ "fs" ) . unlinkSync ( fullPath ) ;
} ;
ThemeModule . prototype . reloadTheme = async function ( filenameOrName ) {
const bdtheme = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] ) . find ( p => p . filename == filenameOrName ) || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ filenameOrName ] ;
if ( ! bdtheme ) return this . loadTheme ( filenameOrName ) ;
const theme = bdtheme . name ;
const error = await _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . reloadContent ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ theme ] . filename , "theme" ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] [ theme ] ) this . disableTheme ( theme , true ) , this . enableTheme ( theme , true ) ;
if ( error ) {
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-1" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showContentErrors ( {
themes : [ error ]
} ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme } could not be reloaded. ` , {
type : "error"
} ) ;
return _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . err ( "ContentManager" , ` ${ theme } could not be reloaded. ` , error ) ;
}
_utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . log ( "ContentManager" , ` ${ theme } v ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ theme ] . version } was reloaded. ` ) ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-2" ] ) _utils _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . showToast ( ` ${ theme } v ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ theme ] . version } was reloaded. ` , {
type : "success"
} ) ;
_bdEvents _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . dispatch ( "theme-reloaded" , theme ) ;
} ;
ThemeModule . prototype . reload = function ( name ) {
return this . reloadTheme ( name ) ;
} ;
ThemeModule . prototype . edit = function ( filenameOrName ) {
const bdplugin = Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] ) . find ( p => p . filename == filenameOrName ) || _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bdthemes" ] [ filenameOrName ] ;
if ( ! bdplugin ) return ;
const fullPath = _ _webpack _require _ _ ( /*! path */ "path" ) . resolve ( _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . themesFolder , bdplugin . filename ) ;
2020-09-20 14:16:02 +02:00
_ _webpack _require _ _ ( /*! electron */ "electron" ) . shell . openExternal ( ` ${ fullPath } ` ) ;
2020-07-28 03:29:41 +02:00
} ;
ThemeModule . prototype . updateThemeList = function ( ) {
const results = _contentManager _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . loadNewContent ( "theme" ) ;
for ( const filename of results . added ) this . loadTheme ( filename ) ;
for ( const name of results . removed ) this . unloadTheme ( name ) ;
} ;
ThemeModule . prototype . loadThemeData = function ( ) {
const saved = _dataStore _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . getSettingGroup ( "themes" ) ;
if ( saved ) {
Object . assign ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] , saved ) ;
}
} ;
ThemeModule . prototype . saveThemeData = function ( ) {
_dataStore _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . setSettingGroup ( "themes" , _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "themeCookie" ] ) ;
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new ThemeModule ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/utils.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / utils . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return Utils ; } ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./webpackModules */ "./src/modules/webpackModules.js" ) ;
/* harmony import */ var _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
class Utils {
/** Document/window width */
static get screenWidth ( ) {
return Math . max ( document . documentElement . clientWidth , window . innerWidth || 0 ) ;
}
/** Document/window height */
static get screenHeight ( ) {
return Math . max ( document . documentElement . clientHeight , window . innerHeight || 0 ) ;
}
static get WindowConfigFile ( ) {
return this . _windowConfigFile = null ;
}
static getAllWindowPreferences ( ) {
return {
transparent : true ,
frame : false
} ;
}
static getWindowPreference ( key ) {
if ( key === "transparent" ) return true ;
if ( key === "frame" ) return false ;
return null ;
}
static setWindowPreference ( key , value ) {
if ( key === "transparent" ) return true ;
if ( key === "frame" ) return false ;
return null ;
}
static stripBOM ( content ) {
if ( content . charCodeAt ( 0 ) === 0xFEFF ) {
content = content . slice ( 1 ) ;
}
return content ;
}
static getTextArea ( ) {
2020-07-29 18:29:36 +02:00
return _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . query ( "." + removeDa ( BDModules . get ( e => e . channelTextArea && e . titleWrapper ) [ 0 ] . channelTextArea ) + " textarea" ) ;
2020-07-28 03:29:41 +02:00
}
static insertText ( textarea , text ) {
textarea . focus ( ) ;
textarea . selectionStart = 0 ;
textarea . selectionEnd = textarea . value . length ;
document . execCommand ( "insertText" , false , text ) ;
}
static escapeID ( id ) {
return id . replace ( /^[^a-z]+|[^\w-]+/gi , "-" ) ;
}
static log ( moduleName , message ) {
console . log ( ` %c[BandagedBD]%c [ ${ moduleName } ]%c ${ message } ` , "color: #3a71c1; font-weight: 700;" , "color: #3a71c1;" , "" ) ;
}
static warn ( moduleName , message ) {
console . warn ( ` %c[BandagedBD]%c [ ${ moduleName } ]%c ${ message } ` , "color: #E8A400; font-weight: 700;" , "color: #E8A400;" , "" ) ;
}
static err ( moduleName , message , error ) {
console . log ( ` %c[BandagedBD]%c [ ${ moduleName } ]%c ${ message } ` , "color: red; font-weight: 700;" , "color: red;" , "" ) ;
if ( error ) {
console . groupCollapsed ( "%cError: " + error . message , "color: red;" ) ;
console . error ( error . stack ) ;
console . groupEnd ( ) ;
}
}
/ * *
* Format strings with placeholders ( ` {{placeholder}} ` ) into full strings .
* Quick example : ` PluginUtilities.formatString("Hello, {{user}}", {user: "Zerebos"}) `
* would return "Hello, Zerebos" .
* @ param { string } string - string to format
* @ param { object } values - object literal of placeholders to replacements
* @ returns { string } the properly formatted string
* /
static formatString ( string , values ) {
for ( const val in values ) {
let replacement = values [ val ] ;
if ( Array . isArray ( replacement ) ) replacement = JSON . stringify ( replacement ) ;
if ( typeof replacement === "object" && replacement !== null ) replacement = replacement . toString ( ) ;
string = string . replace ( new RegExp ( ` {{ ${ val } }} ` , "g" ) , replacement ) ;
}
return string ;
}
static escape ( s ) {
return s . replace ( /[-/\\^$*+?.()|[\]{}]/g , "\\$&" ) ;
}
static testJSON ( data ) {
try {
return JSON . parse ( data ) ;
} catch ( err ) {
return false ;
}
}
static isEmpty ( obj ) {
if ( obj == null || obj == undefined || obj == "" ) return true ;
if ( typeof obj !== "object" ) return false ;
if ( Array . isArray ( obj ) ) return obj . length == 0 ;
for ( const key in obj ) {
if ( obj . hasOwnProperty ( key ) ) return false ;
}
return true ;
}
static suppressErrors ( method , message ) {
return ( ... params ) => {
try {
return method ( ... params ) ;
} catch ( e ) {
this . err ( "SuppressedError" , "Error occurred in " + message , e ) ;
}
} ;
}
static monkeyPatch ( what , methodName , options ) {
const {
before ,
after ,
instead ,
once = false ,
silent = false ,
force = false
} = options ;
const displayName = options . displayName || what . displayName || what [ methodName ] . displayName || what . name || what . constructor . displayName || what . constructor . name ;
if ( ! silent ) console . log ( "patch" , methodName , "of" , displayName ) ; // eslint-disable-line no-console
if ( ! what [ methodName ] ) {
if ( force ) what [ methodName ] = function ( ) { } ; else return console . error ( methodName , "does not exist for" , displayName ) ; // eslint-disable-line no-console
}
const origMethod = what [ methodName ] ;
let canceled = false ;
const cancel = ( ) => {
if ( ! silent ) console . log ( "unpatch" , methodName , "of" , displayName ) ; // eslint-disable-line no-console
//what[methodName] = origMethod;
canceled = true ; // this allow to monkeypatch more than one time.
} ;
what [ methodName ] = function ( ) {
if ( canceled ) {
return origMethod . call ( this , ... arguments ) ;
}
const data = {
thisObject : this ,
methodArguments : arguments ,
cancelPatch : cancel ,
originalMethod : origMethod ,
callOriginalMethod : ( ) => data . returnValue = data . originalMethod . apply ( data . thisObject , data . methodArguments )
} ;
if ( instead ) {
const tempRet = Utils . suppressErrors ( instead , "`instead` callback of " + what [ methodName ] . displayName ) ( data ) ;
if ( tempRet !== undefined ) data . returnValue = tempRet ;
} else {
if ( before ) Utils . suppressErrors ( before , "`before` callback of " + what [ methodName ] . displayName ) ( data ) ;
data . callOriginalMethod ( ) ;
if ( after ) Utils . suppressErrors ( after , "`after` callback of " + what [ methodName ] . displayName ) ( data ) ;
}
if ( once ) cancel ( ) ;
return data . returnValue ;
} ;
Object . assign ( what [ methodName ] , origMethod ) ;
what [ methodName ] . _ _monkeyPatched = true ;
what [ methodName ] . displayName = displayName ;
if ( ! what [ methodName ] . _ _originalMethod ) {
what [ methodName ] . _ _originalMethod = origMethod ;
what [ methodName ] . toString = function ( ) {
return origMethod . toString ( ) ;
} ;
}
return cancel ;
}
static onRemoved ( node , callback ) {
const observer = new MutationObserver ( mutations => {
for ( let m = 0 ; m < mutations . length ; m ++ ) {
const mutation = mutations [ m ] ;
const nodes = Array . from ( mutation . removedNodes ) ;
const directMatch = nodes . indexOf ( node ) > - 1 ;
const parentMatch = nodes . some ( parent => parent . contains ( node ) ) ;
if ( directMatch || parentMatch ) {
observer . disconnect ( ) ;
callback ( ) ;
}
}
} ) ;
observer . observe ( document . body , {
subtree : true ,
childList : true
} ) ;
}
static getNestedProp ( obj , path ) {
return path . split ( /\s?\.\s?/ ) . reduce ( function ( obj , prop ) {
return obj && obj [ prop ] ;
} , obj ) ;
}
/ * *
* This shows a toast similar to android towards the bottom of the screen .
*
* @ param { string } content The string to show in the toast .
* @ param { object } options Options object . Optional parameter .
* @ param { string } options . type Changes the type of the toast stylistically and semantically . Choices : "" , "info" , "success" , "danger" / "error" , "warning" / "warn" . Default : ""
* @ param { boolean } options . icon Determines whether the icon should show corresponding to the type . A toast without type will always have no icon . Default : true
* @ param { number } options . timeout Adjusts the time ( in ms ) the toast should be shown for before disappearing automatically . Default : 3000
* /
static showToast ( content , options = { } ) {
if ( ! document . querySelector ( ".bd-toasts" ) ) {
2020-07-29 18:29:36 +02:00
const container = document . querySelector ( "." + removeDa ( BDModules . get ( e => e . sidebar && e . hasNotice ) [ 0 ] . sidebar ) + " + div" ) || null ;
2020-07-28 03:29:41 +02:00
const form = container ? container . querySelector ( "form" ) : null ;
const bottom = form ? form . offsetHeight : 80 ;
const toastWrapper = document . createElement ( "div" ) ;
toastWrapper . classList . add ( "bd-toasts" ) ;
toastWrapper . style . setProperty ( "bottom" , bottom + "px" ) ;
document . querySelector ( "#app-mount" ) . appendChild ( toastWrapper ) ;
}
2020-08-01 11:05:17 +02:00
const toastWrapper = document . querySelector ( ".bd-toasts" ) ;
2020-07-28 03:29:41 +02:00
const {
type = "" ,
icon = true ,
timeout = 3000
} = options ;
const toastElem = document . createElement ( "div" ) ;
toastElem . classList . add ( "bd-toast" ) ;
if ( type ) toastElem . classList . add ( "toast-" + type ) ;
if ( type && icon ) toastElem . classList . add ( "icon" ) ;
toastElem . innerText = content ;
2020-08-01 11:05:17 +02:00
toastWrapper . appendChild ( toastElem ) ;
toastWrapper . style . setProperty ( "left" , ` calc(50% - ${ toastWrapper . offsetWidth / 2 } px) ` ) ;
2020-07-28 03:29:41 +02:00
setTimeout ( ( ) => {
toastElem . classList . add ( "closing" ) ;
setTimeout ( ( ) => {
toastElem . remove ( ) ;
if ( ! document . querySelectorAll ( ".bd-toasts .bd-toast" ) . length ) document . querySelector ( ".bd-toasts" ) . remove ( ) ;
} , 300 ) ;
} , timeout ) ;
}
static alert ( title , content ) {
let modalModule = BDModules . get ( e => e . modal && e . inner && ! e . hideOnFullscreen ) [ 0 ] ;
let headerModule = BDModules . get ( e => e . header && e . responsiveWidthMobile && e . hideOnFullscreen ) [ 0 ] ;
let footer2Module = BDModules . get ( e => e . header && e . responsiveWidthMobile && e . focusLock ) [ 0 ] ;
const modal = _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . createElement ( ` <div class="bd-modal-wrapper theme-dark">
< div class = "bd-backdrop ${BDModules.get(e => e.backdrop && e.backdropWithLayer)[0].backdrop}" > < / d i v >
< div class = "bd-modal ${modalModule.modal}" >
< div class = "bd-modal-inner ${modalModule.inner}" >
< div class = "header ${headerModule.header}" >
< div class = "title" > $ { title } < / d i v >
< / d i v >
< div class = "bd-modal-body" >
< div class = "scroller-wrap fade" >
< div class = "scroller" >
$ { content }
< / d i v >
< / d i v >
< / d i v >
< div class = "footer ${headerModule.footer} ${footer2Module.footer}" >
< button type = "button" > Okay < / b u t t o n >
< / d i v >
< / d i v >
< / d i v >
< / d i v > ` ) ;
modal . querySelector ( ".footer button" ) . addEventListener ( "click" , ( ) => {
_domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . addClass ( modal , "closing" ) ;
setTimeout ( ( ) => {
modal . remove ( ) ;
closingListeners . forEach ( listener => {
try {
listener ( ) ;
} catch ( e ) {
console . error ( e ) ;
}
} ) ;
} , 300 ) ;
} ) ;
modal . querySelector ( ".bd-backdrop" ) . addEventListener ( "click" , ( ) => {
_domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . addClass ( modal , "closing" ) ;
setTimeout ( ( ) => {
modal . remove ( ) ;
closingListeners . forEach ( listener => {
try {
listener ( ) ;
} catch ( e ) {
console . error ( e ) ;
}
} ) ;
} , 300 ) ;
} ) ;
_domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . query ( "#app-mount" ) . append ( modal ) ;
const closingListeners = [ ] ;
return {
close : ( ) => {
_domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . addClass ( modal , "closing" ) ;
setTimeout ( ( ) => {
modal . remove ( ) ;
closingListeners . forEach ( listener => {
try {
listener ( ) ;
} catch ( e ) {
console . error ( e ) ;
}
} ) ;
} , 300 ) ;
} ,
onClose : listener => {
closingListeners . push ( listener ) ;
}
} ;
}
static showContentErrors ( {
plugins : pluginErrors = [ ] ,
themes : themeErrors = [ ]
} ) {
if ( ! pluginErrors || ! themeErrors ) return ;
if ( ! pluginErrors . length && ! themeErrors . length ) return ;
let modalModule = BDModules . get ( e => e . modal && e . inner && ! e . hideOnFullscreen ) [ 0 ] ;
let headerModule = BDModules . get ( e => e . header && e . responsiveWidthMobile && e . hideOnFullscreen ) [ 0 ] ;
let footer2Module = BDModules . get ( e => e . header && e . responsiveWidthMobile && e . focusLock ) [ 0 ] ;
const modal = _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . createElement ( ` <div class="bd-modal-wrapper theme-dark">
< div class = "bd-backdrop ${BDModules.get(e => e.backdrop && e.backdropWithLayer)[0].backdrop}" > < / d i v >
< div class = "bd-modal bd-content-modal ${modalModule.modal}" >
< div class = "bd-modal-inner ${modalModule.inner}" >
< div class = "header ${headerModule.header}" > < div class = "title" > Content Errors < / d i v > < / d i v >
< div class = "bd-modal-body" >
< div class = "tab-bar-container" >
< div class = "tab-bar TOP" >
< div class = "tab-bar-item" > Plugins < / d i v >
< div class = "tab-bar-item" > Themes < / d i v >
< / d i v >
< / d i v >
< div class = "table-header" >
< div class = "table-column column-name" > Name < / d i v >
< div class = "table-column column-message" > Message < / d i v >
< div class = "table-column column-error" > Error < / d i v >
< / d i v >
< div class = "scroller-wrap fade" >
< div class = "scroller" >
< / d i v >
< / d i v >
< / d i v >
< div class = "footer ${headerModule.footer} ${footer2Module.footer}" >
< button type = "button" > Okay < / b u t t o n >
< / d i v >
< / d i v >
< / d i v >
< / d i v > ` ) ;
function generateTab ( errors ) {
const container = _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . createElement ( ` <div class="errors"> ` ) ;
for ( const err of errors ) {
const error = _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . createElement ( ` <div class="error">
< div class = "table-column column-name" > $ { err . name ? err . name : err . file } < / d i v >
< div class = "table-column column-message" > $ { err . message } < / d i v >
< div class = "table-column column-error" > < a class = "error-link" href = "" > $ { err . error ? err . error . message : "" } < / a > < / d i v >
< / d i v > ` ) ;
container . append ( error ) ;
if ( err . error ) {
error . querySelectorAll ( "a" ) . forEach ( el => el . addEventListener ( "click" , e => {
e . preventDefault ( ) ;
Utils . err ( "ContentManager" , ` Error details for ${ err . name ? err . name : err . file } . ` , err . error ) ;
} ) ) ;
}
}
return container ;
}
const tabs = [ generateTab ( pluginErrors ) , generateTab ( themeErrors ) ] ;
modal . querySelectorAll ( ".tab-bar-item" ) . forEach ( el => el . addEventListener ( "click" , e => {
e . preventDefault ( ) ;
const selected = modal . querySelector ( ".tab-bar-item.selected" ) ;
if ( selected ) _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . removeClass ( selected , "selected" ) ;
_domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . addClass ( e . target , "selected" ) ;
const scroller = modal . querySelector ( ".scroller" ) ;
scroller . innerHTML = "" ;
scroller . append ( tabs [ _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . index ( e . target ) ] ) ;
} ) ) ;
modal . querySelector ( ".footer button" ) . addEventListener ( "click" , ( ) => {
_domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . addClass ( modal , "closing" ) ;
setTimeout ( ( ) => {
modal . remove ( ) ;
} , 300 ) ;
} ) ;
modal . querySelector ( ".bd-backdrop" ) . addEventListener ( "click" , ( ) => {
_domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . addClass ( modal , "closing" ) ;
setTimeout ( ( ) => {
modal . remove ( ) ;
} , 300 ) ;
} ) ;
_domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . query ( "#app-mount" ) . append ( modal ) ;
if ( pluginErrors . length ) modal . querySelector ( ".tab-bar-item" ) . click ( ) ; else modal . querySelectorAll ( ".tab-bar-item" ) [ 1 ] . click ( ) ;
}
static showChangelogModal ( options = { } ) {
const ModalStack = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByProps ( "push" , "update" , "pop" , "popWithKey" ) ;
const ChangelogClasses = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByProps ( "fixed" , "improved" ) ;
const TextElement = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByDisplayName ( "Text" ) ;
const FlexChild = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByProps ( "Child" ) ;
const Titles = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByProps ( "Tags" , "default" ) ;
const Changelog = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . find ( m => m . defaultProps && m . defaultProps . selectable == false ) ;
const MarkdownParser = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByProps ( "defaultRules" , "parse" ) ;
if ( ! Changelog || ! ModalStack || ! ChangelogClasses || ! TextElement || ! FlexChild || ! Titles || ! MarkdownParser ) return ;
const {
image = "https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5" ,
description = "" ,
changes = [ ] ,
title = "BandagedBD" ,
subtitle = ` v ${ _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "bbdVersion" ] } ` ,
footer
} = options ;
const ce = _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ;
const changelogItems = [ ce ( "img" , {
src : image
} ) ] ;
if ( description ) changelogItems . push ( ce ( "p" , null , MarkdownParser . parse ( description ) ) ) ;
for ( let c = 0 ; c < changes . length ; c ++ ) {
const entry = changes [ c ] ;
const type = ChangelogClasses [ entry . type ] ? ChangelogClasses [ entry . type ] : ChangelogClasses . added ;
const margin = c == 0 ? ChangelogClasses . marginTop : "" ;
changelogItems . push ( ce ( "h1" , {
className : ` ${ type } ${ margin } `
} , entry . title ) ) ;
const list = ce ( "ul" , null , entry . items . map ( i => ce ( "li" , null , MarkdownParser . parse ( i ) ) ) ) ;
changelogItems . push ( list ) ;
}
const renderHeader = function ( ) {
return ce ( FlexChild . Child , {
grow : 1 ,
shrink : 1
} , ce ( Titles . default , {
tag : Titles . Tags . H4
} , title ) , ce ( TextElement , {
size : TextElement . Sizes . SMALL ,
color : TextElement . Colors . STANDARD ,
className : ChangelogClasses . date
} , subtitle ) ) ;
} ;
const renderFooter = ( ) => {
const Anchor = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . find ( m => m . displayName == "Anchor" ) ;
const AnchorClasses = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByProps ( "anchorUnderlineOnHover" ) || {
anchor : "anchor-3Z-8Bb" ,
anchorUnderlineOnHover : "anchorUnderlineOnHover-2ESHQB"
} ;
const joinSupportServer = click => {
click . preventDefault ( ) ;
click . stopPropagation ( ) ;
ModalStack . pop ( ) ;
_v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . joinBD2 ( ) ;
} ;
const supportLink = Anchor ? ce ( Anchor , {
onClick : joinSupportServer
} , "Join our Discord Server." ) : ce ( "a" , {
className : ` ${ AnchorClasses . anchor } ${ AnchorClasses . anchorUnderlineOnHover } ` ,
onClick : joinSupportServer
} , "Join our Discord Server." ) ;
const defaultFooter = ce ( TextElement , {
size : TextElement . Sizes . SMALL ,
color : TextElement . Colors . STANDARD
} , "Need support? " , supportLink ) ;
return ce ( FlexChild . Child , {
grow : 1 ,
shrink : 1
} , footer ? footer : defaultFooter ) ;
} ;
return ModalStack . push ( function ( props ) {
return ce ( Changelog , Object . assign ( {
className : ChangelogClasses . container ,
selectable : true ,
onScroll : _ => _ ,
onClose : _ => _ ,
renderHeader : renderHeader ,
renderFooter : renderFooter ,
children : changelogItems
} , props ) ) ;
} ) ;
}
/ * *
* Shows a generic but very customizable confirmation modal with optional confirm and cancel callbacks .
* @ param { string } title - title of the modal
* @ param { ( string | ReactElement | Array < string | ReactElement > ) } children - a single or mixed array of react elements and strings . Every string is wrapped in Discord ' s ` Markdown ` component so strings will show and render properly .
* @ param { object } [ options ] - options to modify the modal
* @ param { boolean } [ options . danger = false ] - whether the main button should be red or not
* @ param { string } [ options . confirmText = Okay ] - text for the confirmation / submit button
* @ param { string } [ options . cancelText = Cancel ] - text for the cancel button
* @ param { callable } [ options . onConfirm = NOOP ] - callback to occur when clicking the submit button
* @ param { callable } [ options . onCancel = NOOP ] - callback to occur when clicking the cancel button
* @ param { string } [ options . key ] - key used to identify the modal . If not provided , one is generated and returned
* @ returns { string } - the key used for this modal
* /
static showConfirmationModal ( title , content , options = { } ) {
const ModalActions = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByProps ( "openModal" , "updateModal" ) ;
const Markdown = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByDisplayName ( "Markdown" ) ;
const ConfirmationModal = _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByDisplayName ( "ConfirmModal" ) ;
if ( ! ModalActions || ! ConfirmationModal || ! Markdown ) return Utils . alert ( title , content ) ;
const emptyFunction = ( ) => { } ;
const {
onConfirm = emptyFunction ,
onCancel = emptyFunction ,
confirmText = "Okay" ,
cancelText = "Cancel" ,
danger = false ,
key = undefined
} = options ;
if ( ! Array . isArray ( content ) ) content = [ content ] ;
content = content . map ( c => typeof c === "string" ? _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( Markdown , null , c ) : c ) ;
return ModalActions . openModal ( props => {
return _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . React . createElement ( ConfirmationModal , Object . assign ( {
header : title ,
red : danger ,
confirmText : confirmText ,
cancelText : cancelText ,
onConfirm : onConfirm ,
onCancel : onCancel
} , props ) , content ) ;
} , {
modalKey : key
} ) ;
}
2020-07-29 18:29:36 +02:00
static get removeDa ( ) {
return removeDa ;
2020-07-28 03:29:41 +02:00
}
}
2020-07-29 18:29:36 +02:00
function removeDa ( className ) {
if ( ! className ) return className ;
return className . split ( " " ) . filter ( e => ! e . startsWith ( "da-" ) ) . join ( " " ) ;
}
2020-07-28 03:29:41 +02:00
Utils . showToast = Utils . suppressErrors ( Utils . showToast , "Could not show toast." ) ;
window . Lightcord . BetterDiscord . Utils = Utils ;
/***/ } ) ,
/***/ "./src/modules/v2.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / v2 . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _themeModule _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./themeModule */ "./src/modules/themeModule.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class V2 {
constructor ( ) {
this . editorDetached = false ;
this . WebpackModules = ( ( ) => {
const req = webpackJsonp . push ( [ [ ] , {
_ _extra _id _ _ : ( module , exports , req ) => module . exports = req
} , [ [ "__extra_id__" ] ] ] ) ;
delete req . m . _ _extra _id _ _ ;
delete req . c . _ _extra _id _ _ ;
const shouldProtect = theModule => {
if ( theModule . remove && theModule . set && theModule . clear && theModule . get && ! theModule . sort ) return true ;
if ( theModule . getToken || theModule . getEmail || theModule . showToken ) return true ;
return false ;
} ;
const protect = ( theModule , isDefault ) => {
let mod = ! isDefault ? theModule . default : theModule ;
if ( ! mod ) return theModule ;
if ( mod . remove && mod . set && mod . clear && mod . get && ! mod . sort ) return null ;
if ( ! mod . getToken && ! mod . getEmail && ! mod . showToken ) return theModule ;
const proxy = new Proxy ( mod , {
getOwnPropertyDescriptor : function ( obj , prop ) {
if ( prop === "getToken" || prop === "getEmail" || prop === "showToken" ) return undefined ;
return Object . getOwnPropertyDescriptor ( obj , prop ) ;
} ,
get : function ( obj , func ) {
if ( func == "getToken" && obj . getToken ) return ( ) => "mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa" ;
if ( func == "getEmail" && obj . getEmail ) return ( ) => "puppet11112@gmail.com" ;
if ( func == "showToken" && obj . showToken ) return ( ) => true ;
if ( func == "__proto__" && obj . _ _proto _ _ ) return proxy ;
return obj [ func ] ;
}
} ) ;
if ( ! isDefault ) {
return Object . assign ( { } , theModule , {
default : proxy
} ) ;
}
return proxy ;
} ;
const find = filter => {
for ( const i in req . c ) {
if ( req . c . hasOwnProperty ( i ) ) {
const m = req . c [ i ] . exports ;
if ( m && m . _ _esModule && m . default && filter ( m . default ) ) return protect ( m . default , true ) ;
if ( m && filter ( m ) ) return protect ( m , false ) ;
}
} // console.warn("Cannot find loaded module in cache");
return null ;
} ;
const findAll = filter => {
const modules = [ ] ;
for ( const i in req . c ) {
if ( req . c . hasOwnProperty ( i ) ) {
const m = req . c [ i ] . exports ;
if ( m && m . _ _esModule && m . default && filter ( m . default ) ) modules . push ( protect ( m . default , true ) ) ; else if ( m && filter ( m ) ) modules . push ( protect ( m , false ) ) ;
}
}
return modules ;
} ;
const findByUniqueProperties = propNames => find ( module => propNames . every ( prop => module [ prop ] !== undefined ) ) ;
const findByPrototypes = protoNames => find ( module => module . prototype && protoNames . every ( protoProp => module . prototype [ protoProp ] !== undefined ) ) ;
const findByDisplayName = displayName => find ( module => module . displayName === displayName ) ;
return {
find ,
findAll ,
findByUniqueProperties ,
findByPrototypes ,
findByDisplayName
} ;
} ) ( ) ;
this . internal = {
react : this . WebpackModules . findByUniqueProperties ( [ "Component" , "PureComponent" , "Children" , "createElement" , "cloneElement" ] ) ,
reactDom : this . WebpackModules . findByUniqueProperties ( [ "findDOMNode" ] )
} ;
this . getInternalInstance = e => e [ Object . keys ( e ) . find ( k => k . startsWith ( "__reactInternalInstance" ) ) ] ;
window . Lightcord . BetterDiscord . V2 = this ;
}
initialize ( ) { }
joinBD1 ( ) {
this . InviteActions . acceptInviteAndTransitionToInviteChannel ( "0Tmfo5ZbORCRqbAd" ) ;
}
leaveBD1 ( ) {
this . GuildActions . leaveGuild ( "86004744966914048" ) ;
}
joinBD2 ( ) {
this . InviteActions . acceptInviteAndTransitionToInviteChannel ( "2HScm8j" ) ;
}
leaveBD2 ( ) {
this . GuildActions . leaveGuild ( "280806472928198656" ) ;
}
joinLC ( ) {
this . InviteActions . acceptInviteAndTransitionToInviteChannel ( "7eFff2A" ) ;
}
leaveLC ( ) {
this . GuildActions . leaveGuild ( "705908350218666117" ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
* @ type { typeof React }
2020-07-28 03:29:41 +02:00
* /
get react ( ) {
return this . internal . react ;
}
2020-09-05 22:50:45 +02:00
/ * *
* @ type { typeof React }
2020-07-28 03:29:41 +02:00
* /
get React ( ) {
return this . internal . react ;
}
2020-09-05 22:50:45 +02:00
/ * *
* @ type { typeof import ( "react-dom" ) }
2020-07-28 03:29:41 +02:00
* /
get reactDom ( ) {
return this . internal . reactDom ;
}
2020-09-05 22:50:45 +02:00
/ * *
* @ type { typeof import ( "react-dom" ) }
2020-07-28 03:29:41 +02:00
* /
get ReactDom ( ) {
return this . internal . reactDom ;
}
2020-09-05 22:50:45 +02:00
/ * *
* @ type { typeof React . Component }
2020-07-28 03:29:41 +02:00
* /
get reactComponent ( ) {
return this . internal . react . Component ;
}
2020-09-05 22:50:45 +02:00
/ * *
* @ type { typeof React . Component }
2020-07-28 03:29:41 +02:00
* /
get ReactComponent ( ) {
return this . internal . react . Component ;
}
get anchorClasses ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "anchorUnderlineOnHover" ] ) || {
anchor : "anchor-3Z-8Bb" ,
anchorUnderlineOnHover : "anchorUnderlineOnHover-2ESHQB"
} ;
}
get slateEditorClasses ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "slateTextArea" ] ) ;
}
get messageClasses ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "message" , "containerCozy" ] ) ;
}
get guildClasses ( ) {
const guildsWrapper = BDModules . get ( e => e . wrapper && e . unreadMentionsBar ) [ 0 ] ;
const guilds = BDModules . get ( e => e . guildsError && e . selected ) [ 0 ] ;
const pill = BDModules . get ( e => e . blobContainer ) [ 0 ] ;
return Object . assign ( { } , guildsWrapper , guilds , pill ) ;
}
get MessageContentComponent ( ) {
return this . WebpackModules . find ( m => m . defaultProps && m . defaultProps . hasOwnProperty ( "disableButtons" ) ) ;
}
get MessageComponent ( ) {
return this . WebpackModules . find ( m => m . default && m . default . displayName && m . default . displayName == "Message" ) ;
}
get TimeFormatter ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "dateFormat" ] ) ;
}
get TooltipWrapper ( ) {
return this . WebpackModules . findByDisplayName ( "Tooltip" ) ;
}
get NativeModule ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "setBadge" ] ) ;
}
get InviteActions ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "acceptInvite" ] ) ;
}
get GuildActions ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "leaveGuild" ] ) ;
}
get Tooltips ( ) {
return this . WebpackModules . find ( m => m . hide && m . show && ! m . search && ! m . submit && ! m . search && ! m . activateRagingDemon && ! m . dismiss ) ;
}
get KeyGenerator ( ) {
return this . WebpackModules . find ( m => m . toString && /"binary"/ . test ( m . toString ( ) ) ) ;
}
get LayerStack ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "popLayer" ] ) ;
}
get UserStore ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "getCurrentUser" ] ) ;
}
get ChannelStore ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "getChannel" ] ) ;
}
get ChannelActions ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "openPrivateChannel" ] ) ;
}
get PrivateChannelActions ( ) {
return this . WebpackModules . findByUniqueProperties ( [ "selectPrivateChannel" ] ) ;
}
openDM ( userId ) {
const selfId = this . UserStore . getCurrentUser ( ) . id ;
if ( selfId == userId ) return ;
const privateChannelId = this . ChannelStore . getDMFromUserId ( userId ) ;
if ( privateChannelId ) return this . PrivateChannelActions . selectPrivateChannel ( privateChannelId ) ;
this . ChannelActions . openPrivateChannel ( selfId , userId ) ;
}
parseSettings ( cat ) {
return Object . keys ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settings" ] ) . reduce ( ( arr , key ) => {
const setting = _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settings" ] [ key ] ;
if ( setting . cat === cat && setting . implemented && ! setting . hidden ) {
setting . text = key ;
arr . push ( setting ) ;
}
return arr ;
} , [ ] ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/voiceMode.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / voiceMode . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _domtools _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./domtools */ "./src/modules/domtools.js" ) ;
const style = `
. container - 2 Rl01u {
display : none ! important ;
}
. chat - 3 bRxxu {
display : none ! important ;
}
. sidebar - 2 K8pFh {
flex - grow : 1 ! important ;
}
` ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( new class VoiceMode {
start ( ) {
_domtools _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . addStyle ( "VoiceMode" , style ) ;
}
stop ( ) {
_domtools _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . removeStyle ( "VoiceMode" ) ;
}
} ( ) ) ;
/***/ } ) ,
/***/ "./src/modules/webpackModules.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / modules / webpackModules . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
const req = webpackJsonp . push ( [ [ ] , {
_ _extra _id _ _ : ( module , exports , req ) => module . exports = req
} , [ [ "__extra_id__" ] ] ] ) ;
delete req . m . _ _extra _id _ _ ;
delete req . c . _ _extra _id _ _ ;
const find = filter => {
for ( const i in req . c ) {
if ( req . c . hasOwnProperty ( i ) ) {
const m = req . c [ i ] . exports ;
if ( m && m . _ _esModule && m . default && filter ( m . default ) ) return m . default ;
if ( m && filter ( m ) ) return m ;
}
} // console.warn("Cannot find loaded module in cache");
return null ;
} ;
const findAll = filter => {
const modules = [ ] ;
for ( const i in req . c ) {
if ( req . c . hasOwnProperty ( i ) ) {
const m = req . c [ i ] . exports ;
if ( m && m . _ _esModule && m . default && filter ( m . default ) ) modules . push ( m . default ) ; else if ( m && filter ( m ) ) modules . push ( m ) ;
}
}
return modules ;
} ;
const findByProps = ( ... propNames ) => find ( module => propNames . every ( prop => module [ prop ] !== undefined ) ) ;
const findByPrototypes = ( ... protoNames ) => find ( module => module . prototype && protoNames . every ( protoProp => module . prototype [ protoProp ] !== undefined ) ) ;
const findByDisplayName = displayName => find ( module => module . displayName === displayName ) ;
let mod = {
find ,
findAll ,
findByProps ,
findByPrototypes ,
findByDisplayName
} ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( mod ) ;
window . Lightcord . BetterDiscord . WebpackModules = mod ;
/***/ } ) ,
2020-09-05 12:14:21 +02:00
/***/ "./src/svg/Lightcord.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / svg / Lightcord . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return LightcordLogo ; } ) ;
function _extends ( ) { _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ; return _extends . apply ( this , arguments ) ; }
class LightcordLogo extends React . Component {
render ( ) {
const props = this . props ;
return /*#__PURE__*/ React . createElement ( "svg" , _extends ( {
viewBox : "0 0 168 168.69"
} , props , {
height : "100%" ,
width : props . size
} ) , /*#__PURE__*/ React . createElement ( "defs" , null , /*#__PURE__*/ React . createElement ( "linearGradient" , {
id : "prefix__a" ,
x1 : 66.7 ,
y1 : - 487.7 ,
x2 : 66.7 ,
y2 : - 508.73 ,
gradientTransform : "matrix(1 0 0 -1 0 -408)" ,
gradientUnits : "userSpaceOnUse"
} , /*#__PURE__*/ React . createElement ( "stop" , {
offset : 0 ,
stopColor : "#e30613"
} ) , /*#__PURE__*/ React . createElement ( "stop" , {
offset : 1 ,
stopColor : "#731a14"
} ) ) , /*#__PURE__*/ React . createElement ( "linearGradient" , {
id : "prefix__b" ,
x1 : 101.7 ,
y1 : - 487.7 ,
x2 : 101.7 ,
y2 : - 508.73 ,
gradientTransform : "matrix(1 0 0 -1 0 -408)" ,
gradientUnits : "userSpaceOnUse"
} , /*#__PURE__*/ React . createElement ( "stop" , {
offset : 0 ,
stopColor : "#e20613"
} ) , /*#__PURE__*/ React . createElement ( "stop" , {
offset : 1 ,
stopColor : "#731a13"
} ) ) , /*#__PURE__*/ React . createElement ( "linearGradient" , {
id : "prefix__c" ,
x1 : 84 ,
y1 : - 408 ,
x2 : 84 ,
y2 : - 576.69 ,
gradientTransform : "matrix(1 0 0 -1 0 -408)" ,
gradientUnits : "userSpaceOnUse"
} , /*#__PURE__*/ React . createElement ( "stop" , {
offset : 0 ,
stopColor : "#e30613"
} ) , /*#__PURE__*/ React . createElement ( "stop" , {
offset : 1 ,
stopColor : "#731a13"
} ) ) ) , /*#__PURE__*/ React . createElement ( "path" , {
fill : "#fff" ,
d : "M14.9 35.3h139.2V133H14.9z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M66.7 79.7c-5.4 0-9.8 4.7-9.8 10.5s4.4 10.5 9.8 10.5 9.8-4.7 9.8-10.5-4.4-10.5-9.8-10.5z" ,
fill : "url(#prefix__a)"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M101.7 79.7c-5.4 0-9.8 4.7-9.8 10.5s4.4 10.5 9.8 10.5 9.8-4.7 9.8-10.5-4.4-10.5-9.8-10.5z" ,
fill : "url(#prefix__b)"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M0 0v168l168 .69V0zm111.3 124.1s-3.4-4.1-6.3-7.7c12.6-3.5 17.4-11.3 17.4-11.3a52.52 52.52 0 01-11.1 5.6 68.63 68.63 0 01-38.9 4 70.12 70.12 0 01-14.1-4.1 48.88 48.88 0 01-7.1-3.3c-.3-.2-.6-.3-.9-.5a.76.76 0 00-.4-.2c-1.7-1-2.6-1.6-2.6-1.6s4.6 7.6 16.8 11.2c-2.9 3.6-6.4 7.9-6.4 7.9-21.2-.6-29.3-14.5-29.3-14.5 0-30.6 13.8-55.4 13.8-55.4 13.8-10.3 26.9-10 26.9-10l1 1.1C52.8 50.3 45 57.9 45 57.9a56.2 56.2 0 015.7-2.7 72.19 72.19 0 0121.8-6 8.75 8.75 0 011.6-.2 89.1 89.1 0 0119.4-.2 78.45 78.45 0 0128.9 9.1s-7.5-7.2-23.9-12.1l1.3-1.5s13.1-.3 26.9 10c0 0 13.8 24.8 13.8 55.4.1-.1-8 13.8-29.2 14.4z" ,
fill : "url(#prefix__c)"
} ) ) ;
}
}
/***/ } ) ,
2020-07-28 03:29:41 +02:00
/***/ "./src/svg/bug_hunter.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / svg / bug _hunter . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return BugHunterBadge ; } ) ;
function _extends ( ) { _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ; return _extends . apply ( this , arguments ) ; }
class BugHunterBadge extends React . Component {
render ( ) {
const props = this . props ;
return /*#__PURE__*/ React . createElement ( "svg" , _extends ( {
viewBox : "0 0 31.3 29.5"
} , props . svg , {
height : "100%"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M22.8 1s12 8.2 7.4 19.7S16.6 29 20 25.6s-4-5.6-8.7-10L22.8 1" ,
fill : "rgba(227,6,19,.6)"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M22.1 12.3c-2.5 3.2-6.1 4.8-8.9 4.3L3.6 28.8c-.7.9-1.9 1-2.8.3-.9-.7-1-1.9-.4-2.8L10 14.1c-1.3-2.5-.6-6.4 2-9.7 3.2-4 8-5.5 10.8-3.4s2.4 7.2-.7 11.3z" ,
fill : "#e30613"
} ) ) ;
}
}
/***/ } ) ,
/***/ "./src/svg/circus.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / svg / circus . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return Circus ; } ) ;
function _extends ( ) { _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ; return _extends . apply ( this , arguments ) ; }
class Circus extends React . Component {
render ( ) {
return /*#__PURE__*/ React . createElement ( "svg" , _extends ( {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 36 36"
} , this . props . svg , {
height : "100%"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
fill : "#DD2E44" ,
d : "M33 33a2 2 0 01-2 2H5a2 2 0 01-2-2l1-12h28l1 12z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
fill : "#EA596E" ,
d : "M13 35c-.792-1.875-1.75-3.291-3.417-4.666 1.75-1.459 4.542-5.5 5.25-8.292s2.75 8.125 2.042 10.625S13 35 13 35zm10.303 0c.791-1.875 1.75-3.291 3.416-4.666-1.75-1.459-4.541-5.5-5.25-8.292-.707-2.792-2.75 8.125-2.04 10.625.708 2.5 3.874 2.333 3.874 2.333z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
fill : "#BE1931" ,
d : "M3.728 24.263A2.5 2.5 0 008 22.5c0-.565-.195-1.081-.511-1.5H4l-.272 3.263zm28.544 0L32 21h-3.489A2.482 2.482 0 0028 22.5a2.5 2.5 0 004.272 1.763z"
} ) , /*#__PURE__*/ React . createElement ( "circle" , {
cx : "14" ,
cy : "23" ,
r : "2" ,
fill : "#BE1931"
} ) , /*#__PURE__*/ React . createElement ( "circle" , {
cx : "22" ,
cy : "23" ,
r : "2" ,
fill : "#BE1931"
} ) , /*#__PURE__*/ React . createElement ( "circle" , {
cx : "10" ,
cy : "23" ,
r : "2" ,
fill : "#BE1931"
} ) , /*#__PURE__*/ React . createElement ( "circle" , {
cx : "26" ,
cy : "23" ,
r : "2" ,
fill : "#BE1931"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M23 35H13s2-6 2-13h6c0 7 2 13 2 13zM17 2h2v7h-2z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
fill : "#55ACEE" ,
d : "M18.838.206C17.667.042 17 .318 17 1.418v1c0 1.1.865 1.753 1.923 1.451l5.154-.901c1.715-.343 1.548-1.593.085-1.884L18.838.206z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
fill : "#CCD6DD" ,
d : "M18 6l-.081.123C10.938 16.981 3 15.015 3 19v2.5a2.5 2.5 0 004.95.5H12a2 2 0 004 0h4a2 2 0 004 0h4.05a2.5 2.5 0 004.95-.5V19c0-4-8-2-15-13z"
} ) , /*#__PURE__*/ React . createElement ( "g" , {
fill : "#F5F8FA"
} , /*#__PURE__*/ React . createElement ( "path" , {
d : "M17.948 6.078l-.03.045C17.132 11.619 10.811 16.126 8 18v4a2 2 0 004 0v-4c.982-.982 5.813-6.787 5.984-11.732-.01-.064-.027-.126-.036-.19zm.08.398C18.324 11.374 23.031 17.031 24 18v4a2 2 0 004 0v-4c-2.75-1.833-8.953-6.19-9.972-11.524z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M17.984 6.27C17.922 8.346 17.606 16.394 16 18v4a2 2 0 004 0v-4c-1.564-1.564-1.905-9.241-1.979-11.559-.011-.057-.027-.113-.037-.171z"
} ) ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/AccountInfos.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / AccountInfos . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _AccountInfos ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _settingsTitle _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./settingsTitle */ "./src/ui/settingsTitle.js" ) ;
2020-09-05 22:50:45 +02:00
/ * *
* @ type { typeof import ( "react" ) }
2020-07-28 03:29:41 +02:00
* /
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
let marginModule2 = BDModules . get ( e => e . defaultMarginh5 ) [ 0 ] ;
let colorModule = BDModules . get ( e => e . colorStandard ) [ 0 ] ;
let sizeModule = BDModules . get ( e => e . size32 ) [ 0 ] ;
let scrollbarModule1 = BDModules . get ( e => e . scrollbarGhostHairline ) [ 0 ] ;
const GuildModule = BDModules . get ( e => e . default && e . default . getGuilds ) [ 0 ] . default ;
const relationShipModule = BDModules . get ( e => e . default && e . default . getRelationships ) [ 0 ] . default ;
const sessionModule = BDModules . get ( e => e . default && e . default . getSessions ) [ 0 ] . default ;
const userModule = BDModules . get ( e => e . default && e . default . getCurrentUser ) [ 0 ] . default ;
class V2C _AccountInfos extends React . Component {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
if ( ! marginModule2 ) marginModule2 = BDModules . get ( e => e . defaultMarginh5 ) [ 0 ] ;
if ( ! colorModule ) colorModule = BDModules . get ( e => e . colorStandard ) [ 0 ] ;
if ( ! sizeModule ) sizeModule = BDModules . get ( e => e . size32 ) [ 0 ] ;
return [ /*#__PURE__*/ React . createElement ( _settingsTitle _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
text : "Account Infos"
} ) , /*#__PURE__*/ React . createElement ( "div" , null , /*#__PURE__*/ React . createElement ( "h5" , {
className : colorModule . colorStandard + " " + sizeModule . size14 + " " + marginModule2 . h5 + " " + marginModule2 . defaultMarginh5
} , "Profile" ) , /*#__PURE__*/ React . createElement ( CodeContent , {
content : this . getProfileValue ( ) ,
language : "diff"
} ) , /*#__PURE__*/ React . createElement ( "h5" , {
className : colorModule . colorStandard + " " + sizeModule . size14 + " " + marginModule2 . h5 + " " + marginModule2 . defaultMarginh5
} , "Statistics" ) , /*#__PURE__*/ React . createElement ( CodeContent , {
content : this . getStatistics ( ) ,
language : "diff"
} ) , /*#__PURE__*/ React . createElement ( "h5" , {
className : colorModule . colorStandard + " " + sizeModule . size14 + " " + marginModule2 . h5 + " " + marginModule2 . defaultMarginh5
} , "Connected Sessions" ) , /*#__PURE__*/ React . createElement ( CodeContent , {
content : this . getSessionValue ( ) ,
language : "diff"
} ) ) , /*#__PURE__*/ React . createElement ( "div" , {
className : BDModules . get ( e => e . marginBottom20 ) [ 0 ] . marginBottom20
} ) ] ;
}
getSessionValue ( ) {
const sessionsRaw = sessionModule . getSessions ( ) ;
const sessions = Object . keys ( sessionsRaw ) . filter ( e => e !== "all" ) . map ( e => sessionsRaw [ e ] ) ;
if ( sessions . length === 0 ) return "- No session detected. Please try in a few seconds" ;
return sessions . map ( e => {
return ` + id: ${ e . sessionId }
+ os : $ { e . clientInfo . os [ 0 ] . toUpperCase ( ) + e . clientInfo . os . slice ( 1 ) }
+ client : $ { e . clientInfo . client }
+ status : $ { e . status }
+ Activities : $ { e . activities . length } ` ;
} ) . join ( "\n" + "-" . repeat ( 38 ) + "\n" ) ;
}
getProfileValue ( ) {
const user = userModule . getCurrentUser ( ) ;
2020-09-05 22:50:45 +02:00
/ * *
* @ type { Date }
2020-07-28 03:29:41 +02:00
* /
const createdAt = user . createdAt ;
let avatarURL = user . avatarURL ;
if ( user . avatar && user . avatar . startsWith ( "a_" ) ) {
avatarURL = user . getAvatarURL ( "gif" ) ;
}
if ( avatarURL . startsWith ( "/" ) ) {
avatarURL = "https://discord.com" + avatarURL ;
}
if ( avatarURL . endsWith ( "?size=128" ) ) {
avatarURL = avatarURL . replace ( "?size=128" , "?size=4096" ) ;
}
return ` + Username: ${ user . username }
+ Discriminator : $ { user . discriminator }
+ Tag : $ { user . tag }
+ ID : $ { user . id }
+ Avatar : $ { user . avatar }
+ Avatar URL : $ { avatarURL }
+ Creation Date : $ { createdAt . getDate ( ) . toString ( ) . padStart ( 2 , "0" ) } / $ { ( createdAt . getMonth ( ) + 1 ) . toString ( ) . padStart ( 2 , "0" ) } / $ { createdAt . getFullYear ( ) . toString ( ) . padStart ( 2 , "0" ) } $ { createdAt . getHours ( ) . toString ( ) . padStart ( 2 , "0" ) } h $ { createdAt . getMinutes ( ) . toString ( ) . padStart ( 2 , "0" ) } min $ { createdAt . getSeconds ( ) } s
+ Flags : $ { user . flags }
+ Has Nitro : $ { user . hasPremiumSubscription ? "Yes" : "No" }
- Email : $ { user . email }
- 2 FA : $ { user . mfaEnabled ? "Yes" : "No" }
- Has Been On Mobile : $ { user . mobile ? "Yes" : "No" }
- Phone : $ { user . phone || "None" }
2020-08-10 18:40:57 +02:00
- Verified : $ { user . verified }
- Can See NSFW Channels : $ { user . nsfwAllowed } ` ;
2020-07-28 03:29:41 +02:00
}
getStatistics ( ) {
const guilds = Object . values ( GuildModule . getGuilds ( ) ) ;
const relations = Object . keys ( relationShipModule . getRelationships ( ) ) ;
const friends = relations . filter ( e => relationShipModule . isFriend ( e ) ) ;
const blocked = relations . filter ( e => relationShipModule . isBlocked ( e ) ) ;
return ` + Server Count: ${ guilds . length } servers
+ Relations : $ { relations . length } relations
+ Friends Count : $ { friends . length } friends
- Blocked Users Count : $ { blocked . length } blocked users ` ;
}
}
let hightlightJS = BDModules . get ( e => e . highlight ) [ 0 ] ;
let messageModule1 = BDModules . get ( e => e . markup ) [ 0 ] ;
let messageModule2 = BDModules . get ( e => e . messageContent ) [ 0 ] ;
class CodeContent extends React . Component {
render ( ) {
if ( ! messageModule1 ) messageModule1 = BDModules . get ( e => e . markup ) [ 0 ] ;
if ( ! messageModule2 ) messageModule2 = BDModules . get ( e => e . messageContent ) [ 0 ] ;
if ( ! scrollbarModule1 ) scrollbarModule1 = BDModules . get ( e => e . scrollbarGhostHairline ) [ 0 ] ;
2020-08-12 01:28:21 +02:00
if ( ! hightlightJS ) hightlightJS = BDModules . get ( e => e . listLanguages ) [ 0 ] ;
2020-07-28 03:29:41 +02:00
return /*#__PURE__*/ React . createElement ( "div" , {
class : ` ${ messageModule1 . markup } ${ messageModule2 . messageContent } `
} , /*#__PURE__*/ React . createElement ( "pre" , null , /*#__PURE__*/ React . createElement ( "code" , {
class : ` ${ scrollbarModule1 . scrollbarGhostHairline } hljs ` ,
dangerouslySetInnerHTML : {
_ _html : hightlightJS . highlight ( this . props . language , this . props . content ) . value
}
} ) ) , /*#__PURE__*/ React . createElement ( "div" , {
className : BDModules . get ( e => e . marginBottom8 ) [ 0 ] . marginBottom8
} ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/ApiPreview.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / ApiPreview . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return ApiPreview ; } ) ;
/* harmony import */ var fs _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! fs */ "fs" ) ;
/* harmony import */ var fs _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( fs _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _modules _distant _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../modules/distant */ "./src/modules/distant.js" ) ;
/* harmony import */ var _modules _webpackModules _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../modules/webpackModules */ "./src/modules/webpackModules.js" ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! electron */ "electron" ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( electron _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _margintop _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./margintop */ "./src/ui/margintop.jsx" ) ;
// Good luck to read my code, Even me can't read it properly.
let formModule ;
class ApiPreview extends React . PureComponent {
constructor ( ) {
super ( ... arguments ) ;
this . state = {
states : [ ]
} ;
}
render ( ) {
if ( ! formModule ) formModule = _modules _webpackModules _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . find ( e => e . FormSection ) ;
2020-09-05 22:50:45 +02:00
/ * *
* @ type { Function [ ] }
2020-07-28 03:29:41 +02:00
* /
const allComponents = [ ... new Set ( Object . keys ( window . Lightcord . Api . Components ) . map ( e => {
return Object . keys ( window . Lightcord . Api . Components [ e ] ) . map ( k => window . Lightcord . Api . Components [ e ] [ k ] ) ;
} ) . flat ( ) ) ] ;
return [ /*#__PURE__*/ React . createElement ( formModule . FormSection , {
tag : "h2" ,
title : "Lightcord's Api Availlable components"
} , /*#__PURE__*/ React . createElement ( formModule . FormText , {
type : "description" ,
className : "" ,
selectable : false
} , "These components are here for the plugin devs. They can quickly embed any component below with this panel." , /*#__PURE__*/ React . createElement ( "div" , {
style : {
marginTop : "20px"
}
} ) , /*#__PURE__*/ React . createElement ( Lightcord . Api . Components . general . AlertBox , {
type : "info"
} , "All these components have error handling. If you want none, add `.original` after the component path." ) , /*#__PURE__*/ React . createElement ( Lightcord . Api . Components . general . AlertBox , {
type : "warn"
2020-08-04 13:43:22 +02:00
} , "We do not recommend modifying these component with plugins. Only do this if you know what you are doing." ) ) , /*#__PURE__*/ React . createElement ( _margintop _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , null ) , /*#__PURE__*/ React . createElement ( Lightcord . Api . Components . inputs . Button , {
2020-07-28 03:29:41 +02:00
color : "brand" ,
look : "outlined" ,
size : "medium" ,
hoverColor : "green" ,
onClick : ( ) => {
2020-10-14 00:50:42 +02:00
electron _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "remote" ] . shell . openExternal ( "https://lightcord.org/LightcordApi/" ) ;
2020-07-28 03:29:41 +02:00
} ,
wrapper : false
} , "Documentation" ) ) , allComponents . map ( comp => {
2020-08-04 13:43:22 +02:00
const compName = comp . displayName || comp . name ;
const compPath = ` Lightcord.Api.Components. ${ Object . keys ( window . Lightcord . Api . Components ) . find ( e => window . Lightcord . Api . Components [ e ] [ compName ] ) } . ${ compName } ` ;
return /*#__PURE__*/ React . createElement ( ComponentPreview , {
key : compPath ,
comp : comp
} ) ;
} ) ] ;
}
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
get renders ( ) { }
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
}
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
class ComponentPreview extends React . Component {
constructor ( props ) {
super ( props ) ;
this . state = {
tab : "preview" ,
elem : props . comp ,
options : { }
} ;
}
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
render ( ) {
const comp = this . props . comp ;
let AllPreviews = [ ] ;
if ( comp . AllPreviews ) AllPreviews = comp . AllPreviews ;
let state = this . state ;
let getProps = ( ) => {
let final = { } ;
AllPreviews . forEach ( category => {
final [ Object . keys ( category [ 0 ] ) [ 0 ] ] = category [ 0 ] [ Object . keys ( category [ 0 ] ) [ 0 ] ] ;
} ) ;
Object . keys ( state . options ) . forEach ( key => {
final [ key ] = AllPreviews . find ( e => e . find ( e => e [ key ] ) ) [ state . options [ key ] ] [ key ] ;
} ) ;
return final ;
} ;
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
let renderPreview = ( ) => {
return /*#__PURE__*/ React . createElement ( "div" , {
style : {
margin : "20px"
}
} , /*#__PURE__*/ React . createElement ( "div" , {
style : {
backgroundColor : "var(--background-secondary)" ,
padding : "30px 30px" ,
borderRadius : "8px"
} ,
className : "lc-tab-box-shadow"
} , React . createElement ( comp , getProps ( ) ) ) ) ;
} ;
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
let renderCode = ( ) => {
return /*#__PURE__*/ React . createElement ( "div" , {
style : {
margin : "20px"
}
} , /*#__PURE__*/ React . createElement ( "div" , {
style : {
backgroundColor : "var(--background-secondary)" ,
padding : "30px 30px" ,
borderRadius : "8px"
} ,
className : "lc-tab-box-shadow"
} , /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . SettingSubTitle , null , "JSX" ) , /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . ErrorCatcher , null , React . createElement ( ( ) => {
return /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . CodeBlock , {
2020-07-28 03:29:41 +02:00
language : "jsx" ,
content : generateCode ( "jsx" )
2020-08-04 13:43:22 +02:00
} ) ;
} ) ) , /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . SettingSubTitle , null , "React" ) , /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . ErrorCatcher , null , React . createElement ( ( ) => {
return /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . CodeBlock , {
2020-07-28 03:29:41 +02:00
language : "js" ,
content : generateCode ( "react" )
2020-08-04 13:43:22 +02:00
} ) ;
} ) ) ) ) ;
} ;
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
let getStrForProp = ( value , compPath , lang ) => {
if ( typeof value === "string" ) {
return value ;
} else if ( typeof value === "boolean" ) {
return String ( value ) ;
} else if ( typeof value === "function" ) {
return value . toString ( ) ;
} else if ( typeof value === "object" ) {
if ( value && value . $$typeof && ( value . $$typeof === Symbol . for ( "react.element" ) || value . $$typeof === 0xeac7 ) ) {
if ( compPath === "Lightcord.Api.Components.general.Tabs" ) {
if ( lang === "react" ) {
return ` React.createElement("div", {style: {
marginTop : "20px" , marginBottom : "20px"
2020-07-28 03:29:41 +02:00
} } ,
2020-08-04 13:43:22 +02:00
React . createElement ( "div" , { style : {
backgroundColor : "var(--background-secondary)" ,
padding : "30px 30px" ,
borderRadius : "8px"
} , className : "lc-tab-box-shadow" } ,
React . createElement ( Lightcord . Api . Components . general . Title , null , "Preview tabs" )
)
2020-07-28 03:29:41 +02:00
) ` ;
2020-08-04 13:43:22 +02:00
} else if ( lang === "jsx" ) {
return ` <div style={{
marginTop : "20px" , marginBottom : "20px"
} } >
< div style = { {
backgroundColor : "var(--background-secondary)" ,
padding : "30px 30px" ,
borderRadius : "8px"
} } className = "lc-tab-box-shadow" >
< Lightcord . Api . Components . general . Title > Preview tabs < / L i g h t c o r d . A p i . C o m p o n e n t s . g e n e r a l . T i t l e >
< / d i v >
< / d i v > ` ;
2020-07-28 03:29:41 +02:00
}
}
2020-08-04 13:43:22 +02:00
return "Your components here." ;
2020-07-28 03:29:41 +02:00
}
2020-08-04 13:43:22 +02:00
return JSON . stringify ( value , null , " " ) ;
} else if ( typeof value === "number" ) {
2020-07-28 03:29:41 +02:00
return String ( value ) ;
2020-08-04 13:43:22 +02:00
}
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
return String ( value ) ;
} ;
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
let generateCode = function ( lang ) {
// code formatting is hard
const compName = comp . displayName || comp . name ;
let categories = Object . keys ( window . Lightcord . Api . Components ) ;
const compCategory = categories . find ( e => window . Lightcord . Api . Components [ e ] [ compName ] ) ;
const compPath = ` Lightcord.Api.Components. ${ compCategory } . ${ compName } ` ;
const props = getProps ( ) ;
if ( lang === "jsx" ) {
let propStrings = [ ] ;
let childrenProp = null ;
Object . keys ( props ) . forEach ( key => {
if ( key == "children" ) {
childrenProp = getStrForProp ( props [ key ] , compPath , lang ) ;
2020-07-28 03:29:41 +02:00
} else {
2020-08-04 13:43:22 +02:00
let str = key + "=" ;
2020-07-28 03:29:41 +02:00
if ( typeof props [ key ] === "string" ) {
str += JSON . stringify ( props [ key ] ) ;
} else {
2020-08-04 13:43:22 +02:00
str += ` { ${ getStrForProp ( props [ key ] , compPath , lang ) } } ` ;
2020-07-28 03:29:41 +02:00
}
propStrings . push ( str ) ;
2020-08-04 13:43:22 +02:00
}
} ) ;
let openTag ;
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
if ( childrenProp ) {
openTag = ` < ${ compPath } ${ propStrings . join ( " " ) } > ` ;
let closeTag = ` </ ${ compPath } > ` ;
return ` ${ openTag } \n ${ childrenProp } \n ${ closeTag } ` ;
} else {
openTag = ` < ${ compPath } ${ propStrings . join ( " " ) } /> ` ;
return openTag ;
}
} else if ( lang === "react" ) {
let children = props . children || null ;
delete props . children ;
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
if ( children && children . $$typeof && ( children . $$typeof === Symbol . for ( "react.element" ) || children . $$typeof === 0xeac7 ) ) {
children = getStrForProp ( children , compPath , lang ) ;
}
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
let propStrings = [ ] ;
Object . keys ( props ) . forEach ( key => {
let visibleKey = /[^\w\d_]/g . test ( key ) ? JSON . stringify ( key ) : key ;
let str = visibleKey + ": " ;
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
if ( typeof props [ key ] === "string" ) {
str += JSON . stringify ( props [ key ] ) ;
2020-07-28 03:29:41 +02:00
} else {
2020-08-04 13:43:22 +02:00
str += getStrForProp ( props [ key ] , compPath , lang ) . split ( "\n" ) . map ( ( str , i ) => {
if ( i === 0 ) return str ;
return " " + str ;
} ) . join ( "\n" ) ;
2020-07-28 03:29:41 +02:00
}
2020-08-04 13:43:22 +02:00
propStrings . push ( str ) ;
} ) ;
let propObject = "{" ;
if ( propStrings . length ) {
propStrings . forEach ( ( str , i ) => {
let isLast = i === propStrings . length - 1 ;
let isFirst = i === 0 ;
if ( ! isFirst ) {
propObject += "," ;
}
propObject += "\n " ;
propObject += str ;
if ( isLast ) {
propObject += "\n}" ;
}
} ) ;
} else {
propObject += "}" ;
2020-07-28 03:29:41 +02:00
}
2020-08-04 13:43:22 +02:00
let childrenData = typeof children === "string" && children . startsWith ( "React.createElement" ) ? children : JSON . stringify ( children ) ;
return ` React.createElement( ${ compPath } , ${ propObject } , ${ childrenData } ) ` ;
}
} ;
2020-07-28 03:29:41 +02:00
2020-08-04 13:43:22 +02:00
let help = comp . help || { } ;
let info = help . info ? /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . AlertBox , {
type : "info"
} , help . info ) : null ;
let warn = help . warn ? /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . AlertBox , {
type : "warn"
} , help . warn ) : null ;
let danger = help . danger ? /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . AlertBox , {
type : "danger"
} , help . danger ) : null ;
let error = help . error ? /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . AlertBox , {
type : "error"
} , help . error ) : null ;
let success = help . success ? /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . AlertBox , {
type : "success"
} , help . success ) : null ;
return /*#__PURE__*/ React . createElement ( "div" , null , /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . SettingsTitle , null , comp . displayName || comp . name ) , info , success , warn , error , danger , AllPreviews . map ( category => {
if ( category [ 0 ] . onClick ) return null ;
if ( category [ 0 ] . text ) return null ;
if ( category [ 0 ] . children ) return null ;
if ( category . length === 1 ) return null ;
let key = Object . keys ( category [ 0 ] ) [ 0 ] ;
return [ /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . SettingSubTitle , null , key ) , /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . inputs . Dropdown , {
options : category . map ( ( e , index ) => {
return {
value : "opt-" + index ,
label : JSON . stringify ( e [ Object . keys ( e ) [ 0 ] ] )
} ;
} ) ,
value : "opt-" + ( state . options [ key ] || "0" ) ,
onChange : value => {
this . setState ( {
options : Object . assign ( { } , state . options , {
[ key ] : ( value . value || "0" ) . replace ( "opt-" , "" )
} )
} ) ;
} ,
searchable : true
} ) , /*#__PURE__*/ React . createElement ( "div" , {
style : {
marginBottom : "8px"
}
} ) ] ;
} ) , /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . general . Tabs , {
tabs : [ {
label : "Preview" ,
id : "preview"
} , {
label : "Code" ,
id : "code"
} ] ,
active : state . tab ,
children : state . tab === "preview" ? renderPreview ( ) : renderCode ( ) ,
onChange : tab => {
this . setState ( {
tab
} ) ;
}
} ) ) ;
}
2020-07-28 03:29:41 +02:00
}
/***/ } ) ,
2020-09-17 12:06:02 +02:00
/***/ "./src/ui/TextInputSetting.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / TextInputSetting . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return TextInputSetting ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _components _textinput _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./components/textinput */ "./src/ui/components/textinput.jsx" ) ;
let classnames = [ ] ;
function getClassName ( name ) {
let className = classnames . find ( e => e . startsWith ( name + "-" ) ) ;
if ( className ) return className ;
className = BDModules . get ( e => e [ name ] ) [ 0 ] [ name ] ;
classnames . push ( className ) ;
return className ;
}
class TextInputSetting extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
this . onChange = this . onChange . bind ( this ) ;
}
onChange ( value ) {
this . props . onChange ( this . props . id , value ) ;
}
render ( ) {
let {
text ,
info
} = this . props . data ;
if ( this . props . data . experimental ) {
if ( ! classnames . find ( e => e . startsWith ( "beta-" ) ) ) {
classnames . push ( BDModules . get ( e => e . beta && ! e . container && ! e . userSettingsVoice ) [ 0 ] . beta ) ;
}
info = [ info , /*#__PURE__*/ React . createElement ( "sup" , {
className : getClassName ( "beta" )
} , "(EXPERIMENTAL)" ) ] ;
}
return /*#__PURE__*/ React . createElement ( "div" , {
className : "ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"
} , /*#__PURE__*/ React . createElement ( "div" , {
className : "ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"
} , /*#__PURE__*/ React . createElement ( "h3" , {
key : "title" ,
className : "ui-form-title h3 margin-reset margin-reset ui-flex-child"
} , text ) , /*#__PURE__*/ React . createElement ( _components _textinput _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
key : "input" ,
onChange : this . onChange ,
value : this . props . value ,
placeholder : this . props . placeholder || null
} ) ) , /*#__PURE__*/ React . createElement ( "div" , {
className : "ui-form-text style-description margin-top-4" ,
style : {
flex : "1 1 auto"
}
} , info ) ) ;
}
}
/***/ } ) ,
2020-07-28 03:29:41 +02:00
/***/ "./src/ui/addoncard.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / addoncard . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _PluginCard ; } ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _modules _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../modules/utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _modules _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../modules/domtools */ "./src/modules/domtools.js" ) ;
/* harmony import */ var _xSvg _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./xSvg */ "./src/ui/xSvg.js" ) ;
/* harmony import */ var _reloadIcon _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./reloadIcon */ "./src/ui/reloadIcon.js" ) ;
/* harmony import */ var _icons _edit _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./icons/edit */ "./src/ui/icons/edit.jsx" ) ;
/* harmony import */ var _icons _delete _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./icons/delete */ "./src/ui/icons/delete.jsx" ) ;
/* harmony import */ var _components _switch _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./components/switch */ "./src/ui/components/switch.jsx" ) ;
/* harmony import */ var _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./tooltipWrap */ "./src/ui/tooltipWrap.js" ) ;
/* harmony import */ var _modules _pluginCertifier _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ../modules/pluginCertifier */ "./src/modules/pluginCertifier.js" ) ;
/* harmony import */ var _modules _contentManager _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ../modules/contentManager */ "./src/modules/contentManager.js" ) ;
/* harmony import */ var path _ _WEBPACK _IMPORTED _MODULE _12 _ _ = _ _webpack _require _ _ ( /*! path */ "path" ) ;
/* harmony import */ var path _ _WEBPACK _IMPORTED _MODULE _12 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( path _ _WEBPACK _IMPORTED _MODULE _12 _ _ ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . React ;
const anchorClasses = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . anchorClasses ;
class V2C _PluginCard extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
this . onChange = this . onChange . bind ( this ) ;
this . showSettings = this . showSettings . bind ( this ) ;
this . setInitialState ( ) ;
this . hasSettings = this . props . addon . plugin && typeof this . props . addon . plugin . getSettingsPanel === "function" ;
this . settingsPanel = "" ;
this . edit = this . edit . bind ( this ) ;
this . delete = this . delete . bind ( this ) ;
this . reload = this . reload . bind ( this ) ;
}
setInitialState ( ) {
this . state = {
checked : this . props . enabled ,
settings : false ,
reloads : 0 ,
trusted : false
} ;
}
showSettings ( ) {
if ( ! this . hasSettings ) return ;
this . setState ( {
settings : true
} ) ;
}
closeSettings ( ) {
this . panelRef . current . innerHTML = "" ;
this . setState ( {
settingsOpen : false
} ) ;
}
componentDidUpdate ( ) {
if ( ! this . state . settings ) return ;
if ( typeof this . settingsPanel === "object" ) {
this . refs . settingspanel . appendChild ( this . settingsPanel ) ;
}
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-3" ] ) return ;
setImmediate ( ( ) => {
const isHidden = ( container , element ) => {
if ( ! container ) {
console . error ( new Error ( ` Container is undefined. ` ) ) ;
return false ;
}
const cTop = container . scrollTop ;
const cBottom = cTop + container . clientHeight ;
const eTop = element . offsetTop ;
const eBottom = eTop + element . clientHeight ;
return eTop < cTop || eBottom > cBottom ;
} ;
const thisNode = this . refs . cardNode ;
const container = thisNode . closest ( "div[class*=\"contentRegionScroller-\"]" ) ;
if ( ! isHidden ( container , thisNode ) ) return ;
const thisNodeOffset = _modules _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . offset ( thisNode ) ;
const containerOffset = _modules _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . offset ( container ) ;
const original = container . scrollTop ;
const endPoint = thisNodeOffset . top - containerOffset . top + container . scrollTop - 30 ;
_modules _domtools _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . animate ( {
duration : 300 ,
update : function ( progress ) {
if ( endPoint > original ) container . scrollTop = original + progress * ( endPoint - original ) ; else container . scrollTop = original - progress * ( original - endPoint ) ;
}
} ) ;
} ) ;
}
getString ( value ) {
if ( ! value ) return "???" ;
return typeof value == "string" ? value : value . toString ( ) ;
}
get settingsComponent ( ) {
try {
this . settingsPanel = this . props . addon . plugin . getSettingsPanel ( ) ;
} catch ( err ) {
_modules _utils _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . err ( "Plugins" , "Unable to get settings panel for " + this . name + "." , err ) ;
}
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
className : "bd-card bd-addon-card settings-open ui-switch-item" ,
ref : "cardNode"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
style : {
"float" : "right" ,
"cursor" : "pointer"
} ,
onClick : ( ) => {
this . refs . settingspanel . innerHTML = "" ;
this . setState ( {
settings : false
} ) ;
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( _xSvg _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , null ) ) , typeof this . settingsPanel === "object" && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
id : ` plugin-settings- ${ this . name } ` ,
className : "plugin-settings" ,
ref : "settingspanel"
} ) , typeof this . settingsPanel !== "object" && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
id : ` plugin-settings- ${ this . name } ` ,
className : "plugin-settings" ,
ref : "settingspanel" ,
dangerouslySetInnerHTML : {
_ _html : this . settingsPanel
}
} ) ) ;
}
buildTitle ( name , version , author ) {
const title = "{{name}} v{{version}} by {{author}}" . split ( /({{[A-Za-z]+}})/ ) ;
const nameIndex = title . findIndex ( s => s == "{{name}}" ) ;
if ( nameIndex ) title [ nameIndex ] = React . createElement ( "span" , {
className : "name bda-name"
} , name ) ;
const versionIndex = title . findIndex ( s => s == "{{version}}" ) ;
if ( nameIndex ) title [ versionIndex ] = React . createElement ( "span" , {
className : "version bda-version"
} , version ) ;
const authorIndex = title . findIndex ( s => s == "{{author}}" ) ;
if ( nameIndex ) {
const props = {
className : "author bda-author"
} ;
if ( author . link || author . id ) {
props . className += ` ${ anchorClasses . anchor } ${ anchorClasses . anchorUnderlineOnHover } ` ;
props . target = "_blank" ;
if ( author . link ) props . href = author . link ;
if ( author . id ) props . onClick = ( ) => {
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . LayerStack . popLayer ( ) ;
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . openDM ( author . id ) ;
} ;
}
title [ authorIndex ] = React . createElement ( author . link || author . id ? "a" : "span" , props , author . name ) ;
}
return title . flat ( ) ;
}
makeLink ( title , url ) {
const props = {
className : "bda-link bda-link-website" ,
target : "_blank"
} ;
if ( typeof url == "string" ) props . href = url ;
if ( typeof url == "function" ) props . onClick = event => {
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
url ( ) ;
} ;
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "a" , props , title ) ;
}
makeButton ( title , children , action ) {
return /*#__PURE__*/ React . createElement ( _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] , {
color : "black" ,
side : "top" ,
text : title
} , /*#__PURE__*/ React . createElement ( "div" , {
className : "bd-addon-button" ,
onClick : action
} , children ) ) ;
}
componentWillUnmount ( ) {
this . unmounted = true ;
}
get links ( ) {
const links = [ ] ;
const addon = this . props . addon ;
if ( addon . website ) links . push ( this . makeLink ( "Website" , addon . website ) ) ;
if ( addon . source ) links . push ( this . makeLink ( "Source" , addon . source ) ) ;
if ( addon . invite ) {
links . push ( this . makeLink ( "Support Server" , ( ) => {
const tester = /\.gg\/(.*)$/ ;
let code = addon . invite ;
if ( tester . test ( code ) ) code = code . match ( tester ) [ 1 ] ;
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . LayerStack . popLayer ( ) ;
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . InviteActions . acceptInviteAndTransitionToInviteChannel ( code ) ;
} ) ) ;
}
if ( addon . donate ) links . push ( this . makeLink ( "Donate" , addon . donate ) ) ;
if ( addon . patreon ) links . push ( this . makeLink ( "Patreon" , addon . patreon ) ) ;
return links ;
}
get footer ( ) {
const links = this . links ;
return ( links . length || this . hasSettings ) && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
className : "bd-card-footer bda-footer"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "span" , {
className : "bd-addon-links bda-links"
} , ... links . map ( ( element , index ) => index < links . length - 1 ? [ element , " | " ] : element ) . flat ( ) ) , this . hasSettings && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "button" , {
onClick : this . showSettings ,
className : "bd-button bda-settings-button" ,
disabled : ! this . state . checked
} , "Settings" ) ) ;
}
onChange ( ) {
this . props . toggle && this . props . toggle ( this . name ) ;
this . setState ( {
checked : ! this . state . checked
} ) ;
}
edit ( ) {
this . props . edit ( this . name ) ;
}
delete ( ) {
this . props . remove ( this . name ) ;
}
reload ( ) {
this . props . reload ( this . name ) ;
}
get name ( ) {
return this . getString ( this . props . addon . plugin ? this . props . addon . plugin . getName ( ) : this . props . addon . name ) ;
}
get author ( ) {
return this . getString ( this . props . addon . plugin ? this . props . addon . plugin . getAuthor ( ) : this . props . addon . author ) ;
}
get description ( ) {
return this . getString ( this . props . addon . plugin ? this . props . addon . plugin . getDescription ( ) : this . props . addon . description ) ;
}
get version ( ) {
return this . getString ( this . props . addon . plugin ? this . props . addon . plugin . getVersion ( ) : this . props . addon . version ) ;
}
render ( ) {
if ( this . state . settings ) return this . settingsComponent ;
const {
authorId ,
authorLink
} = this . props . addon ;
const style = { } ;
if ( _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "fork-ps-6" ] ) {
if ( ! this . isScanning ) {
this . isScanning = true ;
Object ( _modules _pluginCertifier _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "processFile" ] ) ( Object ( path _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "resolve" ] ) ( this . props . addon . filename . endsWith ( ".plugin.js" ) ? _modules _contentManager _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] . pluginsFolder : _modules _contentManager _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] . themesFolder , this . props . addon . filename ) , result => {
if ( this . unmounted ) return ;
this . setState ( {
isTrusted : result . suspect ? "suspect" : true
} ) ;
} , ( ) => { } ) ;
} else {
if ( this . state . isTrusted === true ) {
style . borderColor = "#4087ed" ;
}
if ( this . state . isTrusted === "suspect" ) {
style . borderColor = "rgb(240, 71, 71)" ;
}
}
}
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
className : "bd-card bd-addon-card settings-closed ui-switch-item" ,
style
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
className : "bd-addon-header bda-header"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
className : "bd-card-title bda-header-title"
} , this . buildTitle ( this . name , this . version , {
name : this . author ,
id : authorId ,
link : authorLink
} ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
className : "bd-addon-controls bda-controls"
} , this . props . edit && this . makeButton ( "Edit" , /*#__PURE__*/ React . createElement ( _icons _edit _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] , {
className : "bd-icon"
} ) , this . edit ) , this . props . remove && this . makeButton ( "Delete" , /*#__PURE__*/ React . createElement ( _icons _delete _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] , {
className : "bd-icon"
} ) , this . delete ) , this . props . reload && this . makeButton ( "Reload" , /*#__PURE__*/ React . createElement ( _reloadIcon _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] , {
className : "bd-icon"
} ) , this . reload ) , React . createElement ( _components _switch _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] , {
onChange : this . onChange ,
checked : this . state . checked
} ) ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
className : "bd-scroller-wrap bda-description-wrap scroller-wrap fade"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "div" , {
className : "bd-scroller bd-addon-description bda-description scroller"
} , this . description ) ) , this . footer ) ;
}
}
const originalRender = V2C _PluginCard . prototype . render ;
Object . defineProperty ( V2C _PluginCard . prototype , "render" , {
enumerable : false ,
configurable : false ,
set : function ( ) {
console . warn ( "Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins" ) ;
} ,
get : ( ) => originalRender
} ) ;
/***/ } ) ,
/***/ "./src/ui/addonlist.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / addonlist . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return CardList ; } ) ;
/* harmony import */ var _errorBoundary _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./errorBoundary */ "./src/ui/errorBoundary.js" ) ;
/* harmony import */ var _contentColumn _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./contentColumn */ "./src/ui/contentColumn.js" ) ;
/* harmony import */ var _reloadIcon _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./reloadIcon */ "./src/ui/reloadIcon.js" ) ;
/* harmony import */ var _addoncard _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./addoncard */ "./src/ui/addoncard.jsx" ) ;
/* harmony import */ var _components _dropdown _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./components/dropdown */ "./src/ui/components/dropdown.jsx" ) ;
/* harmony import */ var _components _search _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./components/search */ "./src/ui/components/search.jsx" ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _modules _contentManager _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ../modules/contentManager */ "./src/modules/contentManager.js" ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _modules _pluginModule _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ../modules/pluginModule */ "./src/modules/pluginModule.js" ) ;
/* harmony import */ var _modules _themeModule _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ../modules/themeModule */ "./src/modules/themeModule.js" ) ;
/* harmony import */ var _modules _webpackModules _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ../modules/webpackModules */ "./src/modules/webpackModules.js" ) ;
/* harmony import */ var _modules _bdApi _ _WEBPACK _IMPORTED _MODULE _12 _ _ = _ _webpack _require _ _ ( /*! ../modules/bdApi */ "./src/modules/bdApi.js" ) ;
/* harmony import */ var _modules _utils _ _WEBPACK _IMPORTED _MODULE _13 _ _ = _ _webpack _require _ _ ( /*! ../modules/utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _14 _ _ = _ _webpack _require _ _ ( /*! ./tooltipWrap */ "./src/ui/tooltipWrap.js" ) ;
/* harmony import */ var _modules _bdEvents _ _WEBPACK _IMPORTED _MODULE _15 _ _ = _ _webpack _require _ _ ( /*! ../modules/bdEvents */ "./src/modules/bdEvents.js" ) ;
2020-08-01 11:05:17 +02:00
/* harmony import */ var _tooltip _ _WEBPACK _IMPORTED _MODULE _16 _ _ = _ _webpack _require _ _ ( /*! ./tooltip */ "./src/ui/tooltip.js" ) ;
2020-07-28 03:29:41 +02:00
function _extends ( ) { _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ; return _extends . apply ( this , arguments ) ; }
2020-08-01 11:05:17 +02:00
2020-07-28 03:29:41 +02:00
const Tooltip = _modules _webpackModules _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "default" ] . findByDisplayName ( "Tooltip" ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . react ;
class CardList extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
this . state = {
sort : "name" ,
ascending : true ,
query : ""
} ;
this . isPlugins = this . props . type == "plugins" ;
this . cookie = this . isPlugins ? _0globals _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "pluginCookie" ] : _0globals _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "themeCookie" ] ;
this . manager = this . isPlugins ? _modules _pluginModule _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] : _modules _themeModule _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] ;
this . sort = this . sort . bind ( this ) ;
this . reverse = this . reverse . bind ( this ) ;
this . search = this . search . bind ( this ) ;
this . onAddonChanges = function ( ) {
this . forceUpdate ( ) ;
} ;
this . onAddonChanges = this . onAddonChanges . bind ( this ) ;
}
componentDidMount ( ) {
const type = ( this . isPlugins ? "plugin" : "theme" ) + "-" ;
_modules _bdEvents _ _WEBPACK _IMPORTED _MODULE _15 _ _ [ "default" ] . on ( ` ${ type } loaded ` , this . onAddonChanges ) ;
_modules _bdEvents _ _WEBPACK _IMPORTED _MODULE _15 _ _ [ "default" ] . on ( ` ${ type } unloaded ` , this . onAddonChanges ) ;
_modules _bdEvents _ _WEBPACK _IMPORTED _MODULE _15 _ _ [ "default" ] . on ( ` ${ type } reloaded ` , this . onAddonChanges ) ;
}
componentWillUnmount ( ) {
const type = ( this . isPlugins ? "plugin" : "theme" ) + "-" ;
_modules _bdEvents _ _WEBPACK _IMPORTED _MODULE _15 _ _ [ "default" ] . off ( ` ${ type } loaded ` , this . onAddonChanges ) ;
_modules _bdEvents _ _WEBPACK _IMPORTED _MODULE _15 _ _ [ "default" ] . off ( ` ${ type } unloaded ` , this . onAddonChanges ) ;
_modules _bdEvents _ _WEBPACK _IMPORTED _MODULE _15 _ _ [ "default" ] . off ( ` ${ type } reloaded ` , this . onAddonChanges ) ;
}
openFolder ( ) {
const shell = _ _webpack _require _ _ ( /*! electron */ "electron" ) . shell ;
const open = shell . openPath || shell . openItem ;
open ( this . isPlugins ? _modules _contentManager _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . pluginsFolder : _modules _contentManager _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] . themesFolder ) ;
}
edit ( name ) {
console . log ( name ) ;
this . manager . edit ( name ) ;
}
async delete ( name ) {
const shouldDelete = await this . confirmDelete ( name ) ;
if ( ! shouldDelete ) return ;
this . manager . delete ( name ) ;
}
confirmDelete ( name ) {
return new Promise ( resolve => {
_modules _bdApi _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "default" ] . showConfirmationModal ( "Are You Sure?" , ` Are you sure you want to delete ${ name } ? ` , {
danger : true ,
confirmText : "Delete" ,
onConfirm : ( ) => {
resolve ( true ) ;
} ,
onCancel : ( ) => {
resolve ( false ) ;
}
} ) ;
} ) ;
}
get sortOptions ( ) {
return [ {
label : "Name" ,
value : "name"
} , {
label : "Author" ,
value : "author"
} , {
label : "Version" ,
value : "version"
} , {
label : "Recently Added" ,
value : "added"
} , {
label : "Last Modified" ,
value : "modified"
} , {
label : "File Size" ,
value : "size"
} ] ;
}
get directions ( ) {
return [ {
label : "Ascending" ,
value : true
} , {
label : "Descending" ,
value : false
} ] ;
}
reverse ( value ) {
this . setState ( {
ascending : value
} ) ;
}
sort ( value ) {
this . setState ( {
sort : value
} ) ;
}
search ( event ) {
this . setState ( {
query : event . target . value . toLocaleLowerCase ( )
} ) ;
}
getProps ( addon ) {
return {
key : this . getName ( addon ) ,
enabled : this . cookie [ this . getName ( addon ) ] ,
toggle : this . manager . toggle . bind ( this . manager ) ,
edit : _0globals _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "settingsCookie" ] [ "fork-ps-7" ] ? this . edit . bind ( this ) : null ,
remove : this . delete . bind ( this ) ,
addon : addon ,
hash : addon . hash
} ;
}
getString ( value ) {
if ( ! value ) return "???" ;
return typeof value == "string" ? value : value . toString ( ) ;
}
get list ( ) {
return this . props . type === "plugins" ? Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "bdplugins" ] ) : Object . values ( _0globals _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "bdthemes" ] ) ;
}
getAddons ( ) {
const sortedAddons = this . list . sort ( ( a , b ) => {
const cap = this . state . sort . charAt ( 0 ) . toUpperCase ( ) + this . state . sort . slice ( 1 ) ;
2020-08-04 13:43:22 +02:00
const first = a . plugin && a . plugin [ ` get ${ cap } ` ] ? this . getString ( a . plugin [ ` get ${ cap } ` ] ( ) ) : this . getString ( a [ this . state . sort ] ) ;
const second = b . plugin && b . plugin [ ` get ${ cap } ` ] ? this . getString ( b . plugin [ ` get ${ cap } ` ] ( ) ) : this . getString ( b [ this . state . sort ] ) ;
2020-07-28 03:29:41 +02:00
if ( typeof first == "string" ) return first . toLocaleLowerCase ( ) . localeCompare ( second . toLocaleLowerCase ( ) ) ;
if ( first > second ) return 1 ;
if ( second > first ) return - 1 ;
return 0 ;
} ) ;
if ( ! this . state . ascending ) sortedAddons . reverse ( ) ;
const rendered = [ ] ;
for ( let a = 0 ; a < sortedAddons . length ; a ++ ) {
const addon = sortedAddons [ a ] ;
if ( this . state . query ) {
let matches = null ;
const name = this . getName ( addon ) ;
const author = this . getAuthor ( addon ) ;
const description = this . getDescription ( addon ) ;
const version = this . getVersion ( addon ) ;
if ( name ) matches = name . toLocaleLowerCase ( ) . includes ( this . state . query ) ;
if ( author ) matches = matches || author . toLocaleLowerCase ( ) . includes ( this . state . query ) ;
if ( description ) matches = matches || description . toLocaleLowerCase ( ) . includes ( this . state . query ) ;
if ( version ) matches = matches || version . toLocaleLowerCase ( ) . includes ( this . state . query ) ;
if ( ! matches ) continue ;
}
const props = this . getProps ( addon ) ;
rendered . push ( /*#__PURE__*/ React . createElement ( _errorBoundary _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] , null , /*#__PURE__*/ React . createElement ( _addoncard _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , _extends ( { } , props , {
reload : ! _0globals _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "settingsCookie" ] [ "fork-ps-5" ] && this . manager . reload . bind ( this . manager )
} ) ) ) ) ;
}
return rendered ;
}
getName ( addon ) {
return this . getString ( addon . plugin ? addon . plugin . getName ( ) : addon . name ) ;
}
getAuthor ( addon ) {
return this . getString ( addon . plugin ? addon . plugin . getAuthor ( ) : addon . author ) ;
}
getDescription ( addon ) {
return this . getString ( addon . plugin ? addon . plugin . getDescription ( ) : addon . description ) ;
}
getVersion ( addon ) {
return this . getString ( addon . plugin ? addon . plugin . getVersion ( ) : addon . version ) ;
}
renderCheckUpdates ( ) {
if ( ! window . ZeresPluginLibrary ) return null ;
if ( ! window . PluginUpdates ) return null ;
if ( typeof window . PluginUpdates . checkAll !== "function" ) return null ;
if ( ! this . isPlugins ) return null ;
2020-08-01 11:05:17 +02:00
let tooltipIsShowing = false ;
let tooltip ;
2020-07-28 03:29:41 +02:00
return /*#__PURE__*/ React . createElement ( _tooltipWrap _ _WEBPACK _IMPORTED _MODULE _14 _ _ [ "default" ] , {
text : "Checks for updates of plugins that support this feature. Right-click for a list."
} , /*#__PURE__*/ React . createElement ( "span" , {
style : {
marginLeft : "10px"
2020-08-01 11:05:17 +02:00
} ,
onMouseLeave : ( ) => {
tooltipIsShowing = false ;
tooltip . hide ( ) ;
2020-07-28 03:29:41 +02:00
}
} , /*#__PURE__*/ React . createElement ( Lightcord . Api . Components . inputs . Button , {
2020-08-01 11:05:17 +02:00
ref : "checkUpdateButton" ,
2020-07-28 03:29:41 +02:00
color : "brand" ,
look : "filled" ,
size : "min" ,
hoverColor : "default" ,
onClick : ( ) => {
try {
_modules _utils _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] . showToast ( "Plugin update check in progress." , {
type : "info"
} ) ;
window . PluginUpdates . checkAll ( ) . then ( ( ) => {
_modules _utils _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] . showToast ( "Plugin update check complete." , {
type : "success"
} ) ;
} ) . catch ( err => {
console . error ( err ) ;
_modules _utils _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] . showToast ( "An error occured while checking update." , {
type : "error"
} ) ;
} ) ;
} catch ( e ) {
console . error ( e ) ;
_modules _utils _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "default" ] . showToast ( "An error occured while checking update." , {
type : "error"
} ) ;
}
} ,
wrapper : false ,
2020-08-01 11:05:17 +02:00
disabled : false ,
onRightClick : ( ) => {
if ( ! this . refs . checkUpdateButton ) return ;
if ( ! window . PluginUpdates || ! window . PluginUpdates . plugins ) return ;
if ( tooltipIsShowing ) return ;
tooltip = new _tooltip _ _WEBPACK _IMPORTED _MODULE _16 _ _ [ "default" ] ( this . refs . checkUpdateButton . refs . original . refs . button , Object . values ( window . PluginUpdates . plugins ) . map ( p => p . name ) . join ( ", " ) , {
side : "bottom" ,
attachEvents : false
} ) ;
tooltip . show ( ) ;
tooltipIsShowing = true ;
}
2020-07-28 03:29:41 +02:00
} , "Check for Updates" ) ) ) ;
}
render ( ) {
const refreshIcon = /*#__PURE__*/ React . createElement ( Tooltip , {
color : "black" ,
position : "top" ,
text : "Reload List"
} , props => /*#__PURE__*/ React . createElement ( _reloadIcon _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , _extends ( { } , props , {
className : "bd-icon bd-reload bd-reload-header" ,
size : "18px" ,
onClick : async ( ) => {
if ( this . isPlugins ) _modules _pluginModule _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "default" ] . updatePluginList ( ) ; else _modules _themeModule _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] . updateThemeList ( ) ;
this . forceUpdate ( ) ;
}
} ) ) ) ;
const addonCards = this . getAddons ( ) ;
return /*#__PURE__*/ React . createElement ( _contentColumn _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
title : ` ${ this . props . type . toUpperCase ( ) } — ${ addonCards . length } `
2020-08-01 11:05:17 +02:00
} , /*#__PURE__*/ React . createElement ( Lightcord . Api . Components . inputs . Button , {
2020-07-28 03:29:41 +02:00
key : "folder-button" ,
2020-08-01 11:05:17 +02:00
color : "brand" ,
look : "filled" ,
size : "min" ,
hoverColor : "default" ,
onClick : this . openFolder . bind ( this ) ,
wrapper : false ,
style : {
marginLeft : "10px"
}
2020-07-28 03:29:41 +02:00
} , "Open " , this . isPlugins ? "Plugin" : "Theme" , " Folder" ) , this . renderCheckUpdates ( ) , ! _0globals _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "settingsCookie" ] [ "fork-ps-5" ] && refreshIcon , /*#__PURE__*/ React . createElement ( "div" , {
className : "bd-controls bd-addon-controls"
} , /*#__PURE__*/ React . createElement ( _components _search _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] , {
onChange : this . search ,
placeholder : ` Search ${ this . props . type } ... `
} ) , /*#__PURE__*/ React . createElement ( "div" , {
className : "bd-addon-dropdowns"
} , /*#__PURE__*/ React . createElement ( "div" , {
className : "bd-select-wrapper"
} , /*#__PURE__*/ React . createElement ( "label" , {
className : "bd-label"
} , "Sort by:" ) , /*#__PURE__*/ React . createElement ( _components _dropdown _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
options : this . sortOptions ,
onChange : this . sort ,
style : "transparent"
} ) ) , /*#__PURE__*/ React . createElement ( "div" , {
className : "bd-select-wrapper"
} , /*#__PURE__*/ React . createElement ( "label" , {
className : "bd-label"
} , "Order:" ) , /*#__PURE__*/ React . createElement ( _components _dropdown _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , {
options : this . directions ,
onChange : this . reverse ,
style : "transparent"
} ) ) ) ) , /*#__PURE__*/ React . createElement ( "div" , {
className : "bda-slist bd-addon-list"
} , addonCards ) ) ;
}
}
const originalRender = CardList . prototype . render ;
Object . defineProperty ( CardList . prototype , "render" , {
enumerable : false ,
configurable : false ,
set : function ( ) {
console . warn ( "Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins" ) ;
} ,
get : ( ) => originalRender
} ) ;
/***/ } ) ,
/***/ "./src/ui/bdLogo.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / bdLogo . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return BDLogo ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
class BDLogo extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
render ( ) {
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "svg" , {
height : "100%" ,
width : this . props . size || "16px" ,
className : "bd-logo " + this . props . className ,
style : {
fillRule : "evenodd" ,
clipRule : "evenodd" ,
strokeLinecap : "round" ,
strokeLinejoin : "round"
} ,
viewBox : "0 0 2000 2000"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "metadata" , null ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "defs" , null , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "filter" , {
id : "shadow1"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "feDropShadow" , {
"dx" : "20" ,
"dy" : "0" ,
"stdDeviation" : "20" ,
"flood-color" : "rgba(0,0,0,0.35)"
} ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "filter" , {
id : "shadow2"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "feDropShadow" , {
"dx" : "15" ,
"dy" : "0" ,
"stdDeviation" : "20" ,
"flood-color" : "rgba(255,255,255,0.15)"
} ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "filter" , {
id : "shadow3"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "feDropShadow" , {
"dx" : "10" ,
"dy" : "0" ,
"stdDeviation" : "20" ,
"flood-color" : "rgba(0,0,0,0.35)"
} ) ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "g" , null , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "path" , {
style : {
filter : "url(#shadow3)"
} ,
d : "M1195.44+135.442L1195.44+135.442L997.6+136.442C1024.2+149.742+1170.34+163.542+1193.64+179.742C1264.34+228.842+1319.74+291.242+1358.24+365.042C1398.14+441.642+1419.74+530.642+1422.54+629.642L1422.54+630.842L1422.54+632.042C1422.54+773.142+1422.54+1228.14+1422.54+1369.14L1422.54+1370.34L1422.54+1371.54C1419.84+1470.54+1398.24+1559.54+1358.24+1636.14C1319.74+1709.94+1264.44+1772.34+1193.64+1821.44C1171.04+1837.14+1025.7+1850.54+1000+1863.54L1193.54+1864.54C1539.74+1866.44+1864.54+1693.34+1864.54+1296.64L1864.54+716.942C1866.44+312.442+1541.64+135.442+1195.44+135.442Z" ,
fill : "#171717" ,
opacity : "1"
} ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "path" , {
style : {
filter : "url(#shadow2)"
} ,
d : "M1695.54+631.442C1685.84+278.042+1409.34+135.442+1052.94+135.442L361.74+136.442L803.74+490.442L1060.74+490.442C1335.24+490.442+1335.24+835.342+1060.74+835.342L1060.74+1164.84C1150.22+1164.84+1210.53+1201.48+1241.68+1250.87C1306.07+1353+1245.76+1509.64+1060.74+1509.64L361.74+1863.54L1052.94+1864.54C1409.24+1864.54+1685.74+1721.94+1695.54+1368.54C1695.54+1205.94+1651.04+1084.44+1572.64+999.942C1651.04+915.542+1695.54+794.042+1695.54+631.442Z" ,
fill : "#3E82E5" ,
opacity : "1"
} ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "path" , {
style : {
filter : "url(#shadow1)"
} ,
d : "M1469.25+631.442C1459.55+278.042+1183.05+135.442+826.65+135.442L135.45+135.442L135.45+1004C135.45+1004+135.427+1255.21+355.626+1255.21C575.825+1255.21+575.848+1004+575.848+1004L577.45+490.442L834.45+490.442C1108.95+490.442+1108.95+835.342+834.45+835.342L664.65+835.342L664.65+1164.84L834.45+1164.84C923.932+1164.84+984.244+1201.48+1015.39+1250.87C1079.78+1353+1019.47+1509.64+834.45+1509.64L135.45+1509.64L135.45+1864.54L826.65+1864.54C1182.95+1864.54+1459.45+1721.94+1469.25+1368.54C1469.25+1205.94+1424.75+1084.44+1346.35+999.942C1424.75+915.542+1469.25+794.042+1469.25+631.442Z" ,
fill : "#FFFFFF" ,
opacity : "1"
} ) ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/checkbox.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / checkbox . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _Checkbox ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
class V2C _Checkbox extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
this . onClick = this . onClick . bind ( this ) ;
this . setInitialState ( ) ;
}
setInitialState ( ) {
this . state = {
checked : this . props . checked || false
} ;
}
render ( ) {
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "li" , null , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "checkbox " + BDModules . get ( e => e . checkboxElement ) [ 0 ] . checkbox ,
onClick : this . onClick
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "checkbox-inner " + BDModules . get ( e => e . checkboxInner ) [ 0 ] . checkboxInner
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "input" , {
className : BDModules . get ( e => e . checkboxElement ) [ 0 ] . checkboxElement ,
checked : this . state . checked ,
onChange : ( ) => { } ,
type : "checkbox"
} ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "span" , null ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "span" , null , this . props . text ) ) ) ;
}
onClick ( ) {
this . props . onChange ( this . props . id , ! this . state . checked ) ;
this . setState ( {
checked : ! this . state . checked
} ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/components/dropdown.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / components / dropdown . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return Select ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _icons _downarrow _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../icons/downarrow */ "./src/ui/icons/downarrow.jsx" ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
class Select extends React . Component {
constructor ( props ) {
super ( props ) ;
this . state = {
open : false ,
value : this . props . value || this . props . options [ 0 ] . value
} ;
this . dropdown = React . createRef ( ) ;
this . onChange = this . onChange . bind ( this ) ;
this . showMenu = this . showMenu . bind ( this ) ;
this . hideMenu = this . hideMenu . bind ( this ) ;
}
showMenu ( event ) {
event . preventDefault ( ) ;
this . setState ( {
open : true
} , ( ) => {
document . addEventListener ( "click" , this . hideMenu ) ;
} ) ;
}
hideMenu ( ) {
this . setState ( {
open : false
} , ( ) => {
document . removeEventListener ( "click" , this . hideMenu ) ;
} ) ;
}
onChange ( value ) {
this . setState ( {
value
} ) ;
if ( this . props . onChange ) this . props . onChange ( value ) ;
}
get selected ( ) {
return this . props . options . find ( o => o . value == this . state . value ) ;
}
get options ( ) {
const selected = this . selected ;
return /*#__PURE__*/ React . createElement ( "div" , {
className : "bd-select-options"
} , this . props . options . map ( opt => /*#__PURE__*/ React . createElement ( "div" , {
className : ` bd-select-option ${ selected . value == opt . value ? " selected" : "" } ` ,
onClick : this . onChange . bind ( this , opt . value )
} , opt . label ) ) ) ;
}
render ( ) {
const style = this . props . style == "transparent" ? " bd-select-transparent" : "" ;
const isOpen = this . state . open ? " menu-open" : "" ;
return /*#__PURE__*/ React . createElement ( "div" , {
className : ` bd-select ${ style } ${ isOpen } ` ,
onClick : this . showMenu ,
ref : this . dropdown
} , /*#__PURE__*/ React . createElement ( "div" , {
className : "bd-select-value"
} , this . selected . label ) , /*#__PURE__*/ React . createElement ( _icons _downarrow _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
className : "bd-select-arrow"
} ) , this . state . open && this . options ) ;
}
} // return <div className="bd-select-wrap">
// <label className="bd-label">{this.props.label}</label>
// <div className={`bd-select${style}${isOpen}`} onClick={this.showMenu} ref={this.dropdown}>
// <div className="bd-select-controls">
// <div className="bd-select-value">{this.selected.label}</div>
// <Arrow className="bd-select-arrow" />
// </div>
// </div>
// {this.state.open && this.options}
// </div>;
/***/ } ) ,
/***/ "./src/ui/components/search.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / components / search . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return Search ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _icons _search _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../icons/search */ "./src/ui/icons/search.jsx" ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
class Search extends React . Component {
2020-08-01 11:05:17 +02:00
constructor ( props ) {
super ( props ) ;
this . state = {
focused : false
} ;
}
2020-07-28 03:29:41 +02:00
render ( ) {
2020-08-01 11:05:17 +02:00
const className = [ "bd-search-wrapper" ] ;
if ( this . state . focused ) className . push ( "focused" ) ;
2020-07-28 03:29:41 +02:00
return /*#__PURE__*/ React . createElement ( "div" , {
2020-08-01 11:05:17 +02:00
className : className . join ( " " )
2020-07-28 03:29:41 +02:00
} , /*#__PURE__*/ React . createElement ( "input" , {
onChange : this . props . onChange ,
onKeyDown : this . props . onKeyDown ,
type : "text" ,
className : "bd-search" ,
placeholder : this . props . placeholder ,
2020-08-01 11:05:17 +02:00
maxLength : "50" ,
onFocus : ( ) => {
this . setState ( {
focused : true
} ) ;
} ,
onBlur : ( ) => {
this . setState ( {
focused : false
} ) ;
}
2020-07-28 03:29:41 +02:00
} ) , /*#__PURE__*/ React . createElement ( _icons _search _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , null ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/components/switch.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / components / switch . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return Switch ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
class Switch extends React . Component {
constructor ( props ) {
super ( props ) ;
this . state = {
checked : this . props . checked
} ;
this . onChange = this . onChange . bind ( this ) ;
}
onChange ( value ) {
if ( this . props . disabled ) return ;
this . props . onChange ( value ) ;
this . setState ( {
checked : value
} ) ;
}
render ( ) {
2020-10-14 00:50:42 +02:00
return /*#__PURE__*/ React . createElement ( Lightcord . Api . Components . inputs . Switch , {
onChange : this . onChange ,
value : this . state . checked
} ) ;
2020-07-28 03:29:41 +02:00
}
}
/***/ } ) ,
2020-09-17 12:06:02 +02:00
/***/ "./src/ui/components/textinput.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / components / textinput . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return TextInput ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
class TextInput extends React . Component {
constructor ( props ) {
super ( props ) ;
this . state = {
value : this . props . value
} ;
this . onChange = this . onChange . bind ( this ) ;
this . emitChange = this . emitChange . bind ( this ) ;
this . input = /*#__PURE__*/ React . createElement ( Lightcord . Api . Components . inputs . TextInput . original , {
ref : console . log ,
onChange : this . onChange ,
value : this . state . value ,
placeholder : this . props . placeholder ,
onBlur : this . emitChange
} ) ;
}
onChange ( value ) {
console . log ( value , this . props ) ;
if ( this . props . disabled ) return ;
this . props . onChange ( value ) ;
this . setState ( {
value : value
} ) ;
}
emitChange ( ) {
console . log ( ` Should emit changes. ` ) ;
}
render ( ) {
return this . input ;
}
}
/***/ } ) ,
2020-07-28 03:29:41 +02:00
/***/ "./src/ui/contentColumn.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / contentColumn . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _ContentColumn ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
class V2C _ContentColumn extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
}
static get displayName ( ) {
return "ContentColumn" ;
}
render ( ) {
//let contentModule = BDModules.get(e => e.contentColumn)[0]
let title = this . props . title ? _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "h2" , {
className : "ui-form-title h2 margin-reset margin-bottom-20"
} , this . props . title ) : null ;
return [ title , this . props . children ] ;
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : contentModule . contentColumn + " " + contentModule . contentColumnDefault + " content-column default" ,
style : {
padding : "60px 40px 0px"
}
} , title , this . props . children ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/cssEditor.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / cssEditor . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _CssEditor ; } ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _modules _settingsPanel _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../modules/settingsPanel */ "./src/modules/settingsPanel.js" ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _modules _dataStore _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../modules/dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ../modules/domtools */ "./src/modules/domtools.js" ) ;
2020-07-28 18:55:37 +02:00
/* harmony import */ var _modules _utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ../modules/utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _settingsTitle _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./settingsTitle */ "./src/ui/settingsTitle.js" ) ;
/* harmony import */ var _checkbox _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./checkbox */ "./src/ui/checkbox.js" ) ;
/* harmony import */ var _cssEditorDetached _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./cssEditorDetached */ "./src/ui/cssEditorDetached.js" ) ;
2020-07-28 03:29:41 +02:00
class V2C _CssEditor extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
const self = this ;
self . props . lines = 0 ;
self . setInitialState ( ) ;
self . attach = self . attach . bind ( self ) ;
2020-07-28 18:55:37 +02:00
self . detachedEditor = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( _cssEditorDetached _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
attach : self . attach
} ) ;
self . onClick = self . onClick . bind ( self ) ;
self . updateCss = self . updateCss . bind ( self ) ;
self . saveCss = self . saveCss . bind ( self ) ;
self . detach = self . detach . bind ( self ) ;
}
setInitialState ( ) {
this . state = {
detached : this . props . detached || _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . editorDetached
} ;
}
componentDidMount ( ) {
// this.updateLineCount();
this . editor = ace . edit ( "bd-customcss-editor" ) ;
2020-07-29 18:29:36 +02:00
this . editor . setTheme ( "ace/theme/discord" ) ;
2020-07-28 03:29:41 +02:00
this . editor . session . setMode ( "ace/mode/css" ) ;
this . editor . setShowPrintMargin ( false ) ;
this . editor . setFontSize ( 14 ) ;
this . editor . on ( "change" , ( ) => {
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-css-0" ] ) return ;
this . saveCss ( ) ;
this . updateCss ( ) ;
} ) ;
}
componentWillUnmount ( ) {
this . editor . destroy ( ) ;
}
componentDidUpdate ( prevProps , prevState ) {
const self = this ;
if ( prevState . detached && ! self . state . detached ) {
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . reactDom . unmountComponentAtNode ( self . detachedRoot ) ;
}
}
codeMirror ( ) { }
get options ( ) {
return {
lineNumbers : true ,
mode : "css" ,
indentUnit : 4 ,
theme : "material" ,
scrollbarStyle : "simple"
} ;
}
get css ( ) {
const _ccss = _modules _dataStore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . getBDData ( "bdcustomcss" ) ;
let ccss = "" ;
if ( _ccss && _ccss !== "" ) {
2020-08-04 13:43:22 +02:00
ccss = Buffer . from ( _ccss , "base64" ) . toString ( "utf8" ) ;
2020-07-28 03:29:41 +02:00
}
return ccss ;
}
updateLineCount ( ) {
const lineCount = this . refs . editor . value . split ( "\n" ) . length ;
if ( lineCount == this . props . lines ) return ;
this . refs . lines . textContent = Array . from ( new Array ( lineCount ) , ( _ , i ) => i + 1 ) . join ( ".\n" ) + "." ;
this . props . lines = lineCount ;
}
render ( ) {
const self = this ;
const {
detached
} = self . state ;
return [ detached && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
id : "editor-detached"
2020-07-28 18:55:37 +02:00
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( _settingsTitle _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
text : "Custom CSS Editor"
} ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "h3" , null , "Editor Detached" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "button" , {
className : "btn btn-primary" ,
onClick : ( ) => {
self . attach ( ) ;
}
2020-07-28 18:55:37 +02:00
} , "Attach" ) ) , ! detached && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , null , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( _settingsTitle _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
text : "Custom CSS Editor"
} ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
className : "editor-wrapper"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
id : "bd-customcss-editor" ,
className : "editor" ,
ref : "editor"
} , self . css ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
id : "bd-customcss-attach-controls"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "ul" , {
className : "checkbox-group"
2020-07-28 18:55:37 +02:00
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( _checkbox _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
id : "live-update" ,
text : "Live Update" ,
onChange : this . onChange ,
checked : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-css-0" ]
} ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
id : "bd-customcss-detach-controls-button"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "button" , {
style : {
borderRadius : "3px 0 0 3px" ,
borderRight : "1px solid #3f4146"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "update" ) ;
}
} , "Update" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "button" , {
style : {
borderRadius : "0" ,
borderLeft : "1px solid #2d2d2d" ,
borderRight : "1px solid #2d2d2d"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "save" ) ;
}
} , "Save" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "button" , {
style : {
borderRadius : "0 3px 3px 0" ,
borderLeft : "1px solid #3f4146"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "detach" ) ;
}
} , "Detach" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "span" , {
style : {
fontSize : "10px" ,
marginLeft : "5px"
}
} , "Unsaved changes are lost on detach" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
className : "help-text"
} , "Press " , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "code" , {
className : "inline"
} , "ctrl" ) , "+" , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "span" , {
className : "inline"
} , "," ) , " with the editor focused to access the editor's settings." ) ) ) ) ] ;
}
onClick ( arg ) {
const self = this ;
switch ( arg ) {
case "update" :
self . updateCss ( ) ;
break ;
case "save" :
self . saveCss ( ) ;
break ;
case "detach" :
self . detach ( ) ;
break ;
}
}
onChange ( id , checked ) {
switch ( id ) {
case "live-update" :
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-css-0" ] = checked ;
_modules _settingsPanel _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . saveSettings ( ) ;
break ;
}
}
updateCss ( ) {
_modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . removeStyle ( "customcss" ) ;
_modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . addStyle ( "customcss" , this . editor . session . getValue ( ) ) ;
}
saveCss ( ) {
2020-08-04 13:43:22 +02:00
_modules _dataStore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . setBDData ( "bdcustomcss" , Buffer . from ( this . editor . session . getValue ( ) , "utf-8" ) . toString ( "base64" ) ) ;
2020-07-28 03:29:41 +02:00
}
detach ( ) {
const self = this ;
self . setState ( {
detached : true
} ) ;
const droot = self . detachedRoot ;
if ( ! droot ) {
console . log ( "FAILED TO INJECT ROOT: .app" ) ;
return ;
}
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . reactDom . render ( self . detachedEditor , droot ) ;
}
get detachedRoot ( ) {
const _root = _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( "#bd-customcss-detach-container" ) ;
if ( ! _root ) {
if ( ! this . injectDetachedRoot ( ) ) return null ;
return this . detachedRoot ;
}
return _root ;
}
injectDetachedRoot ( ) {
2020-07-28 18:55:37 +02:00
const app = _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( ".app, ." + _modules _utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . removeDa ( BDModules . get ( e => e . app && e . layers ) [ 0 ] . app ) ) ;
2020-07-28 03:29:41 +02:00
if ( ! app ) return false ;
_modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . insertAfter ( _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . createElement ( ` <div id="bd-customcss-detach-container"> ` ) , app ) ;
return true ;
}
attach ( ) {
const self = this ;
self . setState ( {
detached : false
} ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/cssEditorDetached.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / cssEditorDetached . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _CssEditorDetached ; } ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _modules _settingsPanel _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../modules/settingsPanel */ "./src/modules/settingsPanel.js" ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _modules _dataStore _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../modules/dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ../modules/domtools */ "./src/modules/domtools.js" ) ;
2020-07-28 18:55:37 +02:00
/* harmony import */ var _modules _utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ../modules/utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _checkbox _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./checkbox */ "./src/ui/checkbox.js" ) ;
2020-07-28 03:29:41 +02:00
class V2C _CssEditorDetached extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
const self = this ;
self . onClick = self . onClick . bind ( self ) ;
self . updateCss = self . updateCss . bind ( self ) ;
self . saveCss = self . saveCss . bind ( self ) ;
self . onChange = self . onChange . bind ( self ) ;
}
componentDidMount ( ) {
_modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . addClass ( _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( "#app-mount" ) , "bd-detached-editor" ) ;
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . editorDetached = true ; // this.updateLineCount();
this . editor = ace . edit ( "bd-customcss-editor-detached" ) ;
2020-07-29 18:29:36 +02:00
this . editor . setTheme ( "ace/theme/discord" ) ;
2020-07-28 03:29:41 +02:00
this . editor . session . setMode ( "ace/mode/css" ) ;
this . editor . setShowPrintMargin ( false ) ;
this . editor . setFontSize ( 14 ) ;
this . editor . on ( "change" , ( ) => {
if ( ! _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-css-0" ] ) return ;
this . saveCss ( ) ;
this . updateCss ( ) ;
} ) ;
}
componentWillUnmount ( ) {
_modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . removeClass ( _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( "#app-mount" ) , "bd-detached-editor" ) ;
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . editorDetached = false ;
this . editor . destroy ( ) ;
}
updateLineCount ( ) {
const lineCount = this . refs . editor . value . split ( "\n" ) . length ;
if ( lineCount == this . props . lines ) return ;
this . refs . lines . textContent = Array . from ( new Array ( lineCount ) , ( _ , i ) => i + 1 ) . join ( ".\n" ) + "." ;
this . props . lines = lineCount ;
}
get options ( ) {
return {
lineNumbers : true ,
mode : "css" ,
indentUnit : 4 ,
theme : "material" ,
scrollbarStyle : "simple"
} ;
}
get css ( ) {
const _ccss = _modules _dataStore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . getBDData ( "bdcustomcss" ) ;
let ccss = "" ;
if ( _ccss && _ccss !== "" ) {
2020-08-04 13:43:22 +02:00
ccss = Buffer . from ( _ccss , "base64" ) . toString ( "utf8" ) ;
2020-07-28 03:29:41 +02:00
}
return ccss ;
}
get root ( ) {
const _root = _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( "#bd-customcss-detach-container" ) ;
if ( ! _root ) {
if ( ! this . injectRoot ( ) ) return null ;
return this . detachedRoot ;
}
return _root ;
}
injectRoot ( ) {
2020-07-28 18:55:37 +02:00
const app = _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( ".app, ." + _modules _utils _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . removeDa ( BDModules . get ( e => e . app && e . layers ) [ 0 ] . app ) ) ;
2020-07-28 03:29:41 +02:00
if ( ! app ) return false ;
_modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . insertAfter ( _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . createElement ( ` <div id="bd-customcss-detach-container"> ` ) , app ) ;
return true ;
}
render ( ) {
const self = this ;
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
className : "bd-detached-css-editor" ,
id : "bd-customcss-detach-editor"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
id : "bd-customcss-innerpane"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
className : "editor-wrapper"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
id : "bd-customcss-editor-detached" ,
className : "editor" ,
ref : "editor"
} , self . css ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
id : "bd-customcss-attach-controls"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "ul" , {
className : "checkbox-group"
2020-07-28 18:55:37 +02:00
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( _checkbox _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
id : "live-update" ,
text : "Live Update" ,
onChange : self . onChange ,
checked : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-css-0" ]
} ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "div" , {
id : "bd-customcss-detach-controls-button"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "button" , {
style : {
borderRadius : "3px 0 0 3px" ,
borderRight : "1px solid #3f4146"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "update" ) ;
}
} , "Update" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "button" , {
style : {
borderRadius : "0" ,
borderLeft : "1px solid #2d2d2d" ,
borderRight : "1px solid #2d2d2d"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "save" ) ;
}
} , "Save" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "button" , {
style : {
borderRadius : "0 3px 3px 0" ,
borderLeft : "1px solid #3f4146"
} ,
className : "btn btn-primary" ,
onClick : ( ) => {
self . onClick ( "attach" ) ;
}
} , "Attach" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . react . createElement ( "span" , {
style : {
fontSize : "10px" ,
marginLeft : "5px"
}
} , "Unsaved changes are lost on attach" ) ) ) ) ) ;
}
onChange ( id , checked ) {
switch ( id ) {
case "live-update" :
_0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ "bda-css-0" ] = checked ;
_modules _settingsPanel _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . saveSettings ( ) ;
break ;
}
}
onClick ( id ) {
const self = this ;
switch ( id ) {
case "attach" :
if ( _modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . query ( "#editor-detached" ) ) self . props . attach ( ) ;
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] . reactDom . unmountComponentAtNode ( self . root ) ;
self . root . remove ( ) ;
break ;
case "update" :
self . updateCss ( ) ;
break ;
case "save" :
self . saveCss ( ) ;
break ;
}
}
updateCss ( ) {
_modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . removeStyle ( "customcss" ) ;
_modules _domtools _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] . addStyle ( "customcss" , this . editor . session . getValue ( ) ) ;
}
saveCss ( ) {
2020-08-04 13:43:22 +02:00
_modules _dataStore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . setBDData ( "bdcustomcss" , Buffer . from ( this . editor . session . getValue ( ) , "utf-8" ) . toString ( "base64" ) ) ;
2020-07-28 03:29:41 +02:00
}
}
/***/ } ) ,
/***/ "./src/ui/errorBoundary.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / errorBoundary . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return BDErrorBoundary ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
class BDErrorBoundary extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
this . state = {
hasError : false
} ;
}
componentDidCatch ( ) {
this . setState ( {
hasError : true
} ) ;
}
render ( ) {
if ( this . state . hasError ) return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "react-error"
} , "Component Error" ) ;
return this . props . children ;
}
}
const originalRender = BDErrorBoundary . prototype . render ;
Object . defineProperty ( BDErrorBoundary . prototype , "render" , {
enumerable : false ,
configurable : false ,
set : function ( ) {
console . warn ( "Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins" ) ;
} ,
get : ( ) => originalRender
} ) ;
/***/ } ) ,
/***/ "./src/ui/icons/delete.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / icons / delete . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return Delete ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
class Delete extends React . Component {
render ( ) {
const size = this . props . size || "24px" ;
return /*#__PURE__*/ React . createElement ( "svg" , {
className : this . props . className || "" ,
fill : "var(--text-normal)" ,
viewBox : "0 0 24 24" ,
style : {
width : size ,
height : size
} ,
onClick : this . props . onClick
} , /*#__PURE__*/ React . createElement ( "path" , {
fill : "none" ,
d : "M0 0h24v24H0V0z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
fill : "none" ,
d : "M0 0h24v24H0z"
} ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/icons/downarrow.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / icons / downarrow . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return DownArrow ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
class DownArrow extends React . Component {
render ( ) {
const size = this . props . size || "16px" ;
return /*#__PURE__*/ React . createElement ( "svg" , {
className : this . props . className || "" ,
fill : "var(--text-normal)" ,
viewBox : "0 0 24 24" ,
style : {
width : size ,
height : size
}
} , /*#__PURE__*/ React . createElement ( "path" , {
d : "M8.12 9.29L12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7c-.39-.39-.39-1.02 0-1.41.39-.38 1.03-.39 1.42 0z"
} ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/icons/edit.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / icons / edit . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return Edit ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
class Edit extends React . Component {
render ( ) {
const size = this . props . size || "24px" ;
return /*#__PURE__*/ React . createElement ( "svg" , {
className : this . props . className || "" ,
viewBox : "0 0 24 24" ,
fill : "var(--text-normal)" ,
style : {
width : size ,
height : size
} ,
onClick : this . props . onClick
} , /*#__PURE__*/ React . createElement ( "path" , {
d : "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M0 0h24v24H0z" ,
fill : "none"
} ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/icons/history.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / icons / history . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return History ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
{
2020-09-05 22:50:45 +02:00
/* <svg xmlns="http:/ / www . w3 . org / 2000 / svg " viewBox=" 0 0 24 24 " fill=" white " width=" 18 px " height=" 18 px " >
< path d = "M0 0h24v24H0z" fill = "none" / >
< path d = "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z" / >
2020-07-28 03:29:41 +02:00
< /svg> */
}
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
class History extends React . Component {
render ( ) {
const size = this . props . size || "18px" ;
return /*#__PURE__*/ React . createElement ( "svg" , {
viewBox : "0 0 24 24" ,
fill : "var(--text-normal)" ,
className : this . props . className || "" ,
style : {
width : size ,
height : size
} ,
onClick : this . props . onClick
} , /*#__PURE__*/ React . createElement ( "path" , {
d : "M0 0h24v24H0z" ,
fill : "none"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"
} ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/icons/search.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / icons / search . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return Search ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
class Search extends React . Component {
render ( ) {
const size = this . props . size || "16px" ;
return /*#__PURE__*/ React . createElement ( "svg" , {
className : this . props . className || "" ,
fill : "var(--text-normal)" ,
viewBox : "0 0 24 24" ,
style : {
width : size ,
height : size
}
} , /*#__PURE__*/ React . createElement ( "path" , {
fill : "none" ,
d : "M0 0h24v24H0V0z"
} ) , /*#__PURE__*/ React . createElement ( "path" , {
d : "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
} ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/margintop.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / margintop . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return MarginTop ; } ) ;
let marginModule = BDModules . get ( e => e . marginTop60 ) [ 0 ] ;
class MarginTop extends React . Component {
render ( ) {
if ( ! marginModule ) marginModule = BDModules . get ( e => e . marginTop60 ) [ 0 ] ;
return /*#__PURE__*/ React . createElement ( "div" , {
className : marginModule . marginTop60
} ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/presenceSettings.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / presenceSettings . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _PresenceSettings ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _settingsTitle _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./settingsTitle */ "./src/ui/settingsTitle.js" ) ;
2020-08-14 21:58:19 +02:00
/* harmony import */ var _settingsGroup _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./settingsGroup */ "./src/ui/settingsGroup.jsx" ) ;
2020-07-28 03:29:41 +02:00
/* harmony import */ var _modules _dataStore _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../modules/dataStore */ "./src/modules/dataStore.js" ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _modules _CustomRichPresence _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ../modules/CustomRichPresence */ "./src/modules/CustomRichPresence.js" ) ;
2020-07-28 18:55:37 +02:00
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! electron */ "electron" ) ;
/* harmony import */ var electron _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( electron _ _WEBPACK _IMPORTED _MODULE _6 _ _ ) ;
/* harmony import */ var _margintop _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./margintop */ "./src/ui/margintop.jsx" ) ;
/* harmony import */ var _modules _utils _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ../modules/utils */ "./src/modules/utils.js" ) ;
2020-07-28 03:29:41 +02:00
const React = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React ;
let V2C _PresenceSettingsModules ;
class V2C _PresenceSettings extends React . Component {
constructor ( props ) {
super ( props ) ;
this . state = {
data : _modules _dataStore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . getSettingGroup ( "rpc" ) || _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "defaultRPC" ] ,
assets : [ ]
} ;
this . preview = null ;
this . isfetching = false ;
if ( this . state . data . application _id ) {
this . fetchAssets ( ) ;
}
this . assetComponents = new Set ( ) ;
}
updateWhenFetched ( comp ) {
this . assetComponents . add ( comp ) ;
}
2020-09-05 22:50:45 +02:00
/ * *
*
* @ param { InputText } setting
2020-07-28 03:29:41 +02:00
* /
onChange ( setting , value ) {
let defaultSetting = RPCProps . find ( e => e . id === setting . props . id ) ;
this . setState ( {
data : Object . assign ( _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "settingsRPC" ] , this . state . data , {
[ defaultSetting . id ] : ! ! value ? value : null
} ) ,
assets : this . state . assets
} ) ;
if ( setting . props . id === "application_id" ) {
this . fetchAssets ( ) ;
}
_modules _dataStore _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] . setSettingGroup ( "rpc" , _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "settingsRPC" ] ) ;
this . preview . forceUpdate ( ) ;
_modules _CustomRichPresence _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . set ( _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "settingsRPC" ] ) ;
}
fetchAssets ( ) {
if ( this . isfetching === true ) {
let app = this . state . data . application _id ;
setTimeout ( ( ) => {
if ( this . state . data . application _id !== app ) {
return ;
}
this . fetchAssets ( ) ;
} , 5000 ) ;
}
if ( ! this . state . data . application _id ) {
this . setState ( {
data : this . state . data ,
assets : [ ]
} ) ;
this . forceUpdate ( ) ;
this . assetComponents . forEach ( e => e . forceUpdate ( ) ) ;
return ;
}
this . isfetching = true ;
_modules _CustomRichPresence _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "default" ] . fetchAssets ( this . state . data . application _id ) . then ( assets => {
this . isfetching = false ;
this . setState ( {
data : this . state . data ,
assets : Object . keys ( assets ) . map ( k => {
let asset = assets [ k ] ;
return {
id : asset . id ,
name : asset . name ,
type : asset . type
} ;
} )
} ) ;
this . forceUpdate ( ) ;
this . assetComponents . forEach ( e => e . forceUpdate ( ) ) ;
} ) . catch ( ( ) => {
this . isfetching = false ;
this . setState ( {
data : this . state . data ,
assets : [ ]
} ) ;
this . forceUpdate ( ) ;
this . assetComponents . forEach ( e => e . forceUpdate ( ) ) ;
} ) ;
}
updatePreview ( data ) {
this . setState ( {
data
} ) ;
}
get modules ( ) {
return V2C _PresenceSettingsModules || ( V2C _PresenceSettingsModules = [ BDModules . get ( e => e . marginBottom20 ) [ 0 ] ] ) ;
}
render ( ) {
let [ marginModule ] = this . modules ;
return [ /*#__PURE__*/ React . createElement ( _settingsGroup _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
title : "RichPresence Settings" ,
settings : this . props . settings ,
onChange : this . props . onChange
2020-07-28 18:55:37 +02:00
} ) , /*#__PURE__*/ React . createElement ( _margintop _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] , null ) , /*#__PURE__*/ React . createElement ( _settingsTitle _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
text : "RichPresence"
2020-07-28 18:55:37 +02:00
} ) , /*#__PURE__*/ React . createElement ( "div" , null , this . optionsComponents ) , /*#__PURE__*/ React . createElement ( "div" , null , /*#__PURE__*/ React . createElement ( _margintop _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "default" ] , null ) , /*#__PURE__*/ React . createElement ( _settingsTitle _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
text : "Preview"
} ) , /*#__PURE__*/ React . createElement ( RpcPreview , {
settings : this
} ) ) , /*#__PURE__*/ React . createElement ( "div" , {
className : marginModule . marginBottom20
} ) , /*#__PURE__*/ React . createElement ( "button" , {
style : {
opacity : 0.01
} ,
onClick : window . ohgodohfuck
} , "Oh god Oh fuck" ) , /*#__PURE__*/ React . createElement ( "button" , {
style : {
opacity : 0.01
} ,
onClick : ( ) => {
2020-07-28 18:55:37 +02:00
electron _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "remote" ] . shell . openExternal ( "https://www.youtube.com/watch?v=LkYa7rps_g4" ) ;
2020-07-28 03:29:41 +02:00
}
} , "See ? I pulled a litle sneaky on ya" ) ] ;
}
get optionsComponents ( ) {
return this . _optionsComponents || ( this . _optionsComponents = RPCProps . map ( e => {
if ( e . type === "text" ) {
return /*#__PURE__*/ React . createElement ( InputText , {
setting : e ,
manager : this ,
id : e . id
} ) ;
} else if ( e . type === "number" ) {
let array = [ /*#__PURE__*/ React . createElement ( InputNumber , {
setting : e ,
manager : this ,
id : e . id
} ) ] ;
2020-09-05 22:50:45 +02:00
/ *
if ( e . id === "timestamps.start" ) {
array . unshift ( < DiscordButton title = "Copy Current Timestamp" onClick = { ( ) => {
DiscordNative . clipboard . copy ( Date . now ( ) + "" )
} } / > )
2020-07-28 03:29:41 +02:00
} * /
2020-10-14 00:50:42 +02:00
return array [ 0 ] ;
2020-07-28 03:29:41 +02:00
} else if ( e . type === "choice" ) {
if ( [ "assets.small" , "assets.large" ] . includes ( e . id ) ) {
return /*#__PURE__*/ React . createElement ( InputChoice , {
setting : e ,
manager : this ,
id : e . id ,
choices : [ {
value : "none" ,
label : "No assets"
} ] . concat ( this . state . assets . map ( e => {
return {
value : "asset-" + e . id ,
label : e . name
} ;
} ) )
} ) ;
} else {
return "Unknown choice." ;
}
}
} ) ) ;
}
}
const RPCProps = [ {
title : "Application ID" ,
id : "application_id" ,
type : "number" ,
placeholder : "711416957718757418"
} , {
title : "Name" ,
id : "name" ,
type : "text" ,
placeholder : "Lightcord"
} , {
title : "Details" ,
id : "details" ,
type : "text" ,
placeholder : "Browsing Discord"
} , {
title : "State" ,
id : "state" ,
type : "text" ,
placeholder : "Lightcord Client"
} , {
title : "Timestamp Start" ,
id : "timestamps.start" ,
type : "number" ,
get placeholder ( ) {
return Date . now ( ) ;
}
} , {
title : "LargeAsset" ,
id : "assets.large" ,
type : "choice"
} , {
title : "SmallAsset" ,
id : "assets.small" ,
type : "choice"
} ] ;
let inputTextModules ;
class InputText extends React . PureComponent {
get modules ( ) {
if ( inputTextModules && inputTextModules [ 0 ] ) return inputTextModules ;
return inputTextModules = [ BDModules . get ( e => e . removeKeybind ) [ 0 ] , BDModules . get ( e => e . marginBottom20 ) [ 0 ] , BDModules . get ( e => e . defaultMarginh5 ) [ 0 ] , BDModules . get ( e => e . colorStandard ) [ 0 ] , BDModules . get ( e => e . size32 ) [ 0 ] , BDModules . get ( e => e . _horizontal ) [ 0 ] , BDModules . get ( e => e . inputMini ) [ 0 ] , BDModules . get ( e => e . size16 && e . size20 ) [ 0 ] ] ;
}
constructor ( props ) {
super ( props ) ;
let setting = this . props . setting ;
this . state = {
data : this . props . manager . state . data [ setting . id ]
} ;
this . input = /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . inputs . TextInput , {
placeholder : setting . placeholder ,
name : setting . id ,
value : this . state . data ,
onChange : value => {
this . setState ( {
data : value
} ) ;
if ( ! this . lastEdited || this . lastEdited < Date . now ( ) - 500 ) {
this . props . manager . onChange ( this , value ) ;
this . lastEdited = Date . now ( ) ;
} else if ( ! this . isTiming ) {
this . isTiming = setTimeout ( ( ) => {
this . props . manager . onChange ( this , this . state . data ) ;
this . isTiming = null ;
this . lastEdited = Date . now ( ) ;
} , 500 ) ;
}
} ,
type : "text"
} ) ;
}
render ( ) {
let setting = this . props . setting ;
let [ rowModule , marginModule , marginModule2 , colorModule , sizeModule , flexModule , inputModule , sizeModule2 ] = this . modules ;
return /*#__PURE__*/ React . createElement ( "div" , {
className : rowModule . row + " " + marginModule . marginBottom20
} , /*#__PURE__*/ React . createElement ( "div" , {
className : ` ${ rowModule . item } ${ flexModule . flexChild } `
} , /*#__PURE__*/ React . createElement ( "h5" , {
className : colorModule . colorStandard + " " + sizeModule . size14 + " " + marginModule2 . h5 + " " + marginModule2 . defaultMarginh5
} , setting . title ) , this . input ) , /*#__PURE__*/ React . createElement ( Divider , null ) ) ;
}
}
let InputNumberModules ;
class InputNumber extends React . PureComponent {
get modules ( ) {
return InputNumberModules || ( InputNumberModules = [ BDModules . get ( e => e . removeKeybind ) [ 0 ] , BDModules . get ( e => e . marginBottom20 ) [ 0 ] , BDModules . get ( e => e . defaultMarginh5 ) [ 0 ] , BDModules . get ( e => e . colorStandard ) [ 0 ] , BDModules . get ( e => e . size32 ) [ 0 ] , BDModules . get ( e => e . _horizontal ) [ 0 ] , BDModules . get ( e => e . inputMini ) [ 0 ] , BDModules . get ( e => e . size16 && e . size20 ) [ 0 ] , BDModules . get ( e => e . colorTransparent ) [ 0 ] ] ) ;
}
constructor ( props ) {
super ( props ) ;
let setting = this . props . setting ;
this . state = {
data : this . props . manager . state . data [ setting . id ]
} ;
this . input = /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . inputs . TextInput , {
placeholder : setting . placeholder ,
name : setting . id ,
value : this . state . data ,
type : "number" ,
onChange : ( value , name , input ) => {
value = value . replace ( /[^\d]+/g , "" ) ;
if ( value == this . state . data ) {
input . setValue ( value ) ;
return ;
}
if ( ! this . lastEdited || this . lastEdited < Date . now ( ) - 500 ) {
this . props . manager . onChange ( this , value ) ;
this . lastEdited = Date . now ( ) ;
} else if ( ! this . isTiming ) {
this . isTiming = setTimeout ( ( ) => {
this . props . manager . onChange ( this , this . state . data ) ;
this . isTiming = null ;
this . lastEdited = Date . now ( ) ;
} , 500 ) ;
}
this . setState ( {
data : value
} ) ;
} ,
type : "text"
} ) ;
}
render ( ) {
let setting = this . props . setting ;
let [ rowModule , marginModule , marginModule2 , colorModule , sizeModule , flexModule ] = this . modules ;
return /*#__PURE__*/ React . createElement ( "div" , {
className : rowModule . row + " " + marginModule . marginBottom20
} , /*#__PURE__*/ React . createElement ( "div" , {
className : ` ${ rowModule . item } ${ flexModule . flexChild } `
} , /*#__PURE__*/ React . createElement ( "h5" , {
className : colorModule . colorStandard + " " + sizeModule . size14 + " " + marginModule2 . h5 + " " + marginModule2 . defaultMarginh5
} , setting . title ) , this . input , setting . id === "timestamps.start" ? /*#__PURE__*/ React . createElement ( Lightcord . Api . Components . inputs . Button , {
onClick : ( ) => {
DiscordNative . clipboard . copy ( Date . now ( ) + "" ) ;
} ,
color : "brand"
} , "Copy current timestamp" ) : null ) , /*#__PURE__*/ React . createElement ( Divider , null ) ) ;
}
}
let InputChoiceModules ;
class InputChoice extends React . PureComponent {
constructor ( props ) {
super ( props ) ;
let setting = this . props . setting ;
this . state = {
data : this . props . manager . state . data [ setting . id ] ? "asset-" + this . props . manager . state . data [ setting . id ] : "none"
} ;
this . props . manager . updateWhenFetched ( this ) ;
}
2020-09-06 12:50:52 +02:00
onChange ( value ) {
2020-07-28 03:29:41 +02:00
if ( ! this . lastEdited || this . lastEdited < Date . now ( ) - 500 ) {
this . props . manager . onChange ( this , value === "none" ? null : value . replace ( "asset-" , "" ) ) ;
this . lastEdited = Date . now ( ) ;
} else if ( ! this . isTiming ) {
this . isTiming = setTimeout ( ( ) => {
this . props . manager . onChange ( this , this . state . data === "none" ? null : this . state . data . replace ( "asset-" , "" ) ) ;
this . isTiming = null ;
this . lastEdited = Date . now ( ) ;
} , 500 ) ;
}
this . setState ( {
data : value
} ) ;
this . forceUpdate ( ) ;
}
get modules ( ) {
return InputChoiceModules || ( InputChoiceModules = [ BDModules . get ( e => e . removeKeybind ) [ 0 ] , BDModules . get ( e => e . marginBottom20 ) [ 0 ] , BDModules . get ( e => e . defaultMarginh5 ) [ 0 ] , BDModules . get ( e => e . colorStandard ) [ 0 ] , BDModules . get ( e => e . size32 ) [ 0 ] , BDModules . get ( e => e . _horizontal ) [ 0 ] ] ) ;
}
render ( ) {
let setting = this . props . setting ;
let [ rowModule , marginModule , marginModule2 , colorModule , sizeModule , flexModule ] = this . modules ;
let options = this . props . manager . state . assets . map ( e => {
return {
value : "asset-" + e . id ,
label : e . name
} ;
} ) ;
options . unshift ( {
value : "none" ,
label : "No assets"
} ) ;
return /*#__PURE__*/ React . createElement ( "div" , {
className : rowModule . row + " " + marginModule . marginBottom20
} , /*#__PURE__*/ React . createElement ( "div" , {
className : ` ${ rowModule . item } ${ flexModule . flexChild } `
} , /*#__PURE__*/ React . createElement ( "h5" , {
className : colorModule . colorStandard + " " + sizeModule . size14 + " " + marginModule2 . h5 + " " + marginModule2 . defaultMarginh5
} , setting . title ) , /*#__PURE__*/ React . createElement ( window . Lightcord . Api . Components . inputs . Dropdown , {
value : this . state . data ,
options : options ,
onChange : this . onChange . bind ( this )
} ) ) , /*#__PURE__*/ React . createElement ( Divider , null ) ) ;
}
}
let DividerModules = [ ] ;
class Divider extends React . PureComponent {
get modules ( ) {
return DividerModules && DividerModules [ 0 ] ? DividerModules : DividerModules = [ BDModules . get ( e => e . divider && Object . keys ( e ) . length === 1 ) [ 0 ] , BDModules . get ( e => e . dividerDefault ) [ 0 ] ] ;
}
render ( ) {
let [ divider , dividerDefault ] = this . modules ;
return /*#__PURE__*/ React . createElement ( "div" , {
class : ` ${ divider . divider } ${ dividerDefault . dividerDefault } `
} ) ;
}
}
class DiscordButton extends React . Component {
render ( ) {
let rowModule = BDModules . get ( e => e . removeKeybind ) [ 0 ] ;
let marginModule = BDModules . get ( e => e . marginBottom20 ) [ 0 ] ;
let flexModule = BDModules . get ( e => e . _horizontal ) [ 0 ] ;
return /*#__PURE__*/ React . createElement ( "div" , {
className : rowModule . row + " " + marginModule . marginBottom20
} , /*#__PURE__*/ React . createElement ( "div" , {
className : ` ${ rowModule . item } ${ flexModule . flexChild } `
} , /*#__PURE__*/ React . createElement ( Lightcord . Api . Components . inputs . Button , {
onClick : this . props . onClick ,
color : "brand"
} , this . props . title ) ) ) ;
}
}
class RpcPreview extends React . Component {
constructor ( props = { } ) {
super ( props ) ;
this . state = {
active : "profile"
} ;
this . tabs = [ ] ;
this . props . settings . preview = this ;
}
changeTab ( tab ) {
let ancientTab = this . state . active ;
if ( ancientTab === tab . props . id ) return ;
this . tabs . forEach ( e => {
e . setActive ( false ) ;
} ) ;
tab . setActive ( true ) ;
this . setState ( {
active : tab . props . id
} ) ;
}
render ( ) {
return /*#__PURE__*/ React . createElement ( "div" , {
className : "lc-tabWrapper"
} , /*#__PURE__*/ React . createElement ( "div" , {
className : "lc-tabnav" ,
style : {
flex : "0 1 auto"
}
} , /*#__PURE__*/ React . createElement ( Tab , {
preview : this ,
title : "Full Profile" ,
id : "profile"
} ) , /*#__PURE__*/ React . createElement ( Tab , {
preview : this ,
title : "User Popout" ,
id : "popout"
} ) ) , /*#__PURE__*/ React . createElement ( PresenceErrorCatcher , {
preview : this . preview ,
state : this . state . rpc ,
props : {
preview : this
} ,
key : this . state . active
} ) ) ;
}
isActive ( tab ) {
return this . state . active === tab ;
}
get preview ( ) {
if ( this . state . active === "profile" ) return Profile ;
return Popout ;
}
}
class Tab extends React . Component {
constructor ( props ) {
super ( props ) ;
this . state = {
active : props . preview . isActive ( props . id )
} ;
props . preview . tabs . push ( this ) ;
}
setActive ( isActive ) {
this . setState ( {
active : ! ! isActive
} ) ;
}
render ( ) {
let className = ` lc-navItem ` ;
if ( this . state . active ) {
className += ` lc-navItemActive ` ;
} else {
className += ` lc-navItemInactive ` ;
}
return /*#__PURE__*/ React . createElement ( "div" , {
className : className ,
onClick : ( ) => {
this . props . preview . changeTab ( this ) ;
}
} , this . props . title ) ;
}
}
let emptyClasses ;
class PresenceErrorCatcher extends React . Component {
componentDidCatch ( err , errInfo ) {
console . error ( err , errInfo ) ;
this . setState ( {
error : true
} ) ;
}
render ( ) {
if ( ! this . state ) {
this . state = {
error : false
} ;
}
if ( ! this . state . error ) {
try {
const preview = new this . props . preview ( this . props . props ) ;
preview . setState ( this . props . state ) ;
return preview . render ( ) ;
} catch ( err ) {
console . error ( err ) ;
this . state . error = true ;
return this . render ( ) ;
}
} else {
emptyClasses = emptyClasses || _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . find ( e => e . emptyStateImage && e . emptyState ) ;
if ( ! emptyClasses ) {
2020-07-28 18:55:37 +02:00
_modules _utils _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "default" ] . showToast ( "An error occured. Please check the console for more informations." ) ;
2020-07-28 03:29:41 +02:00
return null ;
}
return /*#__PURE__*/ React . createElement ( "div" , {
style : {
margin : "20px"
}
} , /*#__PURE__*/ React . createElement ( "div" , {
style : {
backgroundColor : "var(--background-primary)" ,
padding : "30px 30px" ,
borderRadius : "8px"
} ,
className : ` lc-tab-box-shadow ${ emptyClasses . emptyState } `
} , /*#__PURE__*/ React . createElement ( "div" , {
className : emptyClasses . emptyStateImage ,
style : {
marginTop : "20px"
}
} ) , /*#__PURE__*/ React . createElement ( "div" , {
className : emptyClasses . emptyStateHeader
} , "An error occured" ) , /*#__PURE__*/ React . createElement ( "p" , {
className : emptyClasses . emptyStateSubtext
} , "Please check the console for more informations. Join our \xAD" , /*#__PURE__*/ React . createElement ( "a" , {
className : ` ${ _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . anchorClasses . anchor } ${ _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . anchorClasses . anchorUnderlineOnHover } ` ,
role : "button" ,
tabindex : 0 ,
onClick : ( ) => {
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . joinLC ( ) ;
}
} , "support server" ) , "\xAD for help." ) ) ) ;
}
}
}
let popoutModules ;
let UserPopoutComponent ;
let PopoutProps ;
class Popout extends React . Component {
get modules ( ) {
2020-08-10 13:44:02 +02:00
return popoutModules || ( popoutModules = [ _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . find ( e => e . default && e . default . displayName === "UserPopout" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . find ( e => e . default && e . default . getCurrentUser ) ] ) ;
2020-07-28 03:29:41 +02:00
}
2020-08-10 13:44:02 +02:00
getComponent ( ) {
2020-07-28 03:29:41 +02:00
let [ UserPopout , userModule ] = this . modules ;
const user = userModule . default . getCurrentUser ( ) ;
2020-08-10 13:44:02 +02:00
return React . createElement ( ( ) => {
let render1 = UserPopout . default ( {
2020-07-28 03:29:41 +02:00
userId : user . id ,
guildId : null ,
channelId : null ,
disableUserProfileLink : true
2020-08-10 13:44:02 +02:00
} ) ;
UserPopoutComponent = render1 . type ;
2020-07-28 03:29:41 +02:00
PopoutProps = render1 . props ;
2020-08-10 13:44:02 +02:00
return this . render ( ) ;
} , null ) ;
}
2020-07-28 03:29:41 +02:00
2020-08-10 13:44:02 +02:00
render ( ) {
if ( ! UserPopoutComponent ) return this . getComponent ( ) ;
let [ _UserPopout , userModule ] = this . modules ;
const user = userModule . default . getCurrentUser ( ) ;
2020-07-28 03:29:41 +02:00
let data = Object . assign ( { } , _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "defaultRPC" ] , this . props . preview . props . settings . state . data ) ;
const activity = function ( ) {
if ( ! this . game ) return null ;
let game = {
name : this . game . name || _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "defaultRPC" ] . name ,
application _id : this . game . application _id || _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "defaultRPC" ] . application _id ,
details : this . game . details || undefined ,
state : this . game . state || undefined ,
timestamps : this . game [ "timestamps.start" ] ? {
start : this . game [ "timestamps.start" ]
} : undefined ,
assets : this . game [ "assets.large" ] ? {
large _image : this . game [ "assets.large" ] ,
small _image : this . game [ "assets.small" ] || undefined
} : undefined ,
type : 0
} ;
return game ;
} . call ( {
game : data
} ) ;
const popout = new UserPopoutComponent ( Object . assign ( { } , PopoutProps , {
2020-08-10 13:44:02 +02:00
activity : activity ,
userId : user . id
2020-07-28 03:29:41 +02:00
} ) ) . render ( ) . props . children ; // bypass tracking
// remove the stop propagation shit.
const container = /*#__PURE__*/ React . createElement ( "div" , window . Lightcord . Api . _ . excludeProperties ( popout . props , [ "onClick" , "onContextMenu" ] ) ) ;
return /*#__PURE__*/ React . createElement ( "div" , {
className : "lc-userPopout lc-tab-box-shadow"
} , container ) ;
}
}
let profileModules ;
let UserProfileComponent ;
let ProfileProps ;
let connectedProfileStore ;
class Profile extends React . Component {
get modules ( ) {
return profileModules || ( profileModules = [ _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . find ( e => e . default && e . default . displayName === "UserProfile" ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . find ( e => e . default && e . default . getCurrentUser ) ] ) ;
}
render ( ) {
let [ UserProfile , userModule ] = this . modules ;
const user = userModule . default . getCurrentUser ( ) ;
if ( ! UserProfileComponent ) {
const render1 = new UserProfile . default ( {
user : user
} ) . render ( ) ;
connectedProfileStore = render1 . type ;
const render2 = new render1 . type ( render1 . props ) . render ( ) ;
const render3 = render2 . type . render ( render2 . props , null ) ;
const render4 = new render3 . type ( render3 . props ) . render ( ) ;
UserProfileComponent = render4 . type ;
}
if ( ! UserProfileComponent ) throw new Error ( ` Couldn't find the UserProfileComponent component. ` ) ;
let data = Object . assign ( { } , _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "defaultRPC" ] , this . props . preview . props . settings . state . data ) ;
const activity = function ( ) {
if ( ! this . game ) return null ;
let game = {
name : this . game . name || _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "defaultRPC" ] . name ,
application _id : this . game . application _id || _0globals _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "defaultRPC" ] . application _id ,
details : this . game . details || undefined ,
state : this . game . state || undefined ,
timestamps : this . game [ "timestamps.start" ] ? {
start : this . game [ "timestamps.start" ]
} : undefined ,
assets : this . game [ "assets.large" ] ? {
large _image : this . game [ "assets.large" ] ,
small _image : this . game [ "assets.small" ] || undefined
} : undefined ,
type : 0
} ;
return game ;
} . call ( {
game : data
} ) ;
ProfileProps = new connectedProfileStore ( {
user : user ,
close : ( ) => { }
} ) . render ( ) . props ;
const profile = new UserProfileComponent ( Object . assign ( { } , ProfileProps , {
activity : activity
} ) ) . render ( ) . props . children ; // bypass tracking
profile . props . style = {
width : "auto"
} ;
return /*#__PURE__*/ React . createElement ( "div" , {
className : "lc-tab lc-tab-box-shadow"
} , profile ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/publicservers/publicServers.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / publicservers / publicServers . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _PublicServers ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
2020-09-05 12:14:21 +02:00
/* harmony import */ var _settingsTitle _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../settingsTitle */ "./src/ui/settingsTitle.js" ) ;
/* harmony import */ var _tabBarSeparator _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../tabBarSeparator */ "./src/ui/tabBarSeparator.js" ) ;
/* harmony import */ var _serverCard _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./serverCard */ "./src/ui/publicservers/serverCard.js" ) ;
/* harmony import */ var _modules _hooks _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ../../modules/hooks */ "./src/modules/hooks.js" ) ;
2020-07-28 03:29:41 +02:00
2020-09-05 12:14:21 +02:00
let SettingsView ;
2020-07-28 03:29:41 +02:00
class V2C _PublicServers extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
this . setInitialState ( ) ;
this . close = this . close . bind ( this ) ;
this . changeCategory = this . changeCategory . bind ( this ) ;
this . search = this . search . bind ( this ) ;
this . searchKeyDown = this . searchKeyDown . bind ( this ) ;
this . checkConnection = this . checkConnection . bind ( this ) ;
this . join = this . join . bind ( this ) ;
this . connect = this . connect . bind ( this ) ;
this . GuildStore = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . findByUniqueProperties ( [ "getGuilds" ] ) ;
this . AvatarDefaults = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . findByUniqueProperties ( [ "getUserAvatarURL" , "DEFAULT_AVATARS" ] ) ;
this . InviteActions = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . findByUniqueProperties ( [ "acceptInvite" ] ) ;
this . SortedGuildStore = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . findByUniqueProperties ( [ "getSortedGuilds" ] ) ;
2020-09-05 12:14:21 +02:00
this . hooks = [ ] ;
2020-07-28 03:29:41 +02:00
}
componentDidMount ( ) {
this . checkConnection ( ) ;
}
setInitialState ( ) {
this . state = {
selectedCategory : - 1 ,
title : "Loading..." ,
loading : true ,
servers : [ ] ,
next : null ,
connection : {
state : 0 ,
user : null
2020-09-05 12:14:21 +02:00
} ,
section : this . categorySlugs [ 0 ] ,
theme : "dark"
2020-07-28 03:29:41 +02:00
} ;
}
close ( ) {
2020-08-12 01:28:21 +02:00
this . props . close ( ) ;
2020-07-28 03:29:41 +02:00
}
search ( query , clear ) {
const self = this ;
2020-09-05 12:14:21 +02:00
fetch ( ` ${ self . searchEndPoint } ${ query } ${ query ? "&schema=new" : "?schema=new" } ` , {
2020-07-28 03:29:41 +02:00
method : "get"
} ) . then ( async res => {
if ( res . status !== 200 ) throw await res . text ( ) ;
let data = await res . json ( ) ;
let servers = data . results . reduce ( ( arr , server ) => {
server . joined = false ;
arr . push ( server ) ; // arr.push(<ServerCard server={server} join={self.join}/>);
return arr ;
} , [ ] ) ;
if ( ! clear ) {
servers = self . state . servers . concat ( servers ) ;
} else { //servers.unshift(self.bdServer);
}
let end = data . size + data . from ;
data . next = ` ?from= ${ end } ` ;
if ( self . state . term ) data . next += ` &term= ${ self . state . term } ` ;
if ( self . state . selectedCategory ) data . next += ` &category= ${ self . categoryButtons [ self . state . selectedCategory ] } ` ;
if ( end >= data . total ) {
end = data . total ;
data . next = null ;
}
let title = ` Showing 1- ${ end } of ${ data . total } results in ${ self . categoryButtons [ self . state . selectedCategory ] } ` ;
if ( self . state . term ) title += ` for ${ self . state . term } ` ;
self . setState ( {
loading : false ,
title : title ,
servers : servers ,
next : data . next
} ) ;
} ) . catch ( err => {
console . error ( err ) ;
return self . setState ( {
loading : false ,
title : "Failed to load servers. Check console for details"
} ) ;
} ) ;
}
async join ( serverCard ) {
if ( serverCard . props . pinned ) return this . InviteActions . acceptInvite ( serverCard . props . invite _code ) ;
await fetch ( ` ${ this . joinEndPoint } / ${ serverCard . props . server . identifier } ` , {
method : "GET" ,
credentials : "include" ,
mode : "cors" ,
headers : {
"Accept" : "application/json" ,
"Content-Type" : "application/json"
}
} ) ;
serverCard . setState ( {
joined : true
} ) ;
}
connect ( ) {
const self = this ;
const options = self . windowOptions ;
options . x = Math . round ( window . screenX + window . innerWidth / 2 - options . width / 2 ) ;
options . y = Math . round ( window . screenY + window . innerHeight / 2 - options . height / 2 ) ;
2020-09-12 14:52:50 +02:00
const win = self . joinWindow = new ( _ _webpack _require _ _ ( /*! electron */ "electron" ) . remote . BrowserWindow ) ( options ) ;
2020-07-28 03:29:41 +02:00
const url = "https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=https://auth.discordservers.com/info" ;
2020-09-05 12:14:21 +02:00
win . webContents . on ( "did-navigate" , ( event , url ) => {
2020-07-28 03:29:41 +02:00
if ( url != "https://auth.discordservers.com/info" ) return ;
2020-09-05 12:14:21 +02:00
win . close ( ) ;
2020-07-28 03:29:41 +02:00
self . checkConnection ( ) ;
} ) ;
2020-09-05 12:14:21 +02:00
win . loadURL ( url ) ;
win . setMenuBarVisibility ( false ) ;
2020-07-28 03:29:41 +02:00
}
get windowOptions ( ) {
return {
width : 500 ,
height : 550 ,
backgroundColor : "#282b30" ,
show : true ,
resizable : false ,
maximizable : false ,
minimizable : false ,
alwaysOnTop : true ,
2020-09-05 12:14:21 +02:00
frame : true ,
2020-07-28 03:29:41 +02:00
center : false ,
webPreferences : {
nodeIntegration : false
}
} ;
}
get bdServer ( ) {
const server = {
name : "BetterDiscord" ,
2020-08-12 01:28:21 +02:00
online : "30000+" ,
members : "70000+" ,
2020-07-28 03:29:41 +02:00
categories : [ "community" , "programming" , "support" ] ,
description : "Official BetterDiscord server for support etc" ,
identifier : "86004744966914048" ,
iconUrl : "https://cdn.discordapp.com/icons/86004744966914048/292e7f6bfff2b71dfd13e508a859aedd.webp" ,
nativejoin : true ,
invite _code : "0Tmfo5ZbORCRqbAd" ,
pinned : true
} ;
const server2 = {
name : "Lightcord" ,
2020-08-12 01:28:21 +02:00
online : "100+" ,
members : "300+" ,
2020-07-28 03:29:41 +02:00
categories : [ "community" , "programming" , "support" ] ,
description : "Official Lightcord server for support etc" ,
2020-08-12 01:28:21 +02:00
identifier : "705908350218666117" ,
iconUrl : "https://github.com/lightcord.png" ,
2020-07-28 03:29:41 +02:00
nativejoin : true ,
invite _code : "7eFff2A" ,
pinned : true
} ;
const guildList = this . SortedGuildStore . getFlattenedGuildIds ( ) ;
const defaultList = this . AvatarDefaults . DEFAULT _AVATARS ;
2020-09-05 12:14:21 +02:00
return [ _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( _serverCard _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
server : server2 ,
pinned : true ,
join : this . join ,
guildList : guildList ,
fallback : defaultList [ Math . floor ( Math . random ( ) * 5 ) ]
2020-09-05 12:14:21 +02:00
} ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( _serverCard _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
server : server ,
pinned : true ,
join : this . join ,
guildList : guildList ,
fallback : defaultList [ Math . floor ( Math . random ( ) * 5 ) ]
} ) ] ;
}
2020-09-05 12:14:21 +02:00
get searchEndPoint ( ) {
2020-07-28 03:29:41 +02:00
return "https://search.discordservers.com" ;
}
get joinEndPoint ( ) {
return "https://j.discordservers.com" ;
}
get connectEndPoint ( ) {
return "https://join.discordservers.com/connect" ;
}
async checkConnection ( ) {
const self = this ;
try {
const response = await fetch ( ` https://auth.discordservers.com/info ` , {
method : "GET" ,
credentials : "include" ,
mode : "cors" ,
headers : {
"Accept" : "application/json" ,
"Content-Type" : "application/json"
}
} ) ;
2020-08-12 01:28:21 +02:00
const text = await response . text ( ) ;
if ( ! text ) {
self . setState ( {
title : "Not connected to discordservers.com!" ,
loading : true ,
selectedCategory : - 1 ,
connection : {
state : 1 ,
user : null
}
} ) ;
return ;
}
const data = JSON . parse ( text ) ;
2020-07-28 03:29:41 +02:00
self . setState ( {
selectedCategory : 0 ,
connection : {
state : 2 ,
user : data
}
} ) ;
self . search ( "" , true ) ;
} catch ( error ) {
console . error ( error ) ;
self . setState ( {
title : "Not connected to discordservers.com!" ,
loading : true ,
selectedCategory : - 1 ,
connection : {
state : 1 ,
user : null
}
} ) ;
}
}
render ( ) {
2020-09-05 12:14:21 +02:00
this . hooks . forEach ( e => e ( ) ) ;
SettingsView = SettingsView || _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . WebpackModules . findByDisplayName ( "SettingsView" ) ;
2020-08-12 01:28:21 +02:00
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
id : "pubslayerroot"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
id : "pubslayer"
2020-09-05 12:14:21 +02:00
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( SettingsView , {
onSetSection : section => {
this . changeCategory ( this . categorySlugs . indexOf ( section ) ) ;
2020-07-28 03:29:41 +02:00
} ,
2020-09-05 12:14:21 +02:00
sections : this . sections ,
onClose : this . close ,
section : this . state . section
} ) ) ) ;
2020-07-28 03:29:41 +02:00
}
2020-09-05 12:14:21 +02:00
get sections ( ) {
let sections = [ ] ;
sections . push ( {
section : "HEADER" ,
label : "Public Servers"
} , {
section : "DIVIDER"
} , {
section : "CUSTOM" ,
element : this . searchInput . bind ( null , ( ) => this , this . searchKeyDown )
} , {
section : "DIVIDER"
} , {
section : "HEADER" ,
label : "Categories"
} , ... this . categoryButtons . map ( ( value , index ) => {
return {
section : this . categorySlugs [ index ] ,
label : value ,
element : this . content . bind ( null , ( ) => this )
} ;
} ) , {
section : "DIVIDER"
} , {
section : "CUSTOM" ,
element : this . footer
} , {
section : "CUSTOM" ,
element : this . connection . bind ( null , ( ) => this )
} ) ;
return sections ;
2020-07-28 03:29:41 +02:00
}
2020-09-05 12:14:21 +02:00
searchInput ( getThis , searchKeyDown ) {
const [ value , setValue ] = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . useState ( "" ) ;
2020-07-28 03:29:41 +02:00
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-form-item"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-text-input flex-vertical" ,
style : {
width : "172px" ,
marginLeft : "10px"
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "input" , {
2020-09-05 12:14:21 +02:00
ref : serchinput => getThis ( ) . refs . searchinput = serchinput ,
onKeyDown : searchKeyDown ,
onChange : e => {
setValue ( e . target . value ) ;
} ,
2020-07-28 03:29:41 +02:00
type : "text" ,
className : "input default" ,
placeholder : "Search..." ,
2020-09-05 12:14:21 +02:00
maxLength : "50" ,
value : value
2020-07-28 03:29:41 +02:00
} ) ) ) ;
}
searchKeyDown ( e ) {
const self = this ;
if ( self . state . loading || e . which !== 13 ) return ;
self . setState ( {
loading : true ,
title : "Loading..." ,
term : e . target . value
} ) ;
let query = ` ?term= ${ e . target . value } ` ;
if ( self . state . selectedCategory !== 0 ) {
query += ` &category= ${ self . categoryButtons [ self . state . selectedCategory ] } ` ;
}
self . search ( query , true ) ;
}
2020-09-05 12:14:21 +02:00
get categorySlugs ( ) {
return this . categoryButtons . map ( e => e . toLowerCase ( ) . replace ( /[^\w\d]+/g , "_" ) ) ;
}
2020-07-28 03:29:41 +02:00
get categoryButtons ( ) {
return [ "All" , "FPS Games" , "MMO Games" , "Strategy Games" , "MOBA Games" , "RPG Games" , "Tabletop Games" , "Sandbox Games" , "Simulation Games" , "Music" , "Community" , "Language" , "Programming" , "Other" ] ;
}
changeCategory ( id ) {
const self = this ;
if ( self . state . loading ) return ;
self . setState ( {
loading : true ,
selectedCategory : id ,
title : "Loading..." ,
2020-09-05 12:14:21 +02:00
term : null ,
section : self . categorySlugs [ id ]
2020-07-28 03:29:41 +02:00
} ) ;
if ( id === 0 ) {
self . search ( "" , true ) ;
return ;
}
self . search ( ` ?category= ${ self . categoryButtons [ id ] } ` , true ) ;
}
2020-09-05 12:14:21 +02:00
content ( getThis ) {
const self = getThis ( ) ;
self . useState ( ) ;
const guildList = self . SortedGuildStore . getFlattenedGuildIds ( ) ;
const defaultList = self . AvatarDefaults . DEFAULT _AVATARS ;
if ( self . state . connection . state === 1 ) return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( self . notConnected . bind ( null , getThis ) ) ;
2020-07-28 03:29:41 +02:00
let columnModule = BDModules . get ( e => e . contentColumnDefault ) [ 0 ] ;
return [ _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
2020-09-05 12:14:21 +02:00
ref : ref => {
self . refs . content = ref ;
} ,
2020-07-28 03:29:41 +02:00
key : "pc" ,
className : columnModule . contentColumn + " " + columnModule . contentColumn + " content-column default"
2020-09-05 12:14:21 +02:00
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( _settingsTitle _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
text : self . state . title
} ) , self . bdServer , self . state . servers . map ( server => {
2020-09-05 12:14:21 +02:00
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( _serverCard _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
key : server . identifier ,
server : server ,
join : self . join ,
guildList : guildList ,
fallback : defaultList [ Math . floor ( Math . random ( ) * 5 ) ]
} ) ;
} ) , self . state . next && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "button" , {
type : "button" ,
onClick : ( ) => {
if ( self . state . loading ) return ;
self . setState ( {
loading : true
} ) ;
self . search ( self . state . next , false ) ;
} ,
className : "ui-button filled brand small grow" ,
style : {
width : "100%" ,
marginTop : "10px" ,
marginBottom : "10px"
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-button-contents"
2020-09-05 12:14:21 +02:00
} , self . state . loading ? "Loading" : "Load More" ) ) , self . state . servers . length > 0 && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( _settingsTitle _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
2020-07-28 03:29:41 +02:00
text : self . state . title
} ) ) ] ;
}
2020-09-05 12:14:21 +02:00
notConnected ( getThis ) {
const self = getThis ( ) ; //return BDV2.react.createElement(SettingsTitle, { text: self.state.title });
2020-07-28 03:29:41 +02:00
let columnModule = BDModules . get ( e => e . contentColumnDefault ) [ 0 ] ;
return [ _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
key : "ncc" ,
2020-09-05 12:14:21 +02:00
ref : ref => self . refs . content = ref ,
2020-07-28 03:29:41 +02:00
className : columnModule . contentColumn + " " + columnModule . contentColumn + " content-column default"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "h2" , {
className : "ui-form-title h2 margin-reset margin-bottom-20"
} , "Not connected to discordservers.com!" , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "button" , {
onClick : self . connect ,
type : "button" ,
className : "ui-button filled brand small grow" ,
style : {
display : "inline-block" ,
minHeight : "18px" ,
marginLeft : "10px" ,
lineHeight : "14px"
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-button-contents"
} , "Connect" ) ) ) , self . bdServer ) ] ;
}
2020-09-05 12:14:21 +02:00
footer ( ) {
2020-07-28 03:29:41 +02:00
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-tab-bar-header"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "a" , {
href : "https://discordservers.com" ,
target : "_blank"
} , "Discordservers.com" ) ) ;
}
2020-09-05 12:14:21 +02:00
useState ( ) {
const forceUpdate = Object ( _modules _hooks _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "useForceUpdate" ] ) ( ) ;
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . React . useEffect ( ( ) => {
const listener = ( ) => {
forceUpdate ( ) ;
} ;
this . hooks . push ( listener ) ;
return ( ) => {
const index = this . hooks . findIndex ( e => e === listener ) ;
if ( index < 0 ) return ;
this . hooks . splice ( index , 1 ) ;
} ;
} , [ ] ) ;
}
connection ( getThis ) {
const self = getThis ( ) ;
self . useState ( ) ;
2020-07-28 03:29:41 +02:00
const {
connection
} = self . state ;
if ( connection . state !== 2 ) return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "span" , null ) ;
2020-09-05 12:14:21 +02:00
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "span" , null , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( _tabBarSeparator _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , null ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "span" , {
2020-07-28 03:29:41 +02:00
style : {
color : "#b9bbbe" ,
fontSize : "10px" ,
marginLeft : "10px"
}
} , "Connected as: " , ` ${ connection . user . username } # ${ connection . user . discriminator } ` ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
style : {
padding : "5px 10px 0 10px"
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "button" , {
style : {
width : "100%" ,
minHeight : "20px"
} ,
type : "button" ,
className : "ui-button filled brand small grow"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-button-contents" ,
onClick : self . connect
} , "Reconnect" ) ) ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/publicservers/serverCard.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / publicservers / serverCard . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _ServerCard ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../../modules/v2 */ "./src/modules/v2.js" ) ;
class V2C _ServerCard extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
if ( ! this . props . server . iconUrl ) this . props . server . iconUrl = this . props . fallback ;
this . state = {
imageError : false ,
joined : this . props . guildList . includes ( this . props . server . identifier )
} ;
}
render ( ) {
const {
server
} = this . props ;
let cardModule = BDModules . get ( e => e . card && e . cardPrimary ) [ 0 ] ;
let flexModule = BDModules . get ( e => e . flexChild && e . _horizontalReverse ) [ 0 ] ;
let wrapModule = BDModules . get ( e => e . noWrap && ! e . streamerModeEnabled ) [ 0 ] ;
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , // cardPrimary-1Hv-to
{
className : ` ${ cardModule . card } ${ cardModule . cardPrimary } ${ BDModules . get ( e => e . marginBottom8 ) [ 0 ] . marginBottom8 } bd-server-card ${ server . pinned ? " bd-server-card-pinned" : "" } `
} , // BDV2.react.createElement(
// "div",
// { className: "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY flex-1O1GKY directionRow-3v3tfG justifyStart-2yIZo0 alignStretch-1hwxMa noWrap-3jynv6" },
_modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "img" , {
ref : "img" ,
className : "bd-server-image" ,
src : server . iconUrl ,
onError : this . handleError . bind ( this ) ,
draggable : false
} ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : flexModule . flexChild + " bd-server-content"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : flexModule . horizontal + " " + wrapModule . noWrap + " bd-server-header"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "h5" , {
className : "h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"
} , server . name ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "h5" , {
className : "h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"
} , server . members , " Members" ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : flexModule . horizontal + " " + wrapModule . noWrap
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "scroller-2FKFPG scroller bd-server-description"
} , server . description ) ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "flexChild-faoVW3 bd-server-tags" ,
style : {
flex : "1 1 auto"
}
} , server . categories . join ( ", " ) ) , this . state . joined && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "button" , {
type : "button" ,
className : "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN colorGreen-29iAKY" ,
style : {
minHeight : "12px" ,
marginTop : "4px" ,
backgroundColor : "#3ac15c"
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-button-contents"
} , "Joined" ) ) , server . error && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "button" , {
type : "button" ,
className : "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN disabled-9aF2ug" ,
style : {
minHeight : "12px" ,
marginTop : "4px" ,
backgroundColor : "#c13a3a"
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-button-contents"
} , "Error" ) ) , ! server . error && ! this . state . joined && _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "button" , {
type : "button" ,
className : "button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN" ,
style : {
minHeight : "12px" ,
marginTop : "4px"
} ,
onClick : ( ) => {
this . join ( ) ;
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-button-contents"
} , "Join" ) ) ) ) // )
) ;
}
handleError ( ) {
this . props . server . iconUrl = this . props . fallback ;
this . setState ( {
imageError : true
} ) ;
}
join ( ) {
this . props . join ( this ) ; //this.setState({joined: true});
}
}
/***/ } ) ,
/***/ "./src/ui/reloadIcon.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / reloadIcon . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _ReloadIcon ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
class V2C _ReloadIcon extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "svg" , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24" ,
fill : "#dcddde" ,
className : "bd-reload " + this . props . className ,
onClick : this . props . onClick ,
style : {
width : this . props . size || "24px" ,
height : this . props . size || "24px"
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "path" , {
d : "M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"
} ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "path" , {
fill : "none" ,
d : "M0 0h24v24H0z"
} ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/sectionedSettingsPanel.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / sectionedSettingsPanel . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _SectionedSettingsPanel ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
2020-08-14 21:58:19 +02:00
/* harmony import */ var _settingsGroup _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./settingsGroup */ "./src/ui/settingsGroup.jsx" ) ;
2020-07-28 03:29:41 +02:00
/* harmony import */ var _margintop _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./margintop */ "./src/ui/margintop.jsx" ) ;
class V2C _SectionedSettingsPanel extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
return this . props . sections . map ( ( section , i ) => {
return [ i !== 0 ? _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( _margintop _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , { } ) : null , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( _settingsGroup _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , Object . assign ( { } , section , {
onChange : this . props . onChange
} ) ) ] ;
} ) ;
}
}
/***/ } ) ,
2020-08-14 21:58:19 +02:00
/***/ "./src/ui/settingsGroup.jsx" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settingsGroup . jsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
2020-07-28 03:29:41 +02:00
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _SettingsGroup ; } ) ;
/* harmony import */ var _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../0globals */ "./src/0globals.js" ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _settingsTitle _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./settingsTitle */ "./src/ui/settingsTitle.js" ) ;
/* harmony import */ var _switch _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./switch */ "./src/ui/switch.js" ) ;
2020-08-14 21:58:19 +02:00
/* harmony import */ var _margintop _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./margintop */ "./src/ui/margintop.jsx" ) ;
2020-10-14 00:50:42 +02:00
/* harmony import */ var _modules _hooks _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ../modules/hooks */ "./src/modules/hooks.js" ) ;
2020-08-14 21:58:19 +02:00
2020-07-28 03:29:41 +02:00
2020-08-14 21:58:19 +02:00
let formModule ;
let switchItem ;
let betaClassNames ;
2020-07-28 03:29:41 +02:00
class V2C _SettingsGroup extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
2020-08-14 21:58:19 +02:00
this . state = {
error : false
} ;
2020-07-28 03:29:41 +02:00
}
2020-08-14 21:58:19 +02:00
renderOldSettings ( ) {
2020-07-28 03:29:41 +02:00
const {
title ,
settings ,
button
} = this . props ;
const buttonComponent = button ? _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( "button" , {
key : "title-button" ,
className : "bd-pfbtn" ,
onClick : button . onClick
} , button . title ) : null ;
return [ _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( _settingsTitle _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "default" ] , {
text : title
} ) , buttonComponent , settings . map ( setting => {
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . react . createElement ( _switch _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "default" ] , {
id : setting . id ,
key : setting . id ,
data : setting ,
checked : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ setting . id ] ,
onChange : ( id , checked ) => {
this . props . onChange ( id , checked ) ;
2020-10-14 00:50:42 +02:00
this . forceUpdate ( ) ;
2020-07-28 03:29:41 +02:00
}
} ) ;
} ) ] ;
}
2020-08-14 21:58:19 +02:00
componentDidCatch ( err , errInfo ) {
console . log ( err , errInfo ) ;
this . setState ( {
error : true
} ) ;
}
render ( ) {
if ( this . state . error ) {
try {
return this . renderOldSettings ( ) ;
} catch ( e ) {
console . error ( e ) ;
return null ;
}
} else {
try {
if ( ! formModule ) formModule = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . WebpackModules . find ( e => e . FormSection ) ;
if ( ! switchItem ) switchItem = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . WebpackModules . find ( e => e . default && e . default . displayName === "SwitchItem" ) ;
if ( ! betaClassNames ) betaClassNames = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . WebpackModules . find ( e => e . beta && ! e . container && ! e . userSettingsVoice ) ;
let children = [ ] ;
if ( this . props . description ) {
children . push ( /*#__PURE__*/ React . createElement ( formModule . FormText , {
type : "description" ,
selectable : false
} , this . props . description ) , /*#__PURE__*/ React . createElement ( _margintop _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "default" ] , null ) ) ;
}
children . push ( ... this . props . settings . map ( setting => {
let info = [ setting . text ] ;
if ( setting . experimental ) {
info . push ( /*#__PURE__*/ React . createElement ( "sup" , {
className : betaClassNames . beta
} , "(EXPERIMENTAL)" ) ) ;
}
2020-10-14 00:50:42 +02:00
return React . createElement ( ( ) => {
const forceUpdate = Object ( _modules _hooks _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "useForceUpdate" ] ) ( ) ;
return /*#__PURE__*/ React . createElement ( switchItem . default , {
onChange : val => {
this . props . onChange ( setting . id , val ) ;
forceUpdate ( ) ;
} ,
key : setting . id ,
value : _0globals _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "settingsCookie" ] [ setting . id ] ,
className : _ _SECRET _EMOTION _ _ . css ( {
marginBottom : "20px"
} ) ,
disabled : false ,
hideBorder : false ,
note : setting . info ,
tooltipNote : null
} , info ) ;
} ) ;
2020-08-14 21:58:19 +02:00
} ) ) ;
return /*#__PURE__*/ React . createElement ( formModule . FormSection , {
tag : "h2" ,
title : this . props . title
} , children ) ;
} catch ( e ) {
console . error ( e ) ;
setImmediate ( ( ) => {
this . setState ( {
error : true
} ) ;
} ) ;
return null ;
}
}
}
2020-07-28 03:29:41 +02:00
}
/***/ } ) ,
/***/ "./src/ui/settingsTitle.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / settingsTitle . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _SettingsTitle ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
class V2C _SettingsTitle extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
} //h2-2gWE-o title-3sZWYQ size16-14cGz5 height20-mO2eIN weightSemiBold-NJexzi da-h2 da-title da-size16 da-height20 da-weightSemiBold defaultColor-1_ajX0 da-defaultColor marginTop60-3PGbtK da-marginTop60 marginBottom20-32qID7 da-marginBottom20
render ( ) {
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "h2" , {
className : "ui-form-title h2 margin-reset margin-bottom-20"
} , this . props . text ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/switch.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / switch . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return SwitchItem ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _components _switch _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./components/switch */ "./src/ui/components/switch.jsx" ) ;
let classnames = [ ] ;
function getClassName ( name ) {
let className = classnames . find ( e => e . startsWith ( name + "-" ) ) ;
if ( className ) return className ;
2020-07-28 18:55:37 +02:00
className = BDModules . get ( e => e [ name ] ) [ 0 ] [ name ] ;
2020-07-28 03:29:41 +02:00
classnames . push ( className ) ;
return className ;
}
class SwitchItem extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
this . onChange = this . onChange . bind ( this ) ;
}
onChange ( ) {
this . props . checked = ! this . props . checked ;
this . props . onChange ( this . props . id , this . props . checked ) ;
}
render ( ) {
let {
text ,
info
} = this . props . data ;
if ( this . props . data . experimental ) {
2020-09-17 12:06:02 +02:00
if ( ! classnames . find ( e => e . startsWith ( "beta-" ) ) ) {
classnames . push ( BDModules . get ( e => e . beta && ! e . container && ! e . userSettingsVoice ) [ 0 ] . beta ) ;
}
2020-07-28 03:29:41 +02:00
info = [ info , React . createElement ( "sup" , {
className : getClassName ( "beta" )
} , "(EXPERIMENTAL)" ) ] ;
}
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "h3" , {
2020-08-01 11:05:17 +02:00
key : "title" ,
2020-07-28 03:29:41 +02:00
className : "ui-form-title h3 margin-reset margin-reset ui-flex-child"
} , text ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( _components _switch _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] , {
2020-08-01 11:05:17 +02:00
key : "switch" ,
2020-07-28 03:29:41 +02:00
onChange : this . onChange ,
checked : this . props . checked
} ) ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-form-text style-description margin-top-4" ,
style : {
flex : "1 1 auto"
}
} , info ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/tabBarSeparator.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / tabBarSeparator . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _TabBarSeparator ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
class V2C _TabBarSeparator extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "div" , {
className : "ui-tab-bar-separator margin-top-8 margin-bottom-8"
} ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/tooltip.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / tooltip . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return EmulatedTooltip ; } ) ;
/* harmony import */ var _modules _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/utils */ "./src/modules/utils.js" ) ;
/* harmony import */ var _modules _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ../modules/webpackModules */ "./src/modules/webpackModules.js" ) ;
2020-09-05 22:50:45 +02:00
/ * *
* Tooltip that automatically show and hide themselves on mouseenter and mouseleave events .
* Will also remove themselves if the node to watch is removed from DOM through
* a MutationObserver .
*
* Note this is not using Discord ' s internals but normal DOM manipulation and emulates
* Discord ' s own tooltips as closely as possible .
*
* @ module EmulatedTooltip
* @ version 0.0 . 1
2020-07-28 03:29:41 +02:00
* /
let TooltipClasses ;
function getTooltipClasses ( ) {
if ( TooltipClasses ) return TooltipClasses ;
return TooltipClasses = _modules _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByProps ( "tooltip" , "tooltipBlack" ) ;
}
let TooltipLayers ;
function getTooltipLayers ( ) {
if ( TooltipLayers ) return TooltipLayers ;
return TooltipLayers = _modules _webpackModules _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] . findByProps ( "layer" , "layerContainer" ) ;
}
const getClass = function ( sideOrColor ) {
const upperCase = sideOrColor [ 0 ] . toUpperCase ( ) + sideOrColor . slice ( 1 ) ;
const tooltipClass = getTooltipClasses ( ) [ ` tooltip ${ upperCase } ` ] ;
if ( tooltipClass ) return tooltipClass ;
return null ;
} ;
const classExists = function ( sideOrColor ) {
return getClass ( sideOrColor ) ? true : false ;
} ;
const toPx = function ( value ) {
return ` ${ value } px ` ;
} ;
class EmulatedTooltip {
2020-09-05 22:50:45 +02:00
/ * *
*
* @ constructor
* @ param { ( HTMLElement | jQuery ) } node - DOM node to monitor and show the tooltip on
* @ param { string } tip - string to show in the tooltip
* @ param { object } options - additional options for the tooltip
* @ param { string } [ options . style = black ] - correlates to the discord styling / colors ( black , brand , green , grey , red , yellow )
* @ param { string } [ options . side = top ] - can be any of top , right , bottom , left
* @ param { boolean } [ options . preventFlip = false ] - prevents moving the tooltip to the opposite side if it is too big or goes offscreen
* @ param { boolean } [ options . disabled = false ] - whether the tooltip should be disabled from showing on hover
* @ param { boolean } [ options . attachEvents = true ] - whether the tooltip should listen to mouseenter and mouseleave events .
2020-07-28 03:29:41 +02:00
* /
constructor ( node , text , options = { } ) {
const {
style = "black" ,
side = "top" ,
preventFlip = false ,
2020-08-01 11:05:17 +02:00
disabled = false ,
attachEvents = true
2020-07-28 03:29:41 +02:00
} = options ;
this . node = node instanceof jQuery ? node [ 0 ] : node ;
this . label = text ;
this . style = style . toLowerCase ( ) ;
this . side = side . toLowerCase ( ) ;
this . preventFlip = preventFlip ;
this . disabled = disabled ;
if ( ! classExists ( this . side ) ) return _modules _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . err ( "EmulatedTooltip" , ` Side ${ this . side } does not exist. ` ) ;
if ( ! classExists ( this . style ) ) return _modules _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . err ( "EmulatedTooltip" , ` Style ${ this . style } does not exist. ` ) ;
this . element = document . createElement ( "div" ) ;
this . element . className = getTooltipLayers ( ) . layer + " " + getTooltipLayers ( ) . disabledPointerEvents ;
this . tooltipElement = document . createElement ( "div" ) ;
this . tooltipElement . className = ` ${ getTooltipClasses ( ) . tooltip } ${ getClass ( this . style ) } ` ;
this . labelElement = document . createElement ( "div" ) ;
this . labelElement . className = getTooltipClasses ( ) . tooltipContent ;
const pointerElement = document . createElement ( "div" ) ;
pointerElement . className = getTooltipClasses ( ) . tooltipPointer ;
this . tooltipElement . append ( pointerElement ) ;
this . tooltipElement . append ( this . labelElement ) ;
this . element . append ( this . tooltipElement ) ;
2020-08-01 11:05:17 +02:00
if ( attachEvents ) {
this . node . addEventListener ( "mouseenter" , ( ) => {
if ( this . disabled ) return ;
this . show ( ) ;
const observer = new MutationObserver ( mutations => {
mutations . forEach ( mutation => {
const nodes = Array . from ( mutation . removedNodes ) ;
const directMatch = nodes . indexOf ( this . node ) > - 1 ;
const parentMatch = nodes . some ( parent => parent . contains ( this . node ) ) ;
if ( directMatch || parentMatch ) {
this . hide ( ) ;
observer . disconnect ( ) ;
}
} ) ;
} ) ;
observer . observe ( document . body , {
subtree : true ,
childList : true
2020-07-28 03:29:41 +02:00
} ) ;
} ) ;
2020-08-01 11:05:17 +02:00
this . node . addEventListener ( "mouseleave" , ( ) => {
this . hide ( ) ;
2020-07-28 03:29:41 +02:00
} ) ;
2020-08-01 11:05:17 +02:00
}
2020-07-28 03:29:41 +02:00
}
/** Container where the tooltip will be appended. */
get container ( ) {
2020-07-28 18:55:37 +02:00
return document . querySelector ( "." + _modules _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . removeDa ( BDModules . get ( e => e . popouts ) [ 0 ] . popouts ) + " ~ ." + _modules _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . removeDa ( BDModules . get ( e => e . layerContainer ) [ 0 ] . layerContainer ) ) ;
2020-07-28 03:29:41 +02:00
}
/** Boolean representing if the tooltip will fit on screen above the element */
get canShowAbove ( ) {
return this . node . getBoundingClientRect ( ) . top - this . element . offsetHeight >= 0 ;
}
/** Boolean representing if the tooltip will fit on screen below the element */
get canShowBelow ( ) {
return this . node . getBoundingClientRect ( ) . top + this . node . offsetHeight + this . element . offsetHeight <= _modules _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . screenHeight ;
}
/** Boolean representing if the tooltip will fit on screen to the left of the element */
get canShowLeft ( ) {
return this . node . getBoundingClientRect ( ) . left - this . element . offsetWidth >= 0 ;
}
/** Boolean representing if the tooltip will fit on screen to the right of the element */
get canShowRight ( ) {
return this . node . getBoundingClientRect ( ) . left + this . node . offsetWidth + this . element . offsetWidth <= _modules _utils _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . screenWidth ;
}
/** Hides the tooltip. Automatically called on mouseleave. */
hide ( ) {
this . element . remove ( ) ;
this . tooltipElement . className = this . _className ;
}
/** Shows the tooltip. Automatically called on mouseenter. Will attempt to flip if position was wrong. */
show ( ) {
this . tooltipElement . className = ` ${ getTooltipClasses ( ) . tooltip } ${ getClass ( this . style ) } ` ;
this . labelElement . textContent = this . label ;
this . container . append ( this . element ) ;
if ( this . side == "top" ) {
if ( this . canShowAbove || ! this . canShowAbove && this . preventFlip ) this . showAbove ( ) ; else this . showBelow ( ) ;
}
if ( this . side == "bottom" ) {
if ( this . canShowBelow || ! this . canShowBelow && this . preventFlip ) this . showBelow ( ) ; else this . showAbove ( ) ;
}
if ( this . side == "left" ) {
if ( this . canShowLeft || ! this . canShowLeft && this . preventFlip ) this . showLeft ( ) ; else this . showRight ( ) ;
}
if ( this . side == "right" ) {
if ( this . canShowRight || ! this . canShowRight && this . preventFlip ) this . showRight ( ) ; else this . showLeft ( ) ;
}
}
/** Force showing the tooltip above the node. */
showAbove ( ) {
this . tooltipElement . classList . add ( getClass ( "top" ) ) ;
this . element . style . setProperty ( "top" , toPx ( this . node . getBoundingClientRect ( ) . top - this . element . offsetHeight - 10 ) ) ;
this . centerHorizontally ( ) ;
}
/** Force showing the tooltip below the node. */
showBelow ( ) {
this . tooltipElement . classList . add ( getClass ( "bottom" ) ) ;
this . element . style . setProperty ( "top" , toPx ( this . node . getBoundingClientRect ( ) . top + this . node . offsetHeight + 10 ) ) ;
this . centerHorizontally ( ) ;
}
/** Force showing the tooltip to the left of the node. */
showLeft ( ) {
this . tooltipElement . classList . add ( getClass ( "left" ) ) ;
this . element . style . setProperty ( "left" , toPx ( this . node . getBoundingClientRect ( ) . left - this . element . offsetWidth - 10 ) ) ;
this . centerVertically ( ) ;
}
/** Force showing the tooltip to the right of the node. */
showRight ( ) {
this . tooltipElement . classList . add ( getClass ( "right" ) ) ;
this . element . style . setProperty ( "left" , toPx ( this . node . getBoundingClientRect ( ) . left + this . node . offsetWidth + 10 ) ) ;
this . centerVertically ( ) ;
}
centerHorizontally ( ) {
const nodecenter = this . node . getBoundingClientRect ( ) . left + this . node . offsetWidth / 2 ;
this . element . style . setProperty ( "left" , toPx ( nodecenter - this . element . offsetWidth / 2 ) ) ;
}
centerVertically ( ) {
const nodecenter = this . node . getBoundingClientRect ( ) . top + this . node . offsetHeight / 2 ;
this . element . style . setProperty ( "top" , toPx ( nodecenter - this . element . offsetHeight / 2 ) ) ;
}
}
/***/ } ) ,
/***/ "./src/ui/tooltipWrap.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / tooltipWrap . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
/* harmony import */ var _tooltip _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./tooltip */ "./src/ui/tooltip.js" ) ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( class extends React . Component {
constructor ( props ) {
super ( props ) ;
}
async componentDidMount ( ) {
const {
style = "black" ,
side = "top" ,
text = ""
} = this . props ;
this . node = _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactDom . findDOMNode ( this ) ;
this . tooltip = new _tooltip _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "default" ] ( this . node , text , {
style ,
side
} ) ;
}
componentWillUnmount ( ) {
this . tooltip . hide ( ) ;
delete this . tooltip ;
}
render ( ) {
return this . props . children ;
}
} ) ;
/***/ } ) ,
/***/ "./src/ui/xSvg.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / ui / xSvg . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "default" , function ( ) { return V2C _XSvg ; } ) ;
/* harmony import */ var _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ../modules/v2 */ "./src/modules/v2.js" ) ;
class V2C _XSvg extends _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . reactComponent {
constructor ( props ) {
super ( props ) ;
}
render ( ) {
return _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "svg" , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 12 12" ,
style : {
width : "18px" ,
height : "18px"
}
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "g" , {
className : "background" ,
fill : "none" ,
fillRule : "evenodd"
} , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "path" , {
d : "M0 0h12v12H0"
} ) , _modules _v2 _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "default" ] . react . createElement ( "path" , {
className : "fill" ,
fill : "#dcddde" ,
d : "M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"
} ) ) ) ;
}
}
/***/ } ) ,
/***/ "crypto" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "crypto" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "crypto" ) ;
/***/ } ) ,
/***/ "electron" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "electron" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "electron" ) ;
/***/ } ) ,
/***/ "events" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "events" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "events" ) ;
/***/ } ) ,
/***/ "fs" :
/ * ! * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "fs" * * * !
\ * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "fs" ) ;
/***/ } ) ,
/***/ "module" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "module" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "module" ) ;
/***/ } ) ,
/***/ "node-fetch" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "node-fetch" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "node-fetch" ) ;
/***/ } ) ,
/***/ "path" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * external "path" * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
module . exports = require ( "path" ) ;
/***/ } )
/******/ } ) ;
2020-10-14 00:50:42 +02:00
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkL3dlYnBhY2svYm9vdHN0cmFwIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvMGdsb2JhbHMuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9pbmRleC5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL2xvYWRpbmdJY29uLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbG9jYWxTdG9yYWdlRml4LmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy8yNGhvdXIuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL0FudGlBZERNLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy9DdXN0b21SaWNoUHJlc2VuY2UuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL0xheWVycy5qc3giLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2JkQXBpLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy9iZEV2ZW50cy5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL21vZHVsZXMvYmx1clByaXZhdGUuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2NsYXNzTm9ybWFsaXplci5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL21vZHVsZXMvY29sb3JlZFRleHQuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2NvbnRlbnRNYW5hZ2VyLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy9jb3JlLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy9kYXRhU3RvcmUuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2Rldk1vZGUuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2Rpc2FibGVUeXBpbmcuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2Rpc3RhbnQuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2RvbXRvb2xzLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy9lbW9qaU1vZHVsZS5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL21vZHVsZXMvaG9va3MuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL3BsdWdpbkNlcnRpZmllci5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL21vZHVsZXMvcGx1Z2luTW9kdWxlLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy9wb3BvdXRXaW5kb3cuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL3B1YmxpY1NlcnZlcnMuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL3NldHRpbmdzUGFuZWwuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL3NldHRpbmdzUGFuZWxTaWRlYmFyLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy90aGVtZU1vZHVsZS5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL21vZHVsZXMvdXRpbHMuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL3YyLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy92b2ljZU1vZGUuanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL3dlYnBhY2tNb2R1bGVzLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvc3ZnL0xpZ2h0Y29yZC5qc3giLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9zdmcvYnVnX2h1bnRlci5qc3giLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9zdmcvY2lyY3VzLmpzeCIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL3VpL0FjY291bnRJbmZvcy5qc3giLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy91aS9BcGlQcmV2aWV3LmpzeCIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL3VpL1RleHRJbnB1dFNldHRpbmcuanN4Iiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvYWRkb25jYXJkLmpzeCIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL3VpL2FkZG9ubGlzdC5qc3giLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy91aS9iZExvZ28uanMiLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy91aS9jaGVja2JveC5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL3VpL2NvbXBvbmVudHMvZHJvcGRvd24uanN4Iiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvY29tcG9uZW50cy9zZWFyY2guanN4Iiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvY29tcG9uZW50cy9zd2l0Y2guanN4Iiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvY29tcG9uZW50cy90ZXh0aW5wdXQuanN4Iiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvY29udGVudENvbHVtbi5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL3VpL2Nzc0VkaXRvci5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL3VpL2Nzc0VkaXRvckRldGFjaGVkLmpzIiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvZXJyb3JCb3VuZGFyeS5qcyIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL3VpL2ljb25zL2RlbGV0ZS5qc3giLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy91aS9pY29ucy9kb3duYXJyb3cuanN4Iiwid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvaWNvbnMvZWRpdC5qc3giLCJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy91aS9pY29ucy9oaXN0b3J5LmpzeCIsIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL3VpL2ljb25zL3NlYXJjaC5qc3giLCJ3ZWJ