BlueGit

ict rusty-teams

chore(demo): forwarded video clip in the release chat

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Michael Wallner · pushed by metis

Authored 2026-11-16 · 2 weeks ago

Hash
57efe3c2d121a80ed42c5894b7c9c04f8f9be995
Parent
8157220e
1 file changed +34 −0
crates/app-state/src/demo.rs +34 −0
@@ -37,6 +37,9 @@ const STAGING_SIZE: (usize, usize) = (960, 540);
37 37 const LINK_IMAGE_KEY: &str =
38 38 "https://de-prod.asyncgw.teams.microsoft.com/urlp/v1/url/image/Thumbnail?url=demo";
39 39 const LINK_IMAGE_SIZE: (u32, u32) = (320, 180);
40 const DEMO_CLIP_URL: &str = "https://eu-api.asm.skype.com/v1/objects/0-weu-d1-democlip/views/video";
41 const DEMO_CLIP_THUMBNAIL_KEY: &str =
42 "https://eu-api.asm.skype.com/v1/objects/0-weu-d1-democlip/views/thumbnail";
40 43 const PRIORITY_CHAT: &str = "demo-chat-priya";
41 44 const BOT_CHAT: &str = "demo-chat-wiki-bot";
42 45 const BOT_NAME: &str = "Wiki Bot";
@@ -1085,6 +1088,7 @@ pub fn seed_directory(state: &mut AppState) {
1085 1088 if std::fs::write(&path, png).is_ok() {
1086 1089 state.directory.set_image(STAGING_IMAGE_KEY, &path);
1087 1090 state.directory.set_image(LINK_IMAGE_KEY, &path);
1091 state.directory.set_image(DEMO_CLIP_THUMBNAIL_KEY, &path);
1088 1092 }
1089 1093 let _ = SEARCHABLE_GIFS.set(demo_gifs::generate(&directory_path));
1090 1094 state.directory.set_image(
@@ -1320,6 +1324,23 @@ fn with_subject(mut record: MessageRecord, subject: &str) -> MessageRecord {
1320 1324 record
1321 1325 }
1322 1326
1327 /// A Graph forward of a Teams video clip, as Teams sends a forwarded phone recording.
1328 fn forwarded_clip_attachments(message_id: &str, sender_id: &str) -> String {
1329 let content = serde_json::json!({
1330 "originalMessageId": message_id,
1331 "originalMessageContent": format!(
1332 r#"<p><video src="{DEMO_CLIP_URL}" itemscope="" itemtype="http://schema.skype.com/AMSVideo" width="720" height="1280" data-duration="PT12S" alt="Media"></video></p>"#
1333 ),
1334 "originalMessageSender": {"user": {"id": sender_id, "displayName": null}},
1335 });
1336 serde_json::json!([{
1337 "content_type": "forwardedMessageReference",
1338 "id": message_id,
1339 "content": content.to_string(),
1340 }])
1341 .to_string()
1342 }
1343
1323 1344 fn with_attachments(mut record: MessageRecord, attachments_json: &str) -> MessageRecord {
1324 1345 record.attachments_json = attachments_json.to_owned();
1325 1346 record
@@ -1857,6 +1878,19 @@ fn release_messages() -> Vec<MessageRecord> {
1857 1878 r#"[{"content_type":"forwardedMessageReference","name":null,"url":null,"text":null,"id":"1789000000000","content":null,"unavailable":true}]"#,
1858 1879 false,
1859 1880 ),
1881 with_attachments(
1882 message(
1883 chat,
1884 "m5f",
1885 None,
1886 (PRIYA_ID, priya_name),
1887 at(0, 12, 45),
1888 "<attachment id=\"1791000000000\"></attachment>",
1889 "[]",
1890 false,
1891 ),
1892 &forwarded_clip_attachments("1791000000000", TOBIAS_ID),
1893 ),
1860 1894 message(
1861 1895 chat,
1862 1896 "m6",
@@ -37,6 +37,9 @@ const STAGING_SIZE: (usize, usize) = (960, 540);
37const LINK_IMAGE_KEY: &str =
37const LINK_IMAGE_KEY: &str =
38 "https://de-prod.asyncgw.teams.microsoft.com/urlp/v1/url/image/Thumbnail?url=demo";
38 "https://de-prod.asyncgw.teams.microsoft.com/urlp/v1/url/image/Thumbnail?url=demo";
39const LINK_IMAGE_SIZE: (u32, u32) = (320, 180);
39const LINK_IMAGE_SIZE: (u32, u32) = (320, 180);
40const DEMO_CLIP_URL: &str = "https://eu-api.asm.skype.com/v1/objects/0-weu-d1-democlip/views/video";
41const DEMO_CLIP_THUMBNAIL_KEY: &str =
42 "https://eu-api.asm.skype.com/v1/objects/0-weu-d1-democlip/views/thumbnail";
40const PRIORITY_CHAT: &str = "demo-chat-priya";
43const PRIORITY_CHAT: &str = "demo-chat-priya";
41const BOT_CHAT: &str = "demo-chat-wiki-bot";
44const BOT_CHAT: &str = "demo-chat-wiki-bot";
42const BOT_NAME: &str = "Wiki Bot";
45const BOT_NAME: &str = "Wiki Bot";
@@ -1085,6 +1088,7 @@ pub fn seed_directory(state: &mut AppState) {
1085 if std::fs::write(&path, png).is_ok() {
1088 if std::fs::write(&path, png).is_ok() {
1086 state.directory.set_image(STAGING_IMAGE_KEY, &path);
1089 state.directory.set_image(STAGING_IMAGE_KEY, &path);
1087 state.directory.set_image(LINK_IMAGE_KEY, &path);
1090 state.directory.set_image(LINK_IMAGE_KEY, &path);
1091 state.directory.set_image(DEMO_CLIP_THUMBNAIL_KEY, &path);
1088 }
1092 }
1089 let _ = SEARCHABLE_GIFS.set(demo_gifs::generate(&directory_path));
1093 let _ = SEARCHABLE_GIFS.set(demo_gifs::generate(&directory_path));
1090 state.directory.set_image(
1094 state.directory.set_image(
@@ -1320,6 +1324,23 @@ fn with_subject(mut record: MessageRecord, subject: &str) -> MessageRecord {
1320 record
1324 record
1321}
1325}
1322
1326
1327/// A Graph forward of a Teams video clip, as Teams sends a forwarded phone recording.
1328fn forwarded_clip_attachments(message_id: &str, sender_id: &str) -> String {
1329 let content = serde_json::json!({
1330 "originalMessageId": message_id,
1331 "originalMessageContent": format!(
1332 r#"<p><video src="{DEMO_CLIP_URL}" itemscope="" itemtype="http://schema.skype.com/AMSVideo" width="720" height="1280" data-duration="PT12S" alt="Media"></video></p>"#
1333 ),
1334 "originalMessageSender": {"user": {"id": sender_id, "displayName": null}},
1335 });
1336 serde_json::json!([{
1337 "content_type": "forwardedMessageReference",
1338 "id": message_id,
1339 "content": content.to_string(),
1340 }])
1341 .to_string()
1342}
1343
1323fn with_attachments(mut record: MessageRecord, attachments_json: &str) -> MessageRecord {
1344fn with_attachments(mut record: MessageRecord, attachments_json: &str) -> MessageRecord {
1324 record.attachments_json = attachments_json.to_owned();
1345 record.attachments_json = attachments_json.to_owned();
1325 record
1346 record
@@ -1857,6 +1878,19 @@ fn release_messages() -> Vec<MessageRecord> {
1857 r#"[{"content_type":"forwardedMessageReference","name":null,"url":null,"text":null,"id":"1789000000000","content":null,"unavailable":true}]"#,
1878 r#"[{"content_type":"forwardedMessageReference","name":null,"url":null,"text":null,"id":"1789000000000","content":null,"unavailable":true}]"#,
1858 false,
1879 false,
1859 ),
1880 ),
1881 with_attachments(
1882 message(
1883 chat,
1884 "m5f",
1885 None,
1886 (PRIYA_ID, priya_name),
1887 at(0, 12, 45),
1888 "<attachment id=\"1791000000000\"></attachment>",
1889 "[]",
1890 false,
1891 ),
1892 &forwarded_clip_attachments("1791000000000", TOBIAS_ID),
1893 ),
1860 message(
1894 message(
1861 chat,
1895 chat,
1862 "m6",
1896 "m6",