mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-12 13:28:49 +00:00
Fix https://{registry}/me display
This commit is contained in:
@@ -16,9 +16,29 @@ impl Login {
|
|||||||
fn get_token_or_ask_user(&self) -> Result<String, std::io::Error> {
|
fn get_token_or_ask_user(&self) -> Result<String, std::io::Error> {
|
||||||
match self.token.as_ref() {
|
match self.token.as_ref() {
|
||||||
Some(s) => Ok(s.clone()),
|
Some(s) => Ok(s.clone()),
|
||||||
None => Input::new()
|
None => {
|
||||||
.with_prompt("Please paste the login token from https://wapm.io/me:\"")
|
let registry_host = url::Url::parse(&wasmer_registry::format_graphql(
|
||||||
.interact_text(),
|
&self.registry,
|
||||||
|
))
|
||||||
|
.map_err(|e| {
|
||||||
|
std::io::Error::new(
|
||||||
|
std::io::ErrorKind::Other,
|
||||||
|
format!("Invalid registry for login {}: {e}", self.registry),
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
let registry_host = registry_host.host_str().ok_or_else(|| {
|
||||||
|
std::io::Error::new(
|
||||||
|
std::io::ErrorKind::Other,
|
||||||
|
format!("Invalid registry for login {}: no host", self.registry),
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
Input::new()
|
||||||
|
.with_prompt(&format!(
|
||||||
|
"Please paste the login token from https://{}/me:\"",
|
||||||
|
registry_host
|
||||||
|
))
|
||||||
|
.interact_text()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ pub mod graphql;
|
|||||||
pub mod login;
|
pub mod login;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
use crate::config::{format_graphql, Registries};
|
pub use crate::config::format_graphql;
|
||||||
|
use crate::config::Registries;
|
||||||
pub use config::PartialWapmConfig;
|
pub use config::PartialWapmConfig;
|
||||||
|
|
||||||
pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") {
|
pub static GLOBAL_CONFIG_FILE_NAME: &str = if cfg!(target_os = "wasi") {
|
||||||
|
|||||||
Reference in New Issue
Block a user