about summary refs log tree commit diff
path: root/streaming/index.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-05-21 16:40:02 +0200
committerThibaut Girka <thib@sitedethib.com>2018-05-21 16:40:02 +0200
commita4c9bda771c04526005f708dfb9ca2ccced60d52 (patch)
tree9ed60f78e2e8acc823bccb7c75ecaa3fdb1b7ab6 /streaming/index.js
parent98ecadbf99aa823164608f796a40ab1cd067bdc2 (diff)
parent46061dc041b0a2a4a3907976cc3432abdb1d67ec (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
	app/javascript/styles/mastodon-light.scss
	config/locales/en.yml
	config/locales/fr.yml
	config/locales/simple_form.pl.yml
	config/themes.yml

Conflicts resolved by deleting config/themes.yml,
marking app/javascript/styles/mastodon-light.scss as added,
and taking all new translation strings, not removing anything from
them.
Diffstat (limited to 'streaming/index.js')
-rw-r--r--streaming/index.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 48bab8078..4eaf66865 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -241,7 +241,9 @@ const startWorker = (workerId) => {
 
   const PUBLIC_STREAMS = [
     'public',
+    'public:media',
     'public:local',
+    'public:local:media',
     'hashtag',
     'hashtag:local',
   ];
@@ -459,11 +461,17 @@ const startWorker = (workerId) => {
   });
 
   app.get('/api/v1/streaming/public', (req, res) => {
-    streamFrom('timeline:public', req, streamToHttp(req, res), streamHttpEnd(req), true);
+    const onlyMedia = req.query.only_media === '1' || req.query.only_media === 'true';
+    const channel   = onlyMedia ? 'timeline:public:media' : 'timeline:public';
+
+    streamFrom(channel, req, streamToHttp(req, res), streamHttpEnd(req), true);
   });
 
   app.get('/api/v1/streaming/public/local', (req, res) => {
-    streamFrom('timeline:public:local', req, streamToHttp(req, res), streamHttpEnd(req), true);
+    const onlyMedia = req.query.only_media === '1' || req.query.only_media === 'true';
+    const channel   = onlyMedia ? 'timeline:public:local:media' : 'timeline:public:local';
+
+    streamFrom(channel, req, streamToHttp(req, res), streamHttpEnd(req), true);
   });
 
   app.get('/api/v1/streaming/direct', (req, res) => {
@@ -521,6 +529,12 @@ const startWorker = (workerId) => {
     case 'public:local':
       streamFrom('timeline:public:local', req, streamToWs(req, ws), streamWsEnd(req, ws), true);
       break;
+    case 'public:media':
+      streamFrom('timeline:public:media', req, streamToWs(req, ws), streamWsEnd(req, ws), true);
+      break;
+    case 'public:local:media':
+      streamFrom('timeline:public:local:media', req, streamToWs(req, ws), streamWsEnd(req, ws), true);
+      break;
     case 'direct':
       streamFrom(`timeline:direct:${req.accountId}`, req, streamToWs(req, ws), streamWsEnd(req, ws), true);
       break;