Mercurial > prosody-modules
annotate mod_http_stats_stream/example.html @ 5173:460f78654864
mod_muc_rtbl: also filter messages
This was a bit tricky because we don't want to run the JIDs
through SHA256 on each message. Took a while to come up with this
simple plan of just caching the SHA256 of the JIDs on the
occupants.
This will leave some dirt in the occupants after unloading the
module, but that should be ok; once they cycle the room, the
hashes will be gone.
This is direly needed, otherwise, there is a tight race between
the moderation activities and the actors joining the room.
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Tue, 21 Feb 2023 21:37:27 +0100 |
parents | 1908e7aefca9 |
children |
rev | line source |
---|---|
2432
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 <!DOCTYPE html> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 <html> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 <head> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 <meta charset="UTF-8"> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 <title>Stats</title> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 </head> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 <body> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 <h1>Glorious statistics!</h1> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 <script> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 |
2433
1908e7aefca9
mod_http_stats_stream/example.html: Update path to reflect last minute rename
Kim Alvefur <zash@zash.se>
parents:
2432
diff
changeset
|
11 var evtSource = new EventSource("/stats_stream"); |
2432
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 evtSource.addEventListener("stats-full", function(e) { |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 var initial_stats = JSON.parse(e.data); |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 console.log(initial_stats); |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 }, false); |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 evtSource.addEventListener("stats-updated", function(e) { |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 var updated_stats = JSON.parse(e.data); |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 console.log(updated_stats); |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 }, false); |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 </script> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 </body> |
47a6f01231b2
mod_http_stats_stream: Sends statistics from statsmanager over an HTTP event stream
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 </html> |