mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
fix content detection rules
This commit is contained in:
parent
fc6cce8072
commit
191057cc50
1 changed files with 50 additions and 0 deletions
|
|
@ -71,6 +71,31 @@ impl File {
|
||||||
.set_mime(Some(content_type.to_string()));
|
.set_mime(Some(content_type.to_string()));
|
||||||
}
|
}
|
||||||
match content_type.as_str() {
|
match content_type.as_str() {
|
||||||
|
"text/gemini" => {
|
||||||
|
if matches!(*feature, Feature::Source) {
|
||||||
|
load_contents_async(file, cancellable, move |result| {
|
||||||
|
match result {
|
||||||
|
Ok(data) => {
|
||||||
|
Text::Source(uri, data).handle(&page)
|
||||||
|
}
|
||||||
|
Err(message) => {
|
||||||
|
Status::Failure(message).handle(&page)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
load_contents_async(file, cancellable, move |result| {
|
||||||
|
match result {
|
||||||
|
Ok(data) => {
|
||||||
|
Text::Gemini(uri, data).handle(&page)
|
||||||
|
}
|
||||||
|
Err(message) => {
|
||||||
|
Status::Failure(message).handle(&page)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
"text/plain" => {
|
"text/plain" => {
|
||||||
if matches!(*feature, Feature::Source) {
|
if matches!(*feature, Feature::Source) {
|
||||||
load_contents_async(file, cancellable, move |result| {
|
load_contents_async(file, cancellable, move |result| {
|
||||||
|
|
@ -119,6 +144,31 @@ impl File {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"text/markdown" => {
|
||||||
|
if matches!(*feature, Feature::Source) {
|
||||||
|
load_contents_async(file, cancellable, move |result| {
|
||||||
|
match result {
|
||||||
|
Ok(data) => {
|
||||||
|
Text::Source(uri, data).handle(&page)
|
||||||
|
}
|
||||||
|
Err(message) => {
|
||||||
|
Status::Failure(message).handle(&page)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
load_contents_async(file, cancellable, move |result| {
|
||||||
|
match result {
|
||||||
|
Ok(data) => {
|
||||||
|
Text::Markdown(uri, data).handle(&page)
|
||||||
|
}
|
||||||
|
Err(message) => {
|
||||||
|
Status::Failure(message).handle(&page)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
"image/png" | "image/gif" | "image/jpeg" | "image/webp" => {
|
"image/png" | "image/gif" | "image/jpeg" | "image/webp" => {
|
||||||
match gtk::gdk::Texture::from_file(&file) {
|
match gtk::gdk::Texture::from_file(&file) {
|
||||||
Ok(texture) => {
|
Ok(texture) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue