This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
projects:matrix_owncast [2021/04/07 21:04] admin |
projects:matrix_owncast [2021/04/07 21:18] (current) admin |
||
---|---|---|---|
Line 7: | Line 7: | ||
I've seperated out the Owncast-to-Matrix and Matrix-to-Owncast components so you can choose which one you want (or run both). | I've seperated out the Owncast-to-Matrix and Matrix-to-Owncast components so you can choose which one you want (or run both). | ||
- | OwncastToMatrix uses my very simple [[Projects/Matrix PHP Class]] but MatrixToOwncast doesn't require it. | + | OwncastToMatrix uses my very simple [[Projects/Matrix PHP Class]] but MatrixToOwncast doesn't require it. It should work as is, but might best serve as inspiration in your own language of choice. |
<code php OwncastToMatrix.php> | <code php OwncastToMatrix.php> | ||
Line 28: | Line 28: | ||
if($line['type'] == "CHAT") { | if($line['type'] == "CHAT") { | ||
if(!array_key_exists($line['id'], $tracker)) { | if(!array_key_exists($line['id'], $tracker)) { | ||
- | $str = "<Owncast: ".$line['author']."> ".htmlspecialchars_decode(strip_tags($line['body'])); | + | $str = "<Owncast: ".$line['author']."> ".htmlspecialchars_decode(strip_tags($line['body']), ENT_QUOTES); |
$tracker[$line['id']] = strip_tags($line['body']); | $tracker[$line['id']] = strip_tags($line['body']); | ||
if(!empty($str)) { | if(!empty($str)) { | ||
Line 61: | Line 61: | ||
$room_id = "!room_id:homeserver"; | $room_id = "!room_id:homeserver"; | ||
- | $sender_name = "@botname:homeserver"; // Set this to the name of the user associated with the access token, this stops it from getting stuck in a loop (and repeating what is said in both rooms forever). | + | $sender_name = "@botname:homeserver"; // IMPORTANT: Set this to the name of the user associated with the access token, this stops it from getting stuck in a loop (and repeating what is said in both rooms forever). |
while(true) { | while(true) { |