From: Claire Date: Mon, 27 Dec 2021 14:16:18 +0000 (+0100) Subject: Merge branch 'main' into glitch-soc/merge-upstream X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=09c61e13767f7b77618949f422f229b638381088;p=mastodon.git Merge branch 'main' into glitch-soc/merge-upstream Conflicts: - `README.md`: We have completely different contents. Kept our version. - `package.json`: Not a real conflict, just an upstream dependency udpated textually too close to a glitch-soc-only dependency. Updated dependencies like upstream. - `streaming/index.js`: Conflict due to code style changes on parts that were modified in glitch-soc to handle local-only toots. Changed style according to upstream. --- 09c61e13767f7b77618949f422f229b638381088 diff --cc Gemfile index 10417b2df,0e5da2976..5f97e6e81 --- a/Gemfile +++ b/Gemfile @@@ -99,10 -99,8 +99,10 @@@ gem 'json-ld gem 'json-ld-preloaded', '~> 3.1' gem 'rdf-normalize', '~> 0.4' +gem 'redcarpet', '~> 3.5' + group :development, :test do - gem 'fabrication', '~> 2.22' + gem 'fabrication', '~> 2.23' gem 'fuubar', '~> 2.5' gem 'i18n-tasks', '~> 0.9', require: false gem 'pry-byebug', '~> 3.9' diff --cc streaming/index.js index 190f96b51,74cbf4c2c..ff873cd04 --- a/streaming/index.js +++ b/streaming/index.js @@@ -364,9 -340,8 +340,9 @@@ const startWorker = async (workerId) = const channelNameFromPath = req => { const { path, query } = req; const onlyMedia = isTruthy(query.only_media); + const allowLocalOnly = isTruthy(query.allow_local_only); - switch(path) { + switch (path) { case '/api/v1/streaming/user': return 'user'; case '/api/v1/streaming/user/notification': @@@ -588,11 -563,10 +564,11 @@@ * @param {function(string, string): void} output * @param {function(string[], function(string): void): void} attachCloseHandler * @param {boolean=} needsFiltering + * @param {boolean=} allowLocalOnly * @return {function(string): void} */ - const streamFrom = (ids, req, output, attachCloseHandler, needsFiltering = false) => { + const streamFrom = (ids, req, output, attachCloseHandler, needsFiltering = false, allowLocalOnly = false) => { - const accountId = req.accountId || req.remoteAddress; + const accountId = req.accountId || req.remoteAddress; log.verbose(req.requestId, `Starting stream from ${ids.join(', ')} for ${accountId}`); @@@ -762,9 -738,9 +746,9 @@@ app.get('/api/v1/streaming/*', (req, res) => { channelNameToIds(req, channelNameFromPath(req), req.query).then(({ channelIds, options }) => { const onSend = streamToHttp(req, res); - const onEnd = streamHttpEnd(req, subscriptionHeartbeat(channelIds)); + const onEnd = streamHttpEnd(req, subscriptionHeartbeat(channelIds)); - streamFrom(channelIds, req, onSend, onEnd, options.needsFiltering); + streamFrom(channelIds, req, onSend, onEnd, options.needsFiltering, options.allowLocalOnly); }).catch(err => { log.verbose(req.requestId, 'Subscription error:', err.toString()); httpNotFound(res); @@@ -954,10 -919,9 +941,9 @@@ return; } - const onSend = streamToWs(request, socket, streamNameFromChannelName(channelName, params)); + const onSend = streamToWs(request, socket, streamNameFromChannelName(channelName, params)); const stopHeartbeat = subscriptionHeartbeat(channelIds); - - const listener = streamFrom(channelIds, request, onSend, undefined, options.needsFiltering, options.allowLocalOnly); - const listener = streamFrom(channelIds, request, onSend, undefined, options.needsFiltering); ++ const listener = streamFrom(channelIds, request, onSend, undefined, options.needsFiltering, options.allowLocalOnly); subscriptions[channelIds.join(';')] = { listener,