mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-04 12:13:27 +00:00
parent
bf543f45d0
commit
395e0ee3da
|
@ -20,7 +20,7 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
|
|||
}
|
||||
R.mutation(|node, args: ChangeNodeNameArgs| async move {
|
||||
if let Some(name) = &args.name {
|
||||
if name.is_empty() || name.len() > 32 {
|
||||
if name.is_empty() || name.len() > 250 {
|
||||
return Err(rspc::Error::new(
|
||||
ErrorCode::BadRequest,
|
||||
"invalid node name".into(),
|
||||
|
|
|
@ -47,16 +47,19 @@ impl Migrate for NodeConfig {
|
|||
type Ctx = ();
|
||||
|
||||
fn default(_path: PathBuf) -> Result<Self, MigratorError> {
|
||||
let mut name = match hostname::get() {
|
||||
// SAFETY: This is just for display purposes so it doesn't matter if it's lossy
|
||||
Ok(hostname) => hostname.to_string_lossy().into_owned(),
|
||||
Err(err) => {
|
||||
eprintln!("Falling back to default node name as an error occurred getting your systems hostname: '{err}'");
|
||||
"my-spacedrive".into()
|
||||
}
|
||||
};
|
||||
name.truncate(250);
|
||||
|
||||
Ok(Self {
|
||||
id: Uuid::new_v4(),
|
||||
name: match hostname::get() {
|
||||
// SAFETY: This is just for display purposes so it doesn't matter if it's lossy
|
||||
Ok(hostname) => hostname.to_string_lossy().into_owned(),
|
||||
Err(err) => {
|
||||
eprintln!("Falling back to default node name as an error occurred getting your systems hostname: '{err}'");
|
||||
"my-spacedrive".into()
|
||||
}
|
||||
},
|
||||
name,
|
||||
keypair: Keypair::generate(),
|
||||
p2p: Default::default(),
|
||||
features: vec![],
|
||||
|
|
|
@ -33,7 +33,7 @@ export const Component = () => {
|
|||
|
||||
const form = useZodForm({
|
||||
schema: z.object({
|
||||
name: z.string().min(1).optional(),
|
||||
name: z.string().min(1).max(250).optional(),
|
||||
p2p_enabled: z.boolean().optional(),
|
||||
p2p_port: u16,
|
||||
customOrDefault: z.enum(['Custom', 'Default'])
|
||||
|
|
Loading…
Reference in a new issue