You've already forked AstralRinth
forked from didirus/AstralRinth
Onboarding changes (#347)
* modal * Finish tutorial phase * Finish onboarding, tutorial, and url front end handlng * Run lint * Update pnpm-lock.yaml * Fixed bad refactor * Fixed #341 * lint * Fixes #315 * Update ModInstallModal.vue * Initial onboarding changes * importing card * Run lint * Update ImportingCard.vue * Fixed home page errors * Fixes * Linter * Login page * Tweaks * Update ImportingCard.vue * Onboarding finishing changes * Linter * update to new auth * bump version * backend for linking --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
This commit is contained in:
@@ -13,9 +13,10 @@ pub mod tags;
|
||||
|
||||
pub mod data {
|
||||
pub use crate::state::{
|
||||
DirectoryInfo, Hooks, JavaSettings, MemorySettings, ModLoader,
|
||||
ModrinthProject, ModrinthTeamMember, ModrinthUser, ModrinthVersion,
|
||||
ProfileMetadata, ProjectMetadata, Settings, Theme, WindowSize,
|
||||
DirectoryInfo, Hooks, JavaSettings, LinkedData, MemorySettings,
|
||||
ModLoader, ModrinthProject, ModrinthTeamMember, ModrinthUser,
|
||||
ModrinthVersion, ProfileMetadata, ProjectMetadata, Settings, Theme,
|
||||
WindowSize,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,9 @@ use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
lazy_static! {
|
||||
static ref HYDRA_URL: Url = Url::parse("https://hydra.modrinth.com")
|
||||
.expect("Hydra URL parse failed");
|
||||
static ref HYDRA_URL: Url =
|
||||
Url::parse("https://staging-api.modrinth.com/v2/auth/minecraft/")
|
||||
.expect("Hydra URL parse failed");
|
||||
}
|
||||
|
||||
// Socket messages
|
||||
@@ -39,6 +40,7 @@ struct TokenJSON {
|
||||
token: String,
|
||||
refresh_token: String,
|
||||
expires_after: u32,
|
||||
flow: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -65,11 +67,10 @@ pub struct HydraAuthFlow<S: AsyncRead + AsyncWrite + Unpin> {
|
||||
|
||||
impl HydraAuthFlow<ws::tokio::ConnectStream> {
|
||||
pub async fn new() -> crate::Result<Self> {
|
||||
let sock_url = wrap_ref_builder!(
|
||||
it = HYDRA_URL.clone() =>
|
||||
{ it.set_scheme("wss").ok() }
|
||||
);
|
||||
let (socket, _) = ws::tokio::connect_async(sock_url.clone()).await?;
|
||||
let (socket, _) = ws::tokio::connect_async(
|
||||
"wss://staging-api.modrinth.com/v2/auth/minecraft/ws",
|
||||
)
|
||||
.await?;
|
||||
Ok(Self { socket })
|
||||
}
|
||||
|
||||
@@ -87,7 +88,7 @@ impl HydraAuthFlow<ws::tokio::ConnectStream> {
|
||||
.into_data();
|
||||
let code = ErrorJSON::unwrap::<LoginCodeJSON>(&code_resp)?;
|
||||
Ok(wrap_ref_builder!(
|
||||
it = HYDRA_URL.join("login")? =>
|
||||
it = HYDRA_URL.join("init")? =>
|
||||
{ it.query_pairs_mut().append_pair("id", &code.login_code); }
|
||||
))
|
||||
}
|
||||
@@ -133,7 +134,7 @@ pub async fn refresh_credentials(
|
||||
) -> crate::Result<()> {
|
||||
let resp = fetch_json::<TokenJSON>(
|
||||
Method::POST,
|
||||
HYDRA_URL.join("/refresh")?.as_str(),
|
||||
"https://staging-api.modrinth.com/v2/auth/minecraft/refresh",
|
||||
None,
|
||||
Some(serde_json::json!({ "refresh_token": credentials.refresh_token })),
|
||||
semaphore,
|
||||
|
||||
@@ -41,7 +41,7 @@ pub struct Settings {
|
||||
#[serde(default)]
|
||||
pub advanced_rendering: bool,
|
||||
#[serde(default)]
|
||||
pub onboarded: bool,
|
||||
pub onboarded_new: bool,
|
||||
#[serde(default = "DirectoryInfo::get_initial_settings_dir")]
|
||||
pub loaded_config_dir: Option<PathBuf>,
|
||||
}
|
||||
@@ -82,7 +82,7 @@ impl Settings {
|
||||
developer_mode: false,
|
||||
opt_out_analytics: false,
|
||||
advanced_rendering: true,
|
||||
onboarded: false,
|
||||
onboarded_new: false,
|
||||
|
||||
// By default, the config directory is the same as the settings directory
|
||||
loaded_config_dir: DirectoryInfo::get_initial_settings_dir(),
|
||||
|
||||
Reference in New Issue
Block a user