mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-15 15:18:47 -05:00
Merge remote-tracking branch 'origin/develop' into store_event_actions
This commit is contained in:
commit
eb03625626
17 changed files with 139 additions and 74 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2015 OpenMarket Ltd
|
||||
# Copyright 2015 - 2016 OpenMarket Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
|
@ -119,8 +119,13 @@ class RegisterRestServlet(RestServlet):
|
|||
if self.hs.config.disable_registration:
|
||||
raise SynapseError(403, "Registration has been disabled")
|
||||
|
||||
guest_access_token = body.get("guest_access_token", None)
|
||||
|
||||
if desired_username is not None:
|
||||
yield self.registration_handler.check_username(desired_username)
|
||||
yield self.registration_handler.check_username(
|
||||
desired_username,
|
||||
guest_access_token=guest_access_token
|
||||
)
|
||||
|
||||
if self.hs.config.enable_registration_captcha:
|
||||
flows = [
|
||||
|
|
@ -150,7 +155,8 @@ class RegisterRestServlet(RestServlet):
|
|||
|
||||
(user_id, token) = yield self.registration_handler.register(
|
||||
localpart=desired_username,
|
||||
password=new_password
|
||||
password=new_password,
|
||||
guest_access_token=guest_access_token,
|
||||
)
|
||||
|
||||
if result and LoginType.EMAIL_IDENTITY in result:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014, 2015 OpenMarket Ltd
|
||||
# Copyright 2014 - 2016 OpenMarket Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
|
@ -248,6 +248,7 @@ class ThumbnailResource(BaseMediaResource):
|
|||
|
||||
if desired_method.lower() == "crop":
|
||||
info_list = []
|
||||
info_list2 = []
|
||||
for info in thumbnail_infos:
|
||||
t_w = info["thumbnail_width"]
|
||||
t_h = info["thumbnail_height"]
|
||||
|
|
@ -258,12 +259,20 @@ class ThumbnailResource(BaseMediaResource):
|
|||
size_quality = abs((d_w - t_w) * (d_h - t_h))
|
||||
type_quality = desired_type != info["thumbnail_type"]
|
||||
length_quality = info["thumbnail_length"]
|
||||
info_list.append((
|
||||
aspect_quality, min_quality, size_quality, type_quality,
|
||||
length_quality, info
|
||||
))
|
||||
if t_w >= d_w or t_h >= d_h:
|
||||
info_list.append((
|
||||
aspect_quality, min_quality, size_quality, type_quality,
|
||||
length_quality, info
|
||||
))
|
||||
else:
|
||||
info_list2.append((
|
||||
aspect_quality, min_quality, size_quality, type_quality,
|
||||
length_quality, info
|
||||
))
|
||||
if info_list:
|
||||
return min(info_list)[-1]
|
||||
else:
|
||||
return min(info_list2)[-1]
|
||||
else:
|
||||
info_list = []
|
||||
info_list2 = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue