initial-offline login

This commit is contained in:
cyber-dream 2022-07-30 16:07:51 +03:00
parent e7dd171cea
commit a4204d1f07
13 changed files with 5258 additions and 4794 deletions

View File

@ -31,6 +31,7 @@
<div id="main"> <div id="main">
<%- include('welcome') %> <%- include('welcome') %>
<%- include('login') %> <%- include('login') %>
<%- include('loginOffline') %>
<%- include('waiting') %> <%- include('waiting') %>
<%- include('loginOptions') %> <%- include('loginOptions') %>
<%- include('settings') %> <%- include('settings') %>

View File

@ -484,6 +484,31 @@ body, button {
color: #8b8b8b; color: #8b8b8b;
} }
/* Login Offline form. */
#loginOfflineForm {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
/* Login form anchor styles. */
#loginOfflineForm a {
font-size: 12px;
color: #848484;
font-weight: bold;
text-decoration: none;
transition: 0.25s ease;
}
#loginOfflineForm a:hover,
#loginOfflineForm a:focus {
color: #a2a2a2;
outline: none;
}
#loginOfflineForm a:active {
color: #8b8b8b;
}
/* Logo on login form. */ /* Logo on login form. */
#loginImageSeal { #loginImageSeal {
border-radius: 50%; border-radius: 50%;
@ -674,6 +699,72 @@ body, button {
display: initial; display: initial;
} }
/* Login Offline button styles. */
#loginOfflineButton {
background: none;
font-weight: bold;
letter-spacing: 2px;
border: none;
padding: 15px 5px;
margin: 10px 0px;
cursor: pointer;
position: relative;
right: -20px;
transition: 0.5s ease;
}
#loginOfflineButton:disabled {
color: rgba(255, 255, 255, 0.75);
pointer-events: none;
}
#loginOfflineButton[loading] {
color: #fff;
}
#loginOfflineButton:hover,
#loginOfflineButton:focus {
text-shadow: 0px 0px 20px #fff;
outline: none;
}
#loginOfflineButton:active {
color: #c7c7c7;
text-shadow: 0px 0px 20px #c7c7c7;
}
#loginOfflineSVG {
-webkit-transform: translate3d(0, 0, 0);
overflow: visible;
transform: rotate(90deg);
margin-left: 20px;
transition: 0.25s ease;
width: 20px;
height: 20px;
}
#loginOfflineButton:hover #loginOfflineSVG,
#loginOfflineButton:focus #loginOfflineSVG {
-webkit-filter: drop-shadow(0px 0px 2px #fff);
}
#loginOfflineButton:active #loginOfflineSVG .arrowLine {
stroke: #c7c7c7;
}
#loginOfflineButton:active #loginOfflineSVG {
-webkit-filter: drop-shadow(0px 0px 2px #c7c7c7);
}
#loginOfflineButton:disabled #loginOfflineSVG .arrowLine {
stroke: rgba(255, 255, 255, 0.75);
}
#loginOfflineButtonContent {
display: flex;
align-items: center;
}
#loginOfflineButton .circle-loader,
#loginOfflineButton[loading] #loginOfflineSVG {
display: none;
}
#loginOfflineButton[loading] .circle-loader,
#loginOfflineButton #loginOfflineSVG {
display: initial;
}
.circle-loader { .circle-loader {
margin-left: 20px; margin-left: 20px;

View File

@ -0,0 +1,298 @@
{
"version": "1.0.0",
"discord": {
"clientId": "385581240906022916",
"smallImageText": "WesterosCraft",
"smallImageKey": "seal-circle"
},
"java": {
"oracle": "http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html"
},
"rss": "https://westeroscraft.com/articles/index.rss",
"servers": [
{
"id": "SkirdaTesting-1.12.2",
"name": "Skirda Test Server",
"description": "Сплошные баги блять",
"icon": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/server-prod.png",
"version": "4.6.5",
"address": "192.168.88.228:35012",
"minecraftVersion": "1.12.2",
"discord": {
"shortId": "Skirda Minecraft Server",
"largeImageText": "Skirda 1.12.2 Minecraft Server",
"largeImageKey": "skirda-testing"
},
"mainServer": false,
"autoconnect": true,
"modules": [
{
"id": "net.minecraftforge:forge:1.12.2-14.23.5.2847",
"name": "Minecraft Forge",
"type": "ForgeHosted",
"artifact": {
"size": 4884700,
"MD5": "90734a5a713e24902d24c45c15caa42c",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/forge-1.12.2-14.23.5.2847-universal.jar"
},
"subModules": [
{
"id": "net.minecraft:launchwrapper:1.12",
"name": "Mojang (LaunchWrapper)",
"type": "Library",
"artifact": {
"size": 32999,
"MD5": "934b2d91c7c5be4a49577c9e6b40e8da",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/launchwrapper-1.12.jar"
}
},
{
"id": "org.ow2.asm:asm-all:5.2",
"name": "Mojang (ASM)",
"type": "Library",
"artifact": {
"size": 247787,
"MD5": "f5ad16c7f0338b541978b0430d51dc83",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/asm-all-5.2.jar"
}
},
{
"id": "jline:jline:2.13",
"name": "Mojang (jline)",
"type": "Library",
"artifact": {
"size": 248566,
"MD5": "f251ba666cccb260ff7215b2cbeee8d4",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/jline-2.13.jar"
}
},
{
"id": "org.scala-lang:scala-library:2.11.1@jar.pack.xz",
"name": "Minecraft Forge (scala-library)",
"type": "Library",
"artifact": {
"size": 1474672,
"MD5": "379c15c4f724421c6d5d7aecedaf87a6",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/scala-library-2.11.1.jar.pack.xz"
}
},
{
"id": "org.scala-lang:scala-compiler:2.11.1@jar.pack.xz",
"name": "Minecraft Forge (scala-compiler)",
"type": "Library",
"artifact": {
"size": 3076920,
"MD5": "7d89e952f2d5c74577310cd2c28e3f20",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/scala-compiler-2.11.1.jar.pack.xz"
}
},
{
"id": "org.scala-lang:scala-actors-migration_2.11:1.1.0@jar.pack.xz",
"name": "Minecraft Forge (scala-actors-migration)",
"type": "Library",
"artifact": {
"size": 21324,
"MD5": "04e3428b2600ace33c7ae2bf1f6c0a4c",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/scala-actors-migration_2.11-1.1.0.jar.pack.xz"
}
},
{
"id": "org.scala-lang.plugins:scala-continuations-library_2.11:1.0.2@jar.pack.xz",
"name": "Minecraft Forge (scala-continuations-library)",
"type": "Library",
"artifact": {
"size": 7956,
"MD5": "ed9b1d27aba8ac4090a3749c4dfc895a",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/scala-continuations-library_2.11-1.0.2.jar.pack.xz"
}
},
{
"id": "org.scala-lang.plugins:scala-continuations-plugin_2.11.1:1.0.2@jar.pack.xz",
"name": "Minecraft Forge (scala-continuations-plugin)",
"type": "Library",
"artifact": {
"size": 46140,
"MD5": "a8232db22a72a981de6b1399eb86dff7",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/scala-continuations-plugin_2.11.1-1.0.2.jar.pack.xz"
}
},
{
"id": "org.scala-lang:scala-parser-combinators_2.11:1.0.1@jar.pack.xz",
"name": "Minecraft Forge (scala-parser-combinators)",
"type": "Library",
"artifact": {
"size": 85568,
"MD5": "2e50a7df17680daadacca69f07f8a16d",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/scala-parser-combinators_2.11-1.0.1.jar.pack.xz"
}
},
{
"id": "org.scala-lang:scala-reflect:2.11.1@jar.pack.xz",
"name": "Minecraft Forge (scala-reflect)",
"type": "Library",
"artifact": {
"size": 1070312,
"MD5": "84e5dc81c10e2bd74c579c9d0332fdd9",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/scala-reflect-2.11.1.jar.pack.xz"
}
},
{
"id": "org.scala-lang:scala-swing_2.11:1.0.1",
"name": "Minecraft Forge (scala-swing)",
"type": "Library",
"artifact": {
"size": 736795,
"MD5": "1d360289e697022a3f57abaad344b28f",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/scala-swing_2.11-1.0.1.jar"
}
},
{
"id": "org.scala-lang:scala-xml_2.11:1.0.2@jar.pack.xz",
"name": "Minecraft Forge (scala-xml)",
"type": "Library",
"artifact": {
"size": 217812,
"MD5": "cc891b094a4c32dedc56bfefe9b072ff",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/scala-xml_2.11-1.0.2.jar.pack.xz"
}
},
{
"id": "com.typesafe.akka:akka-actor_2.11:2.3.3@jar.pack.xz",
"name": "Minecraft Forge (akka-actor)",
"type": "Library",
"artifact": {
"size": 746612,
"MD5": "25cb22c3078e9fb3f7a861c912924862",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/akka-actor_2.11-2.3.3.jar.pack.xz"
}
},
{
"id": "com.typesafe:config:1.2.1@jar.pack.xz",
"name": "Minecraft Forge (typesafe-config)",
"type": "Library",
"artifact": {
"size": 56636,
"MD5": "10ec4ccabc4e68aac9cf87165ead5d7d",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/config-1.2.1.jar.pack.xz"
}
},
{
"id": "lzma:lzma:0.0.1",
"name": "Mojang (LZMA)",
"type": "Library",
"artifact": {
"size": 5762,
"MD5": "a3e3c3186e41c4a1a3027ba2bb23cdc6",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/lzma-0.0.1.jar"
}
},
{
"id": "net.sf.trove4j:trove4j:3.0.3",
"name": "Trove4J",
"type": "Library",
"artifact": {
"size": 2523218,
"MD5": "8fc4d4e0129244f9fd39650c5f30feb2",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/trove4j-3.0.3.jar"
}
},
{
"id": "java3d:vecmath:1.5.2",
"name": "Vecmath",
"type": "Library",
"artifact": {
"size": 318956,
"MD5": "e5d2b7f46c4800a32f62ce75676a5710",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/vecmath-1.5.2.jar"
}
},
{
"id": "net.sf.jopt-simple:jopt-simple:5.0.3",
"name": "Jopt-simple",
"type": "Library",
"artifact": {
"size": 78175,
"MD5": "0a5ec84e23df9d7cfb4063bc55f2744c",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/jopt-simple-5.0.3.jar"
}
},
{
"id": "org.apache.maven:maven-artifact:3.5.3",
"name": "maven-artifact",
"type": "Library",
"artifact": {
"size": 54961,
"MD5": "7741ebf29690ee7d9dde9cf4376347fc",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/maven-artifact-3.5.3.jar"
}
},
{
"id": "net.minecraftforge:MercuriusUpdater:1.12.2",
"name": "MercuriusUpdater",
"type": "Library",
"artifact": {
"size": 15098,
"MD5": "6eb9e61097bee3103a2fdc42746b76a4",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/1.12.2/MercuriusUpdater-1.12.2.jar"
}
}
]
},
{
"id": "net.optifine:optifine:1.12.2_HD_U_F5",
"name": "Optifine",
"type": "ForgeMod",
"artifact": {
"size": 2598821,
"MD5": "043ac1db6f7441ea4cf31bcb621aff0b",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/prod-1.12.2/mods/OptiFine.jar"
}
},
{
"id": "mezz:jei:1.12.2-4.14.3.242",
"name": "JustEnoughItems",
"type": "ForgeMod",
"artifact": {
"size": 620682,
"MD5": "ae6d0e6e873ef6c20f41097dc7fee8c6",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/prod-1.12.2/mods/jei.jar"
}
},
{
"id": "xaeros:minimap:1.12.2-20.15.0",
"name": "XaerosMinimap",
"type": "ForgeMod",
"required": {
"value": false
},
"artifact": {
"size": 528849,
"MD5": "cc12cfe20febd1404345f5339e522cda",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/prod-1.12.2/mods/Xaeros_Minimap.jar"
}
},
{
"id": "options.txt",
"name": "Default Client Options",
"type": "File",
"artifact": {
"size": 1973,
"path": "options.txt",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/files/options-1.12.2.txt"
}
},
{
"id": "servers.dat",
"name": "Saved Client Servers",
"type": "File",
"artifact": {
"size": 84,
"MD5": "71d99e229d7d2b8d2a6423e46832a4b8",
"path": "servers.dat",
"url": "http://mc.westeroscraft.com/WesterosCraftLauncher/prod-1.12.2/servers.dat"
}
}
]
}
]
}

View File

@ -15,6 +15,7 @@ const { RestResponseStatus } = require('helios-core/common')
const { MojangRestAPI, mojangErrorDisplayable, MojangErrorCode } = require('helios-core/mojang') const { MojangRestAPI, mojangErrorDisplayable, MojangErrorCode } = require('helios-core/mojang')
const { MicrosoftAuth, microsoftErrorDisplayable, MicrosoftErrorCode } = require('helios-core/microsoft') const { MicrosoftAuth, microsoftErrorDisplayable, MicrosoftErrorCode } = require('helios-core/microsoft')
const { AZURE_CLIENT_ID } = require('./ipcconstants') const { AZURE_CLIENT_ID } = require('./ipcconstants')
const { async } = require('node-stream-zip')
const log = LoggerUtil.getLogger('AuthManager') const log = LoggerUtil.getLogger('AuthManager')
@ -57,6 +58,10 @@ exports.addMojangAccount = async function(username, password) {
} }
} }
exports.addOfflineAccount = async function(usernameOffline){
ConfigManager.addOfflineAccount('0456456413213', '-', "Megatraher")
}
const AUTH_MODE = { FULL: 0, MS_REFRESH: 1, MC_REFRESH: 2 } const AUTH_MODE = { FULL: 0, MS_REFRESH: 1, MC_REFRESH: 2 }
/** /**

View File

@ -353,6 +353,17 @@ exports.addMojangAuthAccount = function(uuid, accessToken, username, displayName
return config.authenticationDatabase[uuid] return config.authenticationDatabase[uuid]
} }
exports.addOfflineAccount = function(uuid, accessToken, usernameOffline){
config.selectedAccount = uuid
config.authenticationDatabase[uuid] = {
type: 'offline',
accessToken,
username: usernameOffline.trim(),
uuid: uuid.trim(),
displayName: usernameOffline.trim()
}
return config.authenticationDatabase[uuid]
}
/** /**
* Update the tokens of an authenticated microsoft account. * Update the tokens of an authenticated microsoft account.
* *

View File

@ -537,7 +537,8 @@ exports.pullRemote = function(){
return exports.pullLocal() return exports.pullLocal()
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const distroURL = 'http://mc.westeroscraft.com/WesterosCraftLauncher/distribution.json' //const distroURL = 'http://mc.westeroscraft.com/WesterosCraftLauncher/distribution.json'
const distroURL = "http://192.168.88.228:45789/distr.json"
//const distroURL = 'https://gist.githubusercontent.com/dscalzi/53b1ba7a11d26a5c353f9d5ae484b71b/raw/' //const distroURL = 'https://gist.githubusercontent.com/dscalzi/53b1ba7a11d26a5c353f9d5ae484b71b/raw/'
const opts = { const opts = {
url: distroURL, url: distroURL,

View File

@ -108,6 +108,7 @@ document.getElementById('launch_button').addEventListener('click', function(e){
} }
}) })
// Bind settings button // Bind settings button
document.getElementById('settingsMediaButton').onclick = (e) => { document.getElementById('settingsMediaButton').onclick = (e) => {
prepareSettings() prepareSettings()
@ -484,12 +485,12 @@ function dlAsync(login = true){
// Login parameter is temporary for debug purposes. Allows testing the validation/downloads without // Login parameter is temporary for debug purposes. Allows testing the validation/downloads without
// launching the game. // launching the game.
if(login) { /* if(login) {
if(ConfigManager.getSelectedAccount() == null){ if(ConfigManager.getSelectedAccount() == null){
loggerLanding.error('You must be logged into an account.') loggerLanding.error('You must be logged into an account.')
return return
} }
} }*/
setLaunchDetails('Please wait..') setLaunchDetails('Please wait..')
toggleLaunchArea(true) toggleLaunchArea(true)

View File

@ -0,0 +1,30 @@
const loggerOfflineLogin = LoggerUtil1('%c[LoginOffline]', 'color: #000668; font-weight: bold')
const loginOfflineButton = document.getElementById('loginOfflineButton')
function loginOfflineDisabled(v){
if(loginOfflineButton.disabled !== v){
loginOfflineButton.disabled = v
}
}
function formOfflineDisabled(v){
loginOfflineDisabled(v)
//loginCancelButton.disabled = v
loginOfflineUsername.disabled = v
/*loginPassword.disabled = v
if(v){
checkmarkContainer.setAttribute('disabled', v)
} else {
checkmarkContainer.removeAttribute('disabled')
}
loginRememberOption.disabled = v*/
}
loginOfflineButton.addEventListener('click', () => {
formOfflineDisabled(true)
AuthManager.addOfflineAccount(loginOfflineUsername.value).then((value) =>{
switchView(VIEWS.loginOffline, VIEWS.landing, 500, 500)
})
})

View File

@ -3,7 +3,7 @@ const loginOptionMicrosoft = document.getElementById('loginOptionMicrosoft')
const loginOptionMojang = document.getElementById('loginOptionMojang') const loginOptionMojang = document.getElementById('loginOptionMojang')
const loginOptionsCancelButton = document.getElementById('loginOptionCancelButton') const loginOptionsCancelButton = document.getElementById('loginOptionCancelButton')
let loginOptionsCancellable = false let loginOptionsCancellable = true
let loginOptionsViewOnLoginSuccess let loginOptionsViewOnLoginSuccess
let loginOptionsViewOnLoginCancel let loginOptionsViewOnLoginCancel
@ -36,15 +36,10 @@ loginOptionMojang.onclick = (e) => {
}) })
} }
loginOptionsCancelButton.onclick = (e) => { loginOptionOffline.onclick = (e) => {
switchView(getCurrentView(), loginOptionsViewOnCancel, 500, 500, () => { switchView(getCurrentView(), VIEWS.loginOffline, 500, 500, () => {
// Clear login values (Mojang login) loginViewOnSuccess = loginOptionsViewOnLoginSuccess
// No cleanup needed for Microsoft. loginViewOnCancel = loginOptionsViewOnLoginCancel
loginUsername.value = '' loginCancelEnabled(true)
loginPassword.value = ''
if(loginOptionsViewCancelHandler != null){
loginOptionsViewCancelHandler()
loginOptionsViewCancelHandler = null
}
}) })
} }

View File

@ -18,6 +18,7 @@ const VIEWS = {
landing: '#landingContainer', landing: '#landingContainer',
loginOptions: '#loginOptionsContainer', loginOptions: '#loginOptionsContainer',
login: '#loginContainer', login: '#loginContainer',
loginOffline: '#loginOfflineContainer',
settings: '#settingsContainer', settings: '#settingsContainer',
welcome: '#welcomeContainer', welcome: '#welcomeContainer',
waiting: '#waitingContainer' waiting: '#waitingContainer'

25
app/loginOffline.ejs Normal file
View File

@ -0,0 +1,25 @@
<div id="loginOfflineContainer" style="display: none;">
<div id="loginContent">
<form id="loginForm">
<span id="loginSubheader">OFFLINE LOGIN</span>
<div class="loginFieldContainer">
<input id="loginOfflineUsername" class="loginField" type="text" placeholder="USERNAME"/>
</div>
<button id="loginOfflineButton" 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>
</form>
</div>
<script src="./assets/js/scripts/loginOffline.js"></script>
</div>

View File

@ -24,10 +24,15 @@
<span>Login with Mojang</span> <span>Login with Mojang</span>
</button> </button>
</div> </div>
<div class="loginOptionButtonContainer">
<button id="loginOptionOffline" class="loginOptionButton">
<span>Proceed Offline</span>
</button>
</div> </div>
<div id="loginOptionCancelContainer" style="display: none;"> </div>
<!--<div id="loginOptionCancelContainer" style="display: none;">
<button id="loginOptionCancelButton">Cancel</button> <button id="loginOptionCancelButton">Cancel</button>
</div> </div>-->
</div> </div>
</div> </div>
<script src="./assets/js/scripts/loginOptions.js"></script> <script src="./assets/js/scripts/loginOptions.js"></script>