mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
apply ggemini api updates
This commit is contained in:
parent
7674553ac9
commit
2d46fb9726
@ -418,8 +418,8 @@ impl Page {
|
|||||||
// Begin new socket request
|
// Begin new socket request
|
||||||
self.client.gemini.request_async(
|
self.client.gemini.request_async(
|
||||||
uri.clone(),
|
uri.clone(),
|
||||||
None, // default priority
|
Priority::DEFAULT,
|
||||||
Some(cancellable.clone()),
|
cancellable.clone(),
|
||||||
// Search for user certificate match request
|
// Search for user certificate match request
|
||||||
match self.profile.identity.gemini.match_scope(&self.navigation.request.widget.entry.text()) {
|
match self.profile.identity.gemini.match_scope(&self.navigation.request.widget.entry.text()) {
|
||||||
Some(identity) => match identity.to_tls_certificate() {
|
Some(identity) => match identity.to_tls_certificate() {
|
||||||
@ -435,9 +435,6 @@ impl Page {
|
|||||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#input-expected
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#input-expected
|
||||||
gemini::client::response::meta::Status::Input |
|
gemini::client::response::meta::Status::Input |
|
||||||
gemini::client::response::meta::Status::SensitiveInput => {
|
gemini::client::response::meta::Status::SensitiveInput => {
|
||||||
// Close connection
|
|
||||||
let _ = response.connection.close();
|
|
||||||
|
|
||||||
// Format response
|
// Format response
|
||||||
let status = Status::Input;
|
let status = Status::Input;
|
||||||
let title = match response.meta.data {
|
let title = match response.meta.data {
|
||||||
@ -483,8 +480,8 @@ impl Page {
|
|||||||
// Read entire input stream to buffer
|
// Read entire input stream to buffer
|
||||||
gemini::client::response::data::Text::from_stream_async(
|
gemini::client::response::data::Text::from_stream_async(
|
||||||
response.connection.stream(),
|
response.connection.stream(),
|
||||||
Some(Priority::DEFAULT),
|
Priority::DEFAULT,
|
||||||
Some(cancellable.clone()),
|
cancellable.clone(),
|
||||||
{
|
{
|
||||||
let content = content.clone();
|
let content = content.clone();
|
||||||
let id = id.clone();
|
let id = id.clone();
|
||||||
@ -494,9 +491,6 @@ impl Page {
|
|||||||
move |result|{
|
move |result|{
|
||||||
match result {
|
match result {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
// Close connection
|
|
||||||
let _ = response.connection.close();
|
|
||||||
|
|
||||||
// Set children component
|
// Set children component
|
||||||
let text_gemini = content.to_text_gemini(
|
let text_gemini = content.to_text_gemini(
|
||||||
&uri,
|
&uri,
|
||||||
@ -554,7 +548,7 @@ impl Page {
|
|||||||
// this action allows to count the bytes for loading widget and validate max size for incoming data
|
// this action allows to count the bytes for loading widget and validate max size for incoming data
|
||||||
gemini::gio::memory_input_stream::from_stream_async(
|
gemini::gio::memory_input_stream::from_stream_async(
|
||||||
response.connection.stream(),
|
response.connection.stream(),
|
||||||
Some(cancellable.clone()),
|
cancellable.clone(),
|
||||||
Priority::DEFAULT,
|
Priority::DEFAULT,
|
||||||
0x400, // 1024 bytes per chunk, optional step for images download tracking
|
0x400, // 1024 bytes per chunk, optional step for images download tracking
|
||||||
0xA00000, // 10M bytes max to prevent memory overflow if server play with promises
|
0xA00000, // 10M bytes max to prevent memory overflow if server play with promises
|
||||||
@ -577,9 +571,6 @@ impl Page {
|
|||||||
&memory_input_stream,
|
&memory_input_stream,
|
||||||
Some(&cancellable),
|
Some(&cancellable),
|
||||||
move |result| {
|
move |result| {
|
||||||
// Close connection
|
|
||||||
let _ = response.connection.close();
|
|
||||||
|
|
||||||
// Process buffer data
|
// Process buffer data
|
||||||
match result {
|
match result {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
@ -633,9 +624,6 @@ impl Page {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
// Close connection
|
|
||||||
let _ = response.connection.close();
|
|
||||||
|
|
||||||
// Define common data
|
// Define common data
|
||||||
let status = Status::Failure;
|
let status = Status::Failure;
|
||||||
let title = "Oops";
|
let title = "Oops";
|
||||||
@ -660,9 +648,6 @@ impl Page {
|
|||||||
gemini::client::response::meta::Status::Redirect |
|
gemini::client::response::meta::Status::Redirect |
|
||||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-31-permanent-redirection
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-31-permanent-redirection
|
||||||
gemini::client::response::meta::Status::PermanentRedirect => {
|
gemini::client::response::meta::Status::PermanentRedirect => {
|
||||||
// Close connection
|
|
||||||
let _ = response.connection.close();
|
|
||||||
|
|
||||||
// Extract redirection URL from response data
|
// Extract redirection URL from response data
|
||||||
match response.meta.data {
|
match response.meta.data {
|
||||||
Some(unresolved_url) => {
|
Some(unresolved_url) => {
|
||||||
@ -776,9 +761,6 @@ impl Page {
|
|||||||
gemini::client::response::meta::Status::CertificateUnauthorized |
|
gemini::client::response::meta::Status::CertificateUnauthorized |
|
||||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-62-certificate-not-valid
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-62-certificate-not-valid
|
||||||
gemini::client::response::meta::Status::CertificateInvalid => {
|
gemini::client::response::meta::Status::CertificateInvalid => {
|
||||||
// Close connection
|
|
||||||
let _ = response.connection.close(); // @TODO
|
|
||||||
|
|
||||||
// Define common data
|
// Define common data
|
||||||
let status = Status::Success;
|
let status = Status::Success;
|
||||||
let title = "Identity";
|
let title = "Identity";
|
||||||
@ -809,9 +791,6 @@ impl Page {
|
|||||||
update.activate(Some(&id));
|
update.activate(Some(&id));
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// Close connection
|
|
||||||
let _ = response.connection.close();
|
|
||||||
|
|
||||||
// Define common data
|
// Define common data
|
||||||
let status = Status::Failure;
|
let status = Status::Failure;
|
||||||
let title = "Oops";
|
let title = "Oops";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user