Revert "Merge pull request #11 from VicariousNetwork/refresh-attempt2"

This reverts commit 206de5d4fd, reversing
changes made to b3846d86b0.
This commit is contained in:
Peter 2021-07-13 14:22:22 +01:00
parent da9059ae8a
commit e7c0af5283
17 changed files with 76 additions and 382 deletions

View File

@ -3105,19 +3105,6 @@ input:checked + .toggleSwitchSlider:before {
height: 23px;
}
#refreshSVG {
fill: #ffffff;
height: 15px;
}
#refreshSVG:hover {
height: 25px;
fill: #ffffff;
}
#refreshMediaButton[inprogress] #refreshSVG {
animation: spin 0.8s infinite;
}
/* Settings tooltip styles. */
#settingsTooltip {
visibility: hidden;

View File

@ -1,8 +0,0 @@
<svg id="Capa_1" enable-background="new 0 0 515.556 515.556" height="512" viewBox="0 0 515.556 515.556" width="512" xmlns="http://www.w3.org/2000/svg">
<defs>
<style>.cls-1{fill:none;}.cls-2{clip-path:url(#clip-path);}</style>
<clipPath id="clip-path"><rect class="cls-1" x="45.65" y="42.62" width="49.58" height="52.43"/></clipPath>
</defs>
<title>refresh</title>
<path d="m418.889 290c0 88.832-72.28 161.111-161.111 161.111s-161.111-72.279-161.111-161.111c0-77.798 55.445-142.882 128.889-157.855v61.188l96.667-96.667-96.667-96.666v67.017c-109.124 15.718-193.334 109.578-193.334 222.983 0 124.373 101.182 225.556 225.556 225.556s225.556-101.182 225.556-225.556z"/>
</svg>

Before

Width:  |  Height:  |  Size: 704 B

View File

@ -21,22 +21,23 @@ exports.getLauncherDirectory = function(){
}
/**
* Retrieve the ETag version for the current stored distribution file
* Retrieve the file hash for the current stored distribution file
*
* @returns {string} The absolute path of the launcher directory.
*/
exports.getDistributionVersion = function(){
return config.distributionVersion
exports.getDistributionHash = function(){
return config.distributionHash
}
/**
* Stores the current distribution ETag version into the configuration
* Stores the current distribution file hash into the configuration
*
* @returns {string} The absolute path of the launcher directory.
*/
exports.setDistributionVersion = function(version){
config.distributionVersion = version
exports.setDistributionHash = function(hash){
config.distributionHash = hash
}
/**
* Get the launcher's data directory. This is where all files related
* to game launch are installed (common, instances, java, etc).
@ -85,12 +86,13 @@ exports.getAbsoluteMinRAM = function(){
exports.getAbsoluteMaxRAM = function(){
const mem = os.totalmem()
return Math.floor((mem/1000000000))
const gT16 = mem-16000000000
return Math.floor((mem-1000000000-(gT16 > 0 ? (Number.parseInt(gT16/8) + 16000000000/4) : mem/4))/1000000000)
}
function resolveMaxRAM(){
const mem = os.totalmem()
return mem >= 16000000000 ? '8G' : (mem >= 8000000000 ? '6G' : (mem >= 6000000000 ? '4G' : '2G'))
return mem >= 8000000000 ? '4G' : (mem >= 6000000000 ? '3G' : '2G')
}
function resolveMinRAM(){
@ -113,8 +115,7 @@ const DEFAULT_CONFIG = {
'-XX:+UseConcMarkSweepGC',
'-XX:+CMSIncrementalMode',
'-XX:-UseAdaptiveSizePolicy',
'-Xmn128M',
'-Dfml.loginTimeout=180'
'-Xmn128M'
],
},
game: {
@ -127,7 +128,6 @@ const DEFAULT_CONFIG = {
},
launcher: {
allowPrerelease: false,
discordIntegration: true,
dataDirectory: dataPath,
serverCodes: []
}
@ -138,7 +138,7 @@ const DEFAULT_CONFIG = {
dismissed: false
},
clientToken: null,
distributionVersion: null,
distributionHash: null,
selectedServer: null, // Resolved
selectedAccount: null,
authenticationDatabase: {},
@ -797,23 +797,4 @@ exports.getAllowPrerelease = function(def = false){
*/
exports.setAllowPrerelease = function(allowPrerelease){
config.settings.launcher.allowPrerelease = allowPrerelease
}
/**
* Check if the launcher should enable discord presence features
*
* @param {boolean} def Optional. If true, the default value will be returned.
* @returns {boolean} Whether or not the launcher should enable discord presence features
*/
exports.getDiscordIntegration = function(def = false){
return !def ? config.settings.launcher.discordIntegration : DEFAULT_CONFIG.settings.launcher.discordIntegration
}
/**
* Change the status of whether or not the launcher should denable discord presence features
*
* @param {boolean} discordIntegration Whether or not the launcher should enable discord presence features
*/
exports.setDiscordIntegration = function(discordIntegration){
config.settings.launcher.discordIntegration = discordIntegration
}

View File

@ -6,14 +6,16 @@ const {Client} = require('discord-rpc')
let client
let activity
exports.initRPC = function(genSettings, servSettings = null, initialDetails = 'Waiting for Client..'){
logger.log('Now Loading Discord RPC')
exports.initRPC = function(genSettings, servSettings, initialDetails = 'Waiting for Client..'){
client = new Client({ transport: 'ipc' })
activity = {
details: initialDetails,
largeImageKey: genSettings.smallImageKey,
largeImageText: genSettings.smallImageText,
state: 'Modpack: ' + servSettings.shortId,
largeImageKey: servSettings.largeImageKey,
largeImageText: servSettings.largeImageText,
smallImageKey: genSettings.smallImageKey,
smallImageText: genSettings.smallImageText,
startTimestamp: new Date().getTime(),
instance: false
}
@ -32,55 +34,9 @@ exports.initRPC = function(genSettings, servSettings = null, initialDetails = 'W
})
}
exports.updateState = function(state){
if(client){
activity.state = state
client.setActivity(activity)
logger.log('Updated discord state to: ' + state)
}
}
exports.clearState = function(){
if(client){
activity = {
details: activity.details,
largeImageKey: activity.largeImageKey,
largeImageText: activity.largeImageText,
startTimestamp: activity.startTimestamp,
instance: activity.instance
}
client.setActivity(activity)
logger.log('Cleared the activity state!')
}
}
exports.updateDetails = function(details){
if(client){
activity.details = details
client.setActivity(activity)
logger.log('Updated discord details to: ' + details)
}
}
exports.clearDetails = function(){
if(client){
activity = {
state: activity.state,
largeImageKey: activity.largeImageKey,
largeImageText: activity.largeImageText,
startTimestamp: activity.startTimestamp,
instance: activity.instance
}
logger.log('Cleared the activity details!')
}
}
exports.resetTime = function(){
if(client){
activity.startTimestamp = new Date().getTime()
client.setActivity(activity)
logger.log('Reset the activity time!')
}
activity.details = details
client.setActivity(activity)
}
exports.shutdownRPC = function(){
@ -89,8 +45,4 @@ exports.shutdownRPC = function(){
client.destroy()
client = null
activity = null
}
exports.getClient = function(){
return client
}

View File

@ -1,12 +1,10 @@
const fs = require('fs')
const path = require('path')
const crypto = require('crypto')
const request = require('request')
const ConfigManager = require('./configmanager')
const logger = require('./loggerutil')('%c[DistroManager]', 'color: #a02d2a; font-weight: bold')
const constants = require('../../config/constants')
const isDev = require('../../assets/js/isdev')
const distributionURL = isDev ? constants.DEV_DISTRIBUTION_URL : constants.LIVE_DISTRIBUTION_URL
const ConfigManager = require('./configmanager')
const logger = require('./loggerutil')('%c[DistroManager]', 'color: #a02d2a; font-weight: bold')
/**
* Represents the download information
@ -565,10 +563,10 @@ exports.pullRemote = function(){
return exports.pullLocal()
}
return new Promise((resolve, reject) => {
//const distroURL = 'http://launcher.vicariousnetwork.com/distribution.json'
const distroURL = 'http://launcher.vicariousnetwork.com/distribution.json'
//const distroURL = 'https://gist.githubusercontent.com/dscalzi/53b1ba7a11d26a5c353f9d5ae484b71b/raw/'
const opts = {
url: distributionURL,
url: distroURL,
timeout: 2500
}
const distroDest = path.join(ConfigManager.getLauncherDirectory(), 'distribution.json')
@ -584,7 +582,7 @@ exports.pullRemote = function(){
fs.writeFile(distroDest, body, 'utf-8', (err) => {
if(!err){
ConfigManager.setDistributionVersion(String(resp.headers['etag']))
ConfigManager.setDistributionHash(crypto.createHash('md5').update(body).digest('hex'))
ConfigManager.save()
resolve(data)
return
@ -603,16 +601,13 @@ exports.pullRemote = function(){
/**
* @returns {Promise.<DistroIndex>}
* Pulls the local version of the distribution file, does not require any downloading.
*/
exports.pullLocal = function(){
logger.info('Now preparing to pull distribution from local.')
exports.pullLocal = function(){
return new Promise((resolve, reject) => {
fs.readFile(DEV_MODE ? DEV_PATH : DISTRO_PATH, 'utf-8', (err, d) => {
if(!err){
data = DistroIndex.fromJSON(JSON.parse(d))
resolve(data)
logger.info('Pulled distribution from local.')
return
} else {
reject(err)
@ -622,35 +617,6 @@ exports.pullRemote = function(){
})
}
/**
* @returns {Promise.<DistroIndex>}
* Runs a remote ETag version check on the distribution file. If it matches the locally stored version, grab the local.
*/
exports.pullRemoteIfOutdated = function(){
return new Promise((resolve, reject) => {
request.head(distributionURL, (err, resp) => {
if(!err && resp.statusCode === 200){
const tag = resp.headers['etag']
if(tag === ConfigManager.getDistributionVersion()){
this.pullLocal().then(data => {
resolve(data)
}).catch(err => {
resolve(err)
})
} else {
this.pullRemote().then(data => {
resolve(data)
}).catch(err => {
resolve(err)
})
}
} else {
reject(err)
}
})
})
}
exports.setDevMode = function(value){
if(value){
logger.log('Developer mode enabled.')

View File

@ -37,7 +37,7 @@ function sendLoadFromCacheNotification(data){
}
// Ensure Distribution is downloaded and cached.
DistroManager.pullRemoteIfOutdated().then((data) => {
DistroManager.pullRemote().then((data) => {
logger.log('Loaded distribution index.')
onDistroLoad(data)

View File

@ -72,7 +72,6 @@ function setLaunchPercentage(value, max, percent = ((value/max)*100)){
function setDownloadPercentage(value, max, percent = ((value/max)*100)){
remote.getCurrentWindow().setProgressBar(value/max)
setLaunchPercentage(value, max, percent)
DiscordWrapper.updateDetails('Downloading... (' + percent + '%)')
}
/**
@ -119,61 +118,16 @@ document.getElementById('launch_button').addEventListener('click', function(e){
document.getElementById('settingsMediaButton').onclick = (e) => {
prepareSettings()
switchView(getCurrentView(), VIEWS.settings)
if(hasRPC){
DiscordWrapper.updateDetails('In the Settings...')
DiscordWrapper.clearState()
}
}
document.getElementById('openInstanceMediaButton').onclick = (e) => {
let INSTANCE_PATH = path.join(ConfigManager.getDataDirectory(), 'instances', ConfigManager.getSelectedServer())
let INSTANCES_PATH = path.join(ConfigManager.getDataDirectory(), 'instances')
if(ConfigManager.getSelectedServer() && fs.pathExistsSync(INSTANCE_PATH)){
shell.openPath(INSTANCE_PATH)
} else if (fs.pathExistsSync(INSTANCES_PATH)){
shell.openPath(INSTANCES_PATH)
if(ConfigManager.getSelectedServer()){
shell.openPath(path.join(ConfigManager.getDataDirectory(), 'instances', ConfigManager.getSelectedServer()))
} else {
shell.openPath(ConfigManager.getDataDirectory())
shell.openPath(path.join(ConfigManager.getDataDirectory(), 'instances'))
}
}
document.getElementById('refreshMediaButton').onclick = (e) => {
let ele = document.getElementById('refreshMediaButton')
ele.setAttribute('inprogress', '')
DistroManager.pullRemote().then((data) => {
onDistroRefresh(data)
showMainUI(data)
setOverlayContent(
'Launcher Refreshed!',
'This is a confirmation letting you know that you have manually refreshed your launcher, your server list is now up to date and should be good to go! If you have any problems please do let us know!',
'Great! Thank you.',
'Join our Discord'
)
setOverlayHandler(() => {
toggleOverlay(false)
})
setDismissHandler(() => {
shell.openExternal('https://vcnet.work/discord')
})
toggleOverlay(true, true)
}).catch(err => {
setOverlayContent(
'Error Refreshing Distribution',
'We were unable to grab the latest server information from the internet upon startup, so we have used a previously stored version instead.<br><br>This is not recommended, and you should restart your client to fix this to avoid your modpack files being out of date. If you wish to continue using the launcher, you can try again at any time by pressing the refresh button on the landing screen.<br><br>If this continues to occur, and you are not too sure why, come and see us on Discord!<br><br>Error Code:<br>' + err,
'Understood.',
'Join our Discord'
)
setOverlayHandler(() => {
toggleOverlay(false)
})
setDismissHandler(() => {
shell.openExternal('https://vcnet.work/discord')
})
toggleOverlay(true, true)
ele.removeAttribute('inprogress')
})
}
// Bind avatar overlay button.
document.getElementById('avatarOverlay').onclick = (e) => {
prepareSettings()
@ -308,17 +262,6 @@ const refreshServerStatus = async function(fade = false){
}
function loadDiscord(){
if(!ConfigManager.getDiscordIntegration()) return
const distro = DistroManager.getDistribution()
if(!hasRPC){
if(distro.discord != null){
DiscordWrapper.initRPC(distro.discord, null, '...')
hasRPC = true
}
}
}
refreshMojangStatuses()
// Server Status is refreshed in uibinder.js on distributionIndexDone.
@ -394,7 +337,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
// Show this information to the user.
setOverlayContent(
'No Compatible<br>Java Installation Found',
'In order to join any Vicarious Network Modpack, you need a 64-bit installation of Java 8. Would you like us to install a copy? By installing, you accept <a href="http://www.oracle.com/technetwork/java/javase/terms/license/index.html">Oracle\'s license agreement</a>.',
'In order to join WesterosCraft, you need a 64-bit installation of Java 8. Would you like us to install a copy? By installing, you accept <a href="http://www.oracle.com/technetwork/java/javase/terms/license/index.html">Oracle\'s license agreement</a>.',
'Install Java',
'Install Manually'
)
@ -725,8 +668,7 @@ function dlAsync(login = true){
const onLoadComplete = () => {
toggleLaunchArea(false)
if(hasRPC){
DiscordWrapper.updateDetails('Launching game...')
DiscordWrapper.resetTime()
DiscordWrapper.updateDetails('Loading game..')
}
proc.stdout.on('data', gameStateChange)
proc.stdout.on('data', gameCrashReportListener)
@ -756,7 +698,7 @@ function dlAsync(login = true){
if(SERVER_JOINED_REGEX.test(data)){
DiscordWrapper.updateDetails('Exploring the Realm!')
} else if(GAME_JOINED_REGEX.test(data)){
DiscordWrapper.updateDetails('Sailing to Vicarious Network!')
DiscordWrapper.updateDetails('Sailing to Westeros!')
}
}
@ -801,14 +743,6 @@ function dlAsync(login = true){
proc.stderr.on('data', gameErrorListener)
setLaunchDetails('Done. Enjoy the modpack!')
proc.on('close', (code, signal) => {
if(hasRPC){
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
DiscordWrapper.updateDetails('Ready to Play!')
DiscordWrapper.updateState('Modpack: ' + serv.getName())
DiscordWrapper.resetTime()
}
})
// Init Discord Hook
const distro = DistroManager.getDistribution()
@ -840,30 +774,30 @@ function dlAsync(login = true){
// Begin Validations
// Validate Forge files.
validateServerInformation()
}
function validateServerInformation() {
setLaunchDetails('Loading server information..')
DiscordWrapper.updateDetails('Loading server information...')
DistroManager.pullRemoteIfOutdated().then(data => {
refreshDistributionIndex(true, (data) => {
onDistroRefresh(data)
serv = data.getServer(ConfigManager.getSelectedServer())
aEx.send({task: 'execute', function: 'validateEverything', argsArr: [ConfigManager.getSelectedServer(), DistroManager.isDevMode()]})
}).catch(err => {
loggerLaunchSuite.error('Unable to refresh distribution index.', err)
if(DistroManager.getDistribution() == null){
showLaunchFailure('Fatal Error', 'Could not load a copy of the distribution index. See the console (CTRL + Shift + i) for more details.')
// Disconnect from AssetExec
aEx.disconnect()
} else {
}, (err) => {
loggerLaunchSuite.log('Error while fetching a fresh copy of the distribution index.', err)
refreshDistributionIndex(false, (data) => {
onDistroRefresh(data)
serv = data.getServer(ConfigManager.getSelectedServer())
aEx.send({task: 'execute', function: 'validateEverything', argsArr: [ConfigManager.getSelectedServer(), DistroManager.isDevMode()]})
}
}, (err) => {
loggerLaunchSuite.error('Unable to refresh distribution index.', err)
if(DistroManager.getDistribution() == null){
showLaunchFailure('Fatal Error', 'Could not load a copy of the distribution index. See the console (CTRL + Shift + i) for more details.')
// Disconnect from AssetExec
aEx.disconnect()
} else {
serv = data.getServer(ConfigManager.getSelectedServer())
aEx.send({task: 'execute', function: 'validateEverything', argsArr: [ConfigManager.getSelectedServer(), DistroManager.isDevMode()]})
}
})
})
}
@ -973,15 +907,6 @@ document.getElementById('newsButton').onclick = () => {
if(newsActive){
$('#landingContainer *').removeAttr('tabindex')
$('#newsContainer *').attr('tabindex', '-1')
if(hasRPC){
if(ConfigManager.getSelectedServer()){
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
DiscordWrapper.updateDetails('Ready to Play!')
DiscordWrapper.updateState('Modpack: ' + serv.getName())
} else {
DiscordWrapper.updateDetails('Landing Screen...')
}
}
} else {
$('#landingContainer *').attr('tabindex', '-1')
$('#newsContainer, #newsContainer *, #lower, #lower #center *').removeAttr('tabindex')
@ -990,10 +915,6 @@ document.getElementById('newsButton').onclick = () => {
newsAlertShown = false
ConfigManager.setNewsCacheDismissed(true)
ConfigManager.save()
if(hasRPC){
DiscordWrapper.updateDetails('Reading the News...')
DiscordWrapper.clearState()
}
}
}
slide_(!newsActive)

View File

@ -249,22 +249,6 @@ loginCancelButton.onclick = (e) => {
loginViewCancelHandler()
loginViewCancelHandler = null
}
if(loginViewOnSuccess === VIEWS.settings){
if(hasRPC){
DiscordWrapper.updateDetails('In the Settings...')
DiscordWrapper.clearState()
}
} else {
if(hasRPC){
if(ConfigManager.getSelectedServer()){
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
DiscordWrapper.updateDetails('Ready to Play!')
DiscordWrapper.updateState('Server: ' + serv.getName())
} else {
DiscordWrapper.updateDetails('Landing Screen...')
}
}
}
})
}
@ -289,20 +273,6 @@ loginButton.addEventListener('click', () => {
// Temporary workaround
if(loginViewOnSuccess === VIEWS.settings){
prepareSettings()
if(hasRPC){
DiscordWrapper.updateDetails('In the Settings...')
DiscordWrapper.clearState()
}
} else {
if(hasRPC){
if(ConfigManager.getSelectedServer()){
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
DiscordWrapper.updateDetails('Ready to Play!')
DiscordWrapper.updateState('Modpack: ' + serv.getName())
} else {
DiscordWrapper.updateDetails('Landing Screen...')
}
}
}
loginViewOnSuccess = VIEWS.landing // Reset this for good measure.
loginCancelEnabled(false) // Reset this for good measure.

View File

@ -120,7 +120,6 @@ function toggleOverlay(toggleState, dismissable = false, content = 'overlayConte
function toggleServerSelection(toggleState) {
prepareServerSelectionList()
toggleOverlay(toggleState, true, 'serverSelectContent')
DiscordWrapper.updateDetails('Selecting modpack...')
}
/**
@ -180,8 +179,6 @@ document.getElementById('serverSelectConfirm').addEventListener('click', () => {
updateSelectedServer(serv)
refreshServerStatus(true)
toggleOverlay(false)
DiscordWrapper.updateDetails('Ready to Play!')
DiscordWrapper.updateState('Modpack: ' + serv.getName())
return
}
}

View File

@ -312,15 +312,6 @@ settingsNavDone.onclick = () => {
saveDropinModConfiguration()
saveShaderpackSettings()
switchView(getCurrentView(), VIEWS.landing)
if(hasRPC){
if(ConfigManager.getSelectedServer()){
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
DiscordWrapper.updateDetails('Ready to Play!')
DiscordWrapper.updateState('Modpack: ' + serv.getName())
} else {
DiscordWrapper.updateDetails('Landing Screen...')
}
}
}
/**
@ -333,10 +324,6 @@ document.getElementById('settingsAddAccount').onclick = (e) => {
loginViewOnCancel = VIEWS.settings
loginViewOnSuccess = VIEWS.settings
loginCancelEnabled(true)
if(hasRPC){
DiscordWrapper.updateDetails('Adding an Account...')
DiscordWrapper.clearState()
}
})
}
@ -423,10 +410,6 @@ function bindAuthAccountLogOut(){
processLogOut(val, isLastAccount)
toggleOverlay(false)
switchView(getCurrentView(), VIEWS.login)
if(hasRPC){
DiscordWrapper.updateDetails('Adding an Account...')
DiscordWrapper.clearState()
}
})
setDismissHandler(() => {
toggleOverlay(false)
@ -1105,9 +1088,9 @@ settingsMinRAMRange.onchange = (e) => {
const max = (os.totalmem()-1000000000)/1000000000
// Change range bar color based on the selected value.
if(sMinV >= max/1.25){
if(sMinV >= max/2){
bar.style.background = '#e86060'
} else if(sMinV >= max/2) {
} else if(sMinV >= max/4) {
bar.style.background = '#e8e18b'
} else {
bar.style.background = null
@ -1137,9 +1120,9 @@ settingsMaxRAMRange.onchange = (e) => {
const max = (os.totalmem()-1000000000)/1000000000
// Change range bar color based on the selected value.
if(sMaxV >= max/1.25){
if(sMaxV >= max/2){
bar.style.background = '#e86060'
} else if(sMaxV >= max/2) {
} else if(sMaxV >= max/4) {
bar.style.background = '#e8e18b'
} else {
bar.style.background = null

View File

@ -65,7 +65,6 @@ function showMainUI(data){
prepareSettings(true)
updateSelectedServer(data.getServer(ConfigManager.getSelectedServer()))
refreshServerStatus()
loadDiscord()
setTimeout(() => {
document.getElementById('frameBar').style.backgroundColor = 'rgba(0, 0, 0, 0.5)'
document.body.style.backgroundImage = `url('assets/images/backgrounds/${document.body.getAttribute('bkid')}.jpg')`
@ -82,30 +81,13 @@ function showMainUI(data){
if(ConfigManager.isFirstLaunch()){
currentView = VIEWS.welcome
$(VIEWS.welcome).fadeIn(1000)
if(hasRPC){
DiscordWrapper.updateDetails('Welcome and continue.')
DiscordWrapper.updateState('Launcher Setup')
}
} else {
if(isLoggedIn){
currentView = VIEWS.landing
$(VIEWS.landing).fadeIn(1000)
if(hasRPC && !ConfigManager.isFirstLaunch()){
if(ConfigManager.getSelectedServer()){
const serv = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer())
DiscordWrapper.updateDetails('Ready to Play!')
DiscordWrapper.updateState('Modpack: ' + serv.getName())
} else {
DiscordWrapper.updateDetails('Landing Screen...')
}
}
} else {
currentView = VIEWS.login
$(VIEWS.login).fadeIn(1000)
if(hasRPC){
DiscordWrapper.updateDetails('Adding an Account...')
DiscordWrapper.clearState()
}
}
}
@ -128,17 +110,14 @@ function showFatalStartupError(){
document.getElementById('overlayContainer').style.background = 'none'
setOverlayContent(
'Fatal Error: Unable to Load Distribution Index',
'A connection could not be established to our servers to download the distribution index. No local copies were available to load. <br><br>The distribution index is an essential file which provides the latest server information. The launcher is unable to start without it. Ensure you are connected to the internet and relaunch the application. <br><br>It is very possible that the launcher has updated and changed the location for the distribution index file. We would recommend installing the latest version of the launcher from our releases page. <br><br>If you continue to have issues, please contact us on the Vicarious Network Discord server.',
'Download Latest Version',
'Join our Discord'
'A connection could not be established to our servers to download the distribution index. No local copies were available to load. <br><br>The distribution index is an essential file which provides the latest server information. The launcher is unable to start without it. Ensure you are connected to the internet and relaunch the application.',
'Close'
)
setOverlayHandler(() => {
shell.openExternal('https://github.com/VicariousNetwork/HeliosLauncher/releases/latest')
const window = remote.getCurrentWindow()
window.close()
})
setDismissHandler(() => {
shell.openExternal('https://vcnet.work/discord')
})
toggleOverlay(true, true)
toggleOverlay(true)
})
}, 750)
}
@ -323,17 +302,17 @@ function mergeModConfiguration(o, n, nReq = false){
return n
}
//function refreshDistributionIndex(remote, onSuccess, onError){
// if(remote){
// DistroManager.pullRemote()
// .then(onSuccess)
// .catch(onError)
// } else {
// DistroManager.pullLocal()
// .then(onSuccess)
// .catch(onError)
// }
//}
function refreshDistributionIndex(remote, onSuccess, onError){
if(remote){
DistroManager.pullRemote()
.then(onSuccess)
.catch(onError)
} else {
DistroManager.pullLocal()
.then(onSuccess)
.catch(onError)
}
}
async function validateSelectedAccount(){
const selectedAcc = ConfigManager.getSelectedAccount()
@ -364,10 +343,6 @@ async function validateSelectedAccount(){
}
toggleOverlay(false)
switchView(getCurrentView(), VIEWS.login)
if(hasRPC){
DiscordWrapper.updateDetails('Adding an Account...')
DiscordWrapper.clearState()
}
})
setDismissHandler(() => {
if(accLen > 1){

View File

@ -141,7 +141,7 @@ document.addEventListener('readystatechange', function () {
Array.from(document.getElementsByClassName('fCb')).map((val) => {
val.addEventListener('click', e => {
const window = remote.getCurrentWindow()
window.destroy()
window.close()
})
})

View File

@ -3,8 +3,4 @@
*/
document.getElementById('welcomeButton').addEventListener('click', e => {
switchView(VIEWS.welcome, VIEWS.login)
if(hasRPC){
DiscordWrapper.updateDetails('Adding an Account...')
DiscordWrapper.updateState('Launcher Setup')
}
})

View File

@ -1,5 +0,0 @@
const APP_DATA_NAME = 'Vicarious Network Launcher'
const LIVE_DISTRIBUTION_URL = 'https://launcher.vicariousnetwork.com/distribution.json'
const DEV_DISTRIBUTION_URL = 'https://launcher.vicariousnetwork.com/dev_distribution.json'
module.exports = { APP_DATA_NAME, LIVE_DISTRIBUTION_URL, DEV_DISTRIBUTION_URL }

View File

@ -25,13 +25,8 @@
</svg>
<div id="settingsTooltip">Settings</div>
</button>
<button class="mediaButton" id="refreshMediaButton">
<svg id="refreshSVG" class="mediaSVG" viewBox="0 0 515.556 515.556">
<path d="m418.889 290c0 88.832-72.28 161.111-161.111 161.111s-161.111-72.279-161.111-161.111c0-77.798 55.445-142.882 128.889-157.855v61.188l96.667-96.667-96.667-96.666v67.017c-109.124 15.718-193.334 109.578-193.334 222.983 0 124.373 101.182 225.556 225.556 225.556s225.556-101.182 225.556-225.556z" id="svg_4" class=""/>
</svg>
<div id="settingsTooltip">Refresh</div>
</button>
<button class="mediaButton" id="openInstanceMediaButton">
<div class="mediaContainer" id="settingsMediaContainer">
<button class="mediaButton" id="openInstanceMediaButton">
<svg id="openInstanceSVG" class="mediaSVG" viewBox="0 0 198.084 198.084">
<g>
<path d="M197.951,77.097l-16.024,78.532c-1.222,5.987-6.488,10.288-12.599,10.288H20.196c-8.135,0-14.225-7.459-12.599-15.429
@ -41,8 +36,8 @@
v92.186L12.142,78.198z"/>
</g>
</svg>
<div id="settingsTooltip">Data Folder</div>
</button>
</div>
</div>
</div>
<div class="mediaDivider"></div>

View File

@ -179,7 +179,7 @@
<span id="settingsMinRAMLabel" class="settingsMemoryLabel">3G</span>
</div>
</div>
<div id="settingsMemoryDesc">The recommended minimum RAM is 4-6 gigabytes. Setting the minimum and maximum values to the same value may reduce lag. In order to use the memory you have allocated, it must be free and available in your system. Allocating all of your total memory is not recommended.</div>
<div id="settingsMemoryDesc">The recommended minimum RAM is 3 gigabytes. Setting the minimum and maximum values to the same value may reduce lag. In order to use the memory you have allocated, it must be free and available in your system. Allocating all of your total memory is not recommended.</div>
</div>
<div id="settingsMemoryContentRight">
<div id="settingsMemoryStatus">
@ -259,18 +259,6 @@
</label>
</div>
</div>
<div class="settingsFieldContainer">
<div class="settingsFieldLeft">
<span class="settingsFieldTitle">Enable Discord Integration</span>
<span class="settingsFieldDesc">This option will allow the launcher to control your presence on Discord. If you close the launcher at any time, this feature will no longer work.</span>
</div>
<div class="settingsFieldRight">
<label class="toggleSwitch">
<input type="checkbox" cValue="DiscordIntegration">
<span class="toggleSwitchSlider"></span>
</label>
</div>
</div>
<div class="settingsFileSelContainer">
<div class="settingsFileSelContent">
<div class="settingsFieldTitle" id="settingsDataDirTitle">Data Directory</div>

View File

@ -13,10 +13,6 @@ const { pathToFileURL } = require('url')
const redirectUriPrefix = 'https://login.microsoftonline.com/common/oauth2/nativeclient?'
const clientID = '71a6e661-ee73-4166-a21a-26ce6e15b3de'
if(isDev) {
console.log('Is in dev mode!')
}
// Setup auto updater.
function initAutoUpdater(event, data) {