mirror of
https://github.com/simon987/feed_viz.git
synced 2025-04-08 05:06:43 +00:00
Handle array messages
This commit is contained in:
parent
c1ba11f152
commit
8c502646e6
@ -99,13 +99,15 @@ function connect(exchange, topics) {
|
||||
socket = new WebSocket("wss://feed.the-eye.eu/socket");
|
||||
|
||||
socket.onmessage = msg => {
|
||||
let j = JSON.parse(msg.data);
|
||||
let items = JSON.parse(msg.data);
|
||||
|
||||
items.forEach(j => {
|
||||
if (j._urls && ((loadNsfw && j.over_18) || !j.over_18 || !j.hasOwnProperty("over_18"))) {
|
||||
j._urls
|
||||
.filter(url => /http?s:\/\/.*(.jpg|.jpeg|.bmp|.png|.gif|.jpeg:orig|.jpg:orig)$/.test(url))
|
||||
.forEach(url => appendToGallery(createImage(url, j)));
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
socket.onopen = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user