mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 00:55:25 +00:00
feat: support supplementary environment variables for hooks in App (#5916)
* feat: Implement launcher supplementary environmental variables, and env var substitution in hooks * lint fix, prettier reformat * descriptions added for each environment variable for hook settings * alphabetize language keys --------- Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
@@ -116,6 +116,35 @@ const messages = defineMessages({
|
||||
id: 'app.settings.default-instance-options.post-exit-hook.description',
|
||||
defaultMessage: 'Runs after the game closes.',
|
||||
},
|
||||
hookVariablesDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.description',
|
||||
defaultMessage:
|
||||
'Hooks run in the working directory of the instance, with the following variables:',
|
||||
},
|
||||
instanceNameDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-name.description',
|
||||
defaultMessage: '$INST_NAME: The name of the instance',
|
||||
},
|
||||
instanceIdDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-id.description',
|
||||
defaultMessage: "$INST_ID: The name of the instance's folder",
|
||||
},
|
||||
instanceDirDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-dir.description',
|
||||
defaultMessage: "$INST_DIR: The absolute path to the instance's folder",
|
||||
},
|
||||
instanceMcDirDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-mc-dir.description',
|
||||
defaultMessage: '$INST_MC_DIR: An alias for $INST_DIR',
|
||||
},
|
||||
instanceJavaDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-java.description',
|
||||
defaultMessage: '$INST_JAVA: The absolute path to the java binary',
|
||||
},
|
||||
instanceJavaArgsDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-java-args.description',
|
||||
defaultMessage: '$INST_JAVA_ARGS: The JVM Arguments provided to the game',
|
||||
},
|
||||
})
|
||||
|
||||
const fetchSettings = await get()
|
||||
@@ -328,6 +357,18 @@ watch(
|
||||
{{ formatMessage(messages.postExitHookDescription) }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="m-0 leading-tight">
|
||||
{{ formatMessage(messages.hookVariablesDescription) }}
|
||||
<ul>
|
||||
<li>{{ formatMessage(messages.instanceNameDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceIdDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceDirDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceMcDirDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceJavaDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceJavaArgsDescription) }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1625,6 +1625,27 @@
|
||||
"instance.settings.tabs.hooks.title": {
|
||||
"message": "Game launch hooks"
|
||||
},
|
||||
"instance.settings.tabs.hooks.variables.description": {
|
||||
"message": "Hooks run in the working directory of the instance, with the following variables:"
|
||||
},
|
||||
"instance.settings.tabs.hooks.variables.inst-dir.description": {
|
||||
"message": "$INST_DIR: The absolute path to the instance's folder"
|
||||
},
|
||||
"instance.settings.tabs.hooks.variables.inst-id.description": {
|
||||
"message": "$INST_ID: The name of the instance's folder"
|
||||
},
|
||||
"instance.settings.tabs.hooks.variables.inst-java-args.description": {
|
||||
"message": "$INST_JAVA_ARGS: The JVM Arguments provided to the game"
|
||||
},
|
||||
"instance.settings.tabs.hooks.variables.inst-java.description": {
|
||||
"message": "$INST_JAVA: The absolute path to the java binary"
|
||||
},
|
||||
"instance.settings.tabs.hooks.variables.inst-mc-dir.description": {
|
||||
"message": "$INST_MC_DIR: An alias for $INST_DIR"
|
||||
},
|
||||
"instance.settings.tabs.hooks.variables.inst-name.description": {
|
||||
"message": "$INST_NAME: The name of the instance"
|
||||
},
|
||||
"instance.settings.tabs.hooks.wrapper": {
|
||||
"message": "Wrapper"
|
||||
},
|
||||
|
||||
@@ -56,6 +56,35 @@ const messages = defineMessages({
|
||||
defaultMessage:
|
||||
'Hooks allow advanced users to run certain system commands before and after launching the game.',
|
||||
},
|
||||
hookVariablesDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.description',
|
||||
defaultMessage:
|
||||
'Hooks run in the working directory of the instance, with the following variables:',
|
||||
},
|
||||
instanceNameDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-name.description',
|
||||
defaultMessage: '$INST_NAME: The name of the instance',
|
||||
},
|
||||
instanceIdDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-id.description',
|
||||
defaultMessage: "$INST_ID: The name of the instance's folder",
|
||||
},
|
||||
instanceDirDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-dir.description',
|
||||
defaultMessage: "$INST_DIR: The absolute path to the instance's folder",
|
||||
},
|
||||
instanceMcDirDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-mc-dir.description',
|
||||
defaultMessage: '$INST_MC_DIR: An alias for $INST_DIR',
|
||||
},
|
||||
instanceJavaDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-java.description',
|
||||
defaultMessage: '$INST_JAVA: The absolute path to the java binary',
|
||||
},
|
||||
instanceJavaArgsDescription: {
|
||||
id: 'instance.settings.tabs.hooks.variables.inst-java-args.description',
|
||||
defaultMessage: '$INST_JAVA_ARGS: The JVM Arguments provided to the game',
|
||||
},
|
||||
customHooks: {
|
||||
id: 'instance.settings.tabs.hooks.custom-hooks',
|
||||
defaultMessage: 'Custom launch hooks',
|
||||
@@ -153,5 +182,17 @@ const messages = defineMessages({
|
||||
<p class="m-0">
|
||||
{{ formatMessage(messages.postExitDescription) }}
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-6">
|
||||
{{ formatMessage(messages.hookVariablesDescription) }}
|
||||
</div>
|
||||
<ul class="m-0 mt-2">
|
||||
<li>{{ formatMessage(messages.instanceNameDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceIdDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceDirDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceMcDirDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceJavaDescription) }}</li>
|
||||
<li>{{ formatMessage(messages.instanceJavaArgsDescription) }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user