File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
apps/frontend/src/pages/servers/manage/[id]/options Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 5353 />
5454 .modrinth.gg
5555 </div >
56+ <span v-if =" !isValidSubdomain" class =" text-sm text-rose-400" >
57+ Subdomain must be at least 3 characters long and can only contain alphanumeric
58+ characters, dashes, and underscores.
59+ </span >
5660 </div >
5761
5862 <!-- Allocations section -->
128132 <UiServersPyroLoading v-else />
129133 <div class =" absolute bottom-[2.5%] left-[2.5%] z-10 w-[95%]" >
130134 <UiServersSaveBanner
131- v-if =" hasUnsavedChanges"
135+ v-if =" hasUnsavedChanges && isValidSubdomain "
132136 :server =" props.server"
133137 :is-updating =" isUpdating"
134138 :save =" saveNetwork"
@@ -164,6 +168,8 @@ const newAllocationPort = ref(0);
164168
165169const hasUnsavedChanges = computed (() => serverSubdomain .value !== data ?.value ?.net ?.domain );
166170
171+ const isValidSubdomain = computed (() => / ^ [a-zA-Z0-9 -_] {3,} $ / .test (serverSubdomain .value ));
172+
167173const addNewAllocation = async () => {
168174 if (! newAllocationName .value ) return ;
169175
@@ -226,6 +232,8 @@ const removeAllocation = async (port: number) => {
226232};
227233
228234const saveNetwork = async () => {
235+ if (! isValidSubdomain .value ) return ;
236+
229237 try {
230238 isUpdating .value = true ;
231239 const available = await props .server .network ?.checkSubdomainAvailability (serverSubdomain .value );
You can’t perform that action at this time.
0 commit comments