Compare commits

...

58 Commits

Author SHA1 Message Date
Sandro Soria
5500d45ae6
Merge afb461dbc3 into 6aaeeff9a4 2024-11-20 12:29:02 +00:00
Sandro Soria
afb461dbc3
Merge branch 'dscalzi:master' into master 2024-11-20 13:28:58 +01:00
Sandro642
092f36afeb Refactor variables.json: Add newline at end of file 2024-10-29 11:22:41 +01:00
Sandro642
0770d652c2 Refactor settings.js: Update variable and comment names in manageMods function 2024-10-29 11:21:05 +01:00
Sandro Soria
d4437c7e38
Update variables.json 2024-10-28 09:28:14 +01:00
Sandro642
2f0a054bfe Refactor variables.json: Add newline at end of file 2024-10-27 11:53:20 +01:00
Sandro642
7f33a1d2fa Refactor landing.js: Update modIdentity assignment in dlAsync function 2024-10-27 11:47:23 +01:00
Sandro642
07ed316f9f Refactor package.json: Remove unused crypto dependency 2024-10-27 11:47:01 +01:00
Sandro642
d659e0fa41 Refactor README.md: Remove ExtraFileVerification section 2024-10-27 11:08:57 +01:00
Sandro642
4732ee54f7 Refactor landing.js: Update logger name in dlAsync function 2024-10-27 11:05:21 +01:00
Sandro642
745a11e5bb Refactor landing.js: Remove unnecessary blank lines and comments 2024-10-27 11:04:30 +01:00
Sandro642
e51eefa611 Refactor mod verification system and improve debug capabilities 2024-10-27 11:03:16 +01:00
Sandro642
bd67015210 Refactor package.json to update extraverif script 2024-10-27 11:00:35 +01:00
Sandro642
93bca16ebb Refactor documentation and file names for mod verification 2024-10-27 11:00:30 +01:00
Sandro642
1614b63ae1 Refactor language file and update mod verification messages 2024-10-27 10:57:46 +01:00
Sandro642
aef5e02f19 Refactor mod verification logic and improve debug capabilities 2024-10-27 10:57:37 +01:00
Sandro642
040ca971e8 Refactor CLI activation logic and improve debug capabilities
This commit refactors the code in extraverif.js to improve the activation logic for the extra file verification CLI. It now handles comment lines correctly and ignores them. Additionally, the debug capabilities have been enhanced. The landing script has also been updated to improve debug capabilities. Unnecessary comment separators have been removed.
2024-10-27 10:57:28 +01:00
Sandro642
f68165c66f Refactor class name in parserExtraverif.js 2024-10-27 10:47:55 +01:00
Sandro642
0348e83ffe Refactor Athena's Shield configuration handling 2024-10-27 10:45:45 +01:00
Sandro642
f0321e1f6d Reorder function calls in prepareModsTab.
Moved the manageModCategory function call to the end within prepareModsTab. This ensures that category management happens after resolving the UI elements, maintaining the logical sequence of operations.
2024-10-26 17:46:24 +02:00
Sandro642
0893cf5a5e Update landing script to improve debug capabilities
Added comment about server regex customization and clarified the login parameter's role in the dlAsync function, simplifying testing and validation without game launch.
2024-10-26 17:45:03 +02:00
Sandro642
8744d3b8c5 Remove unnecessary comment separators
Deleted redundant comment separators to clean up the code and improve readability. This does not affect the functionality but ensures the codebase remains easier to maintain.
2024-10-26 17:41:08 +02:00
Sandro642
aab9ff5c3e Update launch process with Discord RPC enhancements
Refined the logic for initializing and shutting down Discord Rich Presence (RPC). Added more detailed logging and error handling to the game launch process, enhancing the user experience and debugging capabilities.
2024-10-26 17:39:40 +02:00
Sandro642
a8a00e46ba Add Athena's Shield section to README
Introduced instructions on activating Athena's Shield in HeliosLauncher. This includes steps for running the verification system and choosing various options to ensure mod integrity and a secure gaming experience.
2024-10-26 17:26:45 +02:00
Sandro642
068ca6b0f0 Remove French configuration and distribution files
Deleted `config.json` and `distribution.json` from the `fr` directory. These files contained localized configuration and distribution settings which are no longer needed.
2024-10-26 17:11:43 +02:00
Sandro642
5ffa73275e Remove outdated .idea configuration files
Removed various .idea project configuration files that are no longer needed. This cleanup helps avoid clutter and potential conflicts with differing local configurations.
2024-10-26 17:08:43 +02:00
Sandro642
d0c5bf142d Set package to private
Change the "private" field in package.json to true. This will prevent the package from being accidentally published to public repositories.
2024-10-26 17:06:30 +02:00
Sandro642
a9c81a15ff Update review date in landing.js header comment
Adjusted the review date to reflect the latest inspection on 10.26.2024. No other changes or bug fixes were included in this commit.
2024-10-26 17:05:45 +02:00
Sandro642
160898389e Add crypto package to dependencies
The crypto package is added to the dependencies in package.json to support encryption-related functionalities. This addition helps in enhancing the security features of the application.
2024-10-26 17:03:39 +02:00
Sandro642
db499844db Update documentation: Move Athena's Shield docs to /docs
Renamed Athena's Shield documentation file and added detailed sections explaining its purpose, key features, and user benefits. Introduced a new security feature for HeliosLauncher, ensuring the integrity of installed mods.
2024-10-26 17:03:15 +02:00
Sandro642
1515571824 Remove deprecated Athena Shield and HeliosLauncher code
Deleted the dlAsync.js and landing.js files from both "ancien code" and "version code final" directories. This cleanup removes outdated functionality related to mod validation and launcher processes, streamlining the codebase.
2024-10-26 16:51:58 +02:00
Sandro642
a94aa49402 Fix typo in comment annotation
Corrected the typo "discovereds" to "discovered" in the comment section of the landing.js file. This ensures accuracy and professionalism in the documentation.
2024-10-26 16:46:22 +02:00
Sandro642
50ad0e8a91 Enable detailed debug logging for mod identity validation
This commit refactors the mod identity extraction and validation process to include detailed debug logs, which are conditionally logged based on the `athShield.debug` flag. It also updates the import statements and correctly references the `ConfigManager.getNameDataPath` function for error messages.
2024-10-26 16:46:05 +02:00
Sandro642
f366b8b86a Update distribution URL in distromanager.js
Revert distribution URL to 'https://helios-files.geekcorner.eu.org/distribution.json'. This change ensures compatibility with the older distribution endpoint and corrects the previous, unintended URL.
2024-10-26 16:28:41 +02:00
Sandro642
84b4ba91ed Refactor identity check error message
Simplify the log message for identity not found in the manifest by combining it with the hash usage statement. This improves readability and reduces redundancy in the code.
2024-10-26 16:28:10 +02:00
Sandro642
33788d4086 Update REMOTE_DISTRO_URL to new API endpoint
Switched the distribution URL to a more reliable API endpoint to improve stability and performance. The new URL is 'https://api.skym-mc.fr/api/v1/servers/distro', which replaces the old one.
2024-10-26 16:27:50 +02:00
Sandro642
485facf1f1 Enable debug logging conditionally for AthShield
Wrapped several logging statements related to module identity extraction and validation with a conditional check on the athShield.debug flag. This ensures that detailed logging information is recorded only when debugging is enabled, optimizing performance and log clarity.
2024-10-26 16:27:25 +02:00
Sandro642
3cdad516c9 Add debug mode option to Athena's Shield configuration
Introduced an option to activate debug mode in Athena's Shield. Updated relevant JavaScript files and configuration to handle the debug mode setting. Added a new method for retrieving the debug status within the parserAthShield.js class.
2024-10-26 16:26:54 +02:00
Sandro642
09646484f1 Add project configuration and settings files
Added .gitignore to exclude IDE-specific files, set up project code style configuration, included game and launcher settings in config.json, and created minimal discord and distribution JSON files for project setup.
2024-10-26 14:30:35 +02:00
Sandro642
980c836d9d Make package public
Changed "private" field in package.json from true to false. This will make the package accessible on npm and allow others to install it.
2024-10-25 21:16:50 +02:00
Sandro642
1f4df6b8ff Refactor config path retrieval in landing.js
Remove unused dataPath constant and replace its usage in mod validation error message with ConfigManager.getNameDataPath(). This ensures the config path is retrieved dynamically.
2024-10-24 23:40:14 +02:00
Sandro642
48350019f2 Refactor dataPath assignment
Replaced direct assignment of `dataPath` with variable `nameDataPath` for consistent naming. Introduced `getNameDataPath` function to return the launcher directory name string.
2024-10-24 23:39:45 +02:00
Sandro642
9d4c8cc399 Fix escape character handling in console log messages
Updated console log messages in athshield.js to use single quotes for consistent escape character handling. This adjustment ensures better compatibility and readability of string literals in the code.
2024-10-24 18:20:36 +02:00
Sandro642
297a3a099c Refactor comments and questions from French to English
Updated all comments and user prompts in athshield.js from French to English for better code readability and broader usability. No functional changes were made.
2024-10-24 18:18:52 +02:00
Sandro642
96e0ca12f4 Refactor menu visibility logic in athshield.js
Separate logic for 'cacher' and 'bloquer' options and update corresponding values to 'hidden' and 'blocked' respectively. Ensure configuration is saved after setting the menu visibility.
2024-10-24 18:17:46 +02:00
Sandro642
fc5a2d4b8d Rename view method to type and integrate athShield in settings
Renamed the `view` method to `type` in parserAthShield.js to better reflect its purpose. Removed unused `athShield` import from landing.js and added it to settings.js. Added a manageModCategory function in settings.js to manage the display and interaction state of the Mods tab based on the type of `athShield`.
2024-10-24 18:00:00 +02:00
Sandro642
ae9e7b54b0 Update athshield script path in package.json
Relocated the athshield.js script from ./athshield/ to app/assets/athshield/. This change ensures better organization of script files within the project structure.
2024-10-24 16:28:14 +02:00
Sandro642
e3c6a185ed Add Athena's Shield activation messages
Include messages for when Athena's Shield is activated and deactivated in the English localization file. This will provide users with clear notifications on the status of Athena's Shield.
2024-10-24 16:28:05 +02:00
Sandro642
b435f7a485 Refactor project structure by moving athshield files
Relocated athshield files to app/assets/athshield for better organization and maintainability. This change improves the project's folder structure and simplifies file management.
2024-10-24 16:27:56 +02:00
Sandro642
2fc9c3ec35 Add mod verification logic using Athena's Shield
Integrated Athena's Shield for mod verification, including mod identity extraction and validation against expected identities. Added exclusion list for mods, and implemented fallbacks for missing mod identities using MD5 hashes. Adjusted logging and error reporting to provide clearer feedback.
2024-10-24 16:27:37 +02:00
Sandro Soria
1476dbb67b Merge remote-tracking branch 'origin/master' 2024-10-24 16:10:27 +02:00
Sandro Soria
886b29e356 Use AthShield for mod verification
Implemented mod verification using AthShield when enabled. Added detailed mod identity extraction and validation logic for better integrity checks. Added logs for each verification step and fallback to hash-based identity if the manifest is missing.

Grande ligne : quand tu actives ath shield alors il utilise le système Athena's Shield.
2024-10-24 16:10:14 +02:00
Sandro642
7073c2744b Add mod whitelist and new HeliosLauncher support
Implemented a whitelist for mods and added support for the new version of HeliosLauncher. Also corrected a language key for launch information logging.
2024-10-24 16:08:15 +02:00
Sandro642
85cb73363a Fix typo in game launch message
Corrected the typo from "launchingGame" to "waintingLaunchingGame" in the en_US language file. This ensures the message displayed to users is accurate and free of errors.
2024-10-24 16:08:01 +02:00
Sandro642
3790b52d0d Update landing.js dependencies and add new features
Replaced 'path' with 'fs' module and removed unused 'Lang'. Added support for the new HeliosLauncher version and implemented a whitelist for mods. Fixed a typo in the logging message.
2024-10-24 16:05:21 +02:00
Sandro642
5f3e229360 Add new dlAsync function and mod validation messages
Implemented a new `dlAsync.js` file and updated the `en_US.toml` with new mod validation messages. This includes the logic for mod verification and error handling, ensuring the integrity of mods before launching the game.

Ajout prochainement de l'utilitaire npm run athshield
2024-10-23 19:17:23 +02:00
Sandro642
9813802b1c Add Athena's Shield configuration and CLI
Introduce AthenaShield class to manage configuration, CLI for user setup, and update package.json with new script. This enhances the application's configurability and user interaction.
2024-10-23 17:33:39 +02:00
Sandro642
3ee4c73790 Add documentation for Athena's Shield feature 2024-10-23 16:23:32 +02:00
9 changed files with 391 additions and 51 deletions

View File

@ -0,0 +1,76 @@
const fs = require('fs')
const readline = require('readline')
const path = require('path')
const configPath = path.join(__dirname, 'variables.json')
function loadConfig() {
const rawData = fs.readFileSync(configPath)
return JSON.parse(rawData.toString())
}
function saveConfig(config) {
const data = JSON.stringify(config, null, 2)
fs.writeFileSync(configPath, data)
}
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
function startCLI() {
const config = loadConfig()
rl.question('Would you like to activate extra file verification? (yes/no): ', (answer) => {
if (answer.trim().startsWith('//')) {
console.log('This is a comment; the line is ignored.')
rl.close()
return
}
if (answer.toLowerCase() === 'yes') {
config.extraFileVerifActivated = true
rl.question('Would you like to activate debug mode? (yes/no): ', (debugAnswer) => {
config.debug = debugAnswer.toLowerCase() === 'yes'
rl.question('Would you like to hide or block the menu? (hide/block): ', (menuAnswer) => {
if (menuAnswer.trim().startsWith('//')) {
console.log('This is a comment; the line is ignored.')
rl.close()
return
}
if (menuAnswer.toLowerCase() === 'hide') {
config.menuVisibility = 'hidden'
console.log('Extra file verification activated. Menu hidden.')
} else if (menuAnswer.toLowerCase() === 'block') {
config.menuVisibility = 'blocked'
console.log('Extra file verification activated. Menu blocked.')
} else {
console.log('Invalid option for the menu.')
rl.close()
return
}
saveConfig(config)
rl.close()
})
})
} else if (answer.toLowerCase() === 'no') {
console.log('Extra file verification not activated. Closing the CLI.')
config.extraFileVerifActivated = false
config.menuVisibility = 'visible'
config.debug = false
saveConfig(config)
rl.close()
} else {
console.log('Invalid response.')
rl.close()
}
})
}
startCLI()

View File

@ -0,0 +1,30 @@
const fs = require('fs')
const path = require('path')
const configPath = path.join(__dirname, 'variables.json')
class ExtraFileVerification {
constructor() {
this.config = this.loadConfig()
}
loadConfig() {
const rawData = fs.readFileSync(configPath)
return JSON.parse(rawData.toString())
}
get status() {
return this.config.extraFileVerifActivated
}
get type() {
return this.config.menuVisibility
}
get debug() {
return this.config.debug
}
}
const ExtraFileVerificationInstance = new ExtraFileVerification()
module.exports = ExtraFileVerificationInstance

View File

@ -0,0 +1,5 @@
{
"extraFileVerifActivated": false,
"menuVisibility": "visible",
"debug": false
}

View File

@ -7,10 +7,23 @@ const logger = LoggerUtil.getLogger('ConfigManager')
const sysRoot = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME)
const dataPath = path.join(sysRoot, '.helioslauncher')
const nameDataPath = '.helioslauncher'
const dataPath = path.join(sysRoot, nameDataPath)
const launcherDir = require('@electron/remote').app.getPath('userData')
/**
* The path to the data directory used by the application.
* This variable can be used to retrieve or set the location
* where the application's data files are stored.
*
* @type {string}
*/
exports.getNameDataPath = function(){
return nameDataPath
}
/**
* Retrieve the absolute path of the launcher directory.
*

View File

@ -30,6 +30,8 @@ const {
// Internal Requirements
const DiscordWrapper = require('./assets/js/discordwrapper')
const ProcessBuilder = require('./assets/js/processbuilder')
const crypto = require('crypto')
const fs = require('fs')
// Launch Elements
const launch_content = document.getElementById('launch_content')
@ -445,13 +447,17 @@ const GAME_JOINED_REGEX = /\[.+\]: Sound engine started/
const GAME_LAUNCH_REGEX = /^\[.+\]: (?:MinecraftForge .+ Initialized|ModLauncher .+ starting: .+|Loading Minecraft .+ with Fabric Loader .+)$/
const MIN_LINGER = 5000
// List of mods to exclude from validation
const EXCLUDED_MODS = [
]
async function dlAsync(login = true) {
// Login parameter is temporary for debug purposes. Allows testing the validation/downloads without
// launching the game.
const loggerLaunchSuite = LoggerUtil.getLogger('LaunchSuite')
const loggerLanding = LoggerUtil.getLogger('dlAsync')
setLaunchDetails(Lang.queryJS('landing.dlAsync.loadingServerInfo'))
let distro
@ -459,21 +465,137 @@ async function dlAsync(login = true) {
try {
distro = await DistroAPI.refreshDistributionOrFallback()
onDistroRefresh(distro)
} catch(err) {
loggerLaunchSuite.error('Unable to refresh distribution index.', err)
} catch (err) {
loggerLanding.error(Lang.queryJS('landing.dlAsync.unableToLoadDistributionIndex'))
showLaunchFailure(Lang.queryJS('landing.dlAsync.fatalError'), Lang.queryJS('landing.dlAsync.unableToLoadDistributionIndex'))
return
}
const serv = distro.getServerById(ConfigManager.getSelectedServer())
if(login) {
if(ConfigManager.getSelectedAccount() == null){
loggerLanding.error('You must be logged into an account.')
if (login) {
if (ConfigManager.getSelectedAccount() == null) {
loggerLanding.error(Lang.queryJS('landing.dlAsync.accountLoginNeeded'))
return
}
}
// --------- Mod Verification Logic ---------
if (extraFileVerif.status) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.usingExtraFileVerif'))
const modsDir = path.join(ConfigManager.getDataDirectory(), 'instances', serv.rawServer.id, 'mods')
// Check if mods directory exists, if not, create it
if (!fs.existsSync(modsDir)) {
fs.mkdirSync(modsDir, {recursive: true})
}
const distroMods = {}
const mdls = serv.modules
// Populate expected mod identities and log them
mdls.forEach(mdl => {
if (mdl.rawModule.name.endsWith('.jar')) {
const modPath = path.join(modsDir, mdl.rawModule.name)
const modIdentity = mdl.rawModule.identity || mdl.rawModule.artifact.MD5
if (extraFileVerif.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.distributionIdentityError', {
'moduleName': mdl.rawModule.name,
'moduleIdentity': modIdentity
}))
}
distroMods[modPath] = modIdentity
}
})
// Function to extract mod identity from the jar file
const extractModIdentity = (filePath) => {
if (extraFileVerif.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.modIdentityExtraction', {'filePath': filePath}))
}
const fileBuffer = fs.readFileSync(filePath)
const hashSum = crypto.createHash('md5') // Use MD5 to match the distribution configuration
hashSum.update(fileBuffer)
const hash = hashSum.digest('hex')
if (extraFileVerif.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.identityNotFoundUsingHash', {
'filePath': filePath,
'hash': hash
}))
}
return hash
}
// Validate mods function
const validateMods = () => {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.startingModValidation'))
const installedMods = fs.readdirSync(modsDir)
let valid = true
for (let mod of installedMods) {
const modPath = path.join(modsDir, mod)
// Skip validation for mods in the excluded list
if (EXCLUDED_MODS.includes(mod)) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.modValidationBypassed', {'mod': mod}))
continue
}
const expectedIdentity = distroMods[modPath]
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.validatingMod', {'mod': mod}))
if (expectedIdentity) {
const modIdentity = extractModIdentity(modPath)
if (extraFileVerif.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.expectedAndCalculatedIdentity', {
'expectedIdentity': expectedIdentity,
'mod': mod,
'modIdentity': modIdentity
}))
}
if (modIdentity !== expectedIdentity) {
if (extraFileVerif.debug) {
loggerLanding.error(Lang.queryJS('landing.dlAsync.extraFileVerif.modIdentityMismatchError', {
'mod': mod,
'expectedIdentity': expectedIdentity,
'modIdentity': modIdentity
}))
}
valid = false
break
}
} else {
loggerLanding.warn(Lang.queryJS('landing.dlAsync.extraFileVerif.expectedIdentityNotFound', {'mod': mod}))
valid = false
break
}
}
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.modValidationCompleted'))
return valid
}
// Perform mod validation before proceeding
if (!validateMods()) {
const errorMessage = Lang.queryJS('landing.dlAsync.extraFileVerif.invalidModsDetectedMessage', {'folder': ConfigManager.getNameDataPath()})
loggerLanding.error(errorMessage)
showLaunchFailure(errorMessage, null)
return
}
} else {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.notUsingExtraFileVerif'))
}
// --------- End of Mod Verification Logic ---------
setLaunchDetails(Lang.queryJS('landing.dlAsync.pleaseWait'))
toggleLaunchArea(true)
setLaunchPercentage(0, 100)
@ -489,17 +611,17 @@ async function dlAsync(login = true) {
fullRepairModule.spawnReceiver()
fullRepairModule.childProcess.on('error', (err) => {
loggerLaunchSuite.error('Error during launch', err)
loggerLaunchSuite.error(Lang.queryJS('landing.dlAsync.errorDuringLaunchText') + err)
showLaunchFailure(Lang.queryJS('landing.dlAsync.errorDuringLaunchTitle'), err.message || Lang.queryJS('landing.dlAsync.errorDuringLaunchText'))
})
fullRepairModule.childProcess.on('close', (code, _signal) => {
if(code !== 0){
loggerLaunchSuite.error(`Full Repair Module exited with code ${code}, assuming error.`)
loggerLaunchSuite.error(Lang.queryJS('landing.dlAsync.fullRepairMode', {'code': code}))
showLaunchFailure(Lang.queryJS('landing.dlAsync.errorDuringLaunchTitle'), Lang.queryJS('landing.dlAsync.seeConsoleForDetails'))
}
})
loggerLaunchSuite.info('Validating files.')
loggerLaunchSuite.info(Lang.queryJS('landing.dlAsync.validatingFileIntegrity'))
setLaunchDetails(Lang.queryJS('landing.dlAsync.validatingFileIntegrity'))
let invalidFileCount = 0
try {
@ -508,12 +630,11 @@ async function dlAsync(login = true) {
})
setLaunchPercentage(100)
} catch (err) {
loggerLaunchSuite.error('Error during file validation.')
loggerLaunchSuite.error(Lang.queryJS('landing.dlAsync.errFileVerification'))
showLaunchFailure(Lang.queryJS('landing.dlAsync.errorDuringFileVerificationTitle'), err.displayable || Lang.queryJS('landing.dlAsync.seeConsoleForDetails'))
return
}
if(invalidFileCount > 0) {
loggerLaunchSuite.info('Downloading files.')
setLaunchDetails(Lang.queryJS('landing.dlAsync.downloadingFiles'))
@ -524,12 +645,12 @@ async function dlAsync(login = true) {
})
setDownloadPercentage(100)
} catch(err) {
loggerLaunchSuite.error('Error during file download.')
loggerLaunchSuite.error(Lang.queryJS('landing.dlAsync.errorDuringFileDownloadTitle'))
showLaunchFailure(Lang.queryJS('landing.dlAsync.errorDuringFileDownloadTitle'), err.displayable || Lang.queryJS('landing.dlAsync.seeConsoleForDetails'))
return
}
} else {
loggerLaunchSuite.info('No invalid files, skipping download.')
loggerLaunchSuite.info(Lang.queryJS('landing.dlAsync.notUsingExtraFileVerif.downloadingFiles'))
}
// Remove download bar.
@ -577,9 +698,9 @@ async function dlAsync(login = true) {
// the progress bar stuff.
const tempListener = function(data){
if(GAME_LAUNCH_REGEX.test(data.trim())){
const diff = Date.now()-start
const diff = Date.now() - start
if(diff < MIN_LINGER) {
setTimeout(onLoadComplete, MIN_LINGER-diff)
setTimeout(onLoadComplete, MIN_LINGER - diff)
} else {
onLoadComplete()
}
@ -587,18 +708,18 @@ async function dlAsync(login = true) {
}
// Listener for Discord RPC.
const gameStateChange = function(data){
const gameStateChange = function(data) {
data = data.trim()
if(SERVER_JOINED_REGEX.test(data)){
if(SERVER_JOINED_REGEX.test(data)) {
DiscordWrapper.updateDetails(Lang.queryJS('landing.discord.joined'))
} else if(GAME_JOINED_REGEX.test(data)){
} else if(GAME_JOINED_REGEX.test(data)) {
DiscordWrapper.updateDetails(Lang.queryJS('landing.discord.joining'))
}
}
const gameErrorListener = function(data){
const gameErrorListener = function(data) {
data = data.trim()
if(data.indexOf('Could not find or load main class net.minecraft.launchwrapper.Launch') > -1){
if(data.indexOf('Could not find or load main class net.minecraft.launchwrapper.Launch') > -1) {
loggerLaunchSuite.error('Game launch failed, LaunchWrapper was not downloaded properly.')
showLaunchFailure(Lang.queryJS('landing.dlAsync.errorDuringLaunchTitle'), Lang.queryJS('landing.dlAsync.launchWrapperNotDownloaded'))
}
@ -608,14 +729,14 @@ async function dlAsync(login = true) {
// Build Minecraft process.
proc = pb.build()
// Bind listeners to stdout.
// Bind listeners to stdout and stderr.
proc.stdout.on('data', tempListener)
proc.stderr.on('data', gameErrorListener)
setLaunchDetails(Lang.queryJS('landing.dlAsync.doneEnjoyServer'))
// Init Discord Hook
if(distro.rawDistribution.discord != null && serv.rawServer.discord != null){
if(distro.rawDistribution.discord != null && serv.rawServer.discord != null) {
DiscordWrapper.initRPC(distro.rawDistribution.discord, serv.rawServer.discord)
hasRPC = true
proc.on('close', (code, signal) => {
@ -627,13 +748,10 @@ async function dlAsync(login = true) {
}
} catch(err) {
loggerLaunchSuite.error('Error during launch', err)
showLaunchFailure(Lang.queryJS('landing.dlAsync.errorDuringLaunchTitle'), Lang.queryJS('landing.dlAsync.checkConsoleForDetails'))
}
}
}
/**
@ -975,7 +1093,7 @@ async function loadNews(){
const articles = []
for(let i=0; i<items.length; i++){
// JQuery Element
// JQuery Element
const el = $(items[i])
// Resolve date.

View File

@ -1,8 +1,9 @@
// Requirements
const os = require('os')
const semver = require('semver')
const os = require('os')
const semver = require('semver')
const DropinModUtil = require('./assets/js/dropinmodutil')
const DropinModUtil = require('./assets/js/dropinmodutil')
const extraFileVerif = require('./assets/extraverif/parserExtraverif')
const { MSFT_OPCODE, MSFT_REPLY_TYPE, MSFT_ERROR } = require('./assets/js/ipcconstants')
const settingsState = {
@ -707,6 +708,29 @@ document.getElementById('settingsGameHeight').addEventListener('keydown', (e) =>
const settingsModsContainer = document.getElementById('settingsModsContainer')
/**
* Manages the display and interaction state of the Mods tab and its buttons based on the type of `extraFileVerif`.
*
* The function performs the following:
* - If `extraFileVerif.type` is 'hidden': hides the Mods button entirely.
* - If `extraFileVerif.type` is 'blocked': shows the Mods button, displays the Mods tab, and disables all buttons within the Mods tab.
* - Otherwise: shows and enables all components (Mods button and buttons within the Mods tab) normally.
*
* @return {void}
*/
function manageModCategory() {
const modsButton = document.querySelector('button[rSc="settingsTabMods"]')
const dropInMods = document.getElementById('settingsDropinModsContainer')
if (extraFileVerif.type === 'hidden') {
// Hide the Mods navigation button
modsButton.style.display = 'none'
} else if (extraFileVerif.type === 'blocked') {
// Hide the drop-in mods elements
dropInMods.style.display = 'none'
}
}
/**
* Resolve and update the mods on the UI.
*/
@ -1133,6 +1157,7 @@ async function prepareModsTab(first){
await resolveModsForUI()
await resolveDropinModsForUI()
await resolveShaderpacksForUI()
manageModCategory()
bindDropinModsRemoveButton()
bindDropinModFileSystemButton()
bindShaderpackButton()

View File

@ -206,6 +206,30 @@ launchingGame = "Launching game.."
launchWrapperNotDownloaded = "The main file, LaunchWrapper, failed to download properly. As a result, the game cannot launch.<br><br>To fix this issue, temporarily turn off your antivirus software and launch the game again.<br><br>If you have time, please <a href=\"https://github.com/dscalzi/HeliosLauncher/issues\">submit an issue</a> and let us know what antivirus software you use. We'll contact them and try to straighten things out."
doneEnjoyServer = "Done. Enjoy the server!"
checkConsoleForDetails = "Please check the console (CTRL + Shift + i) for more details."
accountLoginNeeded = "You must be logged into an account."
fullRepairMode = "Full Repair Module exited with code {code}, assuming error."
errFileVerification = "Error during file validation."
accountToProcessBuilder = "Sending selected account ({userDisplayName}) to ProcessBuilder."
gameError = "Game error: {data}"
gameExited = "Game process exited with code {code}."
gameErrorDuringLaunch = "Error during game launch {error}."
waintingLaunchingGame = "Waiting for game window..."
[js.landing.dlAsync.extraFileVerif]
distributionIdentityError = "Expected Identity from Distribution for {moduleName}: {moduleIdentity}."
modIdentityExtraction = "Extracting identity for mod at: {filePath}."
identityNotFoundUsingHash = "No identity found in manifest for {filePath}, using hash: {hash}"
startingModValidation = "Starting mod validation..."
modValidationBypassed = "Skipping validation for excluded mod: {mod}"
validatingMod = "Validating mod: {mod}"
expectedAndCalculatedIdentity = "Expected Identity: {expectedIdentity}, Calculated Identity for {mod}: {modIdentity}"
modIdentityMismatchError = "Mod identity mismatch! Mod: {mod}, Expected: {expectedIdentity}, Found: {modIdentity}"
expectedIdentityNotFound = "No expected identity found for mod: {mod}. Marking as invalid."
modValidationCompleted = "Mod validation completed."
invalidModsDetectedMessage = "Extra file verification has detected invalid mods. Please delete the {folder} folder and restart the launcher."
downloadingFiles = "No invalid files, skipping download."
usingExtraFileVerif = "Extra file verification activated, Resource usage..."
notUsingExtraFileVerif = "Extra file verification deactivated, Not using resources..."
[js.landing.news]
checking = "Checking for News"

View File

@ -0,0 +1,48 @@
**Documentation: ExtraFileVerification for HeliosLauncher**
### Introduction
HeliosLauncher is a game launcher for Minecraft developed by Daniel Scalzi, designed to provide a secure and optimized gaming experience. To maintain game integrity and prevent unauthorized or altered mods, I have implemented a new security system called ExtraFileVerification.
### Purpose of ExtraFileVerification
The main purpose of ExtraFileVerification is to ensure that only authorized and verified mods are used with HeliosLauncher. This system checks the integrity of installed mods to prevent any modifications or additions of malicious or unapproved mods.
### Key Features
**Installed Mod Validation:**
- Before launching the game, ExtraFileVerification verifies the mods present in the HeliosLauncher mods folder.
- Each mod is validated by comparing its name and hash (digital fingerprint) with expected data in the distribution.
- If a mod does not meet validation criteria, game launch is stopped, and an error message is displayed.
**First Launch Verification:**
- On the first launch of HeliosLauncher, if the mods folder is empty, the game is launched without mod verification.
- If mods are detected on the first launch, their validity is checked immediately to prevent issues.
**Modification Management:**
- ExtraFileVerification also verifies changes to mods. For instance, if a mod is deleted, replaced, or renamed, it will be detected.
- Hash verification ensures that mods have not been altered since their initial download.
**Error Messages and Instructions:**
- If any invalid mods or unauthorized modifications are detected, the system displays a clear error message.
- Users are provided with specific instructions to resolve issues, such as deleting the mods folder and restarting the launcher.
### User Benefits
- **Enhanced Security:** By preventing unauthorized mods and verifying integrity, ExtraFileVerification protects users from malicious mods.
- **Reliable Gaming Experience:** Ensures that only tested and validated mods are used, guaranteeing a stable and trouble-free gaming experience.
- **Ease of Use:** Users are guided with clear messages and instructions to help resolve any potential conflicts, simplifying problem-solving.
### Conclusion
ExtraFileVerification is a significant step toward enhancing the security and integrity of HeliosLauncher. With this integration, I ensure that every Minecraft user enjoys a safe and reliable gaming experience, without compromising on quality or security.
If you have any questions or need further clarification about ExtraFileVerification, feel free to contact me.
**The only way to bypass ExtraFileVerification would be through advanced cryptography knowledge, involving signature copying or hash modification.**
The creation and verification of ExtraFileVerification are currently complete, though additional improvements may be made in the future, as with any project.
Respectfully,
**SORIA Sandro (Sandro642)**

View File

@ -17,7 +17,8 @@
"dist:win": "npm run dist -- -w",
"dist:mac": "npm run dist -- -m",
"dist:linux": "npm run dist -- -l",
"lint": "eslint --config .eslintrc.json ."
"lint": "eslint --config .eslintrc.json .",
"extraverif": "node app/assets/extraverif/extraverif.js"
},
"engines": {
"node": "20.x.x"