-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Oembed config - oembed_endpoints (#2752) #10536
Conversation
See also #10392. |
Yes, it's a bit unfortunate. I made the change some time ago and did not have time to do the PR. Pick one that you like better I guess. |
I think this is meant to fix #2752. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
I've written some words about how I think we should approach this over at #2752 (comment). TL;DR: let's use a providers.json
file rather than config.
Also: note that CI is failing; we'll need to fix the failures before we can merge anything.
9f53615
to
e9aee2a
Compare
@srdjan-catalyst: it doesn't matter too much in this case, since I didn't give it a thorough review, but please don't force-push changes in future, because it makes it hard to see what has changed since an earlier review. |
@richvdh I'm about to commit again. Would you prefer a separate commit, or squashed force push this time please? |
a new commit please. there is never any need to squash. |
e9aee2a
to
6b1ada9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for your work on this! It's definitely progressing in the right direction, but also I have a few comments below.
client = self.reactor.tcpClients[0][2].buildProtocol(None) | ||
server = AccumulatingProtocol() | ||
server.makeConnection(FakeTransport(client, self.reactor)) | ||
client.makeConnection(FakeTransport(server, self.reactor)) | ||
client.dataReceived( | ||
( | ||
b"HTTP/1.0 200 OK\r\nContent-Length: %d\r\n" | ||
b'Content-Type: application/json; charset="utf8"\r\n\r\n' | ||
) | ||
% (len(oembed_content),) | ||
+ oembed_content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think mocking out the HTTP client is fine, but out of interest, was there a reason you chose to replace this logic with mocks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not make FakeTransport work with SSL at all with tests. I spent a day trying to make it work with no success. Other tests are passing because they are checking that certain requesta are attempted, and the fact that they are breaking at the SSL level does not matter for the outcome. In case of oembed we have two consecutive calls, and the second call never happens because the first one breaks.
Urls that come from oembed.com are (almost) all https, so I wanted to keep that.
Moved twitter patterns from preview_url_resource to oembed_endpoints Signed-off-by: Srdjan <[email protected]>
Replaced oembed_endpoint full providers list with oembed_providers_dir, and provided initial providers.json
664d900
to
9087812
Compare
Co-authored-by: Richard van der Hoff <[email protected]>
7f58824
to
435fecf
Compare
Co-authored-by: Richard van der Hoff <[email protected]>
435fecf
to
83203e1
Compare
Hello! I implemented something similar in #10714, I think that meets all the requirements that you were going for, but please shout if not. The changes from that should be in Synapse 1.43.0 (which won't be released for several weeks). Thanks for your contribution! |
Moved twitter patterns from preview_url_resource to oembed_endpoints
Signed-off-by: Srdjan [email protected]
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.