diff --git a/src/bin/super/superapp/src/Remotes.svelte b/src/bin/super/superapp/src/Remotes.svelte index cb3506c0a..8b2192c94 100644 --- a/src/bin/super/superapp/src/Remotes.svelte +++ b/src/bin/super/superapp/src/Remotes.svelte @@ -59,10 +59,9 @@ let name = ""; let vanity_address = ""; let domain = ".sphinx.chat"; - let swarm_name_suffix = "-Swarm"; + let swarm_name_prefix = "s-"; const max_input_with = 600; let vanity_input_width = max_input_with; - let swarm_name_width = max_input_with; let aws_instance_types = []; let selected_instance = ""; let vanity_address_error = ""; @@ -470,7 +469,6 @@ vanity_address = ""; selected_instance = ""; vanity_input_width = max_input_with; - swarm_name_width = max_input_with; } async function handleSubmitCreateEc2() { @@ -482,7 +480,7 @@ try { const data = { - name: `${name}${swarm_name_suffix}`, + name: `${swarm_name_prefix}${name}`, vanity_address, instance_type: selected_instance, }; @@ -495,7 +493,6 @@ vanity_address = ""; selected_instance = ""; vanity_input_width = max_input_with; - swarm_name_width = max_input_with; show_notification = true; await getConfig(); @@ -524,11 +521,6 @@ function updateSwarmnameWidth(event) { name = event.target.value.replace(/\s+/g, ""); - const span = document.querySelector(".swarm_name_measure"); - swarm_name_width = span.offsetWidth; - if (!swarm_name_width) { - swarm_name_width = max_input_with; - } } @@ -718,20 +710,16 @@
-
- {name} - -
{#if name.length > 0} - {swarm_name_suffix} + {swarm_name_prefix} {/if} +
@@ -810,30 +798,37 @@ margin-left: -2px; } - .custom_input { + .prefix { + font-size: 1rem; + font-family: "Barlow"; + color: #49c998; + } + + .instance_name_input { border: none; outline: none; margin: 0; font-size: 1rem; font-family: "Barlow"; background-color: transparent; - width: auto; + width: 100%; color: white; padding: 0; } - .vanity_address_measure { - visibility: hidden; - position: absolute; - white-space: nowrap; - font-family: "Barlow"; - font-size: 1rem; - padding: 0; + .custom_input { border: none; + outline: none; margin: 0; + font-size: 1rem; + font-family: "Barlow"; + background-color: transparent; + width: auto; + color: white; + padding: 0; } - .swarm_name_measure { + .vanity_address_measure { visibility: hidden; position: absolute; white-space: nowrap; diff --git a/src/bin/super/util.rs b/src/bin/super/util.rs index 2c7f9e7cb..8edb3e11e 100644 --- a/src/bin/super/util.rs +++ b/src/bin/super/util.rs @@ -606,6 +606,10 @@ pub async fn create_swarm_ec2( info: &CreateEc2InstanceInfo, state: &mut Super, ) -> Result<(), Error> { + if !&info.name.starts_with("s-") { + return Err(anyhow!("swarm name does not match naming convention")); + } + let daily_limit = getenv("EC2_DAILY_LIMIT") .unwrap_or("5".to_string()) .parse()