Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
dd4287ca
Commit
dd4287ca
authored
9 years ago
by
Matthew Hodgson
Browse files
Options
Downloads
Patches
Plain Diff
make it build
parent
e0c2490a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/http/client.py
+1
-1
1 addition, 1 deletion
synapse/http/client.py
synapse/python_dependencies.py
+1
-0
1 addition, 0 deletions
synapse/python_dependencies.py
synapse/rest/media/v1/preview_url_resource.py
+9
-8
9 additions, 8 deletions
synapse/rest/media/v1/preview_url_resource.py
with
11 additions
and
9 deletions
synapse/http/client.py
+
1
−
1
View file @
dd4287ca
...
...
@@ -21,7 +21,7 @@ import synapse.metrics
from
canonicaljson
import
encode_canonical_json
from
twisted.internet
import
defer
,
reactor
,
ssl
from
twisted.internet
import
defer
,
reactor
,
ssl
,
protocol
from
twisted.web.client
import
(
Agent
,
readBody
,
FileBodyProducer
,
PartialDownloadError
,
)
...
...
This diff is collapsed.
Click to expand it.
synapse/python_dependencies.py
+
1
−
0
View file @
dd4287ca
...
...
@@ -36,6 +36,7 @@ REQUIREMENTS = {
"
blist
"
:
[
"
blist
"
],
"
pysaml2>=3.0.0,<4.0.0
"
:
[
"
saml2>=3.0.0,<4.0.0
"
],
"
pymacaroons-pynacl
"
:
[
"
pymacaroons
"
],
"
lxml>=3.6.0
"
:
[
"
lxml
"
],
}
CONDITIONAL_REQUIREMENTS
=
{
"
web_client
"
:
{
...
...
This diff is collapsed.
Click to expand it.
synapse/rest/media/v1/preview_url_resource.py
+
9
−
8
View file @
dd4287ca
...
...
@@ -13,10 +13,11 @@
# limitations under the License.
from
twisted.web.resource
import
Resource
from
twisted.internet
import
defer
from
lxml
import
html
from
synapse.http.client
import
SimpleHttpClient
from
synapse.http.server
import
respond_with_json_bytes
from
simplejson
import
json
from
synapse.http.server
import
request_handler
,
respond_with_json_bytes
import
ujson
as
json
import
logging
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -75,7 +76,7 @@ class PreviewUrlResource(Resource):
# "og:url" : "https://twitter.com/matrixdotorg/status/684074366691356672"
# "og:title" : "Matrix on Twitter"
# "og:image" : "https://pbs.twimg.com/profile_images/500400952029888512/yI0qtFi7_400x400.png"
# "og:description" : "
“
Synapse 0.12 is out! Lots of polishing, performance &amp; bugfixes: /sync API, /r0 prefix, fulltext search, 3PID invites https://t.co/5alhXLLEGP
”
"
# "og:description" : "Synapse 0.12 is out! Lots of polishing, performance &amp; bugfixes: /sync API, /r0 prefix, fulltext search, 3PID invites https://t.co/5alhXLLEGP"
# "og:site_name" : "Twitter"
og
=
{}
...
...
@@ -143,15 +144,15 @@ class PreviewUrlResource(Resource):
os
.
remove
(
fname
)
raise
return
{
yield
(
{
"
media_type
"
:
media_type
,
"
media_length
"
:
length
,
"
download_name
"
:
download_name
,
"
created_ts
"
:
time_now_ms
,
"
filesystem_id
"
:
file_id
,
"
filename
"
:
fname
,
}
}
)
return
def
_is_media
(
content_type
):
if
content_type
.
lower
().
startswith
(
"
image/
"
):
...
...
@@ -159,6 +160,6 @@ class PreviewUrlResource(Resource):
def
_is_html
(
content_type
):
content_type
=
content_type
.
lower
()
if
content_type
==
"
text/html
"
or
content_type
.
startswith
(
"
application/xhtml
"
):
if
(
content_type
==
"
text/html
"
or
content_type
.
startswith
(
"
application/xhtml
"
)
)
:
return
True
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment