Update to the latest version of Rocket, to use rocket_contrib::Template::custom
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ fn create(conn: DbConn, data: Form<NewBlogForm>, user: User) -> Redirect {
|
||||
is_owner: true
|
||||
});
|
||||
|
||||
Redirect::to(format!("/~/{}/", slug).as_str())
|
||||
Redirect::to(format!("/~/{}/", slug))
|
||||
}
|
||||
|
||||
#[get("/~/<name>/outbox")]
|
||||
|
||||
@@ -55,5 +55,5 @@ fn create(blog: String, slug: String, query: CommentQuery, data: Form<NewComment
|
||||
|
||||
broadcast(&*conn, &user, comment.create_activity(&*conn), user.get_followers(&*conn));
|
||||
|
||||
Redirect::to(format!("/~/{}/{}/#comment-{}", blog, slug, comment.id).as_ref())
|
||||
Redirect::to(format!("/~/{}/{}/#comment-{}", blog, slug, comment.id))
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ fn shared_inbox(conn: DbConn, data: String) -> String {
|
||||
}
|
||||
|
||||
#[get("/nodeinfo")]
|
||||
fn nodeinfo(conn: DbConn) -> Json {
|
||||
fn nodeinfo(conn: DbConn) -> Json<serde_json::Value> {
|
||||
Json(json!({
|
||||
"version": "2.0",
|
||||
"software": {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ fn create(blog: String, slug: String, user: User, conn: DbConn) -> Redirect {
|
||||
broadcast(&*conn, &user, delete_act, user.get_followers(&*conn));
|
||||
}
|
||||
|
||||
Redirect::to(format!("/~/{}/{}/", blog, slug).as_ref())
|
||||
Redirect::to(format!("/~/{}/{}/", blog, slug))
|
||||
}
|
||||
|
||||
#[get("/~/<blog>/<slug>/like", rank = 2)]
|
||||
|
||||
+1
-1
@@ -120,5 +120,5 @@ fn create(blog_name: String, data: Form<NewPostForm>, user: User, conn: DbConn)
|
||||
let act = post.create_activity(&*conn);
|
||||
broadcast(&*conn, &user, act, user.get_followers(&*conn));
|
||||
|
||||
Redirect::to(format!("/~/{}/{}/", blog_name, slug).as_str())
|
||||
Redirect::to(format!("/~/{}/{}/", blog_name, slug))
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ fn create(blog: String, slug: String, user: User, conn: DbConn) -> Redirect {
|
||||
broadcast(&*conn, &user, delete_act, user.get_followers(&*conn));
|
||||
}
|
||||
|
||||
Redirect::to(format!("/~/{}/{}/", blog, slug).as_ref())
|
||||
Redirect::to(format!("/~/{}/{}/", blog, slug))
|
||||
}
|
||||
|
||||
#[get("/~/<blog>/<slug>/reshare", rank=1)]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use rocket::{
|
||||
http::{Cookie, Cookies},
|
||||
http::{Cookie, Cookies, uri::Uri},
|
||||
response::{Redirect, status::NotFound},
|
||||
request::{Form,FlashMessage}
|
||||
};
|
||||
@@ -49,10 +49,10 @@ fn create(conn: DbConn, data: Form<LoginForm>, flash: Option<FlashMessage>, mut
|
||||
Ok(usr) => {
|
||||
if usr.auth(form.password.to_string()) {
|
||||
cookies.add_private(Cookie::new(AUTH_COOKIE, usr.id.to_string()));
|
||||
Ok(Redirect::to(&flash
|
||||
.and_then(|f| if f.name()=="callback" { Some(f.msg().to_owned()) } else { None })
|
||||
Ok(Redirect::to(Uri::new(flash
|
||||
.and_then(|f| if f.name() == "callback" { Some(f.msg().to_owned()) } else { None })
|
||||
.unwrap_or("/".to_owned()))
|
||||
)
|
||||
))
|
||||
} else {
|
||||
Err(NotFound(String::from("Invalid username or password")))
|
||||
}
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ use utils;
|
||||
#[get("/me")]
|
||||
fn me(user: Option<User>) -> Result<Redirect,Flash<Redirect>> {
|
||||
match user {
|
||||
Some(user) => Ok(Redirect::to(format!("/@/{}/", user.username).as_ref())),
|
||||
Some(user) => Ok(Redirect::to(format!("/@/{}/", user.username))),
|
||||
None => Err(utils::requires_login("", "/me"))
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ fn follow(name: String, conn: DbConn, user: User) -> Redirect {
|
||||
act.follow_props.set_object_object(user.into_activity(&*conn)).unwrap();
|
||||
act.object_props.set_id_string(format!("{}/follow/{}", user.ap_url, target.ap_url)).unwrap();
|
||||
broadcast(&*conn, &user, act, vec![target]);
|
||||
Redirect::to(format!("/@/{}/", name).as_ref())
|
||||
Redirect::to(format!("/@/{}/", name))
|
||||
}
|
||||
|
||||
#[get("/@/<name>/follow", rank = 2)]
|
||||
@@ -208,7 +208,7 @@ fn create(conn: DbConn, data: Form<NewUserForm>) -> Result<Redirect, String> {
|
||||
User::hash_pass(form.password.to_string()),
|
||||
inst.id
|
||||
)).update_boxes(&*conn);
|
||||
Ok(Redirect::to(format!("/@/{}/", data.get().username).as_str()))
|
||||
Ok(Redirect::to(format!("/@/{}/", data.get().username)))
|
||||
} else {
|
||||
Err(String::from("Passwords don't match"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user