-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
13 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,8 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1> | |
<summary> | ||
<span>Expand source code</span> | ||
</summary> | ||
<pre><code class="python">from logging import Logger | ||
<pre><code class="python">import html | ||
from logging import Logger | ||
from typing import Optional | ||
from typing import Union | ||
|
||
|
@@ -60,7 +61,7 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1> | |
debug_message = f"Handling an OAuth callback success (request: {request.query})" | ||
self._logger.debug(debug_message) | ||
|
||
html = self._redirect_uri_page_renderer.render_success_page( | ||
page_content = self._redirect_uri_page_renderer.render_success_page( | ||
app_id=installation.app_id, | ||
team_id=installation.team_id, | ||
is_enterprise_install=installation.is_enterprise_install, | ||
|
@@ -72,7 +73,7 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1> | |
"Content-Type": "text/html; charset=utf-8", | ||
"Set-Cookie": self._state_utils.build_set_cookie_for_deletion(), | ||
}, | ||
body=html, | ||
body=page_content, | ||
) | ||
|
||
def _build_callback_failure_response( # type: ignore | ||
|
@@ -88,14 +89,13 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1> | |
# Adding a bit more details to the error code to help installers understand what's happening. | ||
# This modification in the HTML page works only when developers use this built-in failure handler. | ||
detailed_error = build_detailed_error(reason) | ||
html = self._redirect_uri_page_renderer.render_failure_page(detailed_error) | ||
return BoltResponse( | ||
status=status, | ||
headers={ | ||
"Content-Type": "text/html; charset=utf-8", | ||
"Set-Cookie": self._state_utils.build_set_cookie_for_deletion(), | ||
}, | ||
body=html, | ||
body=self._redirect_uri_page_renderer.render_failure_page(detailed_error), | ||
) | ||
|
||
|
||
|
@@ -113,7 +113,7 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1> | |
</head> | ||
<body> | ||
<h2>Slack App Installation</h2> | ||
<p><a href="{url}"><img alt=""Add to Slack"" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcset="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/[email protected] 2x" /></a></p> | ||
<p><a href="{html.escape(url)}"><img alt=""Add to Slack"" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcset="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/[email protected] 2x" /></a></p> | ||
</body> | ||
</html> | ||
""" # noqa: E501 | ||
|
@@ -170,7 +170,7 @@ <h1 class="title">Module <code>slack_bolt.oauth.internals</code></h1> | |
elif reason == "storage_error": | ||
return f"{reason}: The app's server encountered an issue. Contact the app developer." | ||
else: | ||
return f"{reason}: This error code is returned from Slack. Refer to the documents for details."</code></pre> | ||
return f"{html.escape(reason)}: This error code is returned from Slack. Refer to the documents for details."</code></pre> | ||
</details> | ||
</section> | ||
<section> | ||
|
@@ -203,7 +203,7 @@ <h2 class="section-title" id="header-functions">Functions</h2> | |
elif reason == "storage_error": | ||
return f"{reason}: The app's server encountered an issue. Contact the app developer." | ||
else: | ||
return f"{reason}: This error code is returned from Slack. Refer to the documents for details."</code></pre> | ||
return f"{html.escape(reason)}: This error code is returned from Slack. Refer to the documents for details."</code></pre> | ||
</details> | ||
</dd> | ||
<dt id="slack_bolt.oauth.internals.get_or_create_default_installation_store"><code class="name flex"> | ||
|
@@ -292,7 +292,7 @@ <h2 class="section-title" id="header-classes">Classes</h2> | |
debug_message = f"Handling an OAuth callback success (request: {request.query})" | ||
self._logger.debug(debug_message) | ||
|
||
html = self._redirect_uri_page_renderer.render_success_page( | ||
page_content = self._redirect_uri_page_renderer.render_success_page( | ||
app_id=installation.app_id, | ||
team_id=installation.team_id, | ||
is_enterprise_install=installation.is_enterprise_install, | ||
|
@@ -304,7 +304,7 @@ <h2 class="section-title" id="header-classes">Classes</h2> | |
"Content-Type": "text/html; charset=utf-8", | ||
"Set-Cookie": self._state_utils.build_set_cookie_for_deletion(), | ||
}, | ||
body=html, | ||
body=page_content, | ||
) | ||
|
||
def _build_callback_failure_response( # type: ignore | ||
|
@@ -320,14 +320,13 @@ <h2 class="section-title" id="header-classes">Classes</h2> | |
# Adding a bit more details to the error code to help installers understand what's happening. | ||
# This modification in the HTML page works only when developers use this built-in failure handler. | ||
detailed_error = build_detailed_error(reason) | ||
html = self._redirect_uri_page_renderer.render_failure_page(detailed_error) | ||
return BoltResponse( | ||
status=status, | ||
headers={ | ||
"Content-Type": "text/html; charset=utf-8", | ||
"Set-Cookie": self._state_utils.build_set_cookie_for_deletion(), | ||
}, | ||
body=html, | ||
body=self._redirect_uri_page_renderer.render_failure_page(detailed_error), | ||
)</code></pre> | ||
</details> | ||
</dd> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"""Check the latest version at https://pypi.org/project/slack-bolt/""" | ||
__version__ = "1.17.0" | ||
__version__ = "1.17.1" |