correction erreur console + statut discord
This commit is contained in:
parent
1e148b08f8
commit
62b6ca702c
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
// Work in progress
|
// Work in progress
|
||||||
const logger = require('./loggerutil')('%c[DiscordWrapper]', 'color: #7289da; font-weight: bold')
|
/*const logger = require('./loggerutil')('%c[DiscordWrapper]', 'color: #7289da; font-weight: bold')
|
||||||
|
|
||||||
const {Client} = require('discord-rpc-patch')
|
const {Client} = require('discord-rpc-patch')
|
||||||
|
|
||||||
@ -39,6 +39,50 @@ exports.updateDetails = function(details){
|
|||||||
client.setActivity(activity)
|
client.setActivity(activity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.shutdownRPC = function(){
|
||||||
|
if(!client) return
|
||||||
|
client.clearActivity()
|
||||||
|
client.destroy()
|
||||||
|
client = null
|
||||||
|
activity = null
|
||||||
|
}*/
|
||||||
|
|
||||||
|
const logger = require('./loggerutil')('%c[DiscordWrapper]', 'color: #7289da; font-weight: bold')
|
||||||
|
|
||||||
|
let rpc = require("discord-rpc")
|
||||||
|
|
||||||
|
const client = new rpc.Client({ transport: 'ipc' })
|
||||||
|
|
||||||
|
client.on("ready", () => {
|
||||||
|
logger.log('Discord RPC Connected')
|
||||||
|
|
||||||
|
client.request('SET_ACTIVITY', {
|
||||||
|
|
||||||
|
pid: process.pid,
|
||||||
|
activity: {
|
||||||
|
assets: {
|
||||||
|
large_image: "pdp_512"
|
||||||
|
},
|
||||||
|
details: "kuku",
|
||||||
|
state: "Serveur Minecraft Communautaire !",
|
||||||
|
buttons: [{ label: "Twitch", url: "https://twitch.tv/lukienlive"}, { label: "Rejoins nous !", url: "https://discord.gg/TEZr3DdaFZ"}],
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
logger.log(`Connecté à l'utilisateur: ${client.user.username}#${client.user.discriminator}`);
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
client.login({clientId: "946067255295369248"}).catch(error => {
|
||||||
|
if(error.message.includes('ENOENT')) {
|
||||||
|
logger.log('Unable to initialize Discord Rich Presence, no client detected.')
|
||||||
|
} else {
|
||||||
|
logger.log('Unable to initialize Discord Rich Presence: ' + error.message, error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
exports.shutdownRPC = function(){
|
exports.shutdownRPC = function(){
|
||||||
if(!client) return
|
if(!client) return
|
||||||
client.clearActivity()
|
client.clearActivity()
|
||||||
|
@ -156,7 +156,7 @@ server_selection_button.onclick = (e) => {
|
|||||||
e.target.blur()
|
e.target.blur()
|
||||||
toggleServerSelection(true)
|
toggleServerSelection(true)
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// Update Mojang Status Color
|
// Update Mojang Status Color
|
||||||
const refreshMojangStatuses = async function(){
|
const refreshMojangStatuses = async function(){
|
||||||
loggerLanding.log('Refreshing Mojang Statuses..')
|
loggerLanding.log('Refreshing Mojang Statuses..')
|
||||||
@ -217,7 +217,7 @@ const refreshMojangStatuses = async function(){
|
|||||||
document.getElementById('mojangStatusNonEssentialContainer').innerHTML = tooltipNonEssentialHTML
|
document.getElementById('mojangStatusNonEssentialContainer').innerHTML = tooltipNonEssentialHTML
|
||||||
document.getElementById('mojang_status_icon').style.color = MojangRestAPI.statusToHex(status)
|
document.getElementById('mojang_status_icon').style.color = MojangRestAPI.statusToHex(status)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
const refreshServerStatus = async function(fade = false){
|
const refreshServerStatus = async function(fade = false){
|
||||||
loggerLanding.log('Refreshing Server Status')
|
loggerLanding.log('Refreshing Server Status')
|
||||||
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
|
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
|
||||||
@ -249,7 +249,7 @@ const refreshServerStatus = async function(fade = false){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
refreshMojangStatuses()
|
refreshMojangStatuses()
|
||||||
// Server Status is refreshed in uibinder.js on distributionIndexDone.
|
// Server Status is refreshed in uibinder.js on distributionIndexDone.
|
||||||
|
|
||||||
@ -830,7 +830,7 @@ function slide_(up){
|
|||||||
newsBtn.style.top = '10px'
|
newsBtn.style.top = '10px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// Bind news button.
|
// Bind news button.
|
||||||
document.getElementById('newsButton').onclick = () => {
|
document.getElementById('newsButton').onclick = () => {
|
||||||
// Toggle tabbing.
|
// Toggle tabbing.
|
||||||
@ -861,7 +861,7 @@ let newsLoadingListener = null
|
|||||||
* Set the news loading animation.
|
* Set the news loading animation.
|
||||||
*
|
*
|
||||||
* @param {boolean} val True to set loading animation, otherwise false.
|
* @param {boolean} val True to set loading animation, otherwise false.
|
||||||
*/
|
*//*
|
||||||
function setNewsLoading(val){
|
function setNewsLoading(val){
|
||||||
if(val){
|
if(val){
|
||||||
const nLStr = 'Vérification des actualitées'
|
const nLStr = 'Vérification des actualitées'
|
||||||
@ -904,7 +904,7 @@ newsArticleContentScrollable.onscroll = (e) => {
|
|||||||
*
|
*
|
||||||
* @returns {Promise.<void>} A promise which resolves when the news
|
* @returns {Promise.<void>} A promise which resolves when the news
|
||||||
* content has finished loading and transitioning.
|
* content has finished loading and transitioning.
|
||||||
*/
|
*//*
|
||||||
function reloadNews(){
|
function reloadNews(){
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
$('#newsContent').fadeOut(250, () => {
|
$('#newsContent').fadeOut(250, () => {
|
||||||
@ -920,7 +920,7 @@ let newsAlertShown = false
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the news alert indicating there is new news.
|
* Show the news alert indicating there is new news.
|
||||||
*/
|
*//*
|
||||||
function showNewsAlert(){
|
function showNewsAlert(){
|
||||||
newsAlertShown = true
|
newsAlertShown = true
|
||||||
$(newsButtonAlert).fadeIn(250)
|
$(newsButtonAlert).fadeIn(250)
|
||||||
@ -932,7 +932,7 @@ function showNewsAlert(){
|
|||||||
*
|
*
|
||||||
* @returns {Promise.<void>} A promise which resolves when the news
|
* @returns {Promise.<void>} A promise which resolves when the news
|
||||||
* content has finished loading and transitioning.
|
* content has finished loading and transitioning.
|
||||||
*/
|
*//*
|
||||||
function initNews(){
|
function initNews(){
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -104,9 +104,9 @@ function showMainUI(data){
|
|||||||
|
|
||||||
}, 750)
|
}, 750)
|
||||||
// Disable tabbing to the news container.
|
// Disable tabbing to the news container.
|
||||||
initNews().then(() => {
|
/*initNews().then(() => {
|
||||||
$('#newsContainer *').attr('tabindex', '-1')
|
$('#newsContainer *').attr('tabindex', '-1')
|
||||||
})
|
})*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function showFatalStartupError(){
|
function showFatalStartupError(){
|
||||||
@ -135,7 +135,7 @@ function showFatalStartupError(){
|
|||||||
function onDistroRefresh(data){
|
function onDistroRefresh(data){
|
||||||
updateSelectedServer(data.getServer(ConfigManager.getSelectedServer()))
|
updateSelectedServer(data.getServer(ConfigManager.getSelectedServer()))
|
||||||
refreshServerStatus()
|
refreshServerStatus()
|
||||||
initNews()
|
//initNews()
|
||||||
syncModConfigurations(data)
|
syncModConfigurations(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
70
package-lock.json
generated
70
package-lock.json
generated
@ -12,7 +12,7 @@
|
|||||||
"@electron/remote": "^2.0.4",
|
"@electron/remote": "^2.0.4",
|
||||||
"adm-zip": "^0.5.9",
|
"adm-zip": "^0.5.9",
|
||||||
"async": "^3.2.3",
|
"async": "^3.2.3",
|
||||||
"discord-rpc-patch": "^4.0.1",
|
"discord-rpc": "^4.0.1",
|
||||||
"ejs": "^3.1.6",
|
"ejs": "^3.1.6",
|
||||||
"ejs-electron": "^2.1.1",
|
"ejs-electron": "^2.1.1",
|
||||||
"electron-updater": "^4.6.5",
|
"electron-updater": "^4.6.5",
|
||||||
@ -817,6 +817,15 @@
|
|||||||
"tweetnacl": "^0.14.3"
|
"tweetnacl": "^0.14.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/bindings": {
|
||||||
|
"version": "1.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||||
|
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"file-uri-to-path": "1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/bl": {
|
"node_modules/bl": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||||
@ -1435,13 +1444,16 @@
|
|||||||
"node": ">= 0.6.x"
|
"node": ">= 0.6.x"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/discord-rpc-patch": {
|
"node_modules/discord-rpc": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/discord-rpc-patch/-/discord-rpc-patch-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/discord-rpc/-/discord-rpc-4.0.1.tgz",
|
||||||
"integrity": "sha512-rnHZzNzUcSNdPZCRf18Nza6Nir4i3ljO0HIoSRadD0uEQwKa8PgqCf/tLUr/HJyJQ3NuXNHACMsOC6/JRhojmQ==",
|
"integrity": "sha512-HOvHpbq5STRZJjQIBzwoKnQ0jHplbEWFWlPDwXXKm/bILh4nzjcg7mNqll0UY7RsjFoaXA7e/oYb/4lvpda2zA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"ws": "^7.3.1"
|
"ws": "^7.3.1"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"register-scheme": "github:devsnek/node-register-scheme"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/dmg-builder": {
|
"node_modules/dmg-builder": {
|
||||||
@ -1995,6 +2007,12 @@
|
|||||||
"node": "^10.12.0 || >=12.0.0"
|
"node": "^10.12.0 || >=12.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/file-uri-to-path": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"node_modules/filelist": {
|
"node_modules/filelist": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz",
|
||||||
@ -3073,7 +3091,6 @@
|
|||||||
"version": "1.7.2",
|
"version": "1.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
||||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/node-fetch": {
|
"node_modules/node-fetch": {
|
||||||
@ -3590,6 +3607,17 @@
|
|||||||
"url": "https://github.com/sponsors/mysticatea"
|
"url": "https://github.com/sponsors/mysticatea"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/register-scheme": {
|
||||||
|
"version": "0.0.2",
|
||||||
|
"resolved": "git+ssh://git@github.com/devsnek/node-register-scheme.git#e7cc9a63a1f512565da44cb57316d9fb10750e17",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"bindings": "^1.3.0",
|
||||||
|
"node-addon-api": "^1.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/registry-auth-token": {
|
"node_modules/registry-auth-token": {
|
||||||
"version": "4.2.1",
|
"version": "4.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz",
|
||||||
@ -5197,6 +5225,15 @@
|
|||||||
"tweetnacl": "^0.14.3"
|
"tweetnacl": "^0.14.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"bindings": {
|
||||||
|
"version": "1.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||||
|
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"file-uri-to-path": "1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"bl": {
|
"bl": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||||
@ -5690,12 +5727,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"discord-rpc-patch": {
|
"discord-rpc": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/discord-rpc-patch/-/discord-rpc-patch-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/discord-rpc/-/discord-rpc-4.0.1.tgz",
|
||||||
"integrity": "sha512-rnHZzNzUcSNdPZCRf18Nza6Nir4i3ljO0HIoSRadD0uEQwKa8PgqCf/tLUr/HJyJQ3NuXNHACMsOC6/JRhojmQ==",
|
"integrity": "sha512-HOvHpbq5STRZJjQIBzwoKnQ0jHplbEWFWlPDwXXKm/bILh4nzjcg7mNqll0UY7RsjFoaXA7e/oYb/4lvpda2zA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
|
"register-scheme": "github:devsnek/node-register-scheme",
|
||||||
"ws": "^7.3.1"
|
"ws": "^7.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -6137,6 +6175,12 @@
|
|||||||
"flat-cache": "^3.0.4"
|
"flat-cache": "^3.0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"file-uri-to-path": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"filelist": {
|
"filelist": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz",
|
||||||
@ -6964,7 +7008,6 @@
|
|||||||
"version": "1.7.2",
|
"version": "1.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz",
|
||||||
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==",
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"node-fetch": {
|
"node-fetch": {
|
||||||
@ -7359,6 +7402,15 @@
|
|||||||
"integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
|
"integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"register-scheme": {
|
||||||
|
"version": "git+ssh://git@github.com/devsnek/node-register-scheme.git#e7cc9a63a1f512565da44cb57316d9fb10750e17",
|
||||||
|
"from": "register-scheme@github:devsnek/node-register-scheme",
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"bindings": "^1.3.0",
|
||||||
|
"node-addon-api": "^1.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"registry-auth-token": {
|
"registry-auth-token": {
|
||||||
"version": "4.2.1",
|
"version": "4.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz",
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"@electron/remote": "^2.0.4",
|
"@electron/remote": "^2.0.4",
|
||||||
"adm-zip": "^0.5.9",
|
"adm-zip": "^0.5.9",
|
||||||
"async": "^3.2.3",
|
"async": "^3.2.3",
|
||||||
"discord-rpc-patch": "^4.0.1",
|
"discord-rpc": "^4.0.1",
|
||||||
"ejs": "^3.1.6",
|
"ejs": "^3.1.6",
|
||||||
"ejs-electron": "^2.1.1",
|
"ejs-electron": "^2.1.1",
|
||||||
"electron-updater": "^4.6.5",
|
"electron-updater": "^4.6.5",
|
||||||
|
Loading…
Reference in New Issue
Block a user