smol update 2
This commit is contained in:
parent
a3f5a0f099
commit
28fb912c70
File diff suppressed because one or more lines are too long
|
@ -82,6 +82,10 @@ export default new class V2_SettingsPanel {
|
|||
return this.getSettings("status")
|
||||
}
|
||||
|
||||
get MsgLogSettings() {
|
||||
return this.getSettings("msglog")
|
||||
}
|
||||
|
||||
getSettings(category) {
|
||||
return Object.keys(settings).reduce((arr, key) => {
|
||||
const setting = settings[key];
|
||||
|
|
|
@ -32,6 +32,9 @@ export default class V2_SettingsPanel_Sidebar {
|
|||
}, {
|
||||
text: "RichPresence",
|
||||
id: "status"
|
||||
}, {
|
||||
text: "Message Logger",
|
||||
id: "msglog"
|
||||
}];
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "discord.js-lightcord",
|
||||
"version": "11.6.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@discordjs/collection": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.5.tgz",
|
||||
"integrity": "sha512-CU1q0UXQUpFNzNB7gufgoisDHP7n+T3tkqTsp3MNUkVJ5+hS3BCvME8uCXAUFlz+6T2FbTCu75A+yQ7HMKqRKw=="
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "discord.js-lightcord",
|
||||
"version": "11.6.4",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "jeanouina",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discordjs/collection": "^0.1.5"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
import { EventEmitter } from "events";
|
||||
import DiscordJSError from "../util/DiscordJSError";
|
||||
import Collection from "@discordjs/collection";
|
||||
import { Snowflake } from "..";
|
||||
import { channelsModule } from "../util/DiscordToModules";
|
||||
|
||||
export default class Client extends EventEmitter {
|
||||
constructor(){
|
||||
super()
|
||||
}
|
||||
|
||||
/** Warnings and overrides for functions that are not compatible. */
|
||||
async login():Promise<never>{
|
||||
throw new DiscordJSError("Client#login is not supported. DiscordJS on lightcord will use the connected account.")
|
||||
}
|
||||
|
||||
get token():never{
|
||||
throw new DiscordJSError("Client#token is not supported. DiscordJS on lightcord will use the connected account.")
|
||||
}
|
||||
|
||||
get broadcasts(){
|
||||
return [] // not giving any since they're not supported.
|
||||
}
|
||||
|
||||
get browser(){
|
||||
return true // since we're in electron, we're always in browser
|
||||
}
|
||||
|
||||
get channels():Collection<Snowflake, Channel>{
|
||||
const channels = Object.values(channelsModule.getChannels())
|
||||
return new Collection(channels.map(e => ([e.id, createChannel(e)])))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
import Client from "./client/client"
|
||||
|
||||
const client = new Client()
|
||||
|
||||
const DiscordJSExporrts = {
|
||||
Client,
|
||||
client
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
DiscordJS: typeof DiscordJSExporrts,
|
||||
DiscordJSClient: Client,
|
||||
BDModules: {
|
||||
modules:any[],
|
||||
get(id:number, modules?:any[]): any
|
||||
get(ids:number[], modules?:any[]): any[]
|
||||
get(filter:(module:any)=>boolean, modules?:any[]): any[]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.DiscordJS = DiscordJSExporrts
|
||||
window.DiscordJSClient = client
|
||||
|
||||
export default DiscordJSExporrts
|
||||
|
||||
export type Snowflake = string
|
|
@ -0,0 +1,5 @@
|
|||
export default class BaseChannel {
|
||||
constructor(){
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
export default class DiscordJSError extends Error {
|
||||
name:string = "DiscordJSError"
|
||||
constructor(message: string){
|
||||
super(message)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
import { Snowflake } from ".."
|
||||
|
||||
export default function getModule(name:string){
|
||||
return exports[name+"Module"]
|
||||
}
|
||||
|
||||
const BDModules = window.BDModules
|
||||
|
||||
function requireModule(filter: (module:any) => boolean){
|
||||
let module = BDModules.get(filter)[0]
|
||||
return module && module.default || module
|
||||
}
|
||||
|
||||
export const channelsModule:{
|
||||
getChannel(id:Snowflake): DiscordChannel,
|
||||
getChannels(): {
|
||||
[k:string]: DiscordChannel
|
||||
},
|
||||
getDMFromUserId(id:string):Snowflake,
|
||||
getDMUserIds():Snowflake[],
|
||||
getFollowerStatsForChannel(id: Snowflake):{
|
||||
loadingStatus: "succeeded"|"failed",
|
||||
lastFetched: number,
|
||||
channelsFollowing: number,
|
||||
guildMembers: number,
|
||||
guildsFollowing: number,
|
||||
usersSeenEver: number,
|
||||
subscribersGainedSinceLastPost: number,
|
||||
subscribersLostSinceLastPost: number
|
||||
},
|
||||
getGDMsForRecipients(recipients: Snowflake[]):Set<Snowflake>
|
||||
} = requireModule(e => e.default && e.default.getChannels && e.default.getChannel)
|
||||
|
||||
interface DiscordChannel {
|
||||
application_id?: Snowflake,
|
||||
bitrate?: number,
|
||||
guild_id?: Snowflake,
|
||||
icon?: string,
|
||||
id: Snowflake,
|
||||
lastMessageId?: Snowflake,
|
||||
lastPinTimestamp?: number,
|
||||
memberListId?: null,
|
||||
name?: string,
|
||||
nicks: any,
|
||||
nsfw: boolean,
|
||||
originChannelId?: Snowflake,
|
||||
ownerId?: Snowflake,
|
||||
parent_id?: Snowflake,
|
||||
permissionOverwrites: any,
|
||||
position: number,
|
||||
rateLimitPerUser: number,
|
||||
rawRecipients: DiscordRecipient[],
|
||||
recipients: Snowflake[],
|
||||
topic: string,
|
||||
type: number,
|
||||
userLimit: number,
|
||||
lastActiveTimestamp: number
|
||||
}
|
||||
|
||||
interface DiscordRecipient {
|
||||
username: string,
|
||||
discriminator: string,
|
||||
id: Snowflake,
|
||||
avatar?: string,
|
||||
public_flags: number
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": false,
|
||||
"module": "commonjs",
|
||||
"target": "ES2017",
|
||||
"jsx": "react",
|
||||
"outDir": "./dist",
|
||||
"resolveJsonModule": true,
|
||||
"rootDir": "./src"
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ const { EventEmitter } = require("events")
|
|||
const Logger = require("./Logger")
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
const electron = require("electron")
|
||||
|
||||
const events = exports.events = new EventEmitter()
|
||||
const logger = exports.logger = new Logger("LightCord")
|
||||
|
@ -113,15 +114,11 @@ require.extensions[".css"] = (m, filename) => {
|
|||
}
|
||||
|
||||
const BetterDiscordConfig = window.BetterDiscordConfig = {
|
||||
"local": true,
|
||||
"localServer": "//localhost:8080",
|
||||
"repo": "rauenzi",
|
||||
"branch": "master",
|
||||
"injectorBranch": "injector",
|
||||
"minified": true,
|
||||
"version": "0.3.2",
|
||||
"branch": "lightcord",
|
||||
dataPath: (process.platform == "win32" ? process.env.APPDATA : process.platform == "darwin" ? process.env.HOME + "/Library/Preferences" : process.env.XDG_CONFIG_HOME ? process.env.XDG_CONFIG_HOME : process.env.HOME + "/.config") + "/LightCord_BD/",
|
||||
os: process.platform
|
||||
os: process.platform,
|
||||
latestVersion: "0.0.0",
|
||||
version: "0.0.0"
|
||||
}
|
||||
|
||||
function ensureGuildClasses(){
|
||||
|
@ -145,4 +142,16 @@ function getGuildClasses() {
|
|||
const guilds = BDModules.get(e => e.guildsError && e.selected)[0]
|
||||
const pill = BDModules.get(e => e.blobContainer)[0]
|
||||
return Object.assign({}, guildsWrapper, guilds, pill);
|
||||
}
|
||||
}
|
||||
|
||||
let originalResolve = path.resolve
|
||||
|
||||
path.resolve = (...args) => {
|
||||
args = args.map(e => {
|
||||
if(e === "BetterDiscord/")return "LightCord_BD/" // replacing default directory of BetterDiscord plugins/themes by lightcord's directory. Open an issue if that's a problem.
|
||||
return e
|
||||
})
|
||||
return originalResolve.call(path, ...args)
|
||||
}
|
||||
|
||||
path.originalResolve = originalResolve
|
|
@ -107,7 +107,7 @@ class WebContents extends EventEmitter {
|
|||
setTimeout(() => {
|
||||
common.getCurrentWindow().setBackgroundColor("#00000000")
|
||||
common.getCurrentWindow().center()
|
||||
}, 1000);
|
||||
}, 500);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 168 168.69"><defs><linearGradient id="a" x1="66.7" y1="-487.7" x2="66.7" y2="-508.73" gradientTransform="matrix(1, 0, 0, -1, 0, -408)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e30613"/><stop offset="1" stop-color="#731a14"/></linearGradient><linearGradient id="b" x1="101.7" y1="-487.7" x2="101.7" y2="-508.73" gradientTransform="matrix(1, 0, 0, -1, 0, -408)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e20613"/><stop offset="1" stop-color="#731a13"/></linearGradient><linearGradient id="c" x1="84" y1="-408" x2="84" y2="-576.69" gradientTransform="matrix(1, 0, 0, -1, 0, -408)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e30613"/><stop offset="1" stop-color="#731a13"/></linearGradient></defs><rect x="14.9" y="35.3" width="139.2" height="97.7" fill="#fff"/><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.5S72.1,79.7,66.7,79.7Z" fill="url(#a)"/><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.5S107.1,79.7,101.7,79.7Z" fill="url(#b)"/><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,0,1-11.1,5.6,68.63,68.63,0,0,1-38.9,4,70.12,70.12,0,0,1-14.1-4.1,48.88,48.88,0,0,1-7.1-3.3c-.3-.2-.6-.3-.9-.5a.76.76,0,0,0-.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,0,1,5.7-2.7,72.19,72.19,0,0,1,21.8-6,8.75,8.75,0,0,1,1.6-.2,89.1,89.1,0,0,1,19.4-.2,78.45,78.45,0,0,1,28.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.4C140.6,109.6,132.5,123.5,111.3,124.1Z" fill="url(#c)"/></svg>
|
After Width: | Height: | Size: 1.8 KiB |
|
@ -9,6 +9,8 @@ exports.init = init;
|
|||
exports.handleSingleInstance = handleSingleInstance;
|
||||
exports.setMainWindowVisible = setMainWindowVisible;
|
||||
|
||||
var glasstron = require("glasstron")
|
||||
|
||||
var _electron = require('electron');
|
||||
|
||||
var _path = require('path');
|
||||
|
@ -339,7 +341,7 @@ function launchMainAppWindow(isVisible) {
|
|||
height: DEFAULT_HEIGHT,
|
||||
minWidth: MIN_WIDTH,
|
||||
minHeight: MIN_HEIGHT,
|
||||
transparent: true,
|
||||
transparent: false,
|
||||
frame: false,
|
||||
resizable: true,
|
||||
show: isVisible,
|
||||
|
@ -363,6 +365,11 @@ function launchMainAppWindow(isVisible) {
|
|||
mainWindow = new _electron.BrowserWindow(mainWindowOptions);
|
||||
mainWindowId = mainWindow.id;
|
||||
global.mainWindowId = mainWindowId;
|
||||
glasstron.update(mainWindow, {
|
||||
windows: {blurType: 'acrylic'},
|
||||
macos: {vibrancy: 'fullscreen-ui'},
|
||||
linux: {requestBlur: true} // KWin
|
||||
});
|
||||
|
||||
mainWindow.webContents.session.webRequest.onHeadersReceived(function(details, callback) {
|
||||
if (!details.responseHeaders["content-security-policy-report-only"] && !details.responseHeaders["content-security-policy"]) return callback({cancel: false});
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
process.on("uncaughtException", console.error)
|
||||
|
||||
// App preload script, used to provide a replacement native API now that
|
||||
// we turned off node integration.
|
||||
|
||||
process.on("uncaughtException", console.error)
|
||||
const bytenode = require("bytenode")// enable .jsc files
|
||||
|
||||
const ipcRenderer = require('./discord_native/ipc');
|
||||
const electron = require("electron")
|
||||
|
||||
// disable Discord's tracking request
|
||||
electron.remote.webContents.getAllWebContents()[0].session.webRequest.onBeforeRequest((details, callback) => {
|
||||
if(/api\/v\d\/science/g.test(details.url))return callback({cancel: true})
|
||||
return callback({})
|
||||
})
|
||||
|
||||
const TRACK_ANALYTICS_EVENT = 'TRACK_ANALYTICS_EVENT';
|
||||
const TRACK_ANALYTICS_EVENT_COMMIT = 'TRACK_ANALYTICS_EVENT_COMMIT';
|
||||
|
@ -44,8 +51,13 @@ const BetterDiscord = require("./BetterDiscord")
|
|||
const _setImmediate = setImmediate;
|
||||
const _clearImmediate = clearImmediate;
|
||||
process.once('loaded', () => {
|
||||
window.global = window
|
||||
// Implementing DiscordNative
|
||||
global.DiscordNative = DiscordNative;
|
||||
|
||||
// Since nodeIntegration has been disable
|
||||
// We're adding node propertys on window so it's easier
|
||||
// to write code / debug
|
||||
window.global = window
|
||||
global.Buffer = Buffer
|
||||
global.require = require
|
||||
|
||||
|
|
|
@ -69,9 +69,9 @@
|
|||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "13.13.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.4.tgz",
|
||||
"integrity": "sha512-x26ur3dSXgv5AwKS0lNfbjpCakGIduWU1DU91Zz58ONRWrIKGunmZBNv4P7N+e27sJkiGDsw/3fT4AtsqQBrBA==",
|
||||
"version": "12.12.39",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.39.tgz",
|
||||
"integrity": "sha512-pADGfwnDkr6zagDwEiCVE4yQrv7XDkoeVa4OfA9Ju/zRTk6YNDLGtQbkdL4/56mCQQCs4AhNrBIag6jrp7ZuOg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/rimraf": {
|
||||
|
@ -372,14 +372,6 @@
|
|||
"@electron/get": "^1.0.1",
|
||||
"@types/node": "^12.0.12",
|
||||
"extract-zip": "^1.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "12.12.39",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.39.tgz",
|
||||
"integrity": "sha512-pADGfwnDkr6zagDwEiCVE4yQrv7XDkoeVa4OfA9Ju/zRTk6YNDLGtQbkdL4/56mCQQCs4AhNrBIag6jrp7ZuOg==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"encodeurl": {
|
||||
|
@ -532,6 +524,14 @@
|
|||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"glasstron": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/glasstron/-/glasstron-0.0.3.tgz",
|
||||
"integrity": "sha512-yJ8+8gkGXXBlnI+4j6i8N+SaeZcswtrO82M863zQkCc5BQfC5fTXcwj9+v80f0jYUfZLFigsgaFuKoFmlVsOdw==",
|
||||
"requires": {
|
||||
"x11": "^2.3.0"
|
||||
}
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||
|
@ -847,6 +847,11 @@
|
|||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"os-homedir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
||||
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M="
|
||||
},
|
||||
"p-cancelable": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
|
||||
|
@ -1222,6 +1227,14 @@
|
|||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"x11": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/x11/-/x11-2.3.0.tgz",
|
||||
"integrity": "sha1-vazO3M2sJIL9Vg8FEee/K9nh2/I=",
|
||||
"requires": {
|
||||
"os-homedir": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"yauzl": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
"test": "tsc && NODE_OPTIONS.bat && electron .",
|
||||
"run": "NODE_OPTIONS.bat && electron .",
|
||||
"build": "electron-packager . --ignore=\"(distApp|builds|\\.ts)\" --arch=ia32 --win32metadata.ProductName=\"Lightcord\" --win32metadata.CompanyName=\"Lightcord Inc.\" --protocol=discord --platform=\"win32\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack=*.{node,dll} --overwrite",
|
||||
"devInstall": "npm i -g --arch=ia32 electron@7.1.11 && npm i -g typescript && npm i --save-dev && npm i --save-dev --arch=ia32 electron@7.1.11 && node installSubModules.js && echo \"Everything is installed. You should be able to do `npm run test` to compile everything and launch.\""
|
||||
"devInstall": "npm i -g --arch=ia32 electron@7.1.11 && npm i -g typescript && npm i --save-dev @types/node@12.12.39 && npm i --save-dev --arch=ia32 electron@7.1.11 && node installSubModules.js && echo \"Everything is installed. You should be able to do `npm run test` to compile everything and launch.\""
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bytenode": "^1.1.6",
|
||||
"glasstron": "0.0.3",
|
||||
"mkdirp": "^1.0.4",
|
||||
"request": "^2.88.2",
|
||||
"rimraf": "^3.0.2",
|
||||
|
@ -21,9 +22,9 @@
|
|||
"private": true,
|
||||
"devDependencies": {
|
||||
"@types/mkdirp": "^1.0.0",
|
||||
"@types/node": "^12.12.39",
|
||||
"@types/rimraf": "^3.0.0",
|
||||
"@types/yauzl": "^2.9.1",
|
||||
"@types/node": "12.12.39",
|
||||
"devtron": "^1.4.0",
|
||||
"electron": "^7.1.11",
|
||||
"terser": "^4.6.13"
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/** Glasstron */
|
||||
import * as glasstron from "glasstron"
|
||||
glasstron.init()
|
||||
|
||||
/** Modules */
|
||||
import * as electron from "electron"
|
||||
import * as fs from "fs"
|
||||
import * as path from "path"
|
||||
|
|
|
@ -8,5 +8,8 @@
|
|||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"rootDir": "./src"
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"./DiscordJS"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue