Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Athena's Shield | The Extra File Verification System #364

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
3ee4c73
Add documentation for Athena's Shield feature
Sandro642 Oct 23, 2024
9813802
Add Athena's Shield configuration and CLI
Sandro642 Oct 23, 2024
5f3e229
Add new dlAsync function and mod validation messages
Sandro642 Oct 23, 2024
3790b52
Update landing.js dependencies and add new features
Sandro642 Oct 24, 2024
85cb733
Fix typo in game launch message
Sandro642 Oct 24, 2024
7073c27
Add mod whitelist and new HeliosLauncher support
Sandro642 Oct 24, 2024
886b29e
Use AthShield for mod verification
Sandro642 Oct 24, 2024
1476dbb
Merge remote-tracking branch 'origin/master'
Sandro642 Oct 24, 2024
2fc9c3e
Add mod verification logic using Athena's Shield
Sandro642 Oct 24, 2024
b435f7a
Refactor project structure by moving athshield files
Sandro642 Oct 24, 2024
e3c6a18
Add Athena's Shield activation messages
Sandro642 Oct 24, 2024
ae9e7b5
Update athshield script path in package.json
Sandro642 Oct 24, 2024
fc5a2d4
Rename view method to type and integrate athShield in settings
Sandro642 Oct 24, 2024
96e0ca1
Refactor menu visibility logic in athshield.js
Sandro642 Oct 24, 2024
297a3a0
Refactor comments and questions from French to English
Sandro642 Oct 24, 2024
9d4c8cc
Fix escape character handling in console log messages
Sandro642 Oct 24, 2024
4835001
Refactor dataPath assignment
Sandro642 Oct 24, 2024
1f4df6b
Refactor config path retrieval in landing.js
Sandro642 Oct 24, 2024
980c836
Make package public
Sandro642 Oct 25, 2024
0964648
Add project configuration and settings files
Sandro642 Oct 26, 2024
3cdad51
Add debug mode option to Athena's Shield configuration
Sandro642 Oct 26, 2024
485facf
Enable debug logging conditionally for AthShield
Sandro642 Oct 26, 2024
33788d4
Update REMOTE_DISTRO_URL to new API endpoint
Sandro642 Oct 26, 2024
84b4ba9
Refactor identity check error message
Sandro642 Oct 26, 2024
f366b8b
Update distribution URL in distromanager.js
Sandro642 Oct 26, 2024
50ad0e8
Enable detailed debug logging for mod identity validation
Sandro642 Oct 26, 2024
a94aa49
Fix typo in comment annotation
Sandro642 Oct 26, 2024
1515571
Remove deprecated Athena Shield and HeliosLauncher code
Sandro642 Oct 26, 2024
db49984
Update documentation: Move Athena's Shield docs to /docs
Sandro642 Oct 26, 2024
1608983
Add crypto package to dependencies
Sandro642 Oct 26, 2024
a9c81a1
Update review date in landing.js header comment
Sandro642 Oct 26, 2024
d0c5bf1
Set package to private
Sandro642 Oct 26, 2024
5ffa732
Remove outdated .idea configuration files
Sandro642 Oct 26, 2024
068ca6b
Remove French configuration and distribution files
Sandro642 Oct 26, 2024
a8a00e4
Add Athena's Shield section to README
Sandro642 Oct 26, 2024
aab9ff5
Update launch process with Discord RPC enhancements
Sandro642 Oct 26, 2024
8744d3b
Remove unnecessary comment separators
Sandro642 Oct 26, 2024
0893cf5
Update landing script to improve debug capabilities
Sandro642 Oct 26, 2024
f0321e1
Reorder function calls in prepareModsTab.
Sandro642 Oct 26, 2024
0348e83
Refactor Athena's Shield configuration handling
Sandro642 Oct 27, 2024
f68165c
Refactor class name in parserExtraverif.js
Sandro642 Oct 27, 2024
040ca97
Refactor CLI activation logic and improve debug capabilities
Sandro642 Oct 27, 2024
aef5e02
Refactor mod verification logic and improve debug capabilities
Sandro642 Oct 27, 2024
1614b63
Refactor language file and update mod verification messages
Sandro642 Oct 27, 2024
93bca16
Refactor documentation and file names for mod verification
Sandro642 Oct 27, 2024
bd67015
Refactor package.json to update extraverif script
Sandro642 Oct 27, 2024
e51eefa
Refactor mod verification system and improve debug capabilities
Sandro642 Oct 27, 2024
745a11e
Refactor landing.js: Remove unnecessary blank lines and comments
Sandro642 Oct 27, 2024
4732ee5
Refactor landing.js: Update logger name in dlAsync function
Sandro642 Oct 27, 2024
d659e0f
Refactor README.md: Remove ExtraFileVerification section
Sandro642 Oct 27, 2024
07ed316
Refactor package.json: Remove unused crypto dependency
Sandro642 Oct 27, 2024
7f33a1d
Refactor landing.js: Update modIdentity assignment in dlAsync function
Sandro642 Oct 27, 2024
2f0a054
Refactor variables.json: Add newline at end of file
Sandro642 Oct 27, 2024
d4437c7
Update variables.json
Sandro642 Oct 28, 2024
0770d65
Refactor settings.js: Update variable and comment names in manageMods…
Sandro642 Oct 29, 2024
092f36a
Refactor variables.json: Add newline at end of file
Sandro642 Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions app/assets/extraverif/extraverif.js
Original file line number Diff line number Diff line change
@@ -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()
30 changes: 30 additions & 0 deletions app/assets/extraverif/parserExtraverif.js
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions app/assets/extraverif/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extraFileVerifActivated": false,
"menuVisibility": "visible",
"debug": false

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a workaround for your editor?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty line before the closing bracket

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove the space

}
15 changes: 14 additions & 1 deletion app/assets/js/configmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Loading