2019-12-31 12:55:33 +00:00
|
|
|
use crate::settings::Settings;
|
|
|
|
use actix_files::NamedFile;
|
|
|
|
use actix_web::web;
|
|
|
|
|
|
|
|
pub fn config(cfg: &mut web::ServiceConfig) {
|
|
|
|
cfg
|
|
|
|
.route("/", web::get().to(index))
|
|
|
|
.route(
|
2020-02-08 04:05:15 +00:00
|
|
|
"/home/data_type/{data_type}/listing_type/{listing_type}/sort/{sort}/page/{page}",
|
2019-12-31 12:55:33 +00:00
|
|
|
web::get().to(index),
|
|
|
|
)
|
|
|
|
.route("/login", web::get().to(index))
|
|
|
|
.route("/create_post", web::get().to(index))
|
|
|
|
.route("/create_community", web::get().to(index))
|
2020-01-22 21:35:29 +00:00
|
|
|
.route("/create_private_message", web::get().to(index))
|
2019-12-31 12:55:33 +00:00
|
|
|
.route("/communities/page/{page}", web::get().to(index))
|
|
|
|
.route("/communities", web::get().to(index))
|
|
|
|
.route("/post/{id}/comment/{id2}", web::get().to(index))
|
|
|
|
.route("/post/{id}", web::get().to(index))
|
2020-02-08 04:05:15 +00:00
|
|
|
.route(
|
|
|
|
"/c/{name}/data_type/{data_type}/sort/{sort}/page/{page}",
|
|
|
|
web::get().to(index),
|
|
|
|
)
|
2019-12-31 12:55:33 +00:00
|
|
|
.route("/c/{name}", web::get().to(index))
|
|
|
|
.route("/community/{id}", web::get().to(index))
|
|
|
|
.route(
|
|
|
|
"/u/{username}/view/{view}/sort/{sort}/page/{page}",
|
|
|
|
web::get().to(index),
|
|
|
|
)
|
|
|
|
.route("/u/{username}", web::get().to(index))
|
|
|
|
.route("/user/{id}", web::get().to(index))
|
|
|
|
.route("/inbox", web::get().to(index))
|
|
|
|
.route("/modlog/community/{community_id}", web::get().to(index))
|
|
|
|
.route("/modlog", web::get().to(index))
|
|
|
|
.route("/setup", web::get().to(index))
|
2020-04-10 20:55:57 +00:00
|
|
|
.route("/admin", web::get().to(index))
|
2019-12-31 12:55:33 +00:00
|
|
|
.route(
|
|
|
|
"/search/q/{q}/type/{type}/sort/{sort}/page/{page}",
|
|
|
|
web::get().to(index),
|
|
|
|
)
|
|
|
|
.route("/search", web::get().to(index))
|
|
|
|
.route("/sponsors", web::get().to(index))
|
|
|
|
.route("/password_change/{token}", web::get().to(index));
|
|
|
|
}
|
|
|
|
|
2020-01-10 22:41:08 +00:00
|
|
|
async fn index() -> Result<NamedFile, actix_web::error::Error> {
|
2019-12-31 12:55:33 +00:00
|
|
|
Ok(NamedFile::open(
|
2020-04-11 18:06:04 +00:00
|
|
|
Settings::get().front_end_dir + "/index.html",
|
2019-12-31 12:55:33 +00:00
|
|
|
)?)
|
|
|
|
}
|