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:
parent
f499a1dfc2
commit
a080ae98c6
16 changed files with 107 additions and 72 deletions
|
@ -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 {
|
||||
|
|
|
@ -2440,9 +2440,10 @@ mod tests {
|
|||
}
|
||||
|
||||
async fn create_client(&mut self, cx: &mut TestAppContext, name: &str) -> TestClient {
|
||||
let http = FakeHttpClient::with_404_response();
|
||||
let user_id = self.app_state.db.create_user(name, false).await.unwrap();
|
||||
let client_name = name.to_string();
|
||||
let mut client = Client::new();
|
||||
let mut client = Client::new(http.clone());
|
||||
let server = self.server.clone();
|
||||
let connection_killers = self.connection_killers.clone();
|
||||
let forbid_connections = self.forbid_connections.clone();
|
||||
|
@ -2489,7 +2490,6 @@ mod tests {
|
|||
})
|
||||
});
|
||||
|
||||
let http = FakeHttpClient::new(|_| async move { Ok(surf::http::Response::new(404)) });
|
||||
client
|
||||
.authenticate_and_connect(&cx.to_async())
|
||||
.await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue