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 PluginCertifier from "./pluginCertifier";
|
||||||
import distant, { uuidv4 } from "./distant";
|
import distant, { uuidv4 } from "./distant";
|
||||||
import EmojiModule from "./emojiModule"
|
import EmojiModule from "./emojiModule"
|
||||||
|
import {remote as electron} from "electron"
|
||||||
|
|
||||||
function Core() {
|
function Core() {
|
||||||
// Object.assign(bdConfig, __non_webpack_require__(DataStore.configFile));
|
// Object.assign(bdConfig, __non_webpack_require__(DataStore.configFile));
|
||||||
@ -272,15 +273,16 @@ Core.prototype.patchSocial = function() {
|
|||||||
BDModules.get(e => e.versionHash)[0].versionHash
|
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 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;
|
const originalVersions = children[children.length - 1].type;
|
||||||
children[children.length - 1].type = function() {
|
children[children.length - 1].type = function() {
|
||||||
const returnVal = originalVersions(...arguments);
|
const returnVal = originalVersions(...arguments);
|
||||||
returnVal.props.children.splice(returnVal.props.children.length - 1, 0, injector);
|
|
||||||
returnVal.props.children.splice(1, 0, additional);
|
returnVal.props.children.splice(1, 0, additional);
|
||||||
return returnVal;
|
return returnVal;
|
||||||
};
|
};
|
||||||
|
@ -33,6 +33,7 @@ export default new class DataStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get injectionPath() {
|
get injectionPath() {
|
||||||
|
return this._injectionPath = null;
|
||||||
if (this._injectionPath) return this._injectionPath;
|
if (this._injectionPath) return this._injectionPath;
|
||||||
const electron = require("electron").remote.app;
|
const electron = require("electron").remote.app;
|
||||||
const base = electron.getAppPath();
|
const base = electron.getAppPath();
|
||||||
|
@ -3,7 +3,7 @@ const path = require("path")
|
|||||||
const terser = require("terser")
|
const terser = require("terser")
|
||||||
const util = require("util")
|
const util = require("util")
|
||||||
|
|
||||||
const production = true
|
const production = false
|
||||||
|
|
||||||
let fs = require("fs")
|
let fs = require("fs")
|
||||||
|
|
||||||
@ -49,7 +49,14 @@ async function main(){
|
|||||||
newDir
|
newDir
|
||||||
}, ((filepath) => filepath.endsWith(".js") && (!production ? !filepath.includes("node_modules") : true)), async (filepath, newpath) => {
|
}, ((filepath) => filepath.endsWith(".js") && (!production ? !filepath.includes("node_modules") : true)), async (filepath, newpath) => {
|
||||||
console.info(`Minifying ${filepath} to ${newpath}`)
|
console.info(`Minifying ${filepath} to ${newpath}`)
|
||||||
|
|
||||||
|
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")
|
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
|
||||||
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
console.info(`Copied files and minified them from ${startDir}.`)
|
console.info(`Copied files and minified them from ${startDir}.`)
|
||||||
}).catch(console.error)
|
}).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 releaseChannel:"stable"|"canary"|"ptb"|"development" = "stable"
|
||||||
export const version = "0.0.306"
|
export const version = "0.0.306"
|
||||||
|
export const commit = getCommitID()
|
||||||
export default {
|
export default {
|
||||||
releaseChannel,
|
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 */
|
/** Modules */
|
||||||
import * as electron from "electron"
|
import * as electron from "electron"
|
||||||
import * as fs from "fs"
|
|
||||||
import * as path from "path"
|
|
||||||
import requireNativeDiscordModule from "./requireNative";
|
import requireNativeDiscordModule from "./requireNative";
|
||||||
import appSettings from "./appSettings"
|
import appSettings from "./appSettings"
|
||||||
import autoStart from "./autoStart"
|
import autoStart from "./autoStart"
|
||||||
@ -52,7 +50,10 @@ function hasArgvFlag(flag) {
|
|||||||
//Transform main thread into async
|
//Transform main thread into async
|
||||||
(async function Main(){
|
(async function Main(){
|
||||||
await electron.app.whenReady()
|
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');
|
if(!electron.app.commandLine.hasSwitch('enable-transparent-visuals'))electron.app.commandLine.appendSwitch('enable-transparent-visuals');
|
||||||
electron.app.setAppUserModelId(Constants.APP_ID);
|
electron.app.setAppUserModelId(Constants.APP_ID);
|
||||||
let coreModule
|
let coreModule
|
||||||
|
Loading…
x
Reference in New Issue
Block a user