remove: PacketType::Javascript
This commit is contained in:
parent
6e0f2985b9
commit
59581f69c9
3 changed files with 0 additions and 59 deletions
|
@ -216,52 +216,6 @@
|
||||||
("class" "card lowered flex flex-wrap gap-2")
|
("class" "card lowered flex flex-wrap gap-2")
|
||||||
(text "{{ components::user_plate(user=invite[0], show_menu=false) }}")))
|
(text "{{ components::user_plate(user=invite[0], show_menu=false) }}")))
|
||||||
(text "{%- endif %}")
|
(text "{%- endif %}")
|
||||||
(div
|
|
||||||
("class" "card-nest w-full")
|
|
||||||
(div
|
|
||||||
("class" "card small flex items-center justify-between gap-2")
|
|
||||||
(div
|
|
||||||
("class" "flex items-center gap-2")
|
|
||||||
(text "{{ icon \"square-function\" }}")
|
|
||||||
(span
|
|
||||||
(text "{{ text \"mod_panel:label.send_debug_payload\" }}"))))
|
|
||||||
(form
|
|
||||||
("class" "card flex flex-col gap-2")
|
|
||||||
("onsubmit" "send_debug_payload(event)")
|
|
||||||
(div
|
|
||||||
("class" "flex flex-col gap-1")
|
|
||||||
(label
|
|
||||||
("for" "title")
|
|
||||||
(text "{{ text \"communities:label.content\" }}"))
|
|
||||||
(textarea
|
|
||||||
("type" "text")
|
|
||||||
("name" "content")
|
|
||||||
("id" "content")
|
|
||||||
("placeholder" "javascript content")
|
|
||||||
("required" "")
|
|
||||||
("minlength" "2")))
|
|
||||||
(button
|
|
||||||
("class" "primary")
|
|
||||||
(text "{{ text \"mod_panel:action.send\" }}"))))
|
|
||||||
(script
|
|
||||||
(text "globalThis.send_debug_payload = async (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if (
|
|
||||||
!(await trigger(\"atto::confirm\", [
|
|
||||||
\"Are you sure you would like to do this? This will only work if the user is online.\",
|
|
||||||
]))
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const res = await trigger(
|
|
||||||
\"streams::send_packet_to\",
|
|
||||||
[\"{{ profile.id }}\", \"notifs\", { Forward: \"Javascript\" }, { js: e.target.content.value }]
|
|
||||||
);
|
|
||||||
|
|
||||||
trigger(\"atto::toast\", [res.ok ? \"success\" : \"error\", res.message]);
|
|
||||||
}"))
|
|
||||||
(div
|
(div
|
||||||
("class" "card-nest w-full")
|
("class" "card-nest w-full")
|
||||||
(div
|
(div
|
||||||
|
|
|
@ -52,17 +52,6 @@
|
||||||
if (data.method.Forward === "Key") {
|
if (data.method.Forward === "Key") {
|
||||||
$.STREAMS[stream].id = data.data;
|
$.STREAMS[stream].id = data.data;
|
||||||
return console.info(`${stream} ${data.data}`);
|
return console.info(`${stream} ${data.data}`);
|
||||||
} else if (data.method.Forward === "Javascript") {
|
|
||||||
const s = document.createElement("script");
|
|
||||||
s.setAttribute("type", "module");
|
|
||||||
s.setAttribute("data-received", Date.now().toString());
|
|
||||||
|
|
||||||
s.text = JSON.parse(data.data).js;
|
|
||||||
document.body.appendChild(s).parentNode.removeChild(s);
|
|
||||||
|
|
||||||
return console.info(
|
|
||||||
`${stream} received Forward(PacketType::Javascript) payload of ${data.data.length} bytes`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $.sock(stream).events.message(data);
|
return $.sock(stream).events.message(data);
|
||||||
|
|
|
@ -16,8 +16,6 @@ pub enum PacketType {
|
||||||
Crud(CrudMessageType),
|
Crud(CrudMessageType),
|
||||||
/// A text key which identifies the socket.
|
/// A text key which identifies the socket.
|
||||||
Key,
|
Key,
|
||||||
/// JavaScript text.
|
|
||||||
Javascript,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue