mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
api: remove experimental request_internet_access option from webxdc's manifest.toml
this partly reverts experimental #3516 that allowed any .xdc sent to "Saved Messages" to request internet. this helped on pushing map integration forward. meanwhile, however, we have that map integration (#5461 and #5678), that implies `info.internet_access` being set. experimental `manifest.request_internet_access` is no longer needed therefore. future will tell, if we revive the option at some point or go for more intrations ('sending' is discussed often :) - but currently it is not needed.
This commit is contained in:
@@ -76,9 +76,6 @@ pub struct WebxdcManifest {
|
|||||||
|
|
||||||
/// Set to "map" to request integration.
|
/// Set to "map" to request integration.
|
||||||
pub request_integration: Option<String>,
|
pub request_integration: Option<String>,
|
||||||
|
|
||||||
/// If the webxdc requests network access.
|
|
||||||
pub request_internet_access: Option<bool>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parsed information from WebxdcManifest and fallbacks.
|
/// Parsed information from WebxdcManifest and fallbacks.
|
||||||
@@ -928,10 +925,7 @@ impl Message {
|
|||||||
|
|
||||||
let request_integration = manifest.request_integration.unwrap_or_default();
|
let request_integration = manifest.request_integration.unwrap_or_default();
|
||||||
let is_integrated = self.is_set_as_webxdc_integration(context).await?;
|
let is_integrated = self.is_set_as_webxdc_integration(context).await?;
|
||||||
|
let internet_access = is_integrated;
|
||||||
let internet_access = manifest.request_internet_access.unwrap_or_default()
|
|
||||||
&& self.chat_id.is_self_talk(context).await.unwrap_or_default()
|
|
||||||
&& self.get_showpadlock();
|
|
||||||
|
|
||||||
let self_addr = self.get_webxdc_self_addr(context).await?;
|
let self_addr = self.get_webxdc_self_addr(context).await?;
|
||||||
|
|
||||||
@@ -958,8 +952,6 @@ impl Message {
|
|||||||
} else if request_integration == "map" {
|
} else if request_integration == "map" {
|
||||||
"🌏 To use as map, forward to \"Saved Messages\" again. Do not enter sensitive data"
|
"🌏 To use as map, forward to \"Saved Messages\" again. Do not enter sensitive data"
|
||||||
.to_string()
|
.to_string()
|
||||||
} else if internet_access {
|
|
||||||
"Dev Mode: Do not enter sensitive data!".to_string()
|
|
||||||
} else {
|
} else {
|
||||||
self.param
|
self.param
|
||||||
.get(Param::WebxdcSummary)
|
.get(Param::WebxdcSummary)
|
||||||
@@ -2247,19 +2239,6 @@ sth_for_the = "future""#
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
|
||||||
async fn test_parse_webxdc_manifest_request_internet_access() -> Result<()> {
|
|
||||||
let result = parse_webxdc_manifest(r#"request_internet_access = 3"#.as_bytes());
|
|
||||||
assert!(result.is_err());
|
|
||||||
let manifest = parse_webxdc_manifest(r#" source_code_url="https://foo.org""#.as_bytes())?;
|
|
||||||
assert_eq!(manifest.request_internet_access, None);
|
|
||||||
let manifest = parse_webxdc_manifest(r#" request_internet_access=false"#.as_bytes())?;
|
|
||||||
assert_eq!(manifest.request_internet_access, Some(false));
|
|
||||||
let manifest = parse_webxdc_manifest(r#"request_internet_access = true"#.as_bytes())?;
|
|
||||||
assert_eq!(manifest.request_internet_access, Some(true));
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||||
async fn test_webxdc_min_api_too_large() -> Result<()> {
|
async fn test_webxdc_min_api_too_large() -> Result<()> {
|
||||||
let t = TestContext::new_alice().await;
|
let t = TestContext::new_alice().await;
|
||||||
@@ -2670,16 +2649,16 @@ sth_for_the = "future""#
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check that `info.internet_access` is not set for normal, non-integrated webxdc -
|
||||||
|
// even if they use the deprecated option `request_internet_access` in manifest.toml
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||||
async fn test_webxdc_internet_access() -> Result<()> {
|
async fn test_webxdc_no_internet_access() -> Result<()> {
|
||||||
let t = TestContext::new_alice().await;
|
let t = TestContext::new_alice().await;
|
||||||
let self_id = t.get_self_chat().await.id;
|
let self_id = t.get_self_chat().await.id;
|
||||||
let single_id = t.create_chat_with_contact("bob", "bob@e.com").await.id;
|
let single_id = t.create_chat_with_contact("bob", "bob@e.com").await.id;
|
||||||
let group_id = create_group_chat(&t, ProtectionStatus::Unprotected, "chat").await?;
|
let group_id = create_group_chat(&t, ProtectionStatus::Unprotected, "chat").await?;
|
||||||
let broadcast_id = create_broadcast_list(&t).await?;
|
let broadcast_id = create_broadcast_list(&t).await?;
|
||||||
|
|
||||||
let mut first_test = true; // only the first test has all conditions for internet access
|
|
||||||
|
|
||||||
for e2ee in ["1", "0"] {
|
for e2ee in ["1", "0"] {
|
||||||
t.set_config(Config::E2eeEnabled, Some(e2ee)).await?;
|
t.set_config(Config::E2eeEnabled, Some(e2ee)).await?;
|
||||||
for chat_id in [self_id, single_id, group_id, broadcast_id] {
|
for chat_id in [self_id, single_id, group_id, broadcast_id] {
|
||||||
@@ -2702,11 +2681,7 @@ sth_for_the = "future""#
|
|||||||
.await?;
|
.await?;
|
||||||
let instance = Message::load_from_db(&t, instance_id).await?;
|
let instance = Message::load_from_db(&t, instance_id).await?;
|
||||||
let info = instance.get_webxdc_info(&t).await?;
|
let info = instance.get_webxdc_info(&t).await?;
|
||||||
assert_eq!(info.internet_access, first_test);
|
assert_eq!(info.internet_access, false);
|
||||||
assert_eq!(info.summary.contains("Do not enter sensitive"), first_test);
|
|
||||||
assert_eq!(info.summary.contains("real summary"), !first_test);
|
|
||||||
|
|
||||||
first_test = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user