diff --git a/FEATURES.md b/FEATURES.md index bfbcd0d..83066ce 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -2310,6 +2310,10 @@ computer_use_screenshot、click、mouse_move、mouse_button(按住/放開) 推播內容只有手機解得開(Web Push 加密),點通知會直接打開那個 Bot 的聊天。 +- **在通知上直接允許/拒絕**(Android 會顯示按鈕;iPhone 點了打開聊天):只有「要你允許的事」才有按鈕(某個操作、讓 Bot 用電腦工具、在這台電腦上執行);問題卡和「需要處理」沒有,要打開來回答。按「允許」是允許一次。通知帶著那個請求的編號,大腦會確認它還是正在等的那一個:已經回答過、或換成別的請求時,不會被舊通知答到,聊天裡留一行「通知上的「允許/拒絕」沒有用上…」。 +- 手機網頁:新訊息從下面滑進來(打開聊天時舊訊息不動;系統設定減少動態時不動);iPhone 鍵盤蓋住畫面時輸入框跟著抬高;送出和按允許時輕震一下(支援的手機)。 +- 主畫面圖示長按有兩個捷徑:「主要 Bot 對話」「未讀對話」(第一個未讀的 Bot)。 + ### 驗證過的 - 單元測試:手機 API 的登入和權限、帳號伺服器的註冊/登入/轉送/備份、推播加密(用手機那一端的方法解開)和簽章、密碼和加密。 diff --git a/docs/feature-map/phone.md b/docs/feature-map/phone.md index 58e0a94..46ead5b 100644 --- a/docs/feature-map/phone.md +++ b/docs/feature-map/phone.md @@ -17,7 +17,7 @@ - 長相(和電腦版同一份設計規格:字級、間距、圓角都是同一組數字):Bot 的回答不放在泡泡裡,像文件一樣直接排在畫面上,用宋體(思源宋體,沒有就用系統的宋體)、16px、行距寬;裡面的表格只有橫向細線、數字欄靠右,提示框([!NOTE] 等)同一種淡底、只有圖示依種類上色,程式碼是淡底圓角塊。你自己的訊息(泡泡)和所有按鈕、清單、設定用黑體。手機沒有字型選項。 - 顏色跟電腦版一樣:電腦上 設定 › 一般 › 外觀 的主題(淺色/深色/跟隨系統)、底色、強調色、對比,手機照著穿;手機自己的「外觀」可以選「跟著電腦」(預設)、「跟著手機」、「淺色」、「深色」。狀態列的顏色跟著畫面。舊版的電腦沒送顏色時,手機用內建的「紙」。 - 像 Claude 的手機 App:上面一條簡單的標題列(Bot 名稱,第二行是它在做什麼或用哪個模型),輸入框是底部一張圓角卡片,回答下面只有時間和複製/重新產生/⋯;按鈕和點的地方至少 44px;清單每列的說明只有一行(太長以 … 結尾);顏色少,強調色只用在連結、選取和新訊息的點。 -- 通知:需要你允許、問你、需要你處理,你不在時做完事,例行任務暫停,收到傳來的檔案——推播到開了通知的手機,點了直接打開那個 Bot。每支手機自己選要哪幾種(需要你/做完了/例行任務暫停/收到傳來的檔案),可以送一則測試通知。通知的圖示是 AnyBot 的貓,Android 狀態列是貓的單色剪影;App 圖示上的數字是正在等你的 Bot。 +- 通知:需要你允許、問你、需要你處理,你不在時做完事,例行任務暫停,收到傳來的檔案——推播到開了通知的手機,點了直接打開那個 Bot。每支手機自己選要哪幾種(需要你/做完了/例行任務暫停/收到傳來的檔案),可以送一則測試通知。通知的圖示是 AnyBot 的貓,Android 狀態列是貓的單色剪影;App 圖示上的數字是正在等你的 Bot。「需要你允許」的通知在 Android 上有「允許/拒絕」(只答那個請求,換了就不答);主畫面圖示長按有「主要 Bot」「未讀」兩個捷徑。 - 像 App 一樣:加入主畫面後全螢幕、沒有網址列(瀏海、動態島、底部手勢條、橫放都避開);首頁會提示「把 AnyBot 裝成 App」(Android 直接安裝,iPhone 教你加入主畫面,可以關掉);換畫面會左右滑動;iPhone 主畫面 App 從左邊緣往右滑回上一頁。 ## 使用者怎麼到 diff --git a/mobile/index.html b/mobile/index.html index 27f39b5..7655f95 100644 --- a/mobile/index.html +++ b/mobile/index.html @@ -68,6 +68,10 @@ a{color:var(--accent-ink)} .app{height:100dvh;display:flex;flex-direction:column;overflow:hidden} .view{flex:1;display:none;flex-direction:column;min-height:0;background:var(--pane)} .view.on{display:flex} +/* A message that just arrived slides up into place (screens slide in with in-fwd / in-back). */ +@keyframes msgIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}} +.m.fresh{animation:msgIn .18s ease-out} +@media (prefers-reduced-motion:reduce){.m.fresh{animation:none}} .scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;min-height:0} /* ---- bars ---- */ @@ -251,7 +255,8 @@ details.dt>.dt-in{padding-left:var(--sp-4);margin-top:var(--sp-2)} .sug .ic{color:var(--text2)} .sug .tt{font-size:var(--fs-ui);font-weight:500}.sug .dd{font-size:var(--fs-caption);color:var(--text3)} /* the dock: approvals, queued steering, attachments, the composer */ -.dock{flex:none;padding:6px 10px calc(var(--safe-b) + 8px);background:linear-gradient(to bottom,transparent,var(--chrome) 40%)} +/* --kb: the iOS keyboard floats over the page; the script measures it and lifts the composer. */ +.dock{flex:none;padding:6px 10px calc(var(--safe-b) + 8px + var(--kb,0px));background:linear-gradient(to bottom,transparent,var(--chrome) 40%)} /* 需要你: yellow is the one colour for what waits for the person. */ /* Tall cards (long reasons, many choices) scroll inside the card: the composer stays on screen. */ .ask{max-width:560px;margin:0 auto 8px;padding:14px 16px;border-radius:var(--r-l);background:var(--attention-bg);box-shadow:inset 0 0 0 1px var(--attention);max-height:min(48dvh,420px);overflow-y:auto;overscroll-behavior:contain} @@ -837,6 +842,7 @@ try { matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () = const S = { sending: [], voice: {}, relay: false, token: localStorage.getItem("anybot.token") || "", host: localStorage.getItem("anybot.host") || "", version: 0, bots: [], approvals: [], pages: [], models: [], hostName: "", mac: false, box: "", boxOn: false, role: "owner", + prevShown: 0, answer: null, sc: "", open: 0, msgs: [], pending: [], quote: null, unfold: {}, openSteps: {}, detail: {}, audit: {}, settings: null, polling: false, chatSig: "", file: null, search: "", size: [0, 0], right: false, @@ -1087,6 +1093,16 @@ async function start() { } function apply(v) { S.bots = v.bots || []; S.approvals = v.approvals || []; S.hostName = v.host || ""; S.mac = !!v.mac; + // An approval answered from a notification banner, and a home-screen shortcut (主要 Bot, 未讀). + if (S.answer && S.token) { + const a = S.answer; S.answer = null; + api(base() + `api/bots/${a.bot}/answer`, {json: {answer: a.answer, call: a.call}}).then(() => toast("已從通知回覆")).catch((e) => toast(e.message)); + } + if (S.sc && !S.open) { + const want = S.sc === "unread" ? S.bots.find((b) => b.unread) : (S.bots.find((b) => b.primary) || S.bots[0]); + S.sc = ""; + if (want) { S.open = want.id; go("chat", {bot: want.id}); } + } S.box = v.box || ""; S.boxOn = !!v.box_available; S.pages = v.pages || []; S.models = v.models || []; S.sections = v.sections || null; S.role = v.role || "owner"; S.voice = v.voice || {}; micShown(); appBadge(); // The computer's 外觀 (an older brain sends neither: the built-in look stays). @@ -1273,7 +1289,7 @@ function chatHead() { } $("island").onclick = () => go("details", {bot: S.open}); function openChat(id) { - if (S.open !== id) { S.msgs = []; S.pending = []; S.quote = null; S.unfold = {}; S.openSteps = {}; S.chatSig = ""; $("msgs").innerHTML = ""; } + if (S.open !== id) { S.msgs = []; S.pending = []; S.quote = null; S.unfold = {}; S.openSteps = {}; S.chatSig = ""; S.prevShown = 0; $("msgs").innerHTML = ""; } S.open = id; // Your bubbles as 聊天的顏色 on the computer says (ob.bubble): "quiet" a light grey with the // page's ink (the default), "bot" the bot's colour, "black". (An older AnyBot sends no field: its colour.) @@ -1401,6 +1417,11 @@ function renderMsgs() { const lastMsg = S.msgs[S.msgs.length - 1]; const shown = {}; let day = ""; let h = ""; + // A message that arrived since the last draw slides up into place; the whole history on + // opening a chat draws plain (no animation on every old message). + const freshFrom = S.prevShown > 0 && S.msgs.length > S.prevShown ? S.prevShown : S.msgs.length; + S.prevShown = S.msgs.length; + const fr = (i) => (i >= freshFrom ? " fresh" : ""); S.msgs.forEach((m, i) => { if (m.at) { const d = dayLabel(m.at); if (d !== day) { day = d; h += `
${esc(d)}
`; } } const reacts = (m.reactions || []).length ? `
${m.reactions.map((e) => ``).join("")}
` : ""; @@ -1433,7 +1454,7 @@ function renderMsgs() { const mems = m.memories || []; const open = S.carried.has(String(m.at || i)); const carried = mems.length ? `${open ? `
${mems.map((x) => "• " + esc(x)).join("
")}
` : ""}` : ""; - h += `
${tag}${m.text ? `
${quote}${esc(text)}
` : ""}${(m.attachments || []).map(attHtml).join("")}${reacts}${carried}
`; + h += `
${tag}${m.text ? `
${quote}${esc(text)}
` : ""}${(m.attachments || []).map(attHtml).join("")}${reacts}${carried}
`; return; } const t = turnOf[i]; @@ -1457,7 +1478,7 @@ function renderMsgs() { const bub = m.text ? `
${pageMd(m.text, 0)}
` : ""; const atts = (m.attachments || []).map(attHtml).join(""); const meta = end && m.text ? `
${m.at ? esc(clock(m.at)) : ""}${owner() && m === lastBot && t === lastTurn ? `` : ""}
` : ""; - h += `
${who}${think}${bub}${steps ? `
${steps}
` : ""}${extra}${atts}${reacts}${meta}
`; + h += `
${who}${think}${bub}${steps ? `
${steps}
` : ""}${extra}${atts}${reacts}${meta}
`; }); // Still working: what it is doing now; a message nobody answered yet can be sent again. if (busy) h += (lastMsg && lastMsg.role !== "user" && !lastMsg.text && !(lastMsg.tools || []).length) || lastMsg?.role === "user" ? `
` : ""; @@ -1548,6 +1569,7 @@ function renderDock() { $("ask").innerHTML = `
${esc(a.title)}
${esc(a.reason)}
${a.can_always ? `` : ``}
${isOwner() ? `${ic("zap", 13)} 全部允許,之後直接操作` : ""}
`; } $("ask").querySelectorAll("button[data-a]").forEach((x) => x.onclick = async () => { + if (navigator.vibrate) navigator.vibrate(8); $("ask").innerHTML = ""; try { await api(base() + `api/bots/${(a && a.target) || S.open}/answer`, {json: {answer: x.dataset.a}}); } catch (e) { toast(e.message); } }); @@ -1755,7 +1777,7 @@ async function send() { memReset(); input.value = ""; input.style.height = "auto"; $("composer").classList.remove("tall"); S.pending = []; renderChips(); renderSlash(); const quiet = /^\/(goal|plan)(\s+(clear|stop|off|reset|none|cancel|清除|取消|停止))?\s*$/i.test(text) || /^\/(always-approve|yolo)(\s|$)/i.test(text) || /^\/(usage|doctor|context|compact)\s*$/i.test(text) || /^\/(fork|rewind)(\s|$)/.test(text); - if (!b.busy && !quiet) { S.msgs.push({role: "user", text, attachments: [], memories: memories || []}); renderMsgs(); $("scroller").scrollTop = 1e9; } + if (!b.busy && !quiet) { if (navigator.vibrate) navigator.vibrate(8); S.msgs.push({role: "user", text, attachments: [], memories: memories || []}); renderMsgs(); $("scroller").scrollTop = 1e9; } // 先顯示: while it works the words aren't in the chat yet — shown at once all the same. const sent = b.busy && text ? {bot: S.open, text, at: Date.now(), failed: false} : null; if (sent) { S.sending.push(sent); renderMsgs(); $("scroller").scrollTop = 1e9; } @@ -3381,14 +3403,30 @@ function openFromHash() { if (/^[A-Za-z0-9_-]{1,64}$/.test(h.get("host") || "")) { S.host = h.get("host"); localStorage.setItem("anybot.host", S.host); } const b = +h.get("bot"); if (b) S.open = b; - if (location.hash) history.replaceState(null, "", location.pathname); + // Tapping 允許/拒絕 on a notification: answer it once the token is in place. + const ans = h.get("answer"); + // (With the request it was about: one that changed since is not answered by an old banner.) + if (ans && b && (ans === "once" || ans === "reject")) S.answer = {bot: b, answer: ans, call: h.get("call") || ""}; + const sc = new URLSearchParams(location.search).get("sc"); + if (sc) S.sc = sc; + if (location.hash || location.search) history.replaceState(null, "", location.pathname); } openFromHash(); if ("serviceWorker" in navigator) navigator.serviceWorker.addEventListener("message", (e) => { const d = e.data && e.data.open; if (!d) return; if (d.host && d.host !== S.host && S.relay) { S.host = d.host; localStorage.setItem("anybot.host", S.host); S.version = 0; } + if (d.answer && S.token && d.bot) api(base() + `api/bots/${d.bot}/answer`, {json: {answer: d.answer, call: d.ask || ""}}).then(() => toast("已從通知回覆")).catch((e) => toast(e.message)); if (d.bot) go("chat", {bot: +d.bot}); }); +// iOS: the keyboard floats over the page instead of shrinking it; measure it and lift the composer. +if (window.visualViewport) { + const kb = () => { + const k = Math.max(0, Math.round(innerHeight - visualViewport.height - visualViewport.offsetTop)); + document.documentElement.style.setProperty("--kb", k + "px"); + }; + visualViewport.addEventListener("resize", kb); + visualViewport.addEventListener("scroll", kb); +} document.addEventListener("visibilitychange", () => { if (!document.hidden && S.view === "screen") startFrames(); }); hello(); diff --git a/mobile/manifest.webmanifest b/mobile/manifest.webmanifest index d81b8b6..51df3bc 100644 --- a/mobile/manifest.webmanifest +++ b/mobile/manifest.webmanifest @@ -19,5 +19,9 @@ {"src": "icon-maskable-192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable"}, {"src": "icon-maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable"}, {"src": "badge-96.png", "sizes": "96x96", "type": "image/png", "purpose": "monochrome"} + ], + "shortcuts": [ + {"name": "主要 Bot 對話", "short_name": "主要 Bot", "url": "./?sc=main", "icons": [{"src": "icon-192.png", "sizes": "192x192"}]}, + {"name": "未讀對話", "short_name": "未讀", "url": "./?sc=unread", "icons": [{"src": "icon-192.png", "sizes": "192x192"}]} ] } diff --git a/mobile/sw.js b/mobile/sw.js index 96bed7f..05ea9cc 100644 --- a/mobile/sw.js +++ b/mobile/sw.js @@ -20,6 +20,9 @@ self.addEventListener("push", (e) => { // 需要你: stays until you look (Android, desktop), and buzzes twice. requireInteraction: need, vibrate: need ? [90, 70, 90] : [70], + // 允許/拒絕 right on the banner (Android; iOS opens the chat): only for a request to allow, + // and it answers only that request (d.ask is its id — the brain checks it is still the one waiting). + actions: d.ask ? [{action: "allow", title: "允許"}, {action: "deny", title: "拒絕"}] : [], }); // The number on the app's icon: bots waiting for you. const n = typeof d.badge === "number" ? d.badge : null; @@ -30,9 +33,10 @@ self.addEventListener("push", (e) => { self.addEventListener("notificationclick", (e) => { e.notification.close(); const d = e.notification.data || {}; - const url = "./#host=" + encodeURIComponent(d.host || "") + "&bot=" + (d.bot || ""); + const answer = d.ask && e.action === "allow" ? "once" : d.ask && e.action === "deny" ? "reject" : ""; + const url = "./#host=" + encodeURIComponent(d.host || "") + "&bot=" + (d.bot || "") + (answer ? "&answer=" + answer + "&call=" + encodeURIComponent(d.ask) : ""); e.waitUntil(self.clients.matchAll({type: "window", includeUncontrolled: true}).then((cs) => { - for (const c of cs) { c.postMessage({open: d}); return c.focus(); } + for (const c of cs) { c.postMessage({open: Object.assign({}, d, {answer})}); return c.focus(); } return self.clients.openWindow(url); })); }); diff --git a/relay/src/main.rs b/relay/src/main.rs index 3958e6f..c31a4c2 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -1058,6 +1058,10 @@ impl Relay { if let Some(n) = v["badge"].as_u64() { payload["badge"] = json!(n.min(999)); } + // A request to allow: its id, so the banner's 允許/拒絕 answer only that one. + if let Some(call) = v["ask"].as_str().filter(|c| !c.is_empty()) { + payload["ask"] = json!(call.chars().take(100).collect::()); + } let subs: Vec = self.data.lock().unwrap().subs.iter().filter(|s| matches!(h.role_of(&s.user).as_deref(), Some("owner") | Some("admin")) && s.wants(kind)).cloned().collect(); let mut gone = vec![]; let mut sent = 0; diff --git a/src/app.rs b/src/app.rs index 9a8f29b..59a38b9 100644 --- a/src/app.rs +++ b/src/app.rs @@ -4190,7 +4190,13 @@ impl App { // The banner doesn't ring a second time when the 提示音 just did. notify::banner_for(&title, &what, !chime, Some(bot_id)); } - crate::remote::notify(crate::remote::Notice::Need, &title, &what, bot_id); + // 允許/拒絕 on the banner only for a request to allow (a question, or a step + // only the person can do, opens the chat). + if matches!(a.kind, ApprovalKind::Action | ApprovalKind::EnableTools | ApprovalKind::EnableThisComputer) { + crate::remote::notify_approval(&title, &what, bot_id, &a.call_id); + } else { + crate::remote::notify(crate::remote::Notice::Need, &title, &what, bot_id); + } } } } diff --git a/src/app/remote_ui.rs b/src/app/remote_ui.rs index 39d5132..936f182 100644 --- a/src/app/remote_ui.rs +++ b/src/app/remote_ui.rs @@ -610,7 +610,13 @@ impl App { } self.mark(); } - Cmd::Answer { bot, answer, text } => { + Cmd::Answer { bot, answer, text, call } => { + // From a notification banner: only the request it showed (it may have been + // answered since, and another one be waiting). + if !call.is_empty() && self.approvals.get(&bot).map(|a| a.call_id.as_str()) != Some(call.as_str()) { + self.goal_note(bot, "通知上的「允許/拒絕」沒有用上:那個請求已經不在等了(回答過,或換成了別的)。打開聊天看現在在等什麼。"); + return; + } let grant = self.approvals.get(&bot).map(|a| a.grant.clone()).unwrap_or_default(); let question = self.approvals.get(&bot).is_some_and(|a| a.kind == ApprovalKind::Question); let a = match answer.as_str() { @@ -1839,6 +1845,30 @@ mod phone_act_tests { (ctx, app) } + /// 允許/拒絕 on a phone notification answers only the request it showed: once that one + /// is gone and another waits, the old banner answers nothing (a note says so). + #[test] + fn a_banner_answers_only_its_own_request() { + let (ctx, mut app) = demo(); + let bot = app.state.bots[0].id; + let wait = |app: &mut App, call: &str| { + let (tx, rx) = std::sync::mpsc::channel(); + app.approvals.insert(bot, crate::providers::Approval { call_id: call.into(), tool: "shell".into(), reason: "刪除 build".into(), grant: String::new(), reply: tx, kind: ApprovalKind::Action }); + rx + }; + let rx = wait(&mut app, "call-2"); + app.remote_cmd(&ctx, Cmd::Answer { bot, answer: "once".into(), text: String::new(), call: "call-1".into() }); + assert!(rx.try_recv().is_err(), "an old banner doesn't allow the new request"); + assert!(app.approvals.contains_key(&bot)); + assert!(app.state.bot(bot).unwrap().messages.iter().any(|m| m.note && m.text.contains("沒有用上"))); + app.remote_cmd(&ctx, Cmd::Answer { bot, answer: "once".into(), text: String::new(), call: "call-2".into() }); + assert!(matches!(rx.try_recv(), Ok(ApprovalAnswer::Once))); + // From the app itself (no request id): as before. + let rx = wait(&mut app, "call-3"); + app.remote_cmd(&ctx, Cmd::Answer { bot, answer: "reject".into(), text: String::new(), call: String::new() }); + assert!(matches!(rx.try_recv(), Ok(ApprovalAnswer::Reject))); + } + #[test] fn the_phone_does_what_the_desktop_does() { let (ctx, mut app) = demo(); diff --git a/src/remote.rs b/src/remote.rs index a84a62c..4546b81 100644 --- a/src/remote.rs +++ b/src/remote.rs @@ -197,7 +197,8 @@ pub enum Cmd { Send { bot: u64, text: String, attachments: Vec, from: String, memories: Option>, member: bool }, Stop { bot: u64 }, /// (`text`: the answers of a 問題卡.) - Answer { bot: u64, answer: String, text: String }, + /// `call`: from a notification's 允許/拒絕 — the request it was about ("" from the app). + Answer { bot: u64, answer: String, text: String, call: String }, Read { bot: u64 }, NewThread { bot: u64 }, /// The time zone of the phone the person uses (a brain on a server only knows UTC). @@ -743,7 +744,7 @@ pub fn handle(req: Req, via_relay: bool) -> Resp { Cmd::Send { bot, text, attachments, from: String::new(), memories: if role == "owner" { picks_of(&b) } else { Some(vec![]) }, member } } "stop" => Cmd::Stop { bot }, - "answer" => Cmd::Answer { bot, answer: b["answer"].as_str().unwrap_or("reject").to_string(), text: b["text"].as_str().unwrap_or("").to_string() }, + "answer" => Cmd::Answer { bot, answer: b["answer"].as_str().unwrap_or("reject").to_string(), text: b["text"].as_str().unwrap_or("").to_string(), call: b["call"].as_str().unwrap_or("").to_string() }, "read" => Cmd::Read { bot }, "new" => Cmd::NewThread { bot }, "regenerate" => Cmd::Regenerate { bot }, @@ -873,7 +874,7 @@ pub fn handle(req: Req, via_relay: bool) -> Resp { member: false, }, "stop" => Cmd::Stop { bot }, - "answer" => Cmd::Answer { bot, answer: b["answer"].as_str().unwrap_or("reject").to_string(), text: b["text"].as_str().unwrap_or("").to_string() }, + "answer" => Cmd::Answer { bot, answer: b["answer"].as_str().unwrap_or("reject").to_string(), text: b["text"].as_str().unwrap_or("").to_string(), call: b["call"].as_str().unwrap_or("").to_string() }, "read" => Cmd::Read { bot }, "new" => Cmd::NewThread { bot }, "regenerate" => Cmd::Regenerate { bot }, @@ -2167,6 +2168,16 @@ pub fn palette_json(p: &crate::theme::Palette) -> Value { /// A notification on the person's phones (through the relay; phones that turned them on). pub fn notify(kind: Notice, title: &str, body: &str, bot: u64) { + notify_about(kind, title, body, bot, ""); +} + +/// A request to allow on the person's phones: the banner gets 允許/拒絕, which answer this +/// request only (`call`: its id; one that changed meanwhile isn't answered by an old banner). +pub fn notify_approval(title: &str, body: &str, bot: u64, call: &str) { + notify_about(Notice::Need, title, body, bot, call); +} + +fn notify_about(kind: Notice, title: &str, body: &str, bot: u64, call: &str) { // Hooks' Notification: the person's own programs hear it too (on a thread; nothing waits). crate::hooks::notification(title, body, bot); let s = hub().settings(); @@ -2185,9 +2196,9 @@ pub fn notify(kind: Notice, title: &str, body: &str, bot: u64) { } _ => {} } - let (title, body) = (title.to_string(), body.to_string()); + let (title, body, call) = (title.to_string(), body.to_string(), call.to_string()); std::thread::spawn(move || { - let _ = relay_post(&format!("{}/relay/host/notify", s.relay_url), &s.host_token, &json!({"title": title, "body": body, "bot": bot, "kind": kind.key(), "badge": waiting.len()})); + let _ = relay_post(&format!("{}/relay/host/notify", s.relay_url), &s.host_token, &json!({"title": title, "body": body, "bot": bot, "kind": kind.key(), "badge": waiting.len(), "ask": call})); }); }