mirror of
https://github.com/Lightcord/Lightcord.git
synced 2025-04-12 00:55:40 +02:00
Adding commit hash under settings pannel
This commit is contained in:
parent
45c5d96a45
commit
8a19ec7e2a
File diff suppressed because one or more lines are too long
@ -15,6 +15,7 @@ import LightcordLogo from "../svg/lightcord";
|
||||
import PluginCertifier from "./pluginCertifier";
|
||||
import distant, { uuidv4 } from "./distant";
|
||||
import EmojiModule from "./emojiModule"
|
||||
import {remote as electron} from "electron"
|
||||
|
||||
function Core() {
|
||||
// Object.assign(bdConfig, __non_webpack_require__(DataStore.configFile));
|
||||
@ -272,15 +273,16 @@ Core.prototype.patchSocial = function() {
|
||||
BDModules.get(e => e.versionHash)[0].versionHash
|
||||
]
|
||||
|
||||
const injector = BDV2.react.createElement("div", {className: `${classNameColorMuted} ${sizes.size12}`}, `Injector ${bdConfig.version}`);
|
||||
const versionHash = `(${bdConfig.hash ? bdConfig.hash.substring(0, 7) : bdConfig.branch})`;
|
||||
const additional = BDV2.react.createElement("div", {className: `${classNameColorMuted} ${sizes.size12}`}, `BBD ${bbdVersion} `, BDV2.react.createElement("span", {className: classNameVersionHash+" da-versionHash"}, versionHash));
|
||||
const additional = [
|
||||
BDV2.react.createElement("div", {className: `${classNameColorMuted} ${sizes.size12}`}, `Lightcord ${electron.getGlobal("BuildInfo").version} `, BDV2.react.createElement("span", {className: classNameVersionHash+" da-versionHash"}, `(${(electron.getGlobal("BuildInfo").commit || "Unknown").slice(0, 7)})`)),
|
||||
BDV2.react.createElement("div", {className: `${classNameColorMuted} ${sizes.size12}`}, `BBD ${bbdVersion} `, BDV2.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(returnVal.props.children.length - 1, 0, injector);
|
||||
returnVal.props.children.splice(1, 0, additional);
|
||||
return returnVal;
|
||||
};
|
||||
|
@ -33,6 +33,7 @@ export default new class DataStore {
|
||||
}
|
||||
|
||||
get injectionPath() {
|
||||
return this._injectionPath = null;
|
||||
if (this._injectionPath) return this._injectionPath;
|
||||
const electron = require("electron").remote.app;
|
||||
const base = electron.getAppPath();
|
||||
|
11
compile.js
11
compile.js
@ -3,7 +3,7 @@ const path = require("path")
|
||||
const terser = require("terser")
|
||||
const util = require("util")
|
||||
|
||||
const production = true
|
||||
const production = false
|
||||
|
||||
let fs = require("fs")
|
||||
|
||||
@ -49,7 +49,14 @@ async function main(){
|
||||
newDir
|
||||
}, ((filepath) => filepath.endsWith(".js") && (!production ? !filepath.includes("node_modules") : true)), async (filepath, newpath) => {
|
||||
console.info(`Minifying ${filepath} to ${newpath}`)
|
||||
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
|
||||
|
||||
if(filepath.endsWith("git.js")){
|
||||
let commit = child_process.execSync("git rev-parse HEAD").toString()
|
||||
console.info(`Obtained commit ${commit} for the compilation`)
|
||||
await fs.promises.writeFile(newpath, terser.minify((await fs.promises.readFile(filepath, "utf8")).replace("{commit}", commit)).code, "utf8")
|
||||
}else{
|
||||
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
|
||||
}
|
||||
}).then(() => {
|
||||
console.info(`Copied files and minified them from ${startDir}.`)
|
||||
}).catch(console.error)
|
||||
|
@ -1,6 +1,17 @@
|
||||
import { getCommitID } from "./common/git"
|
||||
const pak = require("../package.json")
|
||||
|
||||
export const releaseChannel:"stable"|"canary"|"ptb"|"development" = "stable"
|
||||
export const version = "0.0.306"
|
||||
export const commit = getCommitID()
|
||||
export default {
|
||||
releaseChannel,
|
||||
version
|
||||
version,
|
||||
commit
|
||||
}
|
||||
|
||||
global["BuildInfo"] = {
|
||||
releaseChannel,
|
||||
version: pak.version,
|
||||
commit
|
||||
}
|
15
src/common/git.ts
Normal file
15
src/common/git.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import * as child_process from "child_process"
|
||||
|
||||
let commit_id = "{commit}"
|
||||
export function getCommitID(){
|
||||
if(commit_id === "{" + "commit}"){
|
||||
try{
|
||||
return commit_id = child_process.execSync("git rev-parse HEAD").toString()
|
||||
}catch(e){
|
||||
console.error(e)
|
||||
return "{Unknown}"
|
||||
}
|
||||
}else{
|
||||
return commit_id
|
||||
}
|
||||
}
|
@ -4,8 +4,6 @@ glasstron.init()
|
||||
|
||||
/** Modules */
|
||||
import * as electron from "electron"
|
||||
import * as fs from "fs"
|
||||
import * as path from "path"
|
||||
import requireNativeDiscordModule from "./requireNative";
|
||||
import appSettings from "./appSettings"
|
||||
import autoStart from "./autoStart"
|
||||
@ -52,7 +50,10 @@ function hasArgvFlag(flag) {
|
||||
//Transform main thread into async
|
||||
(async function Main(){
|
||||
await electron.app.whenReady()
|
||||
console.log(`Lightcord Init...`)
|
||||
console.log(`Initializing Lightcord.`)
|
||||
console.log(`Version: ${buildInfo.version}
|
||||
releaseChannel: ${buildInfo.releaseChannel}
|
||||
commit: ${buildInfo.commit}`)
|
||||
if(!electron.app.commandLine.hasSwitch('enable-transparent-visuals'))electron.app.commandLine.appendSwitch('enable-transparent-visuals');
|
||||
electron.app.setAppUserModelId(Constants.APP_ID);
|
||||
let coreModule
|
||||
|
Loading…
x
Reference in New Issue
Block a user