begin editing the launcher

This commit is contained in:
Derpy 2022-11-12 09:29:11 -05:00
parent 190bb4cf85
commit 87054e050c
24 changed files with 302 additions and 64 deletions

View File

@ -1,6 +1,6 @@
<p align="center"><img src="./app/assets/images/SealCircle.png" width="150px" height="150px" alt="aventium softworks"></p>
<p align="center"><img src="./app/assets/images/hc.png" width="150px" height="150px" alt="aventium softworks"></p>
<h1 align="center">Helios Launcher</h1>
<h1 align="center">Hobbitcraft Launcher</h1>
<em><h5 align="center">(formerly Electron Launcher)</h5></em>

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>Hobbitcraft 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">
@ -40,8 +40,7 @@
<div id="loadingContainer">
<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="loadCenterImage" src="assets/images/HC.ico">
</div>
</div>
</div>

View File

@ -1438,6 +1438,162 @@ input:checked + .toggleSwitchSlider:before {
/* * *
* Settings View (Account Tab)
* * */
/* Main container for File selectors. */
.settingsServerCodeContainer {
display: flex;
flex-direction: column;
border-bottom: 1px solid rgba(255, 255, 255, 0.50);
margin-bottom: 20px;
margin-top: 20px;
width: 75%;
}
/* Server Code title. */
.settingsServerCodeTitle {
margin-bottom: 10px;
font-size: 14px;
font-family: 'Avenir Medium';
}
/* Wrapper container for the actionable elements. */
.settingsServerCodeActions {
display: flex;
width: 60%;
}
/* Enabled text field which stores the secret code if available. */
.settingsInputServerCodeVal {
border-radius: 0px !important;
width: 100%;
padding: 5px 10px;
font-size: 12px;
}
.settingsInputServerCodeButton {
border: 0px;
border-radius: 3px 3px 3px 3px;
font-size: 12px;
padding: 0px 5px;
margin-left: 10px;
cursor: pointer;
background: rgba(126, 126, 126, 0.57);
transition: 0.25s ease;
white-space: nowrap;
outline: none;
}
.settingsInputServerCodeButton:hover,
.settingInputServerCodeButton:focus {
text-shadow: 0px 0px 20px white;
}
.settingsInputServerCodeButton:active {
text-shadow: 0px 0px 20px rgba(255, 255, 255, 0.75);
color: rgba(255, 255, 255, 0.75);
}
/* Description for the file selector. */
.settingsServerCodesDesc {
margin: 20px 0px;
color: grey;
font-size: 10px;
width: 90%;
}
.settingsServerCodesDesc strong {
font-family: 'Avenir Medium';
}
#settingsServerCodesListContent {
font-size: 10px;
background: rgba(0, 0, 0, 0.25);
border-radius: 3px;
color: white;
margin-top: 10px;
}
.settingsServerCode {
padding: 8px 0px 8px 8px;
}
/* Main content container for server code element information. */
.settingsServerCodeContent {
display: flex;
align-items: center;
justify-content: space-between;
transition: opacity 0.25s ease;
}
/* Wrapper container for the left side of a server code element. */
.settingsServerCodeMainWrapper {
display: flex;
align-items: center;
}
.settingsServerCodeRemoveWrapper {
margin-right: 25px;
}
/* Server code valid/invalid status. */
.settingsServerCodeStatus {
width: 7px;
height: 7px;
border-radius: 50%;
background-color: #c32625;
margin-right: 15px;
transition: 0.25s ease;
}
.settingsServerCode[valid] > .settingsServerCodeContent > .settingsServerCodeMainWrapper > .settingsServerCodeStatus {
background-color: #4ddd19;
}
/* Mod details container. */
.settingsServerCodeDetails {
display: flex;
flex-direction: column;
}
.settingsServerCodeName {
display: flex;
flex-direction: column;
font-size: 12px;
font-weight: bold;
}
.settingsServerCodeServerNamesContent {
max-width: 650px;
}
.settingsServerCodeServerName {
margin-right: 35px;
font-size: 14px;
}
.settingsServerCode:not([valid]) > .settingsServerCodeContent > .settingsServerCodeMainWrapper > .settingsServerCodeDetails > .settingsServerCodeServerNamesContent > .settingsServerCodeServerName {
color: red;
}
/* Button to remove drop-in mods. */
.settingsServerCodeRemoveButton {
background: none;
border: none;
font-size: 12px;
text-align: right;
padding: 0px;
color: grey;
cursor: pointer;
outline: none;
transition: 0.25s ease;
font-weight: bold;
}
.settingsServerCodeRemoveButton:hover,
.settingsServerCodeRemoveButton:focus {
color: red;
}
.settingsServerCodeRemoveButton:active {
color: #9b1f1f;
}
.settingsAuthAccountTypeContainer {
display: flex;
@ -2860,6 +3016,8 @@ input:checked + .toggleSwitchSlider:before {
position: relative;
border: 2px solid white;
box-sizing: border-box;
background-color: rgba(0, 0, 0, 0.35);
box-shadow: 0px 0px 10px 0px rgb(0, 0, 0);
border-radius: 50%;
}

BIN
app/assets/images/hc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
app/assets/images/hc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -6,7 +6,7 @@ const logger = require('./loggerutil')('%c[ConfigManager]', 'color: #a02d2a; fon
const sysRoot = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME)
// TODO change
const dataPath = path.join(sysRoot, '.helioslauncher')
const dataPath = path.join(sysRoot, '.hobbitcraftlauncher')
// Forked processes do not have access to electron, so we have this workaround.
const launcherDir = process.env.CONFIG_DIRECT_PATH || require('@electron/remote').app.getPath('userData')
@ -39,6 +39,24 @@ exports.setDataDirectory = function(dataDirectory){
config.settings.launcher.dataDirectory = dataDirectory
}
/**
* Get the launcher's available server codes. This will be used to load hidden servers.
*
* @returns {string[]} The server codes list that has been put into the launcher's configuration
*/
exports.getServerCodes = function(){
return config.settings.launcher.serverCodes
}
/**
* Set the new server code
*
* @param {string[]} serverCodes The new server code list.
*/
exports.setServerCodes = function(serverCodes){
config.settings.launcher.serverCodes = serverCodes
}
const configPath = path.join(exports.getLauncherDirectory(), 'config.json')
const configPathLEGACY = path.join(dataPath, 'config.json')
const firstLaunch = !fs.existsSync(configPath) && !fs.existsSync(configPathLEGACY)
@ -91,7 +109,9 @@ const DEFAULT_CONFIG = {
},
launcher: {
allowPrerelease: false,
dataDirectory: dataPath
dataDirectory: dataPath,
serverCodes: []
}
},
newsCache: {

View File

@ -398,6 +398,13 @@ class Server {
return this.mainServer
}
/**
* @returns {string} The server code for this server
*/
getServerCode(){
return this.serverCode
}
/**
* @returns {boolean} Whether or not the server is autoconnect.
* by default.
@ -499,6 +506,25 @@ class DistroIndex {
return null
}
/**
* Get a server configuration by its ID. If it does not
* exist, null will be returned.
*
* @param {string} id The ID of the server.
*
* @returns {Server[]} The server configuration with the given ID or null.
*/
getServersFromCode(code){
let servs = []
for(let serv of this.servers){
if(serv.serverCode === code){
servs.push(serv)
}
}
return servs
}
/**
* Get the main server.
*
@ -538,7 +564,6 @@ exports.pullRemote = function(){
}
return new Promise((resolve, reject) => {
const distroURL = 'http://mc.westeroscraft.com/WesterosCraftLauncher/distribution.json'
//const distroURL = 'https://gist.githubusercontent.com/dscalzi/53b1ba7a11d26a5c353f9d5ae484b71b/raw/'
const opts = {
url: distroURL,
timeout: 2500

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 = '04c37f78-b10c-4f1b-a8de-403bfe565303'
// SEE NOTE ABOVE.

View File

@ -343,7 +343,7 @@ class ProcessBuilder {
// Java Arguments
if(process.platform === 'darwin'){
args.push('-Xdock:name=HeliosLauncher')
args.push('-Xdock:name=HobbitcraftLauncher')
args.push('-Xdock:icon=' + path.join(__dirname, '..', 'images', 'minecraft.icns'))
}
args.push('-Xmx' + ConfigManager.getMaxRAM())
@ -381,7 +381,7 @@ class ProcessBuilder {
// Java Arguments
if(process.platform === 'darwin'){
args.push('-Xdock:name=HeliosLauncher')
args.push('-Xdock:name=HobbitcraftLauncher')
args.push('-Xdock:icon=' + path.join(__dirname, '..', 'images', 'minecraft.icns'))
}
args.push('-Xmx' + ConfigManager.getMaxRAM())

View File

@ -85,29 +85,29 @@ function setLaunchEnabled(val){
// Bind launch button
document.getElementById('launch_button').addEventListener('click', function(e){
loggerLanding.log('Launching game..')
const mcVersion = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer()).getMinecraftVersion()
const jExe = ConfigManager.getJavaExecutable()
if(jExe == null){
asyncSystemScan(mcVersion)
} else {
if(checkCurrentServer(true)){
loggerLanding.log('Launching game..')
const mcVersion = DistroManager.getDistribution().getServer(ConfigManager.getSelectedServer()).getMinecraftVersion()
const jExe = ConfigManager.getJavaExecutable()
if(jExe == null){
asyncSystemScan(mcVersion)
}} else {
setLaunchDetails(Lang.queryJS('landing.launch.pleaseWait'))
toggleLaunchArea(true)
setLaunchPercentage(0, 100)
setLaunchDetails(Lang.queryJS('landing.launch.pleaseWait'))
toggleLaunchArea(true)
setLaunchPercentage(0, 100)
const jg = new JavaGuard(mcVersion)
jg._validateJavaBinary(jExe).then((v) => {
loggerLanding.log('Java version meta', v)
if(v.valid){
dlAsync()
} else {
asyncSystemScan(mcVersion)
}
})
}
const jg = new JavaGuard(mcVersion)
jg._validateJavaBinary(jExe).then((v) => {
loggerLanding.log('Java version meta', v)
if(v.valid){
dlAsync()
} else {
asyncSystemScan(mcVersion)
}
})
}
})
// Bind settings button
document.getElementById('settingsMediaButton').onclick = (e) => {
prepareSettings()
@ -326,7 +326,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
// Show this information to the user.
setOverlayContent(
'No Compatible<br>Java Installation Found',
'In order to join WesterosCraft, you need a 64-bit installation of Java 8. Would you like us to install a copy?',
'In order to launch Minecraft, you need a 64-bit installation of Java 8. Would you like us to install a copy?',
'Install Java',
'Install Manually'
)
@ -686,7 +686,7 @@ function dlAsync(login = true){
if(SERVER_JOINED_REGEX.test(data)){
DiscordWrapper.updateDetails('Exploring the Realm!')
} else if(GAME_JOINED_REGEX.test(data)){
DiscordWrapper.updateDetails('Sailing to Westeros!')
DiscordWrapper.updateDetails('Playing Hobbitcraft')
}
}
@ -764,6 +764,38 @@ function dlAsync(login = true){
})
})
}
/**
* Checks the current server to ensure that they still have permission to play it (checking server code, if applicable) and open up an error overlay if specified
* @Param {boolean} whether or not to show the error overlay
*/
function checkCurrentServer(errorOverlay = true){
const selectedServId = ConfigManager.getSelectedServer()
if(selectedServId){
const selectedServ = DistroManager.getDistribution().getServer(selectedServId)
if(selectedServ){
if(selectedServ.getServerCode() && selectedServ.getServerCode() !== ''){
if(!ConfigManager.getServerCodes().includes(selectedServ.getServerCode())){
if(errorOverlay){
setOverlayContent(
'Current Server Restricted!',
'It seems that you no longer have the server code required to access this server! Please switch to a different server to play on.<br><br>If you feel this is an error, please contact the server administrator',
'Switch Server'
)
setOverlayHandler(() => {
toggleServerSelection(true)
})
setDismissHandler(() => {
toggleOverlay(false)
})
toggleOverlay(true, true)
}
return false
}
}
}
return true
}
}
/**
* News Loading Functions

View File

@ -273,6 +273,9 @@ function populateServerListings(){
const servers = distro.getServers()
let htmlString = ''
for(const serv of servers){
if(serv.getServerCode() && !ConfigManager.getServerCodes().includes(serv.getServerCode())){
continue
}
htmlString += `<button class="serverListing" servid="${serv.getID()}" ${serv.getID() === giaSel ? 'selected' : ''}>
<img class="serverListingImg" src="${serv.getIcon()}"/>
<div class="serverListingDetails">

View File

@ -5,7 +5,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 loggerSettings = require('./assets/js/loggerutil')('%c[Settings]', 'color: #353232; font-weight: bold')
const settingsState = {
invalid: new Set()
}
@ -139,6 +139,8 @@ function initSettingsValues(){
v.value = gFn()
} else if(cVal === 'JVMOptions'){
v.value = gFn().join(' ')
} else if (cVal === 'ServerCode'){
v.value = gFn()
} else {
v.value = gFn()
}

View File

@ -50,7 +50,7 @@ if(!isDev){
loggerAutoUpdaterSuccess.log('New update available', info.version)
if(process.platform === 'darwin'){
info.darwindownload = `https://github.com/dscalzi/HeliosLauncher/releases/download/v${info.version}/Helios-Launcher-setup-${info.version}${process.arch === 'arm64' ? '-arm64' : '-x64'}.dmg`
info.darwindownload = `https://github.com/HobbitcraftSMP/Launcher/releases/download/v${info.version}/Hobbitcraft-Launcher-setup-${info.version}${process.arch === 'arm64' ? '-arm64' : '-x64'}.dmg`
showUpdateUI(info)
}

View File

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

View File

@ -2,7 +2,7 @@
<div id="upper">
<div id="left">
<div id="image_seal_container">
<img id="image_seal" src="assets/images/SealCircle.png"/>
<img id="image_seal" src="assets/images/hc.png"/>
<div id="updateAvailableTooltip">Update Available</div>
</div>
</div>
@ -30,7 +30,7 @@
<div class="mediaDivider"></div>
<div id="externalMedia">
<div class="mediaContainer">
<a href="https://github.com/dscalzi/HeliosLauncher" class="mediaURL" id="linkURL">
<a href="https://github.com/HobbitcraftSMP" class="mediaURL" id="linkURL">
<svg id="linkSVG" class="mediaSVG" viewBox="35.34 34.3575 70.68 68.71500">
<g>
<path d="M75.37,65.51a3.85,3.85,0,0,0-1.73.42,8.22,8.22,0,0,1,.94,3.76A8.36,8.36,0,0,1,66.23,78H46.37a8.35,8.35,0,1,1,0-16.7h9.18a21.51,21.51,0,0,1,6.65-8.72H46.37a17.07,17.07,0,1,0,0,34.15H66.23A17,17,0,0,0,82.77,65.51Z"/>

View File

@ -7,7 +7,7 @@
</div>
<div id="loginContent">
<form id="loginForm">
<img id="loginImageSeal" src="assets/images/SealCircle.png"/>
<img id="loginImageSeal" src="assets/images/hc.png"/>
<span id="loginSubheader">MINECRAFT LOGIN</span>
<div class="loginFieldContainer">
<svg id="profileSVG" class="loginSVG" viewBox="40 37 65.36 61.43">
@ -29,11 +29,11 @@
</div>
<div id="loginOptions">
<span class="loginSpanDim">
<a href="https://minecraft.net/password/forgot/">forgot password?</a>
<a href="https://minecraft.net/password/forgot/">Forgot password?</a>
</span>
<label id="checkmarkContainer">
<input id="loginRememberOption" type="checkbox" checked>
<span id="loginRememberText" class="loginSpanDim">remember me?</span>
<span id="loginRememberText" class="loginSpanDim">Remember me?</span>
<span class="loginCheckmark"></span>
</label>
</div>
@ -56,8 +56,8 @@
<span class="loginSpanDim" id="loginRegisterSpan">
<a href="https://minecraft.net/store/minecraft-java-edition/">Need an Account?</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">Your password is sent directly to mojang/microsoft and never stored.</p>
<p class="loginDisclaimerText">Hobbitcraft Launcher is not affiliated with Mojang AB.</p>
</div>
</form>
</div>

View File

@ -304,8 +304,8 @@
<div id="settingsAboutCurrentContainer">
<div id="settingsAboutCurrentContent">
<div id="settingsAboutCurrentHeadline">
<img id="settingsAboutLogo" src="./assets/images/SealCircle.png">
<span id="settingsAboutTitle">Helios Launcher</span>
<img id="settingsAboutLogo" src="./assets/images/hc.png">
<span id="settingsAboutTitle">Hobbitcraft Launcher</span>
</div>
<div id="settingsAboutCurrentVersion">
<div id="settingsAboutCurrentVersionCheck">&#10003;</div>
@ -319,10 +319,10 @@
</div>
</div>
<div id="settingsAboutButtons">
<a href="https://github.com/dscalZi/HeliosLauncher" id="settingsAboutSourceButton" class="settingsAboutButton">Source (GitHub)</a>
<a href="https://github.com/HobbitcraftSMP/Launcher" 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="https://github.com/dscalzi/HeliosLauncher" id="settingsAboutSourceButton" class="settingsAboutButton">Original Source</a>
<a href="https://github.com/dscalZi/HobbitcraftSMP/Launcher" id="settingsAboutSupportButton" class="settingsAboutButton">Support</a>
<a href="#" id="settingsAboutDevToolsButton" class="settingsAboutButton">DevTools Console</a>
</div>
</div>

View File

@ -4,11 +4,10 @@
<div class="cloudBottom"></div>
</div>-->
<div id="welcomeContent">
<img id="welcomeImageSeal" src="assets/images/SealCircle.png"/>
<span id="welcomeHeader">WELCOME TO WESTEROSCRAFT</span>
<span id="welcomeDescription">Our mission is to recreate the universe imagined by author George RR Martin in his fantasy series, A Song of Ice and Fire. Through the collaborative effort of thousands of community members, we have sought to create Westeros as accurately and precisely as possible within Minecraft. The world we are creating is yours to explore. Journey from Dorne to Castle Black, and if you arent afraid, beyond the Wall itself, but best not delay. As the words of House Stark ominously warn: Winter is Coming.</span>
<img id="welcomeImageSeal" src="assets/images/hc.png"/>
<span id="welcomeHeader">WELCOME TO THE HOBBITCRAFT LAUNCHER</span>
<span id="welcomeDescription">From here, you will be able to download the Season 8 modpack, quickly install voice chat for Season 7, and install every other world download with a click of a button!</span>
<br>
<span id="welcomeDescCTA">You are just a few clicks away from Westeros.</span>
<button id="welcomeButton">
<div id="welcomeButtonContent">
CONTINUE

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,3 +1,3 @@
owner: dscalzi
repo: HeliosLauncher
owner: DerpDerpling
repo: hclauncher
provider: github

View File

@ -1,5 +1,5 @@
appId: 'helioslauncher'
productName: 'Helios Launcher'
appId: 'hobbitcraftlauncher'
productName: 'Hobbitcraft Launcher'
artifactName: '${productName}-setup-${version}.${ext}'
copyright: 'Copyright © 2018-2022 Daniel Scalzi'

View File

@ -23,7 +23,7 @@ function initAutoUpdater(event, data) {
}
if(isDev){
autoUpdater.autoInstallOnAppQuit = false
autoUpdater.autoInstallOnAppQuit = true
autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml')
}
if(process.platform === 'darwin'){
@ -126,7 +126,7 @@ ipcMain.on(MSFT_OPCODE.OPEN_LOGIN, (ipcEvent, ...arguments_) => {
width: 520,
height: 600,
frame: true,
icon: getPlatformIcon('SealCircle')
icon: getPlatformIcon('HC')
})
msftAuthWindow.on('closed', () => {
@ -179,7 +179,7 @@ ipcMain.on(MSFT_OPCODE.OPEN_LOGOUT, (ipcEvent, uuid, isLastAccount) => {
width: 520,
height: 600,
frame: true,
icon: getPlatformIcon('SealCircle')
icon: getPlatformIcon('HC')
})
msftLogoutWindow.on('closed', () => {
@ -225,7 +225,7 @@ function createWindow() {
win = new BrowserWindow({
width: 980,
height: 552,
icon: getPlatformIcon('SealCircle'),
icon: getPlatformIcon('HC'),
frame: false,
webPreferences: {
preload: path.join(__dirname, 'app', 'assets', 'js', 'preloader.js'),

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{
"name": "helioslauncher",
"name": "hobbitcraftlauncher",
"version": "1.9.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "helioslauncher",
"name": "hobbitcraftlauncher",
"version": "1.9.0",
"license": "UNLICENSED",
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name": "helioslauncher",
"name": "hobbitcraftlauncher",
"version": "1.9.0",
"productName": "Helios Launcher",
"productName": "Hobbitcraft Launcher",
"description": "Modded Minecraft Launcher",
"author": "Daniel Scalzi (https://github.com/dscalzi/)",
"license": "UNLICENSED",