Commit graph

6912 commits

Author SHA1 Message Date
ThibG 9f67e3b9cc Fix Status.remote scope matching *all* statuses (#11265) 2019-07-15 00:48:50 +02:00
ThibG bd77fd6ff3 Fix BackupService crashing when an attachment is missing (#11241)
* Fix BackupService crashing when an attachment is missing

For various reasons such as admin error or out-of-sync media and
database backups, it might be possible for local attachments to be lost.

This commit allows the BackupService to continue its work even if some media
file is missing.

* Change error message
2019-07-15 00:48:49 +02:00
Thibaut Girka 1b074d2a50 Add link to edit each listed filter 2019-07-15 00:48:28 +02:00
Thibaut Girka f7fa11c4cd Make some strings translatable 2019-07-15 00:48:28 +02:00
Thibaut Girka fc8577cf2b Minor refactoring 2019-07-15 00:48:28 +02:00
Thibaut Girka 707b8d7d75 Move the “Show why” button inline 2019-07-15 00:48:28 +02:00
Thibaut Girka 85f3bc1ab3 Implement feature to add filtered phrases to content warnings 2019-07-15 00:48:28 +02:00
Thibaut Girka 42b59b730b Implement option to completely hide filtered toots 2019-07-15 00:48:28 +02:00
Thibaut Girka 16b79a6237 Add options to configure filtering behavior 2019-07-15 00:48:28 +02:00
Thibaut Girka bde7a415b9 Add a way to know why a status has been filtered, and show it anyway 2019-07-15 00:48:28 +02:00
Thibaut Girka e9fac2def9 Do not keep polls pre-filled in thread mode 2019-07-15 00:41:09 +02:00
Thibaut Girka e0bfa685c6 Fix error boundary CSS 2019-07-15 00:28:31 +02:00
Eugen Rochko 6ff67be0f6
Add a spam check (#11217)
* Add a spam check

* Use Nilsimsa to generate locality-sensitive hashes and compare using Levenshtein distance

* Add more tests

* Add exemption when the message is a reply to something that mentions the sender

* Use Nilsimsa Compare Value instead of Levenshtein distance

* Use MD5 for messages shorter than 10 characters

* Add message to automated report, do not add non-public statuses to
automated report, add trust level to accounts and make unsilencing
raise the trust level to prevent repeated spam checks on that account

* Expire spam check data after 3 months

* Add support for local statuses, reduce expiration to 1 week, always create a report

* Add content warnings to the spam check and exempt empty statuses

* Change Nilsimsa threshold to 95 and make sure removed statuses are removed from the spam check

* Add all matched statuses into automatic report
2019-07-13 16:45:50 +02:00
han@highemelry 402302776c Change the retry limit in error of web push notification (#11292)
- Change the maximum count of retry for web push notification (Default -> 5).
   - In case of high load of subscribe server, the retries will be repeated many times.
   - Because the retries occupy the default queue, maximum retry count should be reduced.
2019-07-12 18:46:21 +02:00
Eugen Rochko 5bf67ca913
Add ActivityPub secure mode (#11269)
* Add HTTP signature requirement for served ActivityPub resources

* Change `SECURE_MODE` to `AUTHORIZED_FETCH`

* Add 'Signature' to 'Vary' header and improve code style

* Improve code style by adding `public_fetch_mode?` method
2019-07-11 20:11:09 +02:00
ThibG 4e1260feaa Fix BlockService trying to reject incorrect follow request (#11288)
Fixes #11148
2019-07-11 14:50:27 +02:00
Eugen Rochko 4e8dcc5dbb
Add HTTP signatures to all outgoing ActivityPub GET requests (#11284) 2019-07-11 14:49:55 +02:00
Thibaut Girka 0baaee495f Fix report dialog crashing when a toot gets deleted
Fixes #1155
2019-07-10 19:53:31 +02:00
Eugen Rochko 5d3feed191
Refactor fetching of remote resources (#11251) 2019-07-10 18:59:28 +02:00
ThibG d04c584159 Drop magic-public-key from webfinger replies as it's only used for OStatus (#11280) 2019-07-10 17:10:43 +02:00
ThibG 85eb418e1f Fix handling of webfinger redirects in ResolveAccountService (#11279) 2019-07-10 17:10:12 +02:00
Eugen Rochko 6172263a63
Fix activity being rendered within activity due to caching (#11271)
Fix #11270
2019-07-10 00:43:30 +02:00
Eugen Rochko 4e92183227
Refactor domain block checks (#11268) 2019-07-09 03:27:35 +02:00
ThibG 1e7187f2a8 Fix Status.remote scope matching *all* statuses (#11265) 2019-07-08 18:17:22 +02:00
Eugen Rochko ef15246397
Remove unused remote unfollow controller (#11250) 2019-07-08 12:04:06 +02:00
Eugen Rochko 63c7fe8e48
Refactor controllers for statuses, accounts, and more (#11249) 2019-07-08 12:03:45 +02:00
ThibG 87c1ad4ea3 Fix BackupService crashing when an attachment is missing (#11241)
* Fix BackupService crashing when an attachment is missing

For various reasons such as admin error or out-of-sync media and
database backups, it might be possible for local attachments to be lost.

This commit allows the BackupService to continue its work even if some media
file is missing.

* Change error message
2019-07-08 02:24:25 +02:00
ThibG fce885f271
Merge pull request #1152 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
2019-07-07 22:26:10 +02:00
Eugen Rochko b851456139
Remove Atom feeds and old URLs in the form of GET /:username/updates/:id (#11247) 2019-07-07 16:16:51 +02:00
ThibG 64f3bc77ac [Glitch] Only scroll to the compose form if it's not horizontally in the viewport
Port c07cca4727 to glitch-soc
2019-07-07 14:03:12 +02:00
ThibG a0b614f10a Fix support for HTTP proxies (#11245)
* Disable incorrect check for hidden services in Socket

Hidden services can only be accessed with an HTTP proxy, in which
case the host seen by the Socket class will be the proxy, not the
target host.

Hidden services are already filtered in `Request#initialize`.

* Use our Socket class to connect to HTTP proxies

Avoid the timeout logic being bypassed

* Add support for IP addresses in Request::Socket

* Refactor a bit, no need to keep the DNS resolver around
2019-07-07 13:53:09 +02:00
Thibaut Girka 7039dca12c Merge commit 'c07cca4727041ea5a5721acbc603d4bfb45a15a6' into glitch-soc/merge-upstream
Unlike upstream, kept the direct timeline endpoint, as it is still of use in
glitch-soc.
2019-07-07 13:49:31 +02:00
Eugen Rochko 406b46395d
Fix URLs appearing twice in errors of ActivityPub::DeliveryWorker (#11231) 2019-07-07 03:37:01 +02:00
ThibG 58276715be Fix support for HTTP proxies (#11245)
* Disable incorrect check for hidden services in Socket

Hidden services can only be accessed with an HTTP proxy, in which
case the host seen by the Socket class will be the proxy, not the
target host.

Hidden services are already filtered in `Request#initialize`.

* Use our Socket class to connect to HTTP proxies

Avoid the timeout logic being bypassed

* Add support for IP addresses in Request::Socket

* Refactor a bit, no need to keep the DNS resolver around
2019-07-07 02:05:38 +02:00
Eugen Rochko 23aeef52cc
Remove Salmon and PubSubHubbub (#11205)
* Remove Salmon and PubSubHubbub endpoints

* Add error when trying to follow OStatus accounts

* Fix new accounts not being created in ResolveAccountService
2019-07-06 23:26:16 +02:00
ThibG c07cca4727 Only scroll to the compose form if it's not horizontally in the viewport (#11246)
Avoids jumping the scroll around vertically when giving it focus and
editing long toots.
2019-07-06 18:18:08 +02:00
Eugen Rochko ae003d54f9
Fix option to send e-mail notification about account action always being true (#11242) 2019-07-06 13:54:32 +02:00
ThibG ed544f3166 Fix HTTP requests to IPv6 hosts (#11240) 2019-07-05 22:03:00 +02:00
Thibaut Girka e5f4d83e60 Allow serializing local-only toots in backup service
Fixes #1153
2019-07-05 21:50:19 +02:00
Eugen Rochko 0c1b1069c9
Remove deprecated REST API GET /api/v1/statuses/:id/card (#11213) 2019-07-05 02:15:24 +02:00
Eugen Rochko 3fd6ab99e6
Remove deprecated REST API GET /api/v1/timelines/direct (#11212) 2019-07-05 02:14:56 +02:00
ThibG 47c30be8d8 [Glitch] Memoize ancestorIds and descendantIds in detailed status view
Port 99924f282f to glitch-soc
2019-07-04 16:26:17 +02:00
ThibG 894d82a325 [Glitch] When deleting & redrafting a poll, fill in closest expires_in
Port dc88d226e1 to glitch-soc
2019-07-04 16:24:48 +02:00
Thibaut Girka 6ab84c12a7 Merge branch 'master' into glitch-soc/merge-upstream 2019-07-04 16:21:39 +02:00
ThibG 99924f282f Memoize ancestorIds and descendantIds in detailed status view (#11234) 2019-07-02 16:03:54 +02:00
Eugen Rochko 1a747f7020
Fix statsd UDP sockets not being cleaned up in Sidekiq (#11230) 2019-07-02 01:01:17 +02:00
Eugen Rochko bc60d794f8
Change ActivityPub::DeliveryWorker to not retry HTTP 501 errors (#11233) 2019-07-02 00:59:53 +02:00
ThibG dc88d226e1 When deleting & redrafting a poll, fill in closest expires_in (#11203)
Use the smallest preset expires_in such that the new poll would
not expire before the old one.

In the typical case of a quick delete & redraft, this results in
using the same poll duration.

Fixes #10567
2019-07-02 00:36:16 +02:00
Eugen Rochko 0d9ffe56fb
Add request pool to improve delivery performance (#10353)
* Add request pool to improve delivery performance

Fix #7909

* Ensure connection is closed when exception interrupts execution

* Remove Timeout#timeout from socket connection

* Fix infinite retrial loop on HTTP::ConnectionError

* Close sockets on failure, reduce idle time to 90 seconds

* Add MAX_REQUEST_POOL_SIZE option to limit concurrent connections to the same server

* Use a shared pool size, 512 by default, to stay below open file limit

* Add some tests

* Add more tests

* Reduce MAX_IDLE_TIME from 90 to 30 seconds, reap every 30 seconds

* Use a shared pool that returns preferred connection but re-purposes other ones when needed

* Fix wrong connection being returned on subsequent calls within the same thread

* Reduce mutex calls on flushes from 2 to 1 and add test for reaping
2019-07-02 00:34:38 +02:00
Thibaut Girka c94966891a Minor cleanup and maybe minor performance improvements 2019-07-01 19:31:21 +02:00
Thibaut Girka 9d6b46fe34 Minor optimization regarding regexp filtering in timelines 2019-07-01 19:31:21 +02:00
Thibaut Girka c49f7d5d16 Use strict equality rather than Immutable.is as the compared props are values 2019-07-01 19:31:10 +02:00
Thibaut Girka 82a76f03a4 Assume children of visible IntersectionObserverArticle always change
This fixes multiple issues, while adding few computations
2019-07-01 19:31:10 +02:00
Thibaut Girka c0b5ee315d Revert to using upstream's optimisations
This *does* break things, as `shouldComponentUpdate` assume the
children to never change!
2019-07-01 19:31:10 +02:00
Thibaut Girka 0ef6a114e7 Fix error boundary DOM 2019-07-01 19:30:59 +02:00
Thibaut Girka 82cd138c89 Fix some React warnings 2019-07-01 19:30:59 +02:00
Eugen Rochko 2cfa427ea7
Change domain block behaviour to prevent creation of accounts from suspended domains (#11219) 2019-07-01 19:13:30 +02:00
ThibG 082b3b282f Fix expiration date of filters being set to “Never” when editing them (#11204)
When editing a custom filter, select the shortest preset duration that
still covers the remaining time of that filter.

Fixes #9506
2019-06-30 16:11:21 +02:00
Eugen Rochko 06424786a1
Fix support for MP4 files that are actually M4V files (#11210)
Resolve #11187
2019-06-30 16:10:43 +02:00
Thibaut Girka b6e9b7d1cd [Glitch] When sending a toot, ensure a CW is only set if the CW field is visible
Partial port of ccc7fe3e1d to glitch-soc

It doesn't ensure the field isn't changed, just that it isn't submitted if
the field isn't visible. Ensuring the field isn't changed would require
reworking the “always show CW field” feature.
2019-06-30 14:35:03 +02:00
ThibG cbb41e2dad [Glitch] Optimize makeGetStatus
Port f895bf1984 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
2019-06-30 11:06:04 +02:00
ThibG 46829e009e [Glitch] Use ScrollToOptions for smooth scrolling if supported
Port 84ff393842 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
2019-06-30 11:01:01 +02:00
Thibaut Girka c5495a448c Merge branch 'master' into glitch-soc/merge-upstream 2019-06-30 10:59:45 +02:00
ThibG f895bf1984 Optimize makeGetStatus (#11211)
* Optimize makeGetStatus

Because `ImmutableList.filter` always returns a new object and `createSelector`
memoizes based on object identity, the selector returned by `makeGetStatus`
would *always* execute.

To avoid that, we wrap `getFilters` into a new memoizer that memoizes based on
deep equality, thus returning the same object as long as the filters haven't
changed, allowing the memoization of `makeGetStatus` to work.

Furthermore, we memoize the compiled regexs instead of recomputing them each
time the selector is called.

* Fix memoized result being cleared too often

* Make notifications use memoized getFiltersRegex
2019-06-30 00:12:38 +02:00
ThibG ccc7fe3e1d When sending a toot, ensure a CW is only set if the CW field is visible (#11206)
In some occasions, such as the browser or a browser extension auto-filling
the existing but disabled/hidden CW field, a CW can be set without the user
knowing.
2019-06-29 18:32:36 +02:00
ThibG 84ff393842 Use ScrollToOptions for smooth scrolling if supported (#11207) 2019-06-29 18:32:06 +02:00
Eugen Rochko 662252c8f7 [Glitch] Add categories for custom emojis
Port front-end changes from e64e6a03dd to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
2019-06-28 21:42:37 +02:00
ThibG 4d964398de [Glitch] Fix swiping columns on mobile sometimes failing
Port 072158ee97 to glitch-soc
2019-06-28 21:38:34 +02:00
Thibaut Girka 3922b518f7 Merge branch 'master' into glitch-soc/merge-upstream 2019-06-28 21:36:50 +02:00
ThibG 4f5b221be2 Display FTS warning based on actual search term, not the one being typed (#11202)
Follow-up to #11112
2019-06-28 19:29:11 +02:00
ThibG 43698e08ca [Glitch] Add message telling FTS is disabled when no toot can be found because of this
Port ca8944728f to glitch-soc
2019-06-28 18:54:56 +02:00
Eugen Rochko e64e6a03dd
Add categories for custom emojis (#11196)
Fix #7940
2019-06-28 15:54:10 +02:00
ThibG 072158ee97 Fix swiping columns on mobile sometimes failing (#11200)
Fixes #9779
2019-06-28 13:52:15 +02:00
Thibaut Girka c8ba75b963 Merge branch 'master' into glitch-soc/merge-upstream 2019-06-28 12:11:45 +02:00
Thibaut Girka 6ad870a410 Change search components classes and styling to match upstream 2019-06-28 11:13:41 +02:00
ThibG ca8944728f Add message telling FTS is disabled when no toot can be found because of this (#11112)
* Add message telling FTS is disabled when no toot can be found because of this

Fixes #11082

* Remove info icon and reword message
2019-06-27 21:12:26 +02:00
ThibG 9a90ec3b3b Fix account URI in UpdatePollSerializer (#11194)
* Fix account URI in UpdatePollSerializer

Fixes #11185

* Add specs
2019-06-27 19:41:55 +02:00
Thibaut Girka ca17bae904 Use a redis-cached feed for the DM timeline 2019-06-27 16:44:12 +02:00
Thibaut Girka 6ab7051b48 Merge branch 'master' into glitch-soc/merge-upstream 2019-06-27 15:48:23 +02:00
mayaeh a02f4b7cd4 Fix NameError (#11192) 2019-06-27 09:16:55 +02:00
ThibG 4175f13155 [Glitch] Add option to disable blurhash previews
Port 3086c645fd to glitch-soc
2019-06-26 23:19:26 +02:00
PatOnTheBack 383136d9bb [Glitch] Removed extra pipes from regex.
Port 5b20284f6f to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
2019-06-26 23:19:26 +02:00
ThibG 5c3171e8ea [Glitch] Apply filters to poll options in WebUI
Port 47ef4a6c7a to glitch-soc
2019-06-26 23:19:26 +02:00
Thibaut Girka aaec64a500 Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/controllers/settings/preferences_controller.rb
- app/lib/user_settings_decorator.rb
- app/models/user.rb
- config/locales/simple_form.en.yml
2019-06-26 23:19:22 +02:00
ThibG 3086c645fd Add option to disable blurhash previews (#11188)
* Add option to disable blurhash previews

* Update option text

* Change options order
2019-06-26 19:33:04 +02:00
ThibG 915c619394 Add support for Audio activities (#11189)
Fixes #11127
2019-06-26 19:32:36 +02:00
ThibG 32a4494926 Scroll to compose form rather than reply indicator on focus (#11182) 2019-06-26 14:28:36 +02:00
Thibaut Girka 9ef25877df Scroll to compose form rather than reply indicator on focus 2019-06-26 10:46:11 +02:00
PatOnTheBack 5b20284f6f Removed extra pipes from regex. (#11181) 2019-06-26 02:16:24 +02:00
Eugen Rochko 6836587117
Fix unnecessary SQL query performed on unauthenticated requests (#11179) 2019-06-25 20:18:15 +02:00
ThibG 47ef4a6c7a Apply filters to poll options (#11174)
* Apply filters to poll options in WebUI

Fixes #11128

* Apply filters to poll options server-side

* Add poll options to searchable text
2019-06-25 14:45:14 +02:00
Thibaut Girka 598cdc9542 Use a different icon for audio attachments 2019-06-24 16:16:16 +02:00
Eugen Rochko d7eb580053 [Glitch] Add media description as title to links of unknown media attachments
Port front-end changes from 49ebda4d49 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
2019-06-24 16:00:42 +02:00
Eugen Rochko 967456b6a9 [Glitch] Add audio uploads
Port front-end changes from f7f23b4a19 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
2019-06-24 16:00:42 +02:00
Thibaut Girka ddd875ad99 Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/models/media_attachment.rb
  Upstream added audio attachment support
- app/serializers/initial_state_serializer.rb
  Upstream added audio attachment support and how mimetypes are returned
- app/serializers/rest/instance_serializer.rb
  Upstream added a few fields
- config/application.rb
  Upstream added a different paperclip transcoder
2019-06-24 15:02:59 +02:00
Eugen Rochko 8fe7116cdf
New Crowdin translations (#11144)
* New translations simple_form.en.yml (Japanese)
[ci skip]

* New translations en.json (Catalan)
[ci skip]

* New translations doorkeeper.en.yml (Catalan)
[ci skip]

* New translations en.json (Slovenian)
[ci skip]

* New translations en.json (Slovenian)
[ci skip]

* New translations en.json (Slovenian)
[ci skip]

* New translations en.json (Slovenian)
[ci skip]

* New translations doorkeeper.en.yml (Galician)
[ci skip]

* New translations en.json (Arabic)
[ci skip]

* New translations en.json (Slovenian)
[ci skip]

* New translations doorkeeper.en.yml (German)
[ci skip]

* New translations en.json (Slovenian)
[ci skip]

* i18n-tasks normalize

* yarn manage:translations
2019-06-22 17:26:09 +02:00
Eugen Rochko b927bb3f07
Fix audio-only OGG and WebM files not being processed as such (#11151)
Also, because Chrome sends audio/mp3 instead of audio/mpeg as it's
supposed to, we need to whitelist that mime type as well
2019-06-22 16:54:06 +02:00
koyu 6eb5241099 Change camera icon to paperclip icon in upload form (#11149) 2019-06-22 15:29:25 +02:00
Eugen Rochko d61d164685
Add short_description and approval_required to GET /api/v1/instance (#11146) 2019-06-22 12:08:16 +02:00
Eugen Rochko aa9b37822b
Fix audio not being downloaded from remote servers (#11145) 2019-06-22 02:50:36 +02:00