Allow the zed app to connect to both the old and new rpc endpoints

In the case of the new Next.js app, the app will follow a redirect
from 'zed.dev/rpc' to the subdomain where the rust service is hosted.
Until then, the app will connect directly to zed.dev/rpc.
This commit is contained in:
Max Brunsfeld 2022-01-03 15:20:40 -08:00
parent f499a1dfc2
commit a080ae98c6
16 changed files with 107 additions and 72 deletions

View file

@ -112,6 +112,9 @@ pub fn add_routes(app: &mut Server<Arc<AppState>>) {
app.at("/sign_in").get(get_sign_in);
app.at("/sign_out").post(post_sign_out);
app.at("/auth_callback").get(get_auth_callback);
app.at("/native_app_signin").get(get_sign_in);
app.at("/native_app_signin_succeeded")
.get(get_app_signin_success);
}
#[derive(Debug, Deserialize)]
@ -166,6 +169,10 @@ async fn get_sign_in(mut request: Request) -> tide::Result {
Ok(tide::Redirect::new(auth_url).into())
}
async fn get_app_signin_success(_: Request) -> tide::Result {
Ok(tide::Redirect::new("/").into())
}
async fn get_auth_callback(mut request: Request) -> tide::Result {
#[derive(Debug, Deserialize)]
struct Query {