From 75c33e2809f25b1ccab9df8792986a569f503a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel?= <71277595+Crujera27@users.noreply.github.com> Date: Wed, 31 Jul 2024 23:09:12 +0200 Subject: [PATCH] Development (#69) * Update build.yml * Update build.yml * Relase 1.17.0 * a * Updatre --- .github/workflows/build.yml | 10 ++ .gitignore | 4 +- INSTALLER-LICENSE.md | 38 ++++++ app/assets/css/launcher.css | 4 + app/assets/images/vis-tray.png | Bin 0 -> 928 bytes app/assets/js/configmanager.js | 20 +++ app/assets/js/processbuilder.js | 77 +++++------ app/assets/js/scripts/landing.js | 70 +++++----- app/assets/js/scripts/settings.js | 13 ++ app/assets/js/scripts/uibinder.js | 52 +++++++- app/assets/lang/es_ES.toml | 33 +++-- app/landing.ejs | 6 +- app/settings.ejs | 31 ++++- electron-builder.yml | 5 +- index.js | 64 ++++++++- package-lock.json | 215 ++++++++++++------------------ package.json | 6 +- 17 files changed, 410 insertions(+), 238 deletions(-) create mode 100644 INSTALLER-LICENSE.md create mode 100644 app/assets/images/vis-tray.png diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca896e1..0108dc2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,15 @@ jobs: with: node-version: 18 + - name: Crear la carpeta para el certificado + run: mkdir -p cert + shell: bash + + + - name: Restaurar el certificado + run: echo ${{ secrets.CERTIFICATE_BASE64 }} | base64 --decode > ./cert/certificate.pfx + shell: bash + - name: Instalar y preparar Python uses: actions/setup-python@v4 with: @@ -34,5 +43,6 @@ jobs: - name: Build env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CERTIFICATE_FILE: ${{ github.workspace }}/cert/certificate.pfx run: npm run dist shell: bash \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6a92688..0cb0453 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ /.vscode/ /target/ /logs/ -/dist/ \ No newline at end of file +/dist/ +./cert +./cert/* diff --git a/INSTALLER-LICENSE.md b/INSTALLER-LICENSE.md new file mode 100644 index 0000000..4ea3e18 --- /dev/null +++ b/INSTALLER-LICENSE.md @@ -0,0 +1,38 @@ +Licencias aplicables para este producto de VI Software: + +https://docs.visoftware.tech/vi-software/guidelines/terminos-de-servicio +https://docs.visoftware.tech/vi-software/guidelines/codigo-de-conducta +https://docs.visoftware.tech/vi-software/guidelines/politica-de-invitacion +https://docs.visoftware.tech/vi-software/guidelines/politica-de-uso-justo-para-la-api +https://docs.visoftware.tech/vi-software/guidelines/contribution-guidelines +https://docs.visoftware.tech/vi-software/guidelines/politica-de-contribucion + +Applicable licenses for direct customers of VI Software: + +https://docs.visoftware.tech/vi-software/licencias/licencia-cliente + +Applicable licenses for VI Software guests: + +https://docs.visoftware.tech/vi-software/licencias/licencia-invitado + +The code for this software is distributed under the MIT license. + +Copyright (c) 2024 VI Software + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/app/assets/css/launcher.css b/app/assets/css/launcher.css index 3308547..b301f70 100644 --- a/app/assets/css/launcher.css +++ b/app/assets/css/launcher.css @@ -1845,6 +1845,10 @@ input:checked + .toggleSwitchSlider:before { pointer-events: none; } +#settingsDropinrequiredDesc { + font-size: 10px; + pointer-events: none; +} /* Button to remove drop-in mods. */ .settingsDropinRemoveButton { background: none; diff --git a/app/assets/images/vis-tray.png b/app/assets/images/vis-tray.png new file mode 100644 index 0000000000000000000000000000000000000000..7e31d1b7bcd4a8d296201cb1e68a98e17beb426d GIT binary patch literal 928 zcmV;R17G}!P)QUC=J00j^N2^DmB zejOw(w6(ZBLrkNkr~n5Q000RQ7$lXLousC!Nl#hJ%+3J`7ce(MprWTWJ46Br7A-P8 zV`y%MijM#R36PSP!NSBPEI9=Y8?3Ieczc4WtFMBEiU0{1y}rOmOjHF88GnI>6dfv0 zR9pZ942+MIxVpX4)6}P^tZ8g>*4Nmjr>g)77yt(oQ(0jE0}NhcYXAZZ#Ky?5vbE&o z<=oueuCKBH2NVGY5&!@R?CkCT|NnS=g8%>j7#$|s+uW+Gu#=XX-QC_oM^C!DzFb~o z9v~+^K}RVoGDk{J0IL5-a7;&VOexO>YybcNUvyGVQ~&?}|NsC0|NsC0{{=DsV>_My z|NsC0>i_@$|Nj5_|NsBS|Ns96|NsAp|NsC0^#A|q|Ns4o|NsC0|NsBrcK^u#>;M1% z|Nr0y`u_!XF$QGy;GH|@^yuK==mr1)b#=It0005gNklyX$UxPtNiG|BRp}IXfTb!#s1#JM+Tj7U#lfvwMEtZAOLjy#lu^7Jo>g zJnt%qGK%7Vkjww-t1qYH>7_Fc5PHhz?jZLtRQqwt>KZ}FlP!k!L+%Fh-xF3#6~3fc z`a0-v7`O9RApT4eM(>(rNif|eGubIN*P%+VrqxtTlh+jrk+T|AYg&M- z&{K(4JZ;Hxe`-h3c;Q9%UIAZhy@1 z2;&Uw8XQG?+Cbtu0+Q7EkZAE4Fkr(rEh_4y-Z&9xfT))lw&<(Ca}hboP&>F}sTMcbEF{&1Y$O+P1(F)a6K7c? zG>Q}ed(xA58+#iR?r=PouRw}1?K%0si)sT{{+h7}hYCU console.log(`\x1b[31m[Minecraft]\x1b[0m ${x}`)) }) child.on('close', (code, signal) => { + win.show(); logger.info('Exited with code', code) if(code != 0){ setOverlayContent( @@ -401,12 +432,7 @@ class ProcessBuilder { // Classpath Argument args.push('-cp') args.push(this.classpathArg(mods, tempNativePath).join(ProcessBuilder.getClasspathSeparator())) - // Sets the path to the Authlib Injector jar - const authlibInjectorPath = path.join(app.getAppPath(), 'libraries', 'java', 'authlibinjector.jar'); - const authServerUrl = 'https://authserver.visoftware.tech/authlib-injector'; - // Add the Authlib Injector as a Java agent - args.unshift(`-javaagent:${authlibInjectorPath}=${authServerUrl}`); - args.push('-Dauthlibinjector.noShowServerName') + authLibArgs(args) // Java Arguments if(process.platform === 'darwin'){ args.push('-Xdock:name=VISoftwareLauncher') @@ -445,12 +471,7 @@ class ProcessBuilder { // Debug securejarhandler // args.push('-Dbsl.debug=true') - // Sets the path to the Authlib Injector jar - const authlibInjectorPath = path.join(app.getAppPath(), 'libraries', 'java', 'authlibinjector.jar'); - const authServerUrl = 'https://authserver.visoftware.tech/authlib-injector'; - // Add the Authlib Injector as a Java agent - args.unshift(`-javaagent:${authlibInjectorPath}=${authServerUrl}`); - args.push('-Dauthlibinjector.noShowServerName') + authLibArgs(args) if(this.modManifest.arguments.jvm != null) { for(const argStr of this.modManifest.arguments.jvm) { args.push(argStr @@ -478,26 +499,6 @@ class ProcessBuilder { // Vanilla Arguments args = args.concat(this.vanillaManifest.arguments.game) - async function WriteFullscreenToOptions(filePath, lineToReplace, newLine) { - try { - const exists = await fs.pathExists(filePath); - - if (exists) { - let fileContent = await fs.readFile(filePath, 'utf8'); - if (fileContent.includes(lineToReplace)) { - fileContent = fileContent.replace(lineToReplace, newLine); - await fs.outputFile(filePath, fileContent); - } else { - await fs.outputFile(filePath, newLine); - } - } else { - await fs.outputFile(filePath, newLine); - } - } catch (err) { - logger.info('Error while writing fullscreen to options.txt:', err); - } - } - for(let i=0; i { return } try { - try { - const response = await fetch('https://api.visoftware.tech/services/moderation/globalban/laccount/' + user.displayName); - const data = await response.json(); - if(data.banned){ - showLaunchFailure(Lang.queryJS('landing.launch.GlobalAccountDisabledErrorTitle'), Lang.queryJS('landing.launch.GlobalAccountDisabledErrorText')) - loggerLanding.error('Root account is globaly disabled by VI Software.') - return - } - }catch(err){ - showLaunchFailure(Lang.queryJS('landing.launch.NoCheckModErrorTitle'), Lang.queryJS('landing.launch.NoCheckModErrorText')) - loggerLanding.error('An error has occurred while attempting to check root account status. Error: ', err) - return - } - try { - const response = await fetch('https://api.visoftware.tech/services/launcher/accounts/' + user.displayName); - const data = await response.json(); - if(data.suspended){ - showLaunchFailure(Lang.queryJS('landing.launch.AccountDisabledErrorTitle'), Lang.queryJS('landing.launch.AccountDisabledErrorText')) - loggerLanding.error('Account is disabled by experience administrator.') - return - } - }catch(err){ - showLaunchFailure(Lang.queryJS('landing.launch.NoCheckModErrorTitle'), Lang.queryJS('landing.launch.NoCheckModErrorText')) - loggerLanding.error('An error has occurred while attempting to check account status. Error: ', err) + const response = await fetch('https://api.visoftware.tech/services/moderation/mystatus', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + 'token': user.accessToken + } + }); + + const userData = await response.json(); + if(response.status == 401){ + showLaunchFailure(Lang.queryJS('landing.launch.NoCheckModErrorTitle'), Lang.queryJS('landing.launch.NoCheckModErrorText')); + loggerLanding.error('An error has occurred while attempting to verify the account in the moderation system. Error:', userData.error); + return; + } + if(userData.rootbanned){ + showLaunchFailure(Lang.queryJS('landing.launch.GlobalAccountDisabledErrorTitle'), Lang.queryJS('landing.launch.GlobalAccountDisabledErrorText')) + loggerLanding.error('Root account is banned by VI Software. Canceling launch.') return - } - const response = await fetch('https://api.visoftware.tech/services/moderation/warns/account/' + user.displayName); - const data = await response.json(); - if(data.some(warning => warning.read === 0)){ + } + if(userData.pendingwarns > 0){ showLaunchFailure(Lang.queryJS('landing.launch.WarnsnotreadErrorTitle'), Lang.queryJS('landing.launch.WarnsnotreadErrorText')) - loggerLanding.error('User has unread warnings.') + loggerLanding.error('Root account has pending warnings awaiting to be reviewed. Canceling launch.') return - } - - }catch(err){ - showLaunchFailure(Lang.queryJS('landing.launch.NoCheckModErrorTitle'), Lang.queryJS('landing.launch.NoCheckModErrorText')) - loggerLanding.error('An error has occurred while attempting to check unread user\'s warnings. Error: ', err) - return - } + } + if(userData.launcherbanned){ + showLaunchFailure(Lang.queryJS('landing.launch.AccountDisabledErrorTitle'), Lang.queryJS('landing.launch.AccountDisabledErrorText')) + loggerLanding.error('Launcher account is disabled by Team Administration. Canceling launch.') + return + } + + } catch (err) { + showLaunchFailure(Lang.queryJS('landing.launch.NoCheckModErrorTitle'), Lang.queryJS('landing.launch.NoCheckModErrorText')); + loggerLanding.error('An error has occurred while attempting to verify the account in the moderation system. Error: ', err); + return; + } const jExe = ConfigManager.getJavaExecutable(ConfigManager.getSelectedServer()) if(jExe == null){ await asyncSystemScan(server.effectiveJavaOptions) @@ -1131,4 +1127,4 @@ async function loadNews(){ }) return await promise -} +} \ No newline at end of file diff --git a/app/assets/js/scripts/settings.js b/app/assets/js/scripts/settings.js index 92dfe15..13688c3 100644 --- a/app/assets/js/scripts/settings.js +++ b/app/assets/js/scripts/settings.js @@ -96,6 +96,19 @@ function bindFileSelectors(){ bindFileSelectors() +launchDetachedCheckbox = document.querySelector('input[cValue="LaunchDetached"]') +MinimizeOnLaunchCheckbox = document.querySelector('input[cValue="MinimizeOnLaunch"]') + + +MinimizeOnLaunchCheckbox.addEventListener('change', function() { + if (this.checked) { + MinimizeOnLaunchCheckbox.disabled = true + MinimizeOnLaunchCheckbox.checked = true + } else { + MinimizeOnLaunchCheckbox.disabled = false + } +}) + /** * General Settings Functions diff --git a/app/assets/js/scripts/uibinder.js b/app/assets/js/scripts/uibinder.js index 11913ed..8f1cfae 100644 --- a/app/assets/js/scripts/uibinder.js +++ b/app/assets/js/scripts/uibinder.js @@ -88,6 +88,8 @@ async function showMainUI(data) { // Clear the server list and build status from the local storage to prevent any issues and abuse localStorage.removeItem('serverList'); localStorage.removeItem('buildstatus'); + localStorage.removeItem('disableHttpd'); + localStorage.removeItem('authlibDebug') }catch(err){ console.error(err) } @@ -690,11 +692,57 @@ ipcRenderer.on('distributionIndexDone', async (event, res) => { } }) -// Util for development -async function devModeToggle() { +// Utils for development + +/* Sets a custom port for the httpd server used by the authlib injector + Value is null by default, which means the port will be randomly chosen */ + + async function debug_getHelp() { + console.log('function debug_getHelp() - shows this help message') + console.log('function debug_devModeToggle() - toggles distro dev mode') + console.log('function debug_toggledisableHttpd() - toggles the flag disableHttpd for the authlib injector') + console.log('function debug_toggleAuthLibDebug(mode) - toggles debug mode for the authlib injector. Available options: verbose, authlib, dumpClass, printUntransformed') +} + +/* Toggle distro dev mode */ + +async function debug_devModeToggle() { DistroAPI.toggleDevMode(true) const data = await DistroAPI.refreshDistributionOrFallback() ensureJavaSettings(data) updateSelectedServer(data.servers[0]) syncModConfigurations(data) } + + +/* Toggles the flag disableHttpd for authlib injector */ + + async function debug_toggledisableHttpd() { + if(localStorage.getItem('disableHttpd')){ + localStorage.removeItem('disableHttpd') + console.log('Httpd server enabled') + }else{ + localStorage.setItem('disableHttpd', true) + console.log('Httpd server disabled') + } +} + + +/* Toggles debug mode for the authlib injector + Avilable options: verbose, authlib, dumpClass, printUntransformed +*/ + + +async function debug_toggleAuthLibDebug(mode){ + if(mode){ + if(mode=='verbose' || mode=='authlib' || mode=='dumpClass' || mode=='printUntransformed'){ + console.log('Authlib debug mode enabled for', mode) + localStorage.setItem('authlibDebug', mode) + }else{ + console.log('Invalid debug mode') + } + }else{ + localStorage.removeItem('authlibDebug') + console.log('Authlib debug mode disabled') + } +} \ No newline at end of file diff --git a/app/assets/lang/es_ES.toml b/app/assets/lang/es_ES.toml index ae25f00..6688527 100644 --- a/app/assets/lang/es_ES.toml +++ b/app/assets/lang/es_ES.toml @@ -16,14 +16,14 @@ [ejs.landing] updateAvailableTooltip = "Actualización disponible" -usernamePlaceholder = "Nombre de usuario" +usernamePlaceholder = "Nombre de la cuenta" usernameEditButton = "Editar" settingsTooltip = "Configuración" serverStatus = "SERVIDOR" -serverStatusPlaceholder = "DESCONECTADO" -mojangStatus = "ESTADO DE MOJANG" -mojangStatusTooltipTitle = "Servicios" -mojangStatusNETitle = "No Esenciales" +serverStatusPlaceholder = "Offline" +visStatus = "ESTADOS DE VI SOFTWARE" +visStatusTooltipTitle = "Servicios" +vistatusNETitle = "No Esenciales" newsButton = "NOTICIAS" launchButton = "JUGAR" launchButtonPlaceholder = "• Ningún servidor seleccionado" @@ -67,8 +67,8 @@ accountSelectCancel = "Cancelar" [ejs.settings] navHeaderText = "Configuración" navAccount = "Cuenta" -navMinecraft = "Minecraft" -navMods = "Mods" +navMinecraft = "Juego" +navMods = "Candidatos" navJava = "Java" navLauncher = "Launcher" navAbout = "Acerca de" @@ -80,21 +80,26 @@ microsoftAccount = "Microsoft" addMicrosoftAccount = "+ Añadir Cuenta de Microsoft" VISAccount = "VI Software" addVISAccount = "+ Añadir Cuenta de VI Software" -minecraftTabHeaderText = "Configuración de Minecraft" +minecraftTabHeaderText = "Configuración del juego" minecraftTabHeaderDesc = "Opciones relacionadas con el lanzamiento del juego." gameResolutionTitle = "Resolución del juego" launchFullscreenTitle = "Iniciar en pantalla completa." autoConnectTitle = "Automáticamente conectar al servidor al lanzar el juego si disponible." autoConnectDesc = "Se conecta automáticamente al servidor si la funcionalidad está disponible en el servidor seleccionado. (Debe de haber sido activado por la administradora de la experiencia)" +MinimizeLauncherOnLaunch="Minimizar el launcher en el system tray al iniciar el juego." +MinimizeLauncherOnLaunchDesc="Deja en segundo plano en el tray del sistema el launcher al iniciar el juego. Este se abrirá automáticamente al juego cerrarse." launchDetachedTitle = "(Avanzado) Separar el proceso del juego respecto al proceso del launcher" launchDetachedDesc = "Si los procesos del launcher y el juego no están separados, cerrar el launcher supondrá que el juego también se cierre." tabModsHeaderText = "Configuración de Mods" tabModsHeaderDesc = "Habilita o deshabilita mods." switchServerButton = "Cambiar" -requiredMods = "Mods Obligatorios" -optionalMods = "Mods Opcionales" -dropinMods = "Mods Drop-in" -addMods = "Añadir Mods" +requiredMods = "Candidatos Obligatorios" +requiredDesc = "Estos candidatos son los impuestos como obligatorios por su administradora de experiencia. Siempre estarán incluidos cuando inicie el juego." +optionalMods = "Candidatos Opcionales" +optionalDesc = "Estos candidatos vienen incluidos con la experiencia diseñada por su administradora, algunos de estos mismos pueden venir activados de manera predeterminada, está bajo su elección el activarlos o desactivarlos." +dropinMods = "Candidatos Drop-in" +dropinModsDesc = "¡Personalice la experiencia a su antojo! Añada candidatos que su administradora no incluya con la experiencia aquí." +addMods = "Añadir candidatos" dropinRefreshNote = "(F5 para Actualizar)" shaderpacks = "Paquetes de Shaders" shaderpackDesc = "Habilita o deshabilita shaders. Ten en cuenta que los shaders solo se ejecutarán sin problemas en configuraciones potentes. Puedes añadir paquetes personalizados aquí." @@ -201,7 +206,7 @@ loading = "Cargando..." [js.landing.serverStatus] server = "SERVIDOR" -offline = "DESCONECTADO" +offline = "Offline" players = "JUGADORES" [js.landing.systemScan] @@ -284,7 +289,7 @@ confirmButton = "Estoy Seguro/a" cancelButton = "Cancelar" [js.settings.authAccountPopulate] -username = "Nombre de usuario" +username = "Nombre de la cuenta" rank = "Rango" uuid = "UUID" selectAccount = "Seleccionar Cuenta" diff --git a/app/landing.ejs b/app/landing.ejs index 6b1cd69..5612127 100644 --- a/app/landing.ejs +++ b/app/landing.ejs @@ -81,16 +81,16 @@
- <%- lang('landing.mojangStatus') %> + <%- lang('landing.visStatus') %>
-
<%- lang('landing.mojangStatusTooltipTitle') %>
+
<%- lang('landing.visStatusTooltipTitle') %>
-
<%- lang('landing.mojangStatusNETitle') %>
+
<%- lang('landing.vistatusNETitle') %>
diff --git a/app/settings.ejs b/app/settings.ejs index 3bc82c6..7dfc4f3 100644 --- a/app/settings.ejs +++ b/app/settings.ejs @@ -124,6 +124,18 @@
+
+
+ <%- lang('settings.MinimizeLauncherOnLaunch') %> + <%- lang('settings.MinimizeLauncherOnLaunchDesc') %> +
+
+ +
+
<%- lang('settings.launchDetachedTitle') %> @@ -154,19 +166,28 @@
-
<%- lang('settings.requiredMods') %>
+
<%- lang('settings.requiredMods') %> +
+ <%- lang('settings.requiredDesc') %> +
-
<%- lang('settings.optionalMods') %>
+
<%- lang('settings.optionalMods') %> +
+ <%- lang('settings.optionalDesc') %> +
-
<%- lang('settings.dropinMods') %>
+
<%- lang('settings.dropinMods') %> +
+ <%- lang('settings.dropinModsDesc') %> +
@@ -337,12 +358,12 @@
<%- lang('settings.launcherTabHeaderText') %> <%- lang('settings.launcherTabHeaderDesc') %> -
+
<%- lang('settings.allowPrereleaseTitle') %> <%- lang('settings.allowPrereleaseDesc') %> -
+