1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00
This commit is contained in:
Steffo 2020-01-11 15:51:31 +01:00
parent fe5b8a7712
commit a240eb9f20
3 changed files with 8 additions and 3 deletions

View file

@ -2,7 +2,7 @@
[tool.poetry] [tool.poetry]
name = "royalpack" name = "royalpack"
version = "5.2.6" version = "5.2.8"
description = "A Royalnet command pack for the Royal Games community" description = "A Royalnet command pack for the Royal Games community"
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"] authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
license = "AGPL-3.0+" license = "AGPL-3.0+"

View file

@ -3,6 +3,10 @@ from starlette.requests import Request
from starlette.responses import * from starlette.responses import *
from royalnet.constellation import * from royalnet.constellation import *
from royalnet.utils import * from royalnet.utils import *
import logging
log = logging.getLogger(__name__)
class ApiDiscordPlayStar(PageStar): class ApiDiscordPlayStar(PageStar):
@ -11,9 +15,10 @@ class ApiDiscordPlayStar(PageStar):
async def page(self, request: Request) -> JSONResponse: async def page(self, request: Request) -> JSONResponse:
url = request.query_params.get("url", "") url = request.query_params.get("url", "")
try: try:
guild_id: Optional[int] = int(request.path_params.get("guild_id", None)) guild_id: Optional[int] = int(request.query_params.get("guild_id", None))
except (ValueError, TypeError): except (ValueError, TypeError):
guild_id = None guild_id = None
log.info(f"Received request to play {url} on guild_id {guild_id} via web")
response = await self.interface.call_herald_event("discord", "discord_play", url=url, guild_id=guild_id) response = await self.interface.call_herald_event("discord", "discord_play", url=url, guild_id=guild_id)
return JSONResponse(response, headers={ return JSONResponse(response, headers={
"Access-Control-Allow-Origin": self.interface.config['Funkwhale']['instance_url'], "Access-Control-Allow-Origin": self.interface.config['Funkwhale']['instance_url'],

View file

@ -1 +1 @@
semantic = "5.2.6" semantic = "5.2.8"