Skip to content

Commit

Permalink
Return cloned js/css snippets in API manage endpoint (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
mclmax authored May 22, 2024
1 parent f0e5d40 commit 23cc125
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions canarytokens/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2544,6 +2544,8 @@ class ManageResponse(BaseModel):
wg_qr_code: Optional[str]
qr_code: Optional[str]
force_https: Optional[bool]
clonedsite_js: Optional[str]
clonedsite_css: Optional[str]


class HistoryResponse(BaseModel):
Expand Down
7 changes: 7 additions & 0 deletions frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,13 @@ async def api_manage_canarytoken(token: str, auth: str) -> ManageResponse:
response["qr_code"] = qr_code
elif canarydrop.type == TokenTypes.CLONEDSITE:
response["force_https"] = switchboard_settings.FORCE_HTTPS
response["clonedsite_js"] = canarydrop.get_cloned_site_javascript(
switchboard_settings.FORCE_HTTPS
)
elif canarydrop.type == TokenTypes.CSSCLONEDSITE:
response["clonedsite_css"] = canarydrop.get_cloned_site_css(
frontend_settings.CLOUDFRONT_URL
)

return ManageResponse(**response)

Expand Down

0 comments on commit 23cc125

Please sign in to comment.