work on auth
This commit is contained in:
parent
f813f9d675
commit
291a571b22
@ -34,6 +34,7 @@
|
|||||||
<%- include('waiting') %>
|
<%- include('waiting') %>
|
||||||
<%- include('loginOptions') %>
|
<%- include('loginOptions') %>
|
||||||
<%- include('loginOffline') %>
|
<%- include('loginOffline') %>
|
||||||
|
<%- include('loginSkirdaDiscord') %>
|
||||||
<%- include('settings') %>
|
<%- include('settings') %>
|
||||||
<%- include('landing') %>
|
<%- include('landing') %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,7 +42,7 @@ exports.addMojangAccount = async function(username, password){
|
|||||||
clientToken: 'asdasldkjalskdj',
|
clientToken: 'asdasldkjalskdj',
|
||||||
}
|
}
|
||||||
if(session.selectedProfile != null){
|
if(session.selectedProfile != null){
|
||||||
console.log("here")
|
// console.log("here")
|
||||||
const ret = ConfigManager.addMojangAuthAccount(session.selectedProfile.id, session.accessToken, username, session.selectedProfile.name)
|
const ret = ConfigManager.addMojangAuthAccount(session.selectedProfile.id, session.accessToken, username, session.selectedProfile.name)
|
||||||
if(ConfigManager.getClientToken() == null){
|
if(ConfigManager.getClientToken() == null){
|
||||||
ConfigManager.setClientToken(session.clientToken)
|
ConfigManager.setClientToken(session.clientToken)
|
||||||
@ -63,6 +63,18 @@ exports.addMojangAccount = async function(username, password){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} uuid
|
||||||
|
* @param {string} accessToken
|
||||||
|
* @param {string} username
|
||||||
|
* @param {string} displayName
|
||||||
|
* */
|
||||||
|
exports.addSkirdaAccount = async function(uuid, accessToken, username, displayName){
|
||||||
|
ConfigManager.addSkirdaAccount(uuid, accessToken, username, displayName)
|
||||||
|
ConfigManager.save()
|
||||||
|
}
|
||||||
|
|
||||||
exports.addOfflineAccount = async function(usernameOffline){
|
exports.addOfflineAccount = async function(usernameOffline){
|
||||||
//TODO: check for forbidden symbols and lenght!!
|
//TODO: check for forbidden symbols and lenght!!
|
||||||
ConfigManager.addOfflineAccount(usernameOffline)
|
ConfigManager.addOfflineAccount(usernameOffline)
|
||||||
@ -211,6 +223,42 @@ exports.removeMicrosoftAccount = async function(uuid){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a Offline 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.removeOfflineAccount = 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a Skirda 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.removeSkirdaAccount = 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,
|
* 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
|
* we will attempt to refresh the access token and update that value. If that fails, a
|
||||||
|
@ -364,6 +364,17 @@ exports.addOfflineAccount = function(usernameOffline){
|
|||||||
return config.authenticationDatabase[fake_uuid]
|
return config.authenticationDatabase[fake_uuid]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.addSkirdaAccount = function(uuid, accessToken, username, displayName){
|
||||||
|
config.selectedAccount = uuid
|
||||||
|
config.authenticationDatabase[uuid] = {
|
||||||
|
type: 'skirda',
|
||||||
|
accessToken,
|
||||||
|
username: username.trim(),
|
||||||
|
uuid: uuid.trim(),
|
||||||
|
displayName: displayName.trim()
|
||||||
|
}
|
||||||
|
return config.authenticationDatabase[uuid]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the tokens of an authenticated microsoft account.
|
* Update the tokens of an authenticated microsoft account.
|
||||||
|
@ -5,8 +5,8 @@ const ConfigManager = require('./configmanager')
|
|||||||
// Old WesterosCraft url.
|
// Old WesterosCraft url.
|
||||||
// exports.REMOTE_DISTRO_URL = 'http://mc.westeroscraft.com/WesterosCraftLauncher/distribution.json'
|
// exports.REMOTE_DISTRO_URL = 'http://mc.westeroscraft.com/WesterosCraftLauncher/distribution.json'
|
||||||
// exports.REMOTE_DISTRO_URL = 'https://skirda-minecraft-distribution.brzezinski.ru/distribution.json'
|
// exports.REMOTE_DISTRO_URL = 'https://skirda-minecraft-distribution.brzezinski.ru/distribution.json'
|
||||||
exports.REMOTE_DISTRO_URL = 'https://helios-files.geekcorner.eu.org/distribution.json'
|
// exports.REMOTE_DISTRO_URL = 'https://helios-files.geekcorner.eu.org/distribution.json'
|
||||||
// exports.REMOTE_DISTRO_URL = 'http://192.168.88.10:8080/distribution/manifest'
|
exports.REMOTE_DISTRO_URL = 'http://192.168.88.10:8080/distribution/manifest'
|
||||||
// exports.REMOTE_DISTRO_URL = 'http://gregbrzezinski:8080/distribution/manifest'
|
// exports.REMOTE_DISTRO_URL = 'http://gregbrzezinski:8080/distribution/manifest'
|
||||||
// exports.REMOTE_DISTRO_URL = 'http://localhost:8080/distribution/files/files/distribution.json'
|
// exports.REMOTE_DISTRO_URL = 'http://localhost:8080/distribution/files/files/distribution.json'
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ const loginOptionsCancelContainer = document.getElementById('loginOptionCancelCo
|
|||||||
const loginOptionMicrosoft = document.getElementById('loginOptionMicrosoft')
|
const loginOptionMicrosoft = document.getElementById('loginOptionMicrosoft')
|
||||||
const loginOptionMojang = document.getElementById('loginOptionMojang')
|
const loginOptionMojang = document.getElementById('loginOptionMojang')
|
||||||
const loginOptionOffline = document.getElementById('loginOptionOffline')
|
const loginOptionOffline = document.getElementById('loginOptionOffline')
|
||||||
|
const loginOptionSkirdaDiskord = document.getElementById('loginOptionSkirdaDiscord')
|
||||||
const loginOptionsCancelButton = document.getElementById('loginOptionCancelButton')
|
const loginOptionsCancelButton = document.getElementById('loginOptionCancelButton')
|
||||||
|
|
||||||
let loginOptionsCancellable = false
|
let loginOptionsCancellable = false
|
||||||
@ -46,6 +47,14 @@ loginOptionOffline.onclick = (e) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loginOptionSkirdaDiscord.onclick = (e) => {
|
||||||
|
switchView(getCurrentView(), VIEWS.loginSkirdaDiscord, 500, 500, () => {
|
||||||
|
loginViewOnSuccess = loginOptionsViewOnLoginSuccess
|
||||||
|
loginViewOnCancel = loginOptionsViewOnLoginCancel
|
||||||
|
loginCancelEnabled(true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
loginOptionsCancelButton.onclick = (e) => {
|
loginOptionsCancelButton.onclick = (e) => {
|
||||||
switchView(getCurrentView(), loginOptionsViewOnCancel, 500, 500, () => {
|
switchView(getCurrentView(), loginOptionsViewOnCancel, 500, 500, () => {
|
||||||
// Clear login values (Mojang login)
|
// Clear login values (Mojang login)
|
||||||
|
125
app/assets/js/scripts/loginSkirdaDiscord.js
Normal file
125
app/assets/js/scripts/loginSkirdaDiscord.js
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
// const http = require('http')
|
||||||
|
// const fs = require('fs')
|
||||||
|
// const {addSkirdaAccount} = require('configmanager')
|
||||||
|
const auth_api_url = 'http://192.168.88.10:8083'
|
||||||
|
|
||||||
|
class SkirdaDiscordAuth{
|
||||||
|
/**
|
||||||
|
* @typedef {Object} DiscordRedirectAuth
|
||||||
|
* @property {string} redirectUrl how the person is called
|
||||||
|
* @property {string} requestId how many years the person lived
|
||||||
|
*
|
||||||
|
* @return {Promise<DiscordRedirectAuth | string>}
|
||||||
|
* */
|
||||||
|
temp_installId = '26c175e2-71bd-4d80-9553-cc1575fc8ef9'
|
||||||
|
async Init(){
|
||||||
|
const resp = await fetch(`${auth_api_url}/v1/auth/discord/init?installId=${this.temp_installId}`)
|
||||||
|
|
||||||
|
if (resp.statusCode !== 200){
|
||||||
|
return await resp.text()
|
||||||
|
}
|
||||||
|
|
||||||
|
return await resp.json()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param requestId {string} Request id from init route
|
||||||
|
// * @param timeout {number} Timeout to poll in seconds
|
||||||
|
* @return {SkirdaUserResp | string} Result of OAuth login
|
||||||
|
*/
|
||||||
|
async CyclePolling(requestId){
|
||||||
|
for (let i = 0; i < 15; i++) {
|
||||||
|
const resp = await this._poll(requestId)
|
||||||
|
|
||||||
|
// console.log(resp)
|
||||||
|
|
||||||
|
switch (resp.status){
|
||||||
|
case 204:
|
||||||
|
await this._sleep(4000)
|
||||||
|
continue
|
||||||
|
case 200:
|
||||||
|
return await resp.json()
|
||||||
|
default:
|
||||||
|
console.error(await resp.text())
|
||||||
|
return 'TODO error'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} SkirdaUserResp
|
||||||
|
* @property skirdaUserId {string}
|
||||||
|
* @property username {string}
|
||||||
|
* @property token {string}
|
||||||
|
*
|
||||||
|
* @param requestId {string}
|
||||||
|
* @return {Response}
|
||||||
|
* */
|
||||||
|
async _poll(requestId){
|
||||||
|
const resp = await fetch(`${auth_api_url}/v1/auth/discord/periodicPolling?installId=${this.temp_installId}&requestId=${requestId}`)
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
|
_sleepSetTimeout_ctrl
|
||||||
|
/**
|
||||||
|
* @param ms {number}
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
async _sleep(ms) {
|
||||||
|
clearInterval(this._sleepSetTimeout_ctrl)
|
||||||
|
return new Promise(resolve => this._sleepSetTimeout_ctrl = setTimeout(resolve, ms))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const auth = new SkirdaDiscordAuth()
|
||||||
|
const loginSkirdaDiscordButton = document.getElementById('loginSkirdaDiscordInitAuth')
|
||||||
|
|
||||||
|
loginSkirdaDiscordButton.addEventListener('click', async () =>{
|
||||||
|
const res = await auth.Init()
|
||||||
|
|
||||||
|
const redir = JSON.parse(res) //FIXME
|
||||||
|
console.log(redir)
|
||||||
|
const resOpenUrl = await shell.openExternal(redir.redirectUrl)
|
||||||
|
|
||||||
|
const skirdaAuth = await auth.CyclePolling(redir.requestId)
|
||||||
|
// console.log(skirdaAuth)
|
||||||
|
// skirdaAuth.skirdaUserId = '2a5fd868-1ac5-4ccf-a22f-183822de2d61'
|
||||||
|
|
||||||
|
let account = {
|
||||||
|
uuid: '2a5fd868-1ac5-4ccf-a22f-183822de2d61',
|
||||||
|
token: '',
|
||||||
|
username: skirdaAuth.skirdaUserId,
|
||||||
|
displayName: skirdaAuth.username
|
||||||
|
}
|
||||||
|
|
||||||
|
AuthManager.addSkirdaAccount(account.uuid, account.token, account.username, account.displayName)
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
switchView(VIEWS.landing, VIEWS.landing, 500, 500, async () => {
|
||||||
|
console.log('kek')
|
||||||
|
// // Temporary workaround
|
||||||
|
// if(loginViewOnSuccess === VIEWS.settings){
|
||||||
|
// await prepareSettings()
|
||||||
|
// }
|
||||||
|
// // loginViewOnSuccess = VIEWS.landing // Reset this for good measure.
|
||||||
|
// // loginCancelEnabled(false) // Reset this for good measure.
|
||||||
|
// // loginViewCancelHandler = null // Reset this for good measure.
|
||||||
|
// // loginUsername.value = ''
|
||||||
|
// // loginPassword.value = ''
|
||||||
|
// $('.circle-loader').toggleClass('load-complete')
|
||||||
|
// $('.checkmark').toggle()
|
||||||
|
// loginLoading(false)
|
||||||
|
// loginButton.innerHTML = loginButton.innerHTML.replace(Lang.queryJS('login.success'), Lang.queryJS('login.login'))
|
||||||
|
// formDisabled(false)
|
||||||
|
})
|
||||||
|
}, 1000)
|
||||||
|
})
|
||||||
|
|
@ -351,6 +351,12 @@ document.getElementById('settingsAddMojangAccount').onclick = (e) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById('settingsAddSkirdaDiscord').onclick = (e) => {
|
||||||
|
// console.log("kekekekekek")
|
||||||
|
switchView(getCurrentView(), VIEWS.loginSkirdaDiscord, 500, 500, () => {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Bind the add microsoft account button.
|
// Bind the add microsoft account button.
|
||||||
document.getElementById('settingsAddMicrosoftAccount').onclick = (e) => {
|
document.getElementById('settingsAddMicrosoftAccount').onclick = (e) => {
|
||||||
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
||||||
@ -513,30 +519,50 @@ function processLogOut(val, isLastAccount){
|
|||||||
const uuid = parent.getAttribute('uuid')
|
const uuid = parent.getAttribute('uuid')
|
||||||
const prevSelAcc = ConfigManager.getSelectedAccount()
|
const prevSelAcc = ConfigManager.getSelectedAccount()
|
||||||
const targetAcc = ConfigManager.getAuthAccount(uuid)
|
const targetAcc = ConfigManager.getAuthAccount(uuid)
|
||||||
if(targetAcc.type === 'microsoft') {
|
switch (targetAcc.type){
|
||||||
msAccDomElementCache = parent
|
case 'microsoft':
|
||||||
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
msAccDomElementCache = parent
|
||||||
ipcRenderer.send(MSFT_OPCODE.OPEN_LOGOUT, uuid, isLastAccount)
|
switchView(getCurrentView(), VIEWS.waiting, 500, 500, () => {
|
||||||
})
|
ipcRenderer.send(MSFT_OPCODE.OPEN_LOGOUT, uuid, isLastAccount)
|
||||||
} else {
|
})
|
||||||
AuthManager.removeMojangAccount(uuid).then(() => {
|
break
|
||||||
if(!isLastAccount && uuid === prevSelAcc.uuid){
|
case 'mojang':
|
||||||
const selAcc = ConfigManager.getSelectedAccount()
|
AuthManager.removeMojangAccount(uuid).then(() => {
|
||||||
refreshAuthAccountSelected(selAcc.uuid)
|
if(!isLastAccount && uuid === prevSelAcc.uuid){
|
||||||
updateSelectedAccount(selAcc)
|
const selAcc = ConfigManager.getSelectedAccount()
|
||||||
validateSelectedAccount()
|
refreshAuthAccountSelected(selAcc.uuid)
|
||||||
}
|
updateSelectedAccount(selAcc)
|
||||||
if(isLastAccount) {
|
validateSelectedAccount()
|
||||||
loginOptionsCancelEnabled(false)
|
}
|
||||||
loginOptionsViewOnLoginSuccess = VIEWS.settings
|
if(isLastAccount) {
|
||||||
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
|
loginOptionsCancelEnabled(false)
|
||||||
switchView(getCurrentView(), VIEWS.loginOptions)
|
loginOptionsViewOnLoginSuccess = VIEWS.settings
|
||||||
}
|
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
|
||||||
})
|
switchView(getCurrentView(), VIEWS.loginOptions)
|
||||||
$(parent).fadeOut(250, () => {
|
}
|
||||||
parent.remove()
|
})
|
||||||
})
|
$(parent).fadeOut(250, () => {
|
||||||
|
parent.remove()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'offline':
|
||||||
|
AuthManager.removeOfflineAccount(uuid)
|
||||||
|
break
|
||||||
|
case 'skirda':
|
||||||
|
AuthManager.removeSkirdaAccount(uuid)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
if(isLastAccount) {
|
||||||
|
loginOptionsCancelEnabled(false)
|
||||||
|
loginOptionsViewOnLoginSuccess = VIEWS.settings
|
||||||
|
loginOptionsViewOnLoginCancel = VIEWS.loginOptions
|
||||||
|
switchView(getCurrentView(), VIEWS.loginOptions)
|
||||||
|
}
|
||||||
|
// if(targetAcc.type === 'microsoft') {
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
//
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind reply for Microsoft Logout.
|
// Bind reply for Microsoft Logout.
|
||||||
@ -620,6 +646,8 @@ function refreshAuthAccountSelected(uuid){
|
|||||||
|
|
||||||
const settingsCurrentMicrosoftAccounts = document.getElementById('settingsCurrentMicrosoftAccounts')
|
const settingsCurrentMicrosoftAccounts = document.getElementById('settingsCurrentMicrosoftAccounts')
|
||||||
const settingsCurrentMojangAccounts = document.getElementById('settingsCurrentMojangAccounts')
|
const settingsCurrentMojangAccounts = document.getElementById('settingsCurrentMojangAccounts')
|
||||||
|
const settingsCurrentSkirdaDiscord = document.getElementById('settingsCurrentSkirdaDiscord')
|
||||||
|
const settingsCurrentOfflineDiscord = document.getElementById('settingsCurrentOfflineDiscord')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add auth account elements for each one stored in the authentication database.
|
* Add auth account elements for each one stored in the authentication database.
|
||||||
@ -634,9 +662,12 @@ function populateAuthAccounts(){
|
|||||||
|
|
||||||
let microsoftAuthAccountStr = ''
|
let microsoftAuthAccountStr = ''
|
||||||
let mojangAuthAccountStr = ''
|
let mojangAuthAccountStr = ''
|
||||||
|
let skirdaAuthAccountStr = ''
|
||||||
|
let offlineAuthAccountStr = ''
|
||||||
|
|
||||||
authKeys.forEach((val) => {
|
authKeys.forEach((val) => {
|
||||||
const acc = authAccounts[val]
|
const acc = authAccounts[val]
|
||||||
|
console.log(acc)
|
||||||
|
|
||||||
const accHtml = `<div class="settingsAuthAccount" uuid="${acc.uuid}">
|
const accHtml = `<div class="settingsAuthAccount" uuid="${acc.uuid}">
|
||||||
<div class="settingsAuthAccountLeft">
|
<div class="settingsAuthAccountLeft">
|
||||||
@ -662,16 +693,33 @@ function populateAuthAccounts(){
|
|||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
|
|
||||||
if(acc.type === 'microsoft') {
|
|
||||||
microsoftAuthAccountStr += accHtml
|
switch (acc.type){
|
||||||
} else {
|
case 'microsoft':
|
||||||
mojangAuthAccountStr += accHtml
|
microsoftAuthAccountStr += accHtml
|
||||||
|
break
|
||||||
|
case 'mojang':
|
||||||
|
mojangAuthAccountStr += accHtml
|
||||||
|
break
|
||||||
|
case 'offline':
|
||||||
|
offlineAuthAccountStr += accHtml
|
||||||
|
break
|
||||||
|
case 'skirda':
|
||||||
|
skirdaAuthAccountStr += accHtml
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
// if(acc.type === 'microsoft') {
|
||||||
|
// microsoftAuthAccountStr += accHtml
|
||||||
|
// } else {
|
||||||
|
// mojangAuthAccountStr += accHtml
|
||||||
|
// }
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
settingsCurrentMicrosoftAccounts.innerHTML = microsoftAuthAccountStr
|
settingsCurrentMicrosoftAccounts.innerHTML = microsoftAuthAccountStr
|
||||||
settingsCurrentMojangAccounts.innerHTML = mojangAuthAccountStr
|
settingsCurrentMojangAccounts.innerHTML = mojangAuthAccountStr
|
||||||
|
settingsCurrentSkirdaAccounts.innerHTML = skirdaAuthAccountStr
|
||||||
|
settingsCurrentOfflineAccounts.innerHTML = offlineAuthAccountStr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,7 @@ const VIEWS = {
|
|||||||
landing: '#landingContainer',
|
landing: '#landingContainer',
|
||||||
loginOptions: '#loginOptionsContainer',
|
loginOptions: '#loginOptionsContainer',
|
||||||
login: '#loginContainer',
|
login: '#loginContainer',
|
||||||
|
loginSkirdaDiscord: '#loginSkirdaDiscordContainer',
|
||||||
loginOffline: '#loginOfflineContainer',
|
loginOffline: '#loginOfflineContainer',
|
||||||
settings: '#settingsContainer',
|
settings: '#settingsContainer',
|
||||||
welcome: '#welcomeContainer',
|
welcome: '#welcomeContainer',
|
||||||
|
0
app/assets/js/skirda-auth/auth.js
Normal file
0
app/assets/js/skirda-auth/auth.js
Normal file
@ -35,6 +35,17 @@
|
|||||||
<span>Offline</span>
|
<span>Offline</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="loginOptionButtonContainer">
|
||||||
|
<button id="loginOptionSkirdaDiscord" class="loginOptionButton">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 9.677 9.667">
|
||||||
|
<path d="M-26.332-12.098h2.715c-1.357.18-2.574 1.23-2.715 2.633z" fill="#fff" />
|
||||||
|
<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><%- lang('loginOptions.loginWithMojang') %></span> -->
|
||||||
|
<span>Skirda Discord</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="loginOptionCancelContainer" style="display: none;">
|
<div id="loginOptionCancelContainer" style="display: none;">
|
||||||
<button id="loginOptionCancelButton"><%- lang('loginOptions.cancelButton') %></button>
|
<button id="loginOptionCancelButton"><%- lang('loginOptions.cancelButton') %></button>
|
||||||
|
28
app/loginSkirdaDiscord.ejs
Normal file
28
app/loginSkirdaDiscord.ejs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<div id="loginSkirdaDiscordContainer" style="display: none;">
|
||||||
|
<div id="loginOfflineCancelContainer" > <!--Delete style="" as temp fix-->
|
||||||
|
<button id="loginOfflineCancelButton">
|
||||||
|
<div id="loginOfflineCancelIcon">X</div>
|
||||||
|
<span id="loginOfflineCancelText">Cancel</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div id="loginContent">
|
||||||
|
<button id="loginSkirdaDiscordInitAuth" class="loginButton" enabled>
|
||||||
|
<div id="loginOfflineButtonContent">
|
||||||
|
LOGIN
|
||||||
|
<svg id="loginSVG" viewBox="0 0 24.87 13.97">
|
||||||
|
<defs>
|
||||||
|
<style>.arrowLine{fill:none;stroke:#FFF;stroke-width:2px;transition: 0.25s ease;}</style>
|
||||||
|
</defs>
|
||||||
|
<polyline class="arrowLine" points="0.71 13.26 12.56 1.41 24.16 13.02"/>
|
||||||
|
</svg>
|
||||||
|
<div class="circle-loader">
|
||||||
|
<div class="checkmark draw"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<script src="./assets/js/scripts/loginSkirdaDiscord.js"></script>
|
||||||
|
<script src="./assets/js/skirda-auth/auth.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
@ -68,6 +68,47 @@
|
|||||||
<!-- Mojang auth accounts populated here. -->
|
<!-- Mojang auth accounts populated here. -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="settingsAuthAccountTypeContainer">
|
||||||
|
<div class="settingsAuthAccountTypeHeader">
|
||||||
|
<div class="settingsAuthAccountTypeHeaderLeft">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 9.677 9.667">
|
||||||
|
<path d="M-26.332-12.098h2.715c-1.357.18-2.574 1.23-2.715 2.633z" fill="#fff" />
|
||||||
|
<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>Offline Accounts</span>
|
||||||
|
</div>
|
||||||
|
<div class="settingsAuthAccountTypeHeaderRight">
|
||||||
|
<button class="settingsAddAuthAccount" id="settingsAddOfflineAccount">+ offline accaunt</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="settingsCurrentAccounts" id="settingsCurrentOfflineAccounts">
|
||||||
|
<!-- Offline auth accounts populated here. -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="settingsAuthAccountTypeContainer">
|
||||||
|
<div class="settingsAuthAccountTypeHeader">
|
||||||
|
<div class="settingsAuthAccountTypeHeaderLeft">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 9.677 9.667">
|
||||||
|
<path d="M-26.332-12.098h2.715c-1.357.18-2.574 1.23-2.715 2.633z" fill="#fff" />
|
||||||
|
<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><%- lang('settings.skirdaAccount') %></span>-->
|
||||||
|
<span>Skirda</span>
|
||||||
|
</div>
|
||||||
|
<div class="settingsAuthAccountTypeHeaderRight">
|
||||||
|
<button class="settingsAddAuthAccount" id="settingsAddSkirdaDiscord">Skirda Discord Account</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="settingsCurrentAccounts" id="settingsCurrentSkirdaAccounts">
|
||||||
|
<!-- Mojang auth accounts populated here. -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="settingsTabMinecraft" class="settingsTab" style="display: none;">
|
<div id="settingsTabMinecraft" class="settingsTab" style="display: none;">
|
||||||
<div class="settingsTabHeader">
|
<div class="settingsTabHeader">
|
||||||
|
38
package-lock.json
generated
38
package-lock.json
generated
@ -22,6 +22,7 @@
|
|||||||
"helios-distribution-types": "^1.3.0",
|
"helios-distribution-types": "^1.3.0",
|
||||||
"jquery": "^3.7.1",
|
"jquery": "^3.7.1",
|
||||||
"lodash.merge": "^4.6.2",
|
"lodash.merge": "^4.6.2",
|
||||||
|
"rest-client-sdk": "^7.0.0-rc.10",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"toml": "^3.0.0"
|
"toml": "^3.0.0"
|
||||||
},
|
},
|
||||||
@ -644,6 +645,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz",
|
||||||
"integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw=="
|
"integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/urijs": {
|
||||||
|
"version": "1.19.25",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/urijs/-/urijs-1.19.25.tgz",
|
||||||
|
"integrity": "sha512-XOfUup9r3Y06nFAZh3WvO0rBU4OtlfPB/vgxpjg+NRdGU6CN6djdc6OEiH+PcqHCY6eFLo9Ista73uarf4gnBg=="
|
||||||
|
},
|
||||||
"node_modules/@types/verror": {
|
"node_modules/@types/verror": {
|
||||||
"version": "1.10.9",
|
"version": "1.10.9",
|
||||||
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.9.tgz",
|
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.9.tgz",
|
||||||
@ -1337,6 +1343,11 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/deep-diff": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-aWS3UIVH+NPGCD1kki+DCU9Dua032iSsO43LqQpcs4R3+dVv7tX0qBGjiVHJHjplsoUM2XRO/KB92glqc68awg=="
|
||||||
|
},
|
||||||
"node_modules/deep-is": {
|
"node_modules/deep-is": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||||
@ -3122,6 +3133,15 @@
|
|||||||
"node": ">=10.4.0"
|
"node": ">=10.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pluralize": {
|
||||||
|
"version": "8.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz",
|
||||||
|
"integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==",
|
||||||
|
"optional": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/prelude-ls": {
|
"node_modules/prelude-ls": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||||
@ -3270,6 +3290,19 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/rest-client-sdk": {
|
||||||
|
"version": "7.0.0-rc.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/rest-client-sdk/-/rest-client-sdk-7.0.0-rc.10.tgz",
|
||||||
|
"integrity": "sha512-5zkj/tO7fAIik/QLMKwRNNf+pG3Ajytz88FH+7XLn2ZnGTPqwPMJrLrJO9MpU/DmKgo9eTpPH4CSZfsR1hLOGw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/urijs": "^1.19.9",
|
||||||
|
"deep-diff": "^1.0.2",
|
||||||
|
"urijs": "^1.19.2"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"pluralize": "^8.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/retry": {
|
"node_modules/retry": {
|
||||||
"version": "0.12.0",
|
"version": "0.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
|
"resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",
|
||||||
@ -3807,6 +3840,11 @@
|
|||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/urijs": {
|
||||||
|
"version": "1.19.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz",
|
||||||
|
"integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ=="
|
||||||
|
},
|
||||||
"node_modules/utf8-byte-length": {
|
"node_modules/utf8-byte-length": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz",
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
"helios-distribution-types": "^1.3.0",
|
"helios-distribution-types": "^1.3.0",
|
||||||
"jquery": "^3.7.1",
|
"jquery": "^3.7.1",
|
||||||
"lodash.merge": "^4.6.2",
|
"lodash.merge": "^4.6.2",
|
||||||
|
"rest-client-sdk": "^7.0.0-rc.10",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"toml": "^3.0.0"
|
"toml": "^3.0.0"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user