remove dependency on nightly
This commit is contained in:
parent
cae88a20ff
commit
bf4db99465
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -937,6 +937,7 @@ dependencies = [
|
|||||||
"fend-core",
|
"fend-core",
|
||||||
"futures",
|
"futures",
|
||||||
"html-escape",
|
"html-escape",
|
||||||
|
"once_cell",
|
||||||
"rand",
|
"rand",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
@ -23,6 +23,7 @@ eyre = "0.6.11"
|
|||||||
fend-core = "1.3.3"
|
fend-core = "1.3.3"
|
||||||
futures = "0.3.29"
|
futures = "0.3.29"
|
||||||
html-escape = "0.2.13"
|
html-escape = "0.2.13"
|
||||||
|
once_cell = "1.19.0"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
regex = "1.10.2"
|
regex = "1.10.2"
|
||||||
reqwest = { version = "0.11.23", default-features = false, features = [
|
reqwest = { version = "0.11.23", default-features = false, features = [
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use std::{cell::Cell, sync::LazyLock};
|
use std::cell::Cell;
|
||||||
|
|
||||||
use fend_core::SpanKind;
|
use fend_core::SpanKind;
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use crate::engines::EngineResponse;
|
use crate::engines::EngineResponse;
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ fn evaluate(query: &str, html: bool) -> Option<String> {
|
|||||||
Some(result_html)
|
Some(result_html)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static FEND_CONTEXT: LazyLock<fend_core::Context> = LazyLock::new(|| {
|
pub static FEND_CONTEXT: Lazy<fend_core::Context> = Lazy::new(|| {
|
||||||
let mut context = fend_core::Context::new();
|
let mut context = fend_core::Context::new();
|
||||||
|
|
||||||
// make lowercase f and c work
|
// make lowercase f and c work
|
||||||
|
@ -4,11 +4,11 @@ use std::{
|
|||||||
net::IpAddr,
|
net::IpAddr,
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
sync::LazyLock,
|
|
||||||
time::Instant,
|
time::Instant,
|
||||||
};
|
};
|
||||||
|
|
||||||
use futures::future::join_all;
|
use futures::future::join_all;
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
use reqwest::header::HeaderMap;
|
use reqwest::header::HeaderMap;
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ pub async fn autocomplete_with_engines(
|
|||||||
Ok(merge_autocomplete_responses(autocomplete_results))
|
Ok(merge_autocomplete_responses(autocomplete_results))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static CLIENT: LazyLock<reqwest::Client> = LazyLock::new(|| {
|
pub static CLIENT: Lazy<reqwest::Client> = Lazy::new(|| {
|
||||||
reqwest::ClientBuilder::new()
|
reqwest::ClientBuilder::new()
|
||||||
.local_address(IpAddr::from_str("0.0.0.0").unwrap())
|
.local_address(IpAddr::from_str("0.0.0.0").unwrap())
|
||||||
// we pretend to be a normal browser so websites don't block us
|
// we pretend to be a normal browser so websites don't block us
|
||||||
|
@ -48,7 +48,7 @@ pub fn parse_response(body: &str) -> Option<String> {
|
|||||||
.url_relative(ammonia::UrlRelative::RewriteWithBase(
|
.url_relative(ammonia::UrlRelative::RewriteWithBase(
|
||||||
Url::parse("https://github.com").unwrap(),
|
Url::parse("https://github.com").unwrap(),
|
||||||
))
|
))
|
||||||
.clean(&readme_html)
|
.clean(readme_html)
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let readme_dom = Html::parse_fragment(&readme_html);
|
let readme_dom = Html::parse_fragment(&readme_html);
|
||||||
|
@ -19,7 +19,7 @@ pub fn request(query: &str) -> RequestResponse {
|
|||||||
"https://search.marginalia.nu/search",
|
"https://search.marginalia.nu/search",
|
||||||
&[
|
&[
|
||||||
("query", query),
|
("query", query),
|
||||||
("profile", "default"),
|
("profile", "corpo"),
|
||||||
("js", "default"),
|
("js", "default"),
|
||||||
("adtech", "default"),
|
("adtech", "default"),
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![feature(lazy_cell)]
|
|
||||||
|
|
||||||
pub mod engines;
|
pub mod engines;
|
||||||
pub mod normalize;
|
pub mod normalize;
|
||||||
pub mod parse;
|
pub mod parse;
|
||||||
|
Loading…
Reference in New Issue
Block a user