You've already forked AstralRinth
* fix(content): changing mod versions works again * chore(assets): update pyro logo * fix(properties): deprecate fetchconfigfile * Revert "fix(content): changing mod versions works again" This reverts commit d7c0d1196f8c1850fd7ccbc1644941c6db4dc306. * feat(files): ability to sort via column click * chore(startup): update clunky wording * feat(serverListing): server icons SSR friendly * fix(servers): if archon fails, display err in listing * chore(serverlisting): use pyroserver hook to init icon * chore(servers): much more graceful reinstall * fix(servers): tw warn * fix(platform): correctly react when pack reinstalled * fix(serversroot): explicitly import navigateTo Signed-off-by: Evan Song <theevansong@gmail.com> * chore(serverlabels): show skeleton instead of hiding Signed-off-by: Evan Song <theevansong@gmail.com> * feat(platform): install-aware controls Signed-off-by: Evan Song <theevansong@gmail.com> * refactor!(platform): rewrite platform page * fix(platform): regression in autoselecting loader * chore(platform): prefer version over project modification date * fix(platform): permanent hang after initial mount * chore(platform): do not silently fail and hang if modpack fails loading * oops: remove hardcoded error causer * fix(platform): switch modpack btn while installing doesnt need class Signed-off-by: Evan Song <theevansong@gmail.com> * chore(platform): adjust styling in version modal Signed-off-by: Evan Song <theevansong@gmail.com> * chore(platform): prevent changing project card style Signed-off-by: Evan Song <theevansong@gmail.com> * refactor(pyrodropdown): rewrite Signed-off-by: Evan Song <theevansong@gmail.com> * fix(pyrodropdown): do nopt use deprecated substr Signed-off-by: Evan Song <theevansong@gmail.com> * chore: clean Signed-off-by: Evan Song <theevansong@gmail.com> * fix(network): sentence case Signed-off-by: Evan Song <theevansong@gmail.com> * refactor(terminal): initial batch Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): fulllog over fullscreen Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): fullscreen conflict with body scroll Signed-off-by: Evan Song <theevansong@gmail.com> * feat(terminal): init drag select * feat(terminal): shift click support Signed-off-by: Evan Song <theevansong@gmail.com> * chore(terminal): double lines limit Signed-off-by: Evan Song <theevansong@gmail.com> * feat(terminal): copy button Signed-off-by: Evan Song <theevansong@gmail.com> * chore(terminal): protip style Signed-off-by: Evan Song <theevansong@gmail.com> * chore(terminal): improve styles Signed-off-by: Evan Song <theevansong@gmail.com> * feat(terminal): regex search Signed-off-by: Evan Song <theevansong@gmail.com> * chore(terminal): move icons to icons dir Signed-off-by: Evan Song <theevansong@gmail.com> * chore(terminal): improve drag select autoscroll inertia Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): cancel selection on right click Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): progblur and stb btn disappearing Signed-off-by: Evan Song <theevansong@gmail.com> * refactor(serverstats): power efficiency * fix(subdomainlabel): correct tooltip terminology Signed-off-by: Evan Song <theevansong@gmail.com> * feat(preferences): users hide subdomain label Signed-off-by: Evan Song <theevansong@gmail.com> * chore(servers): clean Signed-off-by: Evan Song <theevansong@gmail.com> * chore(terminal): deselect lines on escape Signed-off-by: Evan Song <theevansong@gmail.com> * fix(serversidebar): type err Signed-off-by: Evan Song <theevansong@gmail.com> * fix(fileitem): vue server render type Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): disable pointer events on lines if scrolling Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): search result counts style Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): plural Signed-off-by: Evan Song <theevansong@gmail.com> * chore(terminal): clean Signed-off-by: Evan Song <theevansong@gmail.com> * feat(terminal): view selection Signed-off-by: Evan Song <theevansong@gmail.com> * feat(terminal): show actively selected lines in scrollbar Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminallog): btn color Signed-off-by: Evan Song <theevansong@gmail.com> * chore: clean Signed-off-by: Evan Song <theevansong@gmail.com> * fix(gamelabel): align to text Signed-off-by: Evan Song <theevansong@gmail.com> * fix(gamelabel): align to text Signed-off-by: Evan Song <theevansong@gmail.com> * fix(listing): remove deadcode Signed-off-by: Evan Song <theevansong@gmail.com> * fix(serverlisting): deprecated process.server Signed-off-by: Evan Song <theevansong@gmail.com> * fix(platform): correctly disable button Signed-off-by: Evan Song <theevansong@gmail.com> * fix(backups): do not allow backup creation during server installation Signed-off-by: Evan Song <theevansong@gmail.com> * fix(platform): flush stale currentversion data on successful install Signed-off-by: Evan Song <theevansong@gmail.com> * fix(gamelabel): fix gap Signed-off-by: Evan Song <theevansong@gmail.com> * chore(network): vaporize uppercase Signed-off-by: Evan Song <theevansong@gmail.com> * chore(info): vaporize uppercase Signed-off-by: Evan Song <theevansong@gmail.com> * chore(backups): style unification Signed-off-by: Evan Song <theevansong@gmail.com> * chore(backups): finalize style change Signed-off-by: Evan Song <theevansong@gmail.com> * fix(servers): catch pyro servers fetch errors during ssr Signed-off-by: Evan Song <theevansong@gmail.com> * fix(serverstats): ram as bytes graph now works Signed-off-by: Evan Song <theevansong@gmail.com> * fix(platform): unify attempts and refresh interval Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): input Signed-off-by: Evan Song <theevansong@gmail.com> * feat(servers): installing ticket + update available notice back in platform Signed-off-by: Evan Song <theevansong@gmail.com> * chore(terminal): dont add bg to scroll track Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): preserve whitespace Signed-off-by: Evan Song <theevansong@gmail.com> * chore(serversroot): unnest blurred icon query Signed-off-by: Evan Song <theevansong@gmail.com> * fix(serverstats): clamp memory usage to 100% no matter what Signed-off-by: Evan Song <theevansong@gmail.com> * feat(terminal): allow copy of single lines, show btn Signed-off-by: Evan Song <theevansong@gmail.com> * chore(terminal): animate copy>view transition Signed-off-by: Evan Song <theevansong@gmail.com> * init: search improvements Signed-off-by: Evan Song <theevansong@gmail.com> * fix: lint Signed-off-by: Evan Song <theevansong@gmail.com> * chore: change log modal title Signed-off-by: Evan Song <theevansong@gmail.com> * fix: hide fullscreen when selecting and cancel selection on clickout Signed-off-by: Evan Song <theevansong@gmail.com> * refactor(terminal): more reliable jumpToLine Signed-off-by: Evan Song <theevansong@gmail.com> * feat: search results separator Signed-off-by: Evan Song <theevansong@gmail.com> * chore: remove buggy isScrollable check Signed-off-by: Evan Song <theevansong@gmail.com> * fix: style Signed-off-by: Evan Song <theevansong@gmail.com> * refactor: correctly store pos to make jump reliable Signed-off-by: Evan Song <theevansong@gmail.com> * fix: disparity between search/log dragselect Signed-off-by: Evan Song <theevansong@gmail.com> * fix: prevent propagation of click events when clicking on jump btn Signed-off-by: Evan Song <theevansong@gmail.com> * fix: switch selection strategies depending on terminal mode Signed-off-by: Evan Song <theevansong@gmail.com> * chore: smarter esc handling Signed-off-by: Evan Song <theevansong@gmail.com> * finalize Signed-off-by: Evan Song <theevansong@gmail.com> * run fix * fix: ensure lines between cannot be selected Signed-off-by: Evan Song <theevansong@gmail.com> * fix: increase initial log batch to 256 Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): click on scroll track should take user to new scroll position Signed-off-by: Evan Song <theevansong@gmail.com> * fix(terminal): update aria label for view selected logs btn Signed-off-by: Evan Song <theevansong@gmail.com> * chore: clean Signed-off-by: Evan Song <theevansong@gmail.com> --------- Signed-off-by: Evan Song <theevansong@gmail.com>
197 lines
6.7 KiB
Vue
197 lines
6.7 KiB
Vue
<template>
|
|
<div class="relative h-full w-full">
|
|
<div v-if="data" class="flex h-full w-full flex-col gap-4">
|
|
<div class="rounded-2xl border-solid border-orange bg-bg-orange p-4 text-contrast">
|
|
These settings are for advanced users. Changing them can break your server.
|
|
</div>
|
|
|
|
<div class="gap-2">
|
|
<div class="card flex flex-col gap-4">
|
|
<div class="flex flex-col justify-between gap-4 sm:flex-row">
|
|
<label for="startup-command-field" class="flex flex-col gap-2">
|
|
<span class="text-lg font-bold text-contrast">Startup command</span>
|
|
<span> The command that runs when your server is started. </span>
|
|
</label>
|
|
<ButtonStyled>
|
|
<button
|
|
:disabled="invocation === startupSettings?.original_invocation"
|
|
class="!w-full sm:!w-auto"
|
|
@click="resetToDefault"
|
|
>
|
|
<UpdatedIcon class="h-5 w-5" />
|
|
Restore default command
|
|
</button>
|
|
</ButtonStyled>
|
|
</div>
|
|
<textarea
|
|
id="startup-command-field"
|
|
v-model="invocation"
|
|
class="min-h-[270px] w-full resize-y font-[family-name:var(--mono-font)]"
|
|
/>
|
|
</div>
|
|
|
|
<div class="card flex flex-col gap-8">
|
|
<div class="flex flex-col gap-4">
|
|
<div class="flex flex-col gap-2">
|
|
<span class="text-lg font-bold text-contrast">Java version</span>
|
|
<span>
|
|
The version of Java that your server will run on. By default, only the Java versions
|
|
compatible with this version of Minecraft are shown. Some mods may require a
|
|
different Java version to work properly.
|
|
</span>
|
|
</div>
|
|
<div class="flex items-center gap-2">
|
|
<input
|
|
id="show-all-versions"
|
|
v-model="showAllVersions"
|
|
class="switch stylized-toggle flex-none"
|
|
type="checkbox"
|
|
/>
|
|
<label for="show-all-versions" class="text-sm">Show all Java versions</label>
|
|
</div>
|
|
<UiServersTeleportDropdownMenu
|
|
:id="'java-version-field'"
|
|
v-model="jdkVersion"
|
|
name="java-version"
|
|
:options="displayedJavaVersions"
|
|
placeholder="Java Version"
|
|
/>
|
|
</div>
|
|
<div class="flex flex-col gap-4">
|
|
<div class="flex flex-col gap-2">
|
|
<span class="text-lg font-bold text-contrast">Runtime</span>
|
|
<span> The Java runtime your server will use. </span>
|
|
</div>
|
|
<UiServersTeleportDropdownMenu
|
|
:id="'runtime-field'"
|
|
v-model="jdkBuild"
|
|
name="runtime"
|
|
:options="['Corretto', 'Temurin', 'GraalVM']"
|
|
placeholder="Runtime"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<UiServersSaveBanner
|
|
:is-visible="!!hasUnsavedChanges"
|
|
:server="props.server"
|
|
:is-updating="isUpdating"
|
|
:save="saveStartup"
|
|
:reset="resetStartup"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { UpdatedIcon } from "@modrinth/assets";
|
|
import { ButtonStyled } from "@modrinth/ui";
|
|
import type { Server } from "~/composables/pyroServers";
|
|
|
|
const props = defineProps<{
|
|
server: Server<["general", "content", "backups", "network", "startup", "ws", "fs"]>;
|
|
}>();
|
|
|
|
const data = computed(() => props.server.general);
|
|
const startupSettings = computed(() => props.server.startup);
|
|
const showAllVersions = ref(false);
|
|
|
|
const jdkVersionMap = [
|
|
{ value: "lts8", label: "Java 8" },
|
|
{ value: "lts11", label: "Java 11" },
|
|
{ value: "lts17", label: "Java 17" },
|
|
{ value: "lts21", label: "Java 21" },
|
|
];
|
|
|
|
const jdkBuildMap = [
|
|
{ value: "corretto", label: "Corretto" },
|
|
{ value: "temurin", label: "Temurin" },
|
|
{ value: "graal", label: "GraalVM" },
|
|
];
|
|
|
|
const invocation = ref(startupSettings.value?.invocation);
|
|
const jdkVersion = ref(
|
|
jdkVersionMap.find((v) => v.value === startupSettings.value?.jdk_version)?.label || "",
|
|
);
|
|
const jdkBuild = ref(
|
|
jdkBuildMap.find((v) => v.value === startupSettings.value?.jdk_build)?.label || "",
|
|
);
|
|
const isUpdating = ref(false);
|
|
|
|
const compatibleJavaVersions = computed(() => {
|
|
const mcVersion = data.value?.mc_version ?? "";
|
|
if (!mcVersion) return jdkVersionMap.map((v) => v.label);
|
|
|
|
const [major, minor] = mcVersion.split(".").map(Number);
|
|
|
|
if (major >= 1) {
|
|
if (minor >= 20) return ["Java 21"];
|
|
if (minor >= 18) return ["Java 17", "Java 21"];
|
|
if (minor >= 17) return ["Java 16", "Java 17", "Java 21"];
|
|
if (minor >= 12) return ["Java 8", "Java 11", "Java 17", "Java 21"];
|
|
if (minor >= 6) return ["Java 8", "Java 11"];
|
|
}
|
|
|
|
return ["Java 8"];
|
|
});
|
|
|
|
const displayedJavaVersions = computed(() => {
|
|
return showAllVersions.value ? jdkVersionMap.map((v) => v.label) : compatibleJavaVersions.value;
|
|
});
|
|
|
|
const hasUnsavedChanges = computed(
|
|
() =>
|
|
invocation.value !== startupSettings.value?.invocation ||
|
|
jdkVersion.value !==
|
|
(jdkVersionMap.find((v) => v.value === startupSettings.value?.jdk_version)?.label || "") ||
|
|
jdkBuild.value !==
|
|
jdkBuildMap.find((v) => v.value === startupSettings.value?.jdk_build || "")?.label,
|
|
);
|
|
|
|
const saveStartup = async () => {
|
|
try {
|
|
isUpdating.value = true;
|
|
const invocationValue = invocation.value ?? "";
|
|
const jdkVersionKey = jdkVersionMap.find((v) => v.label === jdkVersion.value)?.value;
|
|
const jdkBuildKey = jdkBuildMap.find((v) => v.label === jdkBuild.value)?.value;
|
|
await props.server.startup?.update(invocationValue, jdkVersionKey as any, jdkBuildKey as any);
|
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
addNotification({
|
|
group: "serverOptions",
|
|
type: "success",
|
|
title: "Server settings updated",
|
|
text: "Your server settings were successfully changed.",
|
|
});
|
|
await props.server.refresh();
|
|
} catch (error) {
|
|
console.error(error);
|
|
addNotification({
|
|
group: "serverOptions",
|
|
type: "error",
|
|
title: "Failed to update server arguments",
|
|
text: "Please try again later.",
|
|
});
|
|
} finally {
|
|
isUpdating.value = false;
|
|
}
|
|
};
|
|
|
|
const resetStartup = () => {
|
|
invocation.value = startupSettings.value?.invocation;
|
|
jdkVersion.value =
|
|
jdkVersionMap.find((v) => v.value === startupSettings.value?.jdk_version)?.label || "";
|
|
jdkBuild.value =
|
|
jdkBuildMap.find((v) => v.value === startupSettings.value?.jdk_build)?.label || "";
|
|
};
|
|
|
|
const resetToDefault = () => {
|
|
invocation.value = startupSettings.value?.original_invocation;
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.stylized-toggle:checked::after {
|
|
background: var(--color-accent-contrast) !important;
|
|
}
|
|
</style>
|