stable result
This commit is contained in:
parent
7505a602b6
commit
2fdd8410c7
51
.idea/workspace.xml
generated
51
.idea/workspace.xml
generated
@ -6,15 +6,16 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="efee9cb0-966d-4623-845a-f3b0398ae3ab" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/app.ejs" beforeDir="false" afterPath="$PROJECT_DIR$/app/app.ejs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Callback/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/Callback/index.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/css/launcher.css" beforeDir="false" afterPath="$PROJECT_DIR$/app/assets/css/launcher.css" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/js/authmanager.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/assets/js/authmanager.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/js/configmanager.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/assets/js/configmanager.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/js/processbuilder.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/assets/js/processbuilder.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/js/scripts/loginOptions.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/assets/js/scripts/loginOptions.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/js/scripts/loginSkirdaDiscord.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/js/scripts/skirda/auth/telegram.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/lang/en_US.toml" beforeDir="false" afterPath="$PROJECT_DIR$/app/assets/lang/en_US.toml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/lang/ru_RU.toml" beforeDir="false" afterPath="$PROJECT_DIR$/app/assets/lang/ru_RU.toml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/loginOptions.ejs" beforeDir="false" afterPath="$PROJECT_DIR$/app/loginOptions.ejs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/loginSkirdaDiscord.ejs" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/loginSkirdaTelegram.ejs" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/js/scripts/loginSkirda.js" beforeDir="false" afterPath="$PROJECT_DIR$/app/assets/js/scripts/loginSkirda.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/assets/js/skirda-auth/auth.js" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/loginSkirda.ejs" beforeDir="false" afterPath="$PROJECT_DIR$/app/loginSkirda.ejs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/settings.ejs" beforeDir="false" afterPath="$PROJECT_DIR$/app/settings.ejs" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -41,24 +42,24 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
||||
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
||||
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
|
||||
"git-widget-placeholder": "offline-mode",
|
||||
"go.import.settings.migrated": "true",
|
||||
"go.sdk.automatically.set": "true",
|
||||
"last_opened_file_path": "/home/dart/repo/skirda/SkirdaElectronLauncher/app",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"npm.start.executor": "Debug",
|
||||
"ts.external.directory.path": "/opt/goland/plugins/javascript-plugin/jsLanguageServicesImpl/external"
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
||||
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
||||
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
|
||||
"git-widget-placeholder": "offline-mode",
|
||||
"go.import.settings.migrated": "true",
|
||||
"go.sdk.automatically.set": "true",
|
||||
"last_opened_file_path": "/home/dart/repo/skirda/yggdrasil-server",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"npm.start.executor": "Debug",
|
||||
"ts.external.directory.path": "/opt/goland/plugins/javascript-plugin/jsLanguageServicesImpl/external"
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/app" />
|
||||
|
@ -157,7 +157,7 @@
|
||||
<span>Успешная авторизация! Для начала игры вам необходимо вернутся в лаунчер.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="settingsAboutButtons">
|
||||
<div id="footer-label">
|
||||
<span id="loginSkirdaAuthorizationNote">Skirda Launcher</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -174,7 +174,7 @@
|
||||
<span id="loginSkirdaAuthorizationError">(Eror Pizda Poezdu)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="settingsAboutButtons">
|
||||
<div id="footer-label">
|
||||
<span id="loginSkirdaAuthorizationNote">Skirda Launcher</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2208,7 +2208,7 @@ input:checked + .toggleSwitchSlider:before {
|
||||
}
|
||||
|
||||
/* About information links. */
|
||||
#settingsAboutButtons {
|
||||
#footer-label {
|
||||
display: flex;
|
||||
padding: 0px 15px;
|
||||
margin-bottom: 5px;
|
||||
|
@ -175,14 +175,13 @@ exports.addMojangAccount = async function(username, password){
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} uuid
|
||||
* @param {string} uuid Minecraft profile uuid
|
||||
* @param {string} accessToken
|
||||
* @param {string} username
|
||||
* @param {string} displayName
|
||||
* @param {string} skirdaToken
|
||||
* */
|
||||
exports.addSkirdaAccount = async function(uuid, accessToken, username, displayName, skirdaToken){
|
||||
const ret = ConfigManager.addSkirdaAccount(uuid, accessToken, username, displayName, skirdaToken)
|
||||
exports.addSkirdaAccount = async function(uuid, accessToken, username, skirdaToken){
|
||||
const ret = ConfigManager.addSkirdaAccount(uuid, accessToken, username, skirdaToken)
|
||||
ConfigManager.save()
|
||||
return ret
|
||||
}
|
||||
@ -415,7 +414,7 @@ async function validateSelectedMojangAccount(){
|
||||
const auth_api_url = 'https://skirda.brzezinski.ru'
|
||||
async function validateSelectedSkirdaAccount(){
|
||||
const current = ConfigManager.getSelectedAccount()
|
||||
|
||||
console.log(current)
|
||||
const resp = await fetch(`${auth_api_url}/auth/refresh`, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
@ -364,15 +364,14 @@ exports.addOfflineAccount = function(usernameOffline){
|
||||
return config.authenticationDatabase[fake_uuid]
|
||||
}
|
||||
|
||||
exports.addSkirdaAccount = function(uuid, accessToken, username, displayName, skirdaToken){
|
||||
console.log(username)
|
||||
exports.addSkirdaAccount = function(uuid, accessToken, username, skirdaToken){
|
||||
config.selectedAccount = uuid
|
||||
config.authenticationDatabase[uuid] = {
|
||||
type: 'skirda',
|
||||
accessToken,
|
||||
username: username.trim(),
|
||||
uuid: uuid.trim(),
|
||||
displayName: displayName.trim(),
|
||||
displayName: username.trim(),
|
||||
skirdaJWT: skirdaToken.trim()
|
||||
}
|
||||
return config.authenticationDatabase[uuid]
|
||||
|
@ -375,6 +375,10 @@ class ProcessBuilder {
|
||||
args.push('-Xms' + ConfigManager.getMinRAM(this.server.rawServer.id))
|
||||
args = args.concat(ConfigManager.getJVMOptions(this.server.rawServer.id))
|
||||
args.push('-Djava.library.path=' + tempNativePath)
|
||||
args.push('-Dminecraft.api.auth.host=https://skirda.brzezinski.ru/yggdrasil/auth')
|
||||
args.push('-Dminecraft.api.account.host=https://skirda.brzezinski.ru/yggdrasil/account')
|
||||
args.push('-Dminecraft.api.session.host=https://skirda.brzezinski.ru/yggdrasil')
|
||||
args.push('-Dminecraft.api.services.host=https://skirda.brzezinski.ru/yggdrasil/services)')
|
||||
|
||||
// Main Java Class
|
||||
args.push(this.modManifest.mainClass)
|
||||
|
@ -3,6 +3,8 @@ const loginOptionMicrosoft = document.getElementById('loginOptionMicrosoft')
|
||||
const loginOptionMojang = document.getElementById('loginOptionMojang')
|
||||
const loginOptionOffline = document.getElementById('loginOptionOffline')
|
||||
const loginOptionSkirdaAuth = document.getElementById('loginOptionSkirdaAuth')
|
||||
// const loginOptionSkirdaAuthStage1 = document.getElementById('loginOptionSkirdaStage1')
|
||||
// const loginOptionSkirdaAuthStage2 = document.getElementById('loginOptionSkirdaStage2')
|
||||
const loginOptionSkirdaDiskord = document.getElementById('loginOptionSkirdaDiscord')
|
||||
const loginOptionSkirdaTelegram = document.getElementById('loginOptionSkirdaTelegram')
|
||||
const loginOptionsCancelButton = document.getElementById('loginOptionCancelButton')
|
||||
@ -67,23 +69,58 @@ function loginOptionsCancelEnabled(val){
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
|
||||
loginOptionSkirdaAuth.onclick = (e) => {
|
||||
console.log("aaaa")
|
||||
switchView(getCurrentView(), VIEWS.loginSkirdaAuth, 500, 500, () => {
|
||||
loginViewOnSuccess = loginOptionsViewOnLoginSuccess
|
||||
loginViewOnCancel = loginOptionsViewOnLoginCancel
|
||||
// const stage1 = document.getElementById('loginOptionSkirdaStage1')
|
||||
// const stage2 = document.getElementById('loginOptionSkirdaStage2')
|
||||
// /** @type {HTMLInputElement}*/
|
||||
// const usernameInput = document.getElementById('loginOptionSkirdaSubmitUsername')
|
||||
// /** @type {HTMLButtonElement}*/
|
||||
// const submitButton = document.getElementById('loginOptionSkirdaSubmitUsernameButton')
|
||||
//
|
||||
//
|
||||
// stage1.style.display = 'none'
|
||||
// stage2.style.display = 'block'
|
||||
//
|
||||
// submitButton.addEventListener('click', (e) => {
|
||||
// SkirdaAuth.CheckFreeUsername('aaa', usernameInput.value).then((res) => {
|
||||
// if (res.error !== undefined){
|
||||
// console.error(res.error)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// console.log('ok')
|
||||
// })
|
||||
// })
|
||||
//
|
||||
// usernameInput.addEventListener('input', (input) =>{
|
||||
// submitButton.disabled = !usernameInput.checkValidity()
|
||||
// })
|
||||
|
||||
SkirdaAuth.Init().then((result) => {
|
||||
console.log(result)
|
||||
|
||||
AuthManager.addSkirdaAccount(result.ygg_auth_resp.profile.id, result.skirda_auth_resp.token, result.skirda_auth_resp.name, result.skirda_auth_resp.name, result.skirda_auth_resp.token).then((value) => {
|
||||
console.log(value)
|
||||
updateSelectedAccount(value)
|
||||
}).then((value) => {
|
||||
switchView(getCurrentView(), VIEWS.landing, 500, 500, async () => {
|
||||
|
||||
if (result.error) {
|
||||
console.error(result)
|
||||
} else {
|
||||
SkirdaAuth.YggdrasilAuth(result.token).then(ygg_res => {
|
||||
if (ygg_res.error !== undefined) {
|
||||
console.error(ygg_res)
|
||||
} else {
|
||||
AuthManager.addSkirdaAccount(
|
||||
ygg_res.profile.id,
|
||||
ygg_res.accessToken,
|
||||
ygg_res.profile.name,
|
||||
result.token).then((value) => {
|
||||
updateSelectedAccount(value)
|
||||
}).then((value) => {
|
||||
switchView(getCurrentView(), VIEWS.landing, 500, 500, async () => {})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -1,37 +1,46 @@
|
||||
const sk_tg_auth_api_url = 'https://skirda.brzezinski.ru/auth'
|
||||
|
||||
/**@typedef {Object} SkirdaAuthInitResponse
|
||||
* @property {string} redirect_url
|
||||
* @property {string} subscribe_url
|
||||
* */
|
||||
|
||||
|
||||
|
||||
/**@typedef {Object} SkirdaAuthResponse
|
||||
* @property {string} id
|
||||
* @property {string} name
|
||||
/** @typedef {Object} SkirdaAuthError
|
||||
* @property {string} error
|
||||
*/
|
||||
|
||||
/**@typedef {Object} YggdrasilProfile
|
||||
* @property {string} id
|
||||
* @property {string} name
|
||||
/** @typedef {Object} YggdrasilError
|
||||
* @property {string} error
|
||||
* @property {string} path
|
||||
*/
|
||||
|
||||
/**@typedef {Object} SkirdaYggdrasilAuthResponse
|
||||
* @property {YggdrasilProfile} profile
|
||||
/** @typedef {Object} SkirdaAuthInitResponse
|
||||
* @property {string} redirect_url
|
||||
* @property {string} subscribe_url
|
||||
*/
|
||||
|
||||
/** @typedef {Object} SkirdaAuthResultResponse
|
||||
* @property {SkirdaAuthResponse} skirda_auth_resp
|
||||
* @property {SkirdaYggdrasilAuthResponse} ygg_auth_resp
|
||||
**/
|
||||
/** @typedef {Object} SkirdaAuthResponse
|
||||
* @property {string} id
|
||||
* @property {string} name
|
||||
* @property {string} token
|
||||
*/
|
||||
|
||||
class SkirdaAuth{
|
||||
constructor(){
|
||||
/** @typedef {Object} SkirdaYggdrasilAuthResponse
|
||||
* @property {string} clientToken
|
||||
* @property {string} accessToken //jwt from skirda yggdrasil service with minecraft username
|
||||
* @property {YggdrasilProfile} profile
|
||||
*/
|
||||
|
||||
/** @typedef {Object} YggdrasilProfile
|
||||
* @property {string} id
|
||||
* @property {string} name
|
||||
*/
|
||||
|
||||
|
||||
class SkirdaAuth {
|
||||
constructor() {
|
||||
console.log('Skirda Auth')
|
||||
}
|
||||
|
||||
static async #fetchInit(){
|
||||
/**
|
||||
* @returns {Promise<SkirdaAuthResponse|SkirdaAuthError>}
|
||||
*/
|
||||
static async #fetchInit() {
|
||||
const resp = await fetch(`${sk_tg_auth_api_url}/telegram/init`, {})
|
||||
if (!resp.ok) {
|
||||
throw new Error(`Response status: ${resp.status}`)
|
||||
@ -45,31 +54,25 @@ class SkirdaAuth{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Promise<SkirdaAuthResultResponse>
|
||||
* @return {Promise<SkirdaAuthResponse|SkirdaAuthError>}
|
||||
* */
|
||||
static async Init() {
|
||||
const initResp = await SkirdaAuth.#fetchInit()
|
||||
|
||||
await shell.openExternal(initResp.redirect_url)
|
||||
|
||||
const authResult = await SkirdaAuth.#subscribe(initResp.subscribe_url)
|
||||
console.log(authResult)
|
||||
// const yggResp = await SkirdaAuth.#yggdrasilAuth(authResult.token)
|
||||
// console.log(yggResp)
|
||||
|
||||
const yggResp = await SkirdaAuth.#yggdrasilAuth(authResult.token)
|
||||
console.log(yggResp)
|
||||
// console.log(yggResp.profile)
|
||||
|
||||
return {
|
||||
'skirda_auth_resp': authResult,
|
||||
'ygg_auth_resp': yggResp
|
||||
}
|
||||
return await SkirdaAuth.#subscribe(initResp.subscribe_url)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param subscribe_url
|
||||
* @returns {Promise<SkirdaAuthResultResponse>}
|
||||
* @returns {Promise<SkirdaAuthResponse|SkirdaAuthError>}
|
||||
*/
|
||||
static async #subscribe(subscribe_url) {
|
||||
const resp = await fetch(subscribe_url, {})
|
||||
@ -79,20 +82,21 @@ class SkirdaAuth{
|
||||
}
|
||||
return await resp.json()
|
||||
} catch (error) {
|
||||
console.error(error.message)
|
||||
return null
|
||||
return {
|
||||
error: error.message,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} token
|
||||
* @return SkirdaYggdrasilAuthResponse
|
||||
* @return {Promise<SkirdaYggdrasilAuthResponse|YggdrasilError>}
|
||||
* */
|
||||
static async #yggdrasilAuth(token) {
|
||||
static async YggdrasilAuth(token) {
|
||||
const ygg_auth_api_url = 'https://skirda.brzezinski.ru'
|
||||
const resp = await fetch(`${ygg_auth_api_url}/yggdrasil/skirda/authenticate`, {
|
||||
headers: {
|
||||
// 'Content-Type': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': token
|
||||
}
|
||||
})
|
||||
@ -100,7 +104,36 @@ class SkirdaAuth{
|
||||
try {
|
||||
return await resp.json()
|
||||
} catch (error) {
|
||||
console.error(error.message)
|
||||
return {
|
||||
error: error.message,
|
||||
path: 'skirda/authenticate',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} token
|
||||
* @param {string} username
|
||||
* @return {Promise<bool|YggdrasilError>}
|
||||
* */
|
||||
static async CheckFreeUsername(token, username) {
|
||||
const ygg_auth_api_url = 'https://skirda.brzezinski.ru'
|
||||
const resp = await fetch(`${ygg_auth_api_url}/yggdrasil/skirda/checkFreeUsername`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': token
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
return await resp.json()
|
||||
} catch (error) {
|
||||
return {
|
||||
error: error.message,
|
||||
path: 'skirda/checkFreeUsername',
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -5,13 +5,38 @@
|
||||
<div id="settingsAboutCurrentContent" class="Centered">
|
||||
<div id="settingsAboutCurrentHeadline">
|
||||
<img id="settingsAboutLogo" src="./assets/images/SealCircle.png">
|
||||
<span id="settingsAboutTitle">Authorize through Skirda Discord</span>
|
||||
<span id="settingsAboutTitle">TEMP TEXT</span>
|
||||
</div>
|
||||
<div id="settingsAboutCurrentVersion" class="Centered">
|
||||
<span>Мы открыли браузер для дальнейшей авторизации через DiscordAAAAAAAAAAA</span>
|
||||
<div id="loginOptionSkirdaStage1">
|
||||
<div id="settingsAboutCurrentVersion" class="Centered">
|
||||
<span>MEGA GHOPA WATCH YOR BROWSER DUMB FOOL</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="loginOptionSkirdaStage2" style="display: none">
|
||||
<span>CHOOSE USERNAME, BIGBOY</span>
|
||||
<div id="settingsAboutCurrentVersion" class="Centered">
|
||||
<input id="loginOptionSkirdaSubmitUsername" class="loginField" type="text" pattern="^[a-zA-Z0-9_]{2,16}$"/>
|
||||
</div>
|
||||
|
||||
<button id="loginOptionSkirdaSubmitUsernameButton" disabled>
|
||||
<div id="loginButtonContent">
|
||||
<%- lang('login.loginButtonText') %>
|
||||
<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 class="spinningCircle" id="loginSpinner"></div>-->
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="settingsAboutButtons">
|
||||
<div id="footer-label">
|
||||
<span id="loginSkirdaAuthorizationNote">В случае, если это не произошло, откройте его самостоятельно</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -370,7 +370,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="settingsAboutButtons">
|
||||
<div id="footer-label">
|
||||
<a href="<%- lang('settings.sourceGithubLink') %>" id="settingsAboutSourceButton" class="settingsAboutButton"><%- lang('settings.sourceGithub') %></a>
|
||||
<!-- The following must be included in third-party usage. -->
|
||||
<!-- <a href="https://github.com/dscalzi/HeliosLauncher" id="settingsAboutSourceButton" class="settingsAboutButton">Original Source</a> -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user