mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-16 23:00:43 +08:00
move loading into function
This commit is contained in:
parent
1bac3d84b4
commit
dbde931d36
@ -46,12 +46,12 @@ off Xiaomi or its affiliates' products.
|
|||||||
MIoT redirect web pages.
|
MIoT redirect web pages.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# preload the template
|
|
||||||
template = ""
|
template = ""
|
||||||
with open("./resource/oauth_redirect_page.html", "r") as f:
|
|
||||||
template = f.read()
|
|
||||||
|
|
||||||
def oauth_redirect_page(lang: str, status: str) -> str:
|
def oauth_redirect_page(lang: str, status: str) -> str:
|
||||||
|
global template
|
||||||
|
if template == "":
|
||||||
|
with open("./resource/oauth_redirect_page.html", "r") as f:
|
||||||
|
template = f.read()
|
||||||
"""Return oauth redirect page."""
|
"""Return oauth redirect page."""
|
||||||
web_page = template.replace('LANG_PLACEHOLDER', lang)
|
web_page = template.replace('LANG_PLACEHOLDER', lang)
|
||||||
web_page = web_page.replace('STATUS_PLACEHOLDER', status)
|
web_page = web_page.replace('STATUS_PLACEHOLDER', status)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user