update acitx to 2.0
This commit is contained in:
parent
fb48d77a10
commit
0a19214f36
4 changed files with 377 additions and 608 deletions
968
Cargo.lock
generated
968
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -9,7 +9,8 @@ readme = "README.md"
|
||||||
repository = "https://github.com/edward-shen/bunbun"
|
repository = "https://github.com/edward-shen/bunbun"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0"
|
actix-web = "2.0"
|
||||||
|
actix-rt = "1.0"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_yaml = "0.8"
|
serde_yaml = "0.8"
|
||||||
handlebars = "2.0"
|
handlebars = "2.0"
|
||||||
|
|
|
@ -67,7 +67,8 @@ pub struct State {
|
||||||
renderer: Handlebars,
|
renderer: Handlebars,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), BunBunError> {
|
#[actix_rt::main]
|
||||||
|
async fn main() -> Result<(), BunBunError> {
|
||||||
let yaml = load_yaml!("cli.yaml");
|
let yaml = load_yaml!("cli.yaml");
|
||||||
let matches = ClapApp::from(yaml)
|
let matches = ClapApp::from(yaml)
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
|
@ -143,7 +144,8 @@ fn main() -> Result<(), BunBunError> {
|
||||||
.service(routes::opensearch)
|
.service(routes::opensearch)
|
||||||
})
|
})
|
||||||
.bind(&conf.bind_address)?
|
.bind(&conf.bind_address)?
|
||||||
.run()?;
|
.run()
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ const FRAGMENT_ENCODE_SET: &AsciiSet = &CONTROLS
|
||||||
.add(b'+');
|
.add(b'+');
|
||||||
|
|
||||||
#[get("/ls")]
|
#[get("/ls")]
|
||||||
pub fn list(data: Data<Arc<RwLock<State>>>) -> impl Responder {
|
pub async fn list(data: Data<Arc<RwLock<State>>>) -> impl Responder {
|
||||||
let data = data.read().unwrap();
|
let data = data.read().unwrap();
|
||||||
HttpResponse::Ok().body(data.renderer.render("list", &data.groups).unwrap())
|
HttpResponse::Ok().body(data.renderer.render("list", &data.groups).unwrap())
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ pub struct SearchQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/hop")]
|
#[get("/hop")]
|
||||||
pub fn hop(
|
pub async fn hop(
|
||||||
data: Data<Arc<RwLock<State>>>,
|
data: Data<Arc<RwLock<State>>>,
|
||||||
query: Query<SearchQuery>,
|
query: Query<SearchQuery>,
|
||||||
) -> impl Responder {
|
) -> impl Responder {
|
||||||
|
@ -109,7 +109,7 @@ fn resolve_hop(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
pub fn index(data: Data<Arc<RwLock<State>>>) -> impl Responder {
|
pub async fn index(data: Data<Arc<RwLock<State>>>) -> impl Responder {
|
||||||
let data = data.read().unwrap();
|
let data = data.read().unwrap();
|
||||||
HttpResponse::Ok().body(
|
HttpResponse::Ok().body(
|
||||||
data
|
data
|
||||||
|
@ -123,7 +123,7 @@ pub fn index(data: Data<Arc<RwLock<State>>>) -> impl Responder {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/bunbunsearch.xml")]
|
#[get("/bunbunsearch.xml")]
|
||||||
pub fn opensearch(data: Data<Arc<RwLock<State>>>) -> impl Responder {
|
pub async fn opensearch(data: Data<Arc<RwLock<State>>>) -> impl Responder {
|
||||||
let data = data.read().unwrap();
|
let data = data.read().unwrap();
|
||||||
HttpResponse::Ok()
|
HttpResponse::Ok()
|
||||||
.header(
|
.header(
|
||||||
|
|
Loading…
Reference in a new issue