GooseMod / OpenAsar

Open-source alternative of Discord desktop's app.asar
https://openasar.dev
GNU Affero General Public License v3.0
2.54k stars 67 forks source link

Fix broken customFlags handling in cleanup version #142

Closed Dreaming-Codes closed 1 year ago

Dreaming-Codes commented 1 year ago

Hi there,

I noticed that the cleanup of the code in commit 593b236 inadvertently broke the customFlags feature due to a small logic error. In the minified version of the code, the customFlags were concatenated outside of the reduce function, causing the flags to be processed incorrectly.

I have fixed this issue in the minified version by moving the customFlags concatenation inside the reduce function. Here's the corrected code snippet:

for (const x of ('base,' + (oaConfig.cmdPreset || 'perf')).split(',').reduce((a, x) => a.concat(presets[x]?.split(' ')), (oaConfig.customFlags ?? '').split(' '))) {

With this change, the customFlags feature should work correctly, and the minified version should function the same way as my original pull request.