mirror of https://gitlab.com/litecord/litecord.git
embed.sanitizer: add log warn
- channel.messages: handle meta being None - schemas: add gift_code_sku_id
This commit is contained in:
parent
9f56c7a26e
commit
9b76c472d0
|
|
@ -272,6 +272,9 @@ async def process_url_embed(config, storage, dispatcher, session, payload: dict)
|
||||||
img_proxy_url = proxify(url, config=config)
|
img_proxy_url = proxify(url, config=config)
|
||||||
meta = await fetch_metadata(url, config=config, session=session)
|
meta = await fetch_metadata(url, config=config, session=session)
|
||||||
|
|
||||||
|
if meta is None:
|
||||||
|
continue
|
||||||
|
|
||||||
if not meta['image']:
|
if not meta['image']:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,10 @@ async def fetch_metadata(url, *, config=None, session=None) -> dict:
|
||||||
|
|
||||||
async with session.get(request_url) as resp:
|
async with session.get(request_url) as resp:
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
|
body = await resp.text()
|
||||||
|
|
||||||
|
log.warning('failed to generate meta for {!r}: {} {!r}',
|
||||||
|
url, resp.status, body)
|
||||||
return
|
return
|
||||||
|
|
||||||
return await resp.json()
|
return await resp.json()
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,8 @@ REGISTER = {
|
||||||
'invite': {'type': 'string', 'required': False, 'nullable': True}, # optional
|
'invite': {'type': 'string', 'required': False, 'nullable': True}, # optional
|
||||||
'fingerprint': {'type': 'string', 'required': False, 'nullable': True}, # these are sent by official client
|
'fingerprint': {'type': 'string', 'required': False, 'nullable': True}, # these are sent by official client
|
||||||
'captcha_key': {'type': 'string', 'required': False, 'nullable': True},
|
'captcha_key': {'type': 'string', 'required': False, 'nullable': True},
|
||||||
'consent': {'type': 'boolean'}
|
'consent': {'type': 'boolean'},
|
||||||
|
'gift_code_sku_id': {'type': 'string', 'required': False, 'nullable': True}
|
||||||
}
|
}
|
||||||
|
|
||||||
# only used by us, not discord, hence 'invcode' (to separate from discord)
|
# only used by us, not discord, hence 'invcode' (to separate from discord)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue