mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 11:42:14 -08:00
v0.0.1-alpha.6
Fixed AuthManager sending incorrect client token to the auth endpoint. Fixed minor issues with the validate selected function. Fixed minor issue related to UI transitions. Added account validations on startup and when account is switched. Updated dependencies.
This commit is contained in:
parent
5a692d9088
commit
daa6faac86
@ -25,7 +25,7 @@ const Mojang = require('./mojang.js')
|
||||
*/
|
||||
exports.addAccount = async function(username, password){
|
||||
try {
|
||||
const session = await Mojang.authenticate(username, password, ConfigManager.getClientToken)
|
||||
const session = await Mojang.authenticate(username, password, ConfigManager.getClientToken())
|
||||
const ret = ConfigManager.addAuthAccount(session.selectedProfile.id, session.accessToken, username, session.selectedProfile.name)
|
||||
ConfigManager.save()
|
||||
return ret
|
||||
|
@ -236,6 +236,8 @@ loginButton.addEventListener('click', () => {
|
||||
switchView(VIEWS.login, VIEWS.landing, 500, 500, () => {
|
||||
loginUsername.value = ''
|
||||
loginPassword.value = ''
|
||||
$('.circle-loader').toggleClass('load-complete')
|
||||
$('.checkmark').toggle()
|
||||
loginLoading(false)
|
||||
loginButton.innerHTML = loginButton.innerHTML.replace('SUCCESS', 'LOGIN')
|
||||
formDisabled(false)
|
||||
|
@ -248,12 +248,8 @@ function populateServerListings(){
|
||||
function populateAccountListings(){
|
||||
const accountsObj = ConfigManager.getAuthAccounts()
|
||||
const accounts = Array.from(Object.keys(accountsObj), v=>accountsObj[v]);
|
||||
const selectedUUID = ConfigManager.getSelectedAccount().uuid
|
||||
let htmlString = ``
|
||||
for(let i=0; i<accounts.length; i++){
|
||||
if(accounts[i].uuid === selectedUUID) {
|
||||
continue
|
||||
}
|
||||
htmlString += `<button class="accountListing" uuid="${accounts[i].uuid}" ${i===0 ? 'selected' : ''}>
|
||||
<img src="https://crafatar.com/renders/head/${accounts[i].uuid}?scale=2&default=MHF_Steve&overlay">
|
||||
<div class="accountListingName">${accounts[i].displayName}</div>
|
||||
|
@ -13,10 +13,10 @@ let fatalStartupError = false
|
||||
|
||||
// Mapping of each view to their container IDs.
|
||||
const VIEWS = {
|
||||
landing: 'landingContainer',
|
||||
login: 'loginContainer',
|
||||
settings: 'settingsContainer',
|
||||
welcome: 'welcomeContainer'
|
||||
landing: '#landingContainer',
|
||||
login: '#loginContainer',
|
||||
settings: '#settingsContainer',
|
||||
welcome: '#welcomeContainer'
|
||||
}
|
||||
|
||||
// The currently shown view container.
|
||||
@ -35,10 +35,10 @@ let currentView = VIEWS.landing
|
||||
* fades in.
|
||||
*/
|
||||
function switchView(current, next, currentFadeTime = 500, nextFadeTime = 500, onCurrentFade = () => {}, onNextFade = () => {}){
|
||||
currentView = current
|
||||
$(`#${current}`).fadeOut(currentFadeTime, () => {
|
||||
currentView = next
|
||||
$(`${current}`).fadeOut(currentFadeTime, () => {
|
||||
onCurrentFade()
|
||||
$(`#${next}`).fadeIn(nextFadeTime, () => {
|
||||
$(`${next}`).fadeIn(nextFadeTime, () => {
|
||||
onNextFade()
|
||||
})
|
||||
})
|
||||
@ -61,12 +61,22 @@ function showMainUI(){
|
||||
document.body.style.backgroundImage = `url('assets/images/backgrounds/${document.body.getAttribute('bkid')}.jpg')`
|
||||
$('#main').show()
|
||||
|
||||
//validateSelectedAccount()
|
||||
// If this is enabled in a development environment we'll get ratelimited.
|
||||
// The relaunch frequency is usually far too high.
|
||||
if(!isDev){
|
||||
validateSelectedAccount().then((v) => {
|
||||
if(v){
|
||||
console.log('%c[AuthManager]', 'color: #209b07; font-weight: bold', 'Account access token validated.')
|
||||
} else {
|
||||
console.log('%c[AuthManager]', 'color: #a02d2a; font-weight: bold', 'Account access token is invalid.')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if(ConfigManager.isFirstLaunch()){
|
||||
$('#welcomeContainer').fadeIn(1000)
|
||||
$(VIEWS.welcome).fadeIn(1000)
|
||||
} else {
|
||||
$('#landingContainer').fadeIn(1000)
|
||||
$(VIEWS.landing).fadeIn(1000)
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
@ -123,10 +133,12 @@ async function validateSelectedAccount(){
|
||||
if(selectedAcc != null){
|
||||
const val = await AuthManager.validateSelected()
|
||||
if(!val){
|
||||
ConfigManager.removeAuthAccount(selectedAcc.uuid)
|
||||
ConfigManager.save()
|
||||
const accLen = Object.keys(ConfigManager.getAuthAccounts()).length
|
||||
setOverlayContent(
|
||||
'Failed to Refresh Login',
|
||||
`We were unable to refresh the login for <strong>${selectedAcc.displayName}</strong>. Please ${accLen > 1 ? 'select another account or ' : ''} login again.`,
|
||||
`We were unable to refresh the login for <strong>${selectedAcc.displayName}</strong>. Please ${accLen > 0 ? 'select another account or ' : ''} login again.`,
|
||||
'Login',
|
||||
'Select Another Account'
|
||||
)
|
||||
@ -137,25 +149,20 @@ async function validateSelectedAccount(){
|
||||
toggleOverlay(false)
|
||||
})
|
||||
setDismissHandler(() => {
|
||||
if(accLen > 2){
|
||||
if(accLen > 1){
|
||||
prepareAccountSelectionList()
|
||||
$('#overlayContent').fadeOut(250, () => {
|
||||
$('#accountSelectContent').fadeIn(250)
|
||||
})
|
||||
} else {
|
||||
const accountsObj = ConfigManager.getAuthAccounts()
|
||||
const accounts = Array.from(Object.keys(accountsObj), v=>accountsObj[v]);
|
||||
const selectedUUID = ConfigManager.getSelectedAccount().uuid
|
||||
for(let i=0; i<accounts.length; i++){
|
||||
if(accounts[i].uuid !== selectedUUID){
|
||||
setSelectedAccount(accounts[i].uuid)
|
||||
const accounts = Array.from(Object.keys(accountsObj), v => accountsObj[v]);
|
||||
// This function validates the account switch.
|
||||
setSelectedAccount(accounts[0].uuid)
|
||||
toggleOverlay(false)
|
||||
validateSelectedAccount()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
toggleOverlay(true, accLen > 1)
|
||||
toggleOverlay(true, accLen > 0)
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
@ -174,7 +181,7 @@ function setSelectedAccount(uuid){
|
||||
const authAcc = ConfigManager.setSelectedAccount(uuid)
|
||||
ConfigManager.save()
|
||||
updateSelectedAccount(authAcc)
|
||||
//validateSelectedAccount()
|
||||
validateSelectedAccount()
|
||||
}
|
||||
|
||||
// Synchronous Listener
|
||||
|
@ -56,14 +56,4 @@
|
||||
</form>
|
||||
</div>
|
||||
<script src="./assets/js/scripts/login.js"></script>
|
||||
<!-- Will reuse this down the line, then it will be removed from this file. -->
|
||||
<!--<div id="loginLoading">
|
||||
<div id="loginLoadingContent">
|
||||
<div id="loadSpinnerContainer">
|
||||
<img id="loadCenterImage" src="assets/images/westeroscraftlogo1.png">
|
||||
<img id="loadSpinnerImage" class="rotating" src="assets/images/westeroscraftlogo2.png">
|
||||
</div>
|
||||
<span id="loadDescText">LOGGING IN</span>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
155
package-lock.json
generated
155
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "westeroscraftlauncher",
|
||||
"version": "0.0.1-alpha.5",
|
||||
"version": "0.0.1-alpha.6",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -96,9 +96,9 @@
|
||||
}
|
||||
},
|
||||
"app-builder-bin": {
|
||||
"version": "1.9.5",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-1.9.5.tgz",
|
||||
"integrity": "sha512-Uw8jhfww5gYcAvMVgeRZ9cdlXOv+Ivqy4LSbALPMrQrCHHTmfVXETthkhW3cQKdvDo9pRuYn+Q5egSSn04F+Wg==",
|
||||
"version": "1.9.11",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-1.9.11.tgz",
|
||||
"integrity": "sha512-GeB00tbuMeRa5NfYpKAnE3m2Ztj5QKa8pdrYKkg2CxZgyQn3iqJEUzy1EWMS6O1a1pX8wJxPLkEzUghg43bXWQ==",
|
||||
"dev": true
|
||||
},
|
||||
"argparse": {
|
||||
@ -318,13 +318,13 @@
|
||||
"integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA=="
|
||||
},
|
||||
"builder-util": {
|
||||
"version": "5.11.1",
|
||||
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-5.11.1.tgz",
|
||||
"integrity": "sha512-fZu9j33B4VMeUJaeb1q2TubKWrk9tAg2Jwpgjstxk7Mu7sNw7v/XB87/EbpNBlE3RPMrXblG6f8asfCRC8IiNQ==",
|
||||
"version": "5.11.4",
|
||||
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-5.11.4.tgz",
|
||||
"integrity": "sha512-H6KnYwoeA9tEDz0EQNqridZ5YuJiyCX61TyhOMZmLiMnfJCuVfpyXbfYKUDMTAP8vmvjiAYJhbU8THkiHpKljA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"7zip-bin": "~4.0.2",
|
||||
"app-builder-bin": "1.9.5",
|
||||
"app-builder-bin": "1.9.11",
|
||||
"bluebird-lst": "^1.0.5",
|
||||
"builder-util-runtime": "^4.2.1",
|
||||
"chalk": "^2.4.1",
|
||||
@ -725,6 +725,90 @@
|
||||
"js-yaml": "^3.11.0",
|
||||
"parse-color": "^1.0.0",
|
||||
"sanitize-filename": "^1.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"app-builder-bin": {
|
||||
"version": "1.9.5",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-1.9.5.tgz",
|
||||
"integrity": "sha512-Uw8jhfww5gYcAvMVgeRZ9cdlXOv+Ivqy4LSbALPMrQrCHHTmfVXETthkhW3cQKdvDo9pRuYn+Q5egSSn04F+Wg==",
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"electron-builder-lib": {
|
||||
"version": "20.14.7",
|
||||
"resolved": "https://registry.npmjs.org/electron-builder-lib/-/electron-builder-lib-20.14.7.tgz",
|
||||
"integrity": "sha512-sPlpRN5Nea9ZK+nwZcD5ZuGoK2uCj2muQ7enc+9BeXPAxnEu4yYmYanICAi4BQqUdusm4yjjnN9uPowlbvCNzA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"7zip-bin": "~4.0.2",
|
||||
"app-builder-bin": "1.9.5",
|
||||
"async-exit-hook": "^2.0.1",
|
||||
"bluebird-lst": "^1.0.5",
|
||||
"builder-util": "5.11.1",
|
||||
"builder-util-runtime": "4.2.1",
|
||||
"chromium-pickle-js": "^0.2.0",
|
||||
"debug": "^3.1.0",
|
||||
"ejs": "^2.6.1",
|
||||
"electron-osx-sign": "0.4.10",
|
||||
"electron-publish": "20.14.6",
|
||||
"fs-extra-p": "^4.6.0",
|
||||
"hosted-git-info": "^2.6.0",
|
||||
"is-ci": "^1.1.0",
|
||||
"isbinaryfile": "^3.0.2",
|
||||
"js-yaml": "^3.11.0",
|
||||
"lazy-val": "^1.0.3",
|
||||
"minimatch": "^3.0.4",
|
||||
"normalize-package-data": "^2.4.0",
|
||||
"plist": "^3.0.1",
|
||||
"read-config-file": "3.0.1",
|
||||
"sanitize-filename": "^1.6.1",
|
||||
"semver": "^5.5.0",
|
||||
"stream-json": "^0.6.1",
|
||||
"temp-file": "^3.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"builder-util": {
|
||||
"version": "5.11.1",
|
||||
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-5.11.1.tgz",
|
||||
"integrity": "sha512-fZu9j33B4VMeUJaeb1q2TubKWrk9tAg2Jwpgjstxk7Mu7sNw7v/XB87/EbpNBlE3RPMrXblG6f8asfCRC8IiNQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"7zip-bin": "~4.0.2",
|
||||
"app-builder-bin": "1.9.5",
|
||||
"bluebird-lst": "^1.0.5",
|
||||
"builder-util-runtime": "^4.2.1",
|
||||
"chalk": "^2.4.1",
|
||||
"debug": "^3.1.0",
|
||||
"fs-extra-p": "^4.6.0",
|
||||
"is-ci": "^1.1.0",
|
||||
"js-yaml": "^3.11.0",
|
||||
"lazy-val": "^1.0.3",
|
||||
"semver": "^5.5.0",
|
||||
"source-map-support": "^0.5.6",
|
||||
"stat-mode": "^0.2.2",
|
||||
"temp-file": "^3.1.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz",
|
||||
"integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dot-prop": {
|
||||
@ -789,17 +873,17 @@
|
||||
}
|
||||
},
|
||||
"electron-builder": {
|
||||
"version": "20.14.7",
|
||||
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-20.14.7.tgz",
|
||||
"integrity": "sha512-f6k0hDmMof3tKn/RqNMfgNYdSl/UNomFTFw7pizbj8v33iVwCqST02Iqo/xpuXWi0KrJNdBlJvbva1DU/vkYkg==",
|
||||
"version": "20.15.3",
|
||||
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-20.15.3.tgz",
|
||||
"integrity": "sha512-hoZN5+2aFSMH60otpzxYqJAOCxWXdYpLm5c/pMSSyK91LACd0UyLx9IMpFXZadavmHTgf5z/94Blf3/+/2LRgw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bluebird-lst": "^1.0.5",
|
||||
"builder-util": "5.11.1",
|
||||
"builder-util": "5.11.4",
|
||||
"builder-util-runtime": "4.2.1",
|
||||
"chalk": "^2.4.1",
|
||||
"dmg-builder": "4.10.1",
|
||||
"electron-builder-lib": "20.14.7",
|
||||
"electron-builder-lib": "20.15.3",
|
||||
"electron-download-tf": "4.3.4",
|
||||
"fs-extra-p": "^4.6.0",
|
||||
"is-ci": "^1.1.0",
|
||||
@ -885,22 +969,22 @@
|
||||
}
|
||||
},
|
||||
"electron-builder-lib": {
|
||||
"version": "20.14.7",
|
||||
"resolved": "https://registry.npmjs.org/electron-builder-lib/-/electron-builder-lib-20.14.7.tgz",
|
||||
"integrity": "sha512-sPlpRN5Nea9ZK+nwZcD5ZuGoK2uCj2muQ7enc+9BeXPAxnEu4yYmYanICAi4BQqUdusm4yjjnN9uPowlbvCNzA==",
|
||||
"version": "20.15.3",
|
||||
"resolved": "https://registry.npmjs.org/electron-builder-lib/-/electron-builder-lib-20.15.3.tgz",
|
||||
"integrity": "sha512-qOp0zwXCNICEk9IrRR8Q0sTTPvwjQDO2nWzJ/7lMYg7b71GVfF1I3d2IjMgEmrhPzWsF9XAFIWyPduN1aRLYgA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"7zip-bin": "~4.0.2",
|
||||
"app-builder-bin": "1.9.5",
|
||||
"app-builder-bin": "1.9.11",
|
||||
"async-exit-hook": "^2.0.1",
|
||||
"bluebird-lst": "^1.0.5",
|
||||
"builder-util": "5.11.1",
|
||||
"builder-util": "5.11.4",
|
||||
"builder-util-runtime": "4.2.1",
|
||||
"chromium-pickle-js": "^0.2.0",
|
||||
"debug": "^3.1.0",
|
||||
"ejs": "^2.6.1",
|
||||
"electron-osx-sign": "0.4.10",
|
||||
"electron-publish": "20.14.6",
|
||||
"electron-publish": "20.15.0",
|
||||
"fs-extra-p": "^4.6.0",
|
||||
"hosted-git-info": "^2.6.0",
|
||||
"is-ci": "^1.1.0",
|
||||
@ -925,6 +1009,21 @@
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"electron-publish": {
|
||||
"version": "20.15.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-20.15.0.tgz",
|
||||
"integrity": "sha512-0v1jXvbRDlPK5S+LzEZqcvuFHLCSWPKmMYmbDwVheeNRjbJjQLlZyQAINVlV+Ky+yhawChEaAF+dyGLvXEyONg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bluebird-lst": "^1.0.5",
|
||||
"builder-util": "^5.11.2",
|
||||
"builder-util-runtime": "^4.2.1",
|
||||
"chalk": "^2.4.1",
|
||||
"fs-extra-p": "^4.6.0",
|
||||
"lazy-val": "^1.0.3",
|
||||
"mime": "^2.3.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2720,18 +2819,18 @@
|
||||
}
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.1.tgz",
|
||||
"integrity": "sha512-jpKCA3HjsBfSDOEgxRDAxQCNyHfCPSbq57PqCkd3gAyBuPb3IWxw54EHncqESznIdqSetHfw3D7ylThu2Kcc9A==",
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
|
||||
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"punycode": "^2.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"punycode": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz",
|
||||
"integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=",
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
@ -2782,9 +2881,9 @@
|
||||
}
|
||||
},
|
||||
"which": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz",
|
||||
"integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==",
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"isexe": "^2.0.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "westeroscraftlauncher",
|
||||
"version": "0.0.1-alpha.5",
|
||||
"version": "0.0.1-alpha.6",
|
||||
"description": "Custom modded launcher for Westeroscraft",
|
||||
"productName": "WesterosCraft Launcher",
|
||||
"main": "index.js",
|
||||
@ -45,7 +45,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^2.0.2",
|
||||
"electron-builder": "^20.14.7"
|
||||
"electron-builder": "^20.15.3"
|
||||
},
|
||||
"build": {
|
||||
"appId": "westeroscraftlauncher",
|
||||
|
Loading…
Reference in New Issue
Block a user