Remove Mojang Auth + Microsoft Auth, Add AzAuth

This commit is contained in:
Furoxfufu 2023-03-03 21:11:06 +01:00
parent ecfe0de0fb
commit c242afd6f4
17 changed files with 368 additions and 155 deletions

View File

@ -1,7 +1,7 @@
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" http-equiv="Content-Security-Policy" content="script-src 'self' 'sha256-In6B8teKZQll5heMl9bS7CESTbGvuAt3VVV86BUQBDk='"/>
<title>Helios Launcher</title>
<title>Site-33 Launcher</title>
<script src="./assets/js/scripts/uicore.js"></script>
<script src="./assets/js/scripts/uibinder.js"></script>
<link type="text/css" rel="stylesheet" href="./assets/css/launcher.css">
@ -41,7 +41,7 @@
<div id="loadingContent">
<div id="loadSpinnerContainer">
<img id="loadCenterImage" src="assets/images/LoadingSeal.png">
<img id="loadSpinnerImage" class="rotating" src="assets/images/LoadingText.png">
<!-- <img id="loadSpinnerImage" class="rotating" src="assets/images/LoadingText.png"> -->
</div>
</div>
</div>

View File

@ -12,9 +12,11 @@
const ConfigManager = require('./configmanager')
const { LoggerUtil } = require('helios-core')
const { RestResponseStatus } = require('helios-core/common')
const { MojangRestAPI, mojangErrorDisplayable, MojangErrorCode } = require('helios-core/mojang')
const { MicrosoftAuth, microsoftErrorDisplayable, MicrosoftErrorCode } = require('helios-core/microsoft')
const { AZURE_CLIENT_ID } = require('./ipcconstants')
//const { MojangRestAPI, mojangErrorDisplayable, MojangErrorCode } = require('helios-core/mojang')
//const { MicrosoftAuth, microsoftErrorDisplayable, MicrosoftErrorCode } = require('helios-core/microsoft')
//const { AZURE_CLIENT_ID } = require('./ipcconstants')
const azAuth = require('azuriom-auth')
const log = LoggerUtil.getLogger('AuthManager')
@ -25,12 +27,30 @@ const log = LoggerUtil.getLogger('AuthManager')
* authserver. The resultant data will be stored as an auth account in the
* configuration database.
*
* @param {string} username The account username (email if migrated).
* @param {string} email The account username (email if migrated).
* @param {string} password The account password.
* @param {number} a2f The account a2f
* @returns {Promise.<Object>} Promise which resolves the resolved authenticated account object.
*/
exports.addMojangAccount = async function(username, password) {
try {
exports.addMojangAccount = async function(email, password, a2f) {
const auth = new azAuth.AuthClient('https://site-33.net')
let result
if (a2f === null) result = await auth.login(email, password)
else result = await auth.login(email, password, a2f)
if (result.status === 'pending' && result.requires2fa) result = await auth.login(email, password, a2f)
if (result.status !== 'success') {
throw 'Unexpected result: ' + JSON.stringify(result)
}
const ret = ConfigManager.addAzAuthAccount(result.uuid, result.accessToken, result.username, result.username, result.role.id, result.role.name, result.role.color)
ConfigManager.save()
return ret
/**try {
const response = await MojangRestAPI.authenticate(username, password, ConfigManager.getClientToken())
console.log(response)
if(response.responseStatus === RestResponseStatus.SUCCESS) {
@ -54,7 +74,7 @@ exports.addMojangAccount = async function(username, password) {
} catch (err){
log.error(err)
return Promise.reject(mojangErrorDisplayable(MojangErrorCode.UNKNOWN))
}
}*/
}
const AUTH_MODE = { FULL: 0, MS_REFRESH: 1, MC_REFRESH: 2 }
@ -70,7 +90,7 @@ const AUTH_MODE = { FULL: 0, MS_REFRESH: 1, MC_REFRESH: 2 }
* @param {*} authMode The auth mode.
* @returns An object with all auth data. AccessToken object will be null when mode is MC_REFRESH.
*/
async function fullMicrosoftAuthFlow(entryCode, authMode) {
/**async function fullMicrosoftAuthFlow(entryCode, authMode) {
try {
let accessTokenRaw
@ -114,7 +134,7 @@ async function fullMicrosoftAuthFlow(entryCode, authMode) {
log.error(err)
return Promise.reject(microsoftErrorDisplayable(MicrosoftErrorCode.UNKNOWN))
}
}
}*/
/**
* Calculate the expiry date. Advance the expiry time by 10 seconds
@ -135,7 +155,7 @@ function calculateExpiryDate(nowMs, epiresInS) {
* @param {string} authCode The authCode obtained from microsoft.
* @returns {Promise.<Object>} Promise which resolves the resolved authenticated account object.
*/
exports.addMicrosoftAccount = async function(authCode) {
/**exports.addMicrosoftAccount = async function(authCode) {
const fullAuth = await fullMicrosoftAuthFlow(authCode, AUTH_MODE.FULL)
@ -154,7 +174,7 @@ exports.addMicrosoftAccount = async function(authCode) {
ConfigManager.save()
return ret
}
}*/
/**
* Remove a Mojang account. This will invalidate the access token associated
@ -182,14 +202,19 @@ exports.removeMojangAccount = async function(uuid){
}
/**
* Remove a Microsoft account. It is expected that the caller will invoke the OAuth logout
* through the ipc renderer.
* Remove a AzAuth account. This will invalidate the access token associated
* with the account and then remove it from the database.
*
* @param {string} uuid The UUID of the account to be removed.
* @param {string} accessToken The UUID of the account to be removed.
* @returns {Promise.<void>} Promise which resolves to void when the action is complete.
*/
exports.removeMicrosoftAccount = async function(uuid){
exports.removeAzAuthAccount = async function(uuid, accessToken) {
try {
//const authAcc = ConfigManager.getAuthAccount(uuid)
//let rep = AuthClient.logout(authAcc.accessToken)
//console.log(rep)
//azAuth.AuthClient.logout(accessToken)
ConfigManager.removeAuthAccount(uuid)
ConfigManager.save()
return Promise.resolve()
@ -199,6 +224,24 @@ exports.removeMicrosoftAccount = async function(uuid){
}
}
/**
* Remove a Microsoft account. It is expected that the caller will invoke the OAuth logout
* through the ipc renderer.
*
* @param {string} uuid The UUID of the account to be removed.
* @returns {Promise.<void>} Promise which resolves to void when the action is complete.
*/
/**exports.removeMicrosoftAccount = async function(uuid){
try {
ConfigManager.removeAuthAccount(uuid)
ConfigManager.save()
return Promise.resolve()
} catch (err){
log.error('Error while removing account', err)
return Promise.reject(err)
}
}*/
/**
* Validate the selected account with Mojang's authserver. If the account is not valid,
* we will attempt to refresh the access token and update that value. If that fails, a
@ -209,7 +252,7 @@ exports.removeMicrosoftAccount = async function(uuid){
*/
async function validateSelectedMojangAccount(){
const current = ConfigManager.getSelectedAccount()
const response = await MojangRestAPI.validate(current.accessToken, ConfigManager.getClientToken())
/**const response = await MojangRestAPI.validate(current.accessToken, ConfigManager.getClientToken())
if(response.responseStatus === RestResponseStatus.SUCCESS) {
const isValid = response.data
@ -230,8 +273,7 @@ async function validateSelectedMojangAccount(){
log.info('Account access token validated.')
return true
}
}
}*/
}
/**
@ -242,7 +284,7 @@ async function validateSelectedMojangAccount(){
* @returns {Promise.<boolean>} Promise which resolves to true if the access token is valid,
* otherwise false.
*/
async function validateSelectedMicrosoftAccount(){
/**async function validateSelectedMicrosoftAccount(){
const current = ConfigManager.getSelectedAccount()
const now = new Date().getTime()
const mcExpiresAt = current.expiresAt
@ -295,7 +337,7 @@ async function validateSelectedMicrosoftAccount(){
return false
}
}
}
}*/
/**
* Validate the selected auth account.
@ -306,10 +348,10 @@ async function validateSelectedMicrosoftAccount(){
exports.validateSelected = async function(){
const current = ConfigManager.getSelectedAccount()
if(current.type === 'microsoft') {
/**if(current.type === 'microsoft') {
return await validateSelectedMicrosoftAccount()
} else {
return await validateSelectedMojangAccount()
}
}*/
return await validateSelectedMojangAccount()
}

View File

@ -337,10 +337,15 @@ exports.getAuthAccount = function(uuid){
*
* @returns {Object} The authenticated account object created by this action.
*/
exports.updateMojangAuthAccount = function(uuid, accessToken){
/**exports.updateMojangAuthAccount = function(uuid, accessToken){
config.authenticationDatabase[uuid].accessToken = accessToken
config.authenticationDatabase[uuid].type = 'mojang' // For gradual conversion.
return config.authenticationDatabase[uuid]
}*/
exports.updateAzAuthAccount = function(uuid, accessToken){
config.authenticationDatabase[uuid].accessToken = accessToken
config.authenticationDatabase[uuid].type = 'azAuth' // For gradual conversion.
return config.authenticationDatabase[uuid]
}
/**
@ -353,7 +358,7 @@ exports.updateMojangAuthAccount = function(uuid, accessToken){
*
* @returns {Object} The authenticated account object created by this action.
*/
exports.addMojangAuthAccount = function(uuid, accessToken, username, displayName){
/**exports.addMojangAuthAccount = function(uuid, accessToken, username, displayName){
config.selectedAccount = uuid
config.authenticationDatabase[uuid] = {
type: 'mojang',
@ -363,6 +368,34 @@ exports.addMojangAuthAccount = function(uuid, accessToken, username, displayName
displayName: displayName.trim()
}
return config.authenticationDatabase[uuid]
}*/
/**
* Adds an authenticated azuriom account to the database to be stored.
*
* @param {string} uuid The uuid of the authenticated account.
* @param {string} accessToken The accessToken of the authenticated account.
* @param {string} username The username (usually email) of the authenticated account.
* @param {string} displayName The in game name of the authenticated account.
* @param {string} roleid The roleId
* @param {string} rolename The roleName
* @param {string} rolecolor The roleColor
*
* @returns {Object} The authenticated account object created by this action.
*/
exports.addAzAuthAccount = function(uuid, accessToken, username, displayName, roleid, rolename, rolecolor) {
config.selectedAccount = uuid
config.authenticationDatabase[uuid] = {
type: 'azAuth',
accessToken,
username: username.trim(),
uuid: uuid.toString(),
displayName: displayName.trim(),
roleid: roleid,
rolename: rolename,
rolecolor: rolecolor
}
return config.authenticationDatabase[uuid]
}
/**
@ -377,14 +410,14 @@ exports.addMojangAuthAccount = function(uuid, accessToken, username, displayName
*
* @returns {Object} The authenticated account object created by this action.
*/
exports.updateMicrosoftAuthAccount = function(uuid, accessToken, msAccessToken, msRefreshToken, msExpires, mcExpires) {
/**exports.updateMicrosoftAuthAccount = function(uuid, accessToken, msAccessToken, msRefreshToken, msExpires, mcExpires) {
config.authenticationDatabase[uuid].accessToken = accessToken
config.authenticationDatabase[uuid].expiresAt = mcExpires
config.authenticationDatabase[uuid].microsoft.access_token = msAccessToken
config.authenticationDatabase[uuid].microsoft.refresh_token = msRefreshToken
config.authenticationDatabase[uuid].microsoft.expires_at = msExpires
return config.authenticationDatabase[uuid]
}
}*/
/**
* Adds an authenticated microsoft account to the database to be stored.
@ -399,7 +432,7 @@ exports.updateMicrosoftAuthAccount = function(uuid, accessToken, msAccessToken,
*
* @returns {Object} The authenticated account object created by this action.
*/
exports.addMicrosoftAuthAccount = function(uuid, accessToken, name, mcExpires, msAccessToken, msRefreshToken, msExpires) {
/*exports.addMicrosoftAuthAccount = function(uuid, accessToken, name, mcExpires, msAccessToken, msRefreshToken, msExpires) {
config.selectedAccount = uuid
config.authenticationDatabase[uuid] = {
type: 'microsoft',
@ -415,7 +448,7 @@ exports.addMicrosoftAuthAccount = function(uuid, accessToken, name, mcExpires, m
}
}
return config.authenticationDatabase[uuid]
}
}*/
/**
* Remove an authenticated account from the database. If the account

View File

@ -1,7 +1,7 @@
// NOTE FOR THIRD-PARTY
// REPLACE THIS CLIENT ID WITH YOUR APPLICATION ID.
// SEE https://github.com/dscalzi/HeliosLauncher/blob/master/docs/MicrosoftAuth.md
exports.AZURE_CLIENT_ID = '1ce6e35a-126f-48fd-97fb-54d143ac6d45'
/* exports.AZURE_CLIENT_ID = '1ce6e35a-126f-48fd-97fb-54d143ac6d45'
// SEE NOTE ABOVE.
@ -22,7 +22,7 @@ exports.MSFT_ERROR = {
ALREADY_OPEN: 'MSFT_AUTH_ERR_ALREADY_OPEN',
NOT_FINISHED: 'MSFT_AUTH_ERR_NOT_FINISHED'
}
*/
exports.SHELL_OPCODE = {
TRASH_ITEM: 'TRASH_ITEM'
}

View File

@ -132,7 +132,7 @@ function updateSelectedAccount(authUser){
username = authUser.displayName
}
if(authUser.uuid != null){
document.getElementById('avatarContainer').style.backgroundImage = `url('https://mc-heads.net/body/${authUser.uuid}/right')`
document.getElementById('avatarContainer').style.backgroundImage = `url('https://site-33.net/api/skin-api/avatars/face/${authUser.username}')`
}
}
user_text.innerHTML = username
@ -231,7 +231,6 @@ const refreshServerStatus = async function(fade = false){
const serverURL = new URL('my://' + serv.getAddress())
const servStat = await getServerStatus(47, serverURL.hostname, Number(serverURL.port))
console.log(servStat)
pLabel = 'PLAYERS'
pVal = servStat.players.online + '/' + servStat.players.max
@ -1092,7 +1091,7 @@ function displayArticle(articleObject, index){
function loadNews(){
return new Promise((resolve, reject) => {
const distroData = DistroManager.getDistribution()
const newsFeed = distroData.getRSS()
const newsFeed = isDev ? "https://site-33.net/api/rss" : distroData.getRSS()
const newsHost = new URL(newsFeed).origin + '/'
$.ajax({
url: newsFeed,
@ -1105,7 +1104,7 @@ function loadNews(){
const el = $(items[i])
// Resolve date.
const date = new Date(el.find('pubDate').text()).toLocaleDateString('en-US', {month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric'})
const date = new Date(el.find('pubDate').text()).toLocaleDateString('fr-FR', {month: 'short', day: 'numeric', year: 'numeric', hour: 'numeric', minute: 'numeric'})
// Resolve comments.
let comments = el.find('slash\\:comments').text() || '0'
@ -1122,11 +1121,13 @@ function loadNews(){
let link = el.find('link').text()
let title = el.find('title').text()
let author = el.find('dc\\:creator').text()
let img = el.find('enclosure').attr('url')
// Generate article.
articles.push(
{
link,
img,
title,
date,
author,

View File

@ -10,9 +10,11 @@ const basicEmail = /^\S+@\S+\.\S+$/
const loginCancelContainer = document.getElementById('loginCancelContainer')
const loginCancelButton = document.getElementById('loginCancelButton')
const loginEmailError = document.getElementById('loginEmailError')
const loginUsername = document.getElementById('loginUsername')
const loginEmail = document.getElementById('loginEmail')
const loginPasswordError = document.getElementById('loginPasswordError')
const loginPassword = document.getElementById('loginPassword')
const loginA2FError = document.getElementById('loginA2FError')
const loginA2F = document.getElementById('loginA2F')
const checkmarkContainer = document.getElementById('checkmarkContainer')
const loginRememberOption = document.getElementById('loginRememberOption')
const loginButton = document.getElementById('loginButton')
@ -91,7 +93,7 @@ function validatePassword(value){
}
// Emphasize errors with shake when focus is lost.
loginUsername.addEventListener('focusout', (e) => {
loginEmail.addEventListener('focusout', (e) => {
validateEmail(e.target.value)
shakeError(loginEmailError)
})
@ -101,7 +103,7 @@ loginPassword.addEventListener('focusout', (e) => {
})
// Validate input for each field.
loginUsername.addEventListener('input', (e) => {
loginEmail.addEventListener('input', (e) => {
validateEmail(e.target.value)
})
loginPassword.addEventListener('input', (e) => {
@ -142,7 +144,7 @@ function loginLoading(v){
function formDisabled(v){
loginDisabled(v)
loginCancelButton.disabled = v
loginUsername.disabled = v
loginEmail.disabled = v
loginPassword.disabled = v
if(v){
checkmarkContainer.setAttribute('disabled', v)
@ -166,7 +168,7 @@ function loginCancelEnabled(val){
loginCancelButton.onclick = (e) => {
switchView(getCurrentView(), loginViewOnCancel, 500, 500, () => {
loginUsername.value = ''
loginEmail.value = ''
loginPassword.value = ''
loginCancelEnabled(false)
if(loginViewCancelHandler != null){
@ -181,13 +183,16 @@ loginForm.onsubmit = () => { return false }
// Bind login button behavior.
loginButton.addEventListener('click', () => {
// Disable form.
formDisabled(true)
// Show loading stuff.
loginLoading(true)
AuthManager.addMojangAccount(loginUsername.value, loginPassword.value).then((value) => {
login(loginEmail.value, loginPassword.value, loginA2F.value == undefined ? null : loginA2F.value)
})
function login(email, password, a2f) {
AuthManager.addMojangAccount(email, password, a2f).then((value) => {
updateSelectedAccount(value)
loginButton.innerHTML = loginButton.innerHTML.replace(Lang.queryJS('login.loggingIn'), Lang.queryJS('login.success'))
$('.circle-loader').toggleClass('load-complete')
@ -201,8 +206,9 @@ loginButton.addEventListener('click', () => {
loginViewOnSuccess = VIEWS.landing // Reset this for good measure.
loginCancelEnabled(false) // Reset this for good measure.
loginViewCancelHandler = null // Reset this for good measure.
loginUsername.value = ''
loginEmail.value = ''
loginPassword.value = ''
loginA2F.value = ''
$('.circle-loader').toggleClass('load-complete')
$('.checkmark').toggle()
loginLoading(false)
@ -215,14 +221,14 @@ loginButton.addEventListener('click', () => {
let actualDisplayableError
if(isDisplayableError(displayableError)) {
msftLoginLogger.error('Error while logging in.', displayableError)
console.log('Error while logging in.', displayableError)
actualDisplayableError = displayableError
} else {
// Uh oh.
msftLoginLogger.error('Unhandled error during login.', displayableError)
console.log('Unhandled error during login.', displayableError)
actualDisplayableError = {
title: 'Unknown Error During Login',
desc: 'An unknown error has occurred. Please see the console for details.'
title: 'Erreur inconnue pendant la connexion',
desc: 'Une erreur inconnue s\'est produite. Veuillez consulter la console pour plus de détails.'
}
}
@ -233,5 +239,4 @@ loginButton.addEventListener('click', () => {
})
toggleOverlay(true)
})
})
}

View File

@ -1,5 +1,5 @@
const loginOptionsCancelContainer = document.getElementById('loginOptionCancelContainer')
const loginOptionMicrosoft = document.getElementById('loginOptionMicrosoft')
/* const loginOptionMicrosoft = document.getElementById('loginOptionMicrosoft') */
const loginOptionMojang = document.getElementById('loginOptionMojang')
const loginOptionsCancelButton = document.getElementById('loginOptionCancelButton')
@ -18,7 +18,7 @@ function loginOptionsCancelEnabled(val){
}
}
loginOptionMicrosoft.onclick = (e) => {
/* loginOptionMicrosoft.onclick = (e) => {
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
ipcRenderer.send(
MSFT_OPCODE.OPEN_LOGIN,
@ -26,7 +26,7 @@ loginOptionMicrosoft.onclick = (e) => {
loginOptionsViewOnLoginCancel
)
})
}
} */
loginOptionMojang.onclick = (e) => {
switchView(getCurrentView(), VIEWS.login, 500, 500, () => {

View File

@ -305,7 +305,7 @@ function populateAccountListings(){
let htmlString = ''
for(let i=0; i<accounts.length; i++){
htmlString += `<button class="accountListing" uuid="${accounts[i].uuid}" ${i===0 ? 'selected' : ''}>
<img src="https://mc-heads.net/head/${accounts[i].uuid}/40">
<img src="https://site-33.net/api/skin-api/avatars/face/${accounts[i].username}/">
<div class="accountListingName">${accounts[i].displayName}</div>
</button>`
}

View File

@ -4,7 +4,7 @@ const semver = require('semver')
const { JavaGuard } = require('./assets/js/assetguard')
const DropinModUtil = require('./assets/js/dropinmodutil')
const { MSFT_OPCODE, MSFT_REPLY_TYPE, MSFT_ERROR } = require('./assets/js/ipcconstants')
/* const { MSFT_OPCODE, MSFT_REPLY_TYPE, MSFT_ERROR } = require('./assets/js/ipcconstants') */
const settingsState = {
invalid: new Set()
@ -339,8 +339,8 @@ settingsNavDone.onclick = () => {
* Account Management Tab
*/
const msftLoginLogger = LoggerUtil.getLogger('Microsoft Login')
const msftLogoutLogger = LoggerUtil.getLogger('Microsoft Logout')
/*const msftLoginLogger = LoggerUtil.getLogger('Microsoft Login')
const msftLogoutLogger = LoggerUtil.getLogger('Microsoft Logout')*/
// Bind the add mojang account button.
document.getElementById('settingsAddMojangAccount').onclick = (e) => {
@ -352,7 +352,7 @@ document.getElementById('settingsAddMojangAccount').onclick = (e) => {
}
// Bind the add microsoft account button.
document.getElementById('settingsAddMicrosoftAccount').onclick = (e) => {
/* document.getElementById('settingsAddMicrosoftAccount').onclick = (e) => {
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
ipcRenderer.send(MSFT_OPCODE.OPEN_LOGIN, VIEWS.settings, VIEWS.settings)
})
@ -445,7 +445,7 @@ ipcRenderer.on(MSFT_OPCODE.REPLY_LOGIN, (_, ...arguments_) => {
})
}
}
})
}) */
/**
* Bind functionality for the account selection buttons. If another account
@ -512,6 +512,31 @@ let msAccDomElementCache
* @param {boolean} isLastAccount If this logout is on the last added account.
*/
function processLogOut(val, isLastAccount) {
const parent = val.closest('.settingsAuthAccount')
const uuid = parent.getAttribute('uuid')
const prevSelAcc = ConfigManager.getSelectedAccount()
const targetAcc = ConfigManager.getAuthAccount(uuid)
const accessToken = targetAcc.accessToken;
AuthManager.removeAzAuthAccount(uuid, accessToken).then(() => {
if(!isLastAccount && uuid === prevSelAcc.uuid){
const selAcc = ConfigManager.getSelectedAccount()
refreshAuthAccountSelected(selAcc.uuid)
updateSelectedAccount(selAcc)
validateSelectedAccount()
}
if(isLastAccount) {
loginOptionsCancelEnabled(false)
loginOptionsViewOnLoginSuccess = VIEWS.settings
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
switchView(getCurrentView(), VIEWS.loginOptions)
}
})
$(parent).fadeOut(250, () => {
parent.remove()
})
}
/* function processLogOut(val, isLastAccount){
const parent = val.closest('.settingsAuthAccount')
const uuid = parent.getAttribute('uuid')
const prevSelAcc = ConfigManager.getSelectedAccount()
@ -598,7 +623,7 @@ ipcRenderer.on(MSFT_OPCODE.REPLY_LOGOUT, (_, ...arguments_) => {
})
}
})
}) */
/**
* Refreshes the status of the selected account on the auth account
@ -621,7 +646,7 @@ function refreshAuthAccountSelected(uuid){
})
}
const settingsCurrentMicrosoftAccounts = document.getElementById('settingsCurrentMicrosoftAccounts')
/*const settingsCurrentMicrosoftAccounts = document.getElementById('settingsCurrentMicrosoftAccounts')*/
const settingsCurrentMojangAccounts = document.getElementById('settingsCurrentMojangAccounts')
/**
@ -635,7 +660,7 @@ function populateAuthAccounts(){
}
const selectedUUID = ConfigManager.getSelectedAccount().uuid
let microsoftAuthAccountStr = ''
//let microsoftAuthAccountStr = ''
let mojangAuthAccountStr = ''
authKeys.forEach((val) => {
@ -643,7 +668,7 @@ function populateAuthAccounts(){
const accHtml = `<div class="settingsAuthAccount" uuid="${acc.uuid}">
<div class="settingsAuthAccountLeft">
<img class="settingsAuthAccountImage" alt="${acc.displayName}" src="https://mc-heads.net/body/${acc.uuid}/60">
<img class="settingsAuthAccountImage" alt="${acc.displayName}" src="https://site-33.net/api/skin-api/avatars/face/${acc.username}">
</div>
<div class="settingsAuthAccountRight">
<div class="settingsAuthAccountDetails">
@ -665,15 +690,15 @@ function populateAuthAccounts(){
</div>
</div>`
if(acc.type === 'microsoft') {
/**if(acc.type === 'microsoft') {
microsoftAuthAccountStr += accHtml
} else {
mojangAuthAccountStr += accHtml
}
}*/
mojangAuthAccountStr += accHtml
})
settingsCurrentMicrosoftAccounts.innerHTML = microsoftAuthAccountStr
/**settingsCurrentMicrosoftAccounts.innerHTML = microsoftAuthAccountStr*/
settingsCurrentMojangAccounts.innerHTML = mojangAuthAccountStr
}
@ -1404,10 +1429,10 @@ const settingsAboutChangelogText = settingsTabAbout.getElementsByClassName('se
const settingsAboutChangelogButton = settingsTabAbout.getElementsByClassName('settingsChangelogButton')[0]
// Bind the devtools toggle button.
document.getElementById('settingsAboutDevToolsButton').onclick = (e) => {
/**document.getElementById('settingsAboutDevToolsButton').onclick = (e) => {
let window = remote.getCurrentWindow()
window.toggleDevTools()
}
}*/
/**
* Return whether or not the provided version is a prerelease.
@ -1455,7 +1480,7 @@ function populateAboutVersionInformation(){
*/
function populateReleaseNotes(){
$.ajax({
url: 'https://github.com/dscalzi/HeliosLauncher/releases.atom',
url: 'https://github.com/project-site-33/Site-33-Launcher/releases.atom',
success: (data) => {
const version = 'v' + remote.app.getVersion()
const entries = $(data).find('entry')

View File

@ -351,7 +351,7 @@ async function validateSelectedAccount(){
)
setOverlayHandler(() => {
const isMicrosoft = selectedAcc.type === 'microsoft'
/**const isMicrosoft = selectedAcc.type === 'microsoft'
if(isMicrosoft) {
// Empty for now
@ -360,7 +360,10 @@ async function validateSelectedAccount(){
// For convenience, pre-populate the username of the account.
document.getElementById('loginUsername').value = selectedAcc.username
validateEmail(selectedAcc.username)
}
}*/
document.getElementById('loginUsername').value = selectedAcc.username
validateEmail(selectedAcc.username)
loginOptionsViewOnLoginSuccess = getCurrentView()
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
@ -368,7 +371,7 @@ async function validateSelectedAccount(){
if(accLen > 0) {
loginOptionsViewOnCancel = getCurrentView()
loginOptionsViewCancelHandler = () => {
if(isMicrosoft) {
/*if(isMicrosoft) {
ConfigManager.addMicrosoftAuthAccount(
selectedAcc.uuid,
selectedAcc.accessToken,
@ -380,7 +383,8 @@ async function validateSelectedAccount(){
)
} else {
ConfigManager.addMojangAuthAccount(selectedAcc.uuid, selectedAcc.accessToken, selectedAcc.username, selectedAcc.displayName)
}
}*/
ConfigManager.addAzAuthAccount(selectedAcc.uuid, selectedAcc.accessToken, selectedAcc.username, selectedAcc.displayName)
ConfigManager.save()
validateSelectedAccount()
}

View File

@ -13,7 +13,7 @@
<% } else{ %>
<div id="frameContentWin">
<div id="frameTitleDock">
<span id="frameTitleText">Helios Launcher</span>
<span id="frameTitleText">Site-33 Launcher</span>
</div>
<div id="frameButtonDockWin">
<button class="frameButton fMb" id="frameButton_minimize" tabIndex="-1">

View File

@ -7,8 +7,8 @@
</div>
<div id="loginContent">
<form id="loginForm">
<img id="loginImageSeal" src="assets/images/SealCircle.png"/>
<span id="loginSubheader">MINECRAFT LOGIN</span>
<img id="loginImageSeal" src="assets/images/LoadingSeal.png"/>
<span id="loginSubheader">Site-33 Login</span>
<div class="loginFieldContainer">
<svg id="profileSVG" class="loginSVG" viewBox="40 37 65.36 61.43">
<g>
@ -16,7 +16,7 @@
</g>
</svg>
<span class="loginErrorSpan" id="loginEmailError">* Invalid Value</span>
<input id="loginUsername" class="loginField" type="text" placeholder="EMAIL OR USERNAME"/>
<input id="loginEmail" class="loginField" type="text" placeholder="Email"/>
</div>
<div class="loginFieldContainer">
<svg id="lockSVG" class="loginSVG" viewBox="40 32 60.36 70.43">
@ -25,15 +25,24 @@
</g>
</svg>
<span class="loginErrorSpan" id="loginPasswordError">* Required</span>
<input id="loginPassword" class="loginField" type="password" placeholder="PASSWORD"/>
<input id="loginPassword" class="loginField" type="password" placeholder="Password"/>
</div>
<div class="loginFieldContainer">
<svg id="lockSVG" class="loginSVG" viewBox="40 32 60.36 70.43">
<g>
<path d="M86.16,54a16.38,16.38,0,1,0-32,0H44V102.7H96V54Zm-25.9-3.39a9.89,9.89,0,1,1,19.77,0A9.78,9.78,0,0,1,79.39,54H60.89A9.78,9.78,0,0,1,60.26,50.59ZM70,96.2a6.5,6.5,0,0,1-6.5-6.5,6.39,6.39,0,0,1,3.1-5.4V67h6.5V84.11a6.42,6.42,0,0,1,3.39,5.6A6.5,6.5,0,0,1,70,96.2Z"/>
</g>
</svg>
<span class="loginErrorSpan" id="loginA2FError">Si A2F actif</span>
<input id="loginA2F" class="loginField" type="a2f" placeholder="A2F"/>
</div>
<div id="loginOptions">
<span class="loginSpanDim">
<a href="https://minecraft.net/password/forgot/">forgot password?</a>
<a href="https://site-33.net/user/password/reset">Mot de passe oublié?</a>
</span>
<label id="checkmarkContainer">
<input id="loginRememberOption" type="checkbox" checked>
<span id="loginRememberText" class="loginSpanDim">remember me?</span>
<span id="loginRememberText" class="loginSpanDim">Réster connectait ?</span>
<span class="loginCheckmark"></span>
</label>
</div>
@ -54,10 +63,10 @@
</button>
<div id="loginDisclaimer">
<span class="loginSpanDim" id="loginRegisterSpan">
<a href="https://minecraft.net/store/minecraft-java-edition/">Need an Account?</a>
<a href="https://site-33.net/user/register">Pas encore inscrit ?</a>
</span>
<p class="loginDisclaimerText">Your password is sent directly to mojang and never stored.</p>
<p class="loginDisclaimerText">Helios Launcher is not affiliated with Mojang AB.</p>
<p class="loginDisclaimerText">Votre mot de passe est envoyé directement a notre site.</p>
<p class="loginDisclaimerText">Site-33 n'est pas affilié à mojang ab.</p>
</div>
</form>
</div>

View File

@ -3,7 +3,7 @@
<div class="loginOptionsMainContent">
<h2>Login Options</h2>
<div class="loginOptionActions">
<div class="loginOptionButtonContainer">
<!-- <div class="loginOptionButtonContainer">
<button id="loginOptionMicrosoft" class="loginOptionButton">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 23 23">
<path fill="#f35325" d="M1 1h10v10H1z" />
@ -13,7 +13,7 @@
</svg>
<span>Login with Microsoft</span>
</button>
</div>
</div> -->
<div class="loginOptionButtonContainer">
<button id="loginOptionMojang" class="loginOptionButton">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 9.677 9.667">
@ -21,7 +21,7 @@
<path d="M2.598.022h7.07L9.665 7c-.003 1.334-1.113 2.46-2.402 2.654H0V2.542C.134 1.2 1.3.195 2.598.022z" fill="#db2331" />
<path d="M1.54 2.844c.314-.76 1.31-.46 1.954-.528.785-.083 1.503.272 2.1.758l.164-.9c.327.345.587.756.964 1.052.28.254.655-.342.86-.013.42.864.408 1.86.54 2.795l-.788-.373C6.9 4.17 5.126 3.052 3.656 3.685c-1.294.592-1.156 2.65.06 3.255 1.354.703 2.953.51 4.405.292-.07.42-.34.87-.834.816l-4.95.002c-.5.055-.886-.413-.838-.89l.04-4.315z" fill="#fff" />
</svg>
<span>Login with Mojang</span>
<span>Identifiant du site</span>
</button>
</div>
</div>

View File

@ -28,7 +28,7 @@
<span class="settingsTabHeaderText">Account Settings</span>
<span class="settingsTabHeaderDesc">Add new accounts or manage existing ones.</span>
</div>
<div class="settingsAuthAccountTypeContainer">
<!-- <div class="settingsAuthAccountTypeContainer">
<div class="settingsAuthAccountTypeHeader">
<div class="settingsAuthAccountTypeHeaderLeft">
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 23 23">
@ -44,10 +44,10 @@
</div>
</div>
<div class="settingsCurrentAccounts" id="settingsCurrentMicrosoftAccounts">
<div class="settingsCurrentAccounts" id="settingsCurrentMicrosoftAccounts"> -->
<!-- Microsoft auth accounts populated here. -->
</div>
</div>
<!--</div>
</div> -->
<div class="settingsAuthAccountTypeContainer">
<div class="settingsAuthAccountTypeHeader">
@ -57,10 +57,10 @@
<path d="M2.598.022h7.07L9.665 7c-.003 1.334-1.113 2.46-2.402 2.654H0V2.542C.134 1.2 1.3.195 2.598.022z" fill="#db2331" />
<path d="M1.54 2.844c.314-.76 1.31-.46 1.954-.528.785-.083 1.503.272 2.1.758l.164-.9c.327.345.587.756.964 1.052.28.254.655-.342.86-.013.42.864.408 1.86.54 2.795l-.788-.373C6.9 4.17 5.126 3.052 3.656 3.685c-1.294.592-1.156 2.65.06 3.255 1.354.703 2.953.51 4.405.292-.07.42-.34.87-.834.816l-4.95.002c-.5.055-.886-.413-.838-.89l.04-4.315z" fill="#fff" />
</svg>
<span>Mojang</span>
<span>Site</span>
</div>
<div class="settingsAuthAccountTypeHeaderRight">
<button class="settingsAddAuthAccount" id="settingsAddMojangAccount">+ Add Mojang Account</button>
<button class="settingsAddAuthAccount" id="settingsAddMojangAccount">+ Ajouter un compte Site-33</button>
</div>
</div>
@ -71,11 +71,11 @@
</div>
<div id="settingsTabMinecraft" class="settingsTab" style="display: none;">
<div class="settingsTabHeader">
<span class="settingsTabHeaderText">Minecraft Settings</span>
<span class="settingsTabHeaderDesc">Options related to game launch.</span>
<span class="settingsTabHeaderText">Paramètres de Minecraft</span>
<span class="settingsTabHeaderDesc">Options relatives au lancement du jeu.</span>
</div>
<div id="settingsGameResolutionContainer">
<span class="settingsFieldTitle">Game Resolution</span>
<span class="settingsFieldTitle">Résolution du jeu</span>
<div id="settingsGameResolutionContent">
<input type="number" id="settingsGameWidth" min="0" cValue="GameWidth">
<div id="settingsGameResolutionCross">&#10006;</div>
@ -84,7 +84,7 @@
</div>
<div class="settingsFieldContainer">
<div class="settingsFieldLeft">
<span class="settingsFieldTitle">Launch in fullscreen.</span>
<span class="settingsFieldTitle">Lancé en plein écran.</span>
</div>
<div class="settingsFieldRight">
<label class="toggleSwitch">
@ -95,7 +95,7 @@
</div>
<div class="settingsFieldContainer">
<div class="settingsFieldLeft">
<span class="settingsFieldTitle">Automatically connect to the server on launch.</span>
<span class="settingsFieldTitle">Connexion automatique au serveur au lancement.</span>
</div>
<div class="settingsFieldRight">
<label class="toggleSwitch">
@ -106,8 +106,8 @@
</div>
<div class="settingsFieldContainer">
<div class="settingsFieldLeft">
<span class="settingsFieldTitle">Launch game process detached from launcher.</span>
<span class="settingsFieldDesc">If the game is not detached, closing the launcher will also close the game.</span>
<span class="settingsFieldTitle">Lancement du processus de jeu détaché du lanceur.</span>
<span class="settingsFieldDesc">Si le jeu n'est pas détaché, la fermeture du lanceur fermera également le jeu..</span>
</div>
<div class="settingsFieldRight">
<label class="toggleSwitch">
@ -119,8 +119,8 @@
</div>
<div id="settingsTabMods" class="settingsTab" style="display: none;">
<div class="settingsTabHeader">
<span class="settingsTabHeaderText">Mod Settings</span>
<span class="settingsTabHeaderDesc">Enable or disable mods.</span>
<span class="settingsTabHeaderText">Paramètres des mods</span>
<span class="settingsTabHeaderDesc">Activer ou désactiver des mods.</span>
</div>
<div class="settingsSelServContainer">
<div class="settingsSelServContent">
@ -128,19 +128,19 @@
</div>
<div class="settingsSwitchServerContainer">
<div class="settingsSwitchServerContent">
<button class="settingsSwitchServerButton">Switch</button>
<button class="settingsSwitchServerButton">Changer</button>
</div>
</div>
</div>
<div id="settingsModsContainer">
<div id="settingsReqModsContainer">
<div class="settingsModsHeader">Required Mods</div>
<div class="settingsModsHeader">Mods requis</div>
<div id="settingsReqModsContent">
</div>
</div>
<div id="settingsOptModsContainer">
<div class="settingsModsHeader">Optional Mods</div>
<div class="settingsModsHeader">Mods optionnel</div>
<div id="settingsOptModsContent">
</div>
@ -329,11 +329,11 @@
</div>
</div>
<div id="settingsAboutButtons">
<a href="https://github.com/dscalZi/HeliosLauncher" id="settingsAboutSourceButton" class="settingsAboutButton">Source (GitHub)</a>
<!--<a href="https://github.com/dscalZi/HeliosLauncher" id="settingsAboutSourceButton" class="settingsAboutButton">Source (GitHub)</a>-->
<!-- The following must be included in third-party usage. -->
<!-- <a href="https://github.com/dscalzi/HeliosLauncher" id="settingsAboutSourceButton" class="settingsAboutButton">Original Source</a> -->
<a href="https://github.com/dscalZi/HeliosLauncher/issues" id="settingsAboutSupportButton" class="settingsAboutButton">Support</a>
<a href="#" id="settingsAboutDevToolsButton" class="settingsAboutButton">DevTools Console</a>
<a href="https://discord.gg/R6KAdRrfRn" id="settingsAboutSupportButton" class="settingsAboutButton">Support</a>
<!--<a href="#" id="settingsAboutDevToolsButton" class="settingsAboutButton">DevTools Console</a>-->
</div>
</div>
<div class="settingsChangelogContainer">

View File

@ -105,7 +105,7 @@ ipcMain.handle(SHELL_OPCODE.TRASH_ITEM, async (event, ...args) => {
app.disableHardwareAcceleration()
const REDIRECT_URI_PREFIX = 'https://login.microsoftonline.com/common/oauth2/nativeclient?'
/* const REDIRECT_URI_PREFIX = 'https://login.microsoftonline.com/common/oauth2/nativeclient?'
// Microsoft Auth Login
let msftAuthWindow
@ -214,7 +214,7 @@ ipcMain.on(MSFT_OPCODE.OPEN_LOGOUT, (ipcEvent, uuid, isLastAccount) => {
msftLogoutWindow.removeMenu()
msftLogoutWindow.loadURL('https://login.microsoftonline.com/common/oauth2/v2.0/logout')
})
}) */
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.

95
package-lock.json generated
View File

@ -12,6 +12,7 @@
"@electron/remote": "^2.0.8",
"adm-zip": "^0.5.9",
"async": "^3.2.4",
"azuriom-auth": "^1.0.1",
"discord-rpc-patch": "^4.0.1",
"ejs": "^3.1.8",
"ejs-electron": "^2.1.1",
@ -720,6 +721,25 @@
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz",
"integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg=="
},
"node_modules/axios": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz",
"integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==",
"dependencies": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/azuriom-auth": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/azuriom-auth/-/azuriom-auth-1.0.1.tgz",
"integrity": "sha512-oVRyzSzpLsU6VfKhJw5LLl2maXTwVIzLdNKcwsRqKucm7d4IDk7iYksjmz2pfKTOxgNwZ6fKzFErCIxBHnu+JQ==",
"dependencies": {
"axios": "^1.1.0",
"camelcase-keys": "^7.0.0"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@ -945,6 +965,45 @@
"node": ">=6"
}
},
"node_modules/camelcase": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/camelcase-keys": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-7.0.2.tgz",
"integrity": "sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==",
"dependencies": {
"camelcase": "^6.3.0",
"map-obj": "^4.1.0",
"quick-lru": "^5.1.1",
"type-fest": "^1.2.1"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/camelcase-keys/node_modules/type-fest": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",
"integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
@ -1957,6 +2016,25 @@
"resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz",
"integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw=="
},
"node_modules/follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
@ -1969,7 +2047,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dev": true,
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
@ -2786,6 +2863,17 @@
"node": ">=12"
}
},
"node_modules/map-obj": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz",
"integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==",
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/matcher": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",
@ -3145,6 +3233,11 @@
"node": ">=0.4.0"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/psl": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",

View File

@ -1,9 +1,9 @@
{
"name": "helioslauncher",
"version": "1.9.0",
"productName": "Helios Launcher",
"name": "Site-33 Launcher",
"version": "0.0.1",
"productName": "Site-33 Launcher",
"description": "Modded Minecraft Launcher",
"author": "Daniel Scalzi (https://github.com/dscalzi/)",
"author": "Site-33 (Fork of Daniel Scalzi (https://github.com/dscalzi/))",
"license": "UNLICENSED",
"homepage": "https://github.com/dscalzi/HeliosLauncher",
"bugs": {
@ -26,6 +26,7 @@
"@electron/remote": "^2.0.8",
"adm-zip": "^0.5.9",
"async": "^3.2.4",
"azuriom-auth": "^1.0.1",
"discord-rpc-patch": "^4.0.1",
"ejs": "^3.1.8",
"ejs-electron": "^2.1.1",