// Package miot provides MIoT core client for Xiaomi Home devices. // This file is a direct port of py-miot/web_pages.py. package miot import ( _ "embed" "strings" ) //go:embed resource/oauth_redirect_page.html var oauthRedirectTemplate string // OAuthRedirectPage returns the OAuth redirect page HTML. // Replaces TITLE_PLACEHOLDER, CONTENT_PLACEHOLDER, BUTTON_PLACEHOLDER, // and STATUS_PLACEHOLDER in the embedded template. func OAuthRedirectPage(title, content, button string, success bool) string { status := "false" if success { status = "true" } html := oauthRedirectTemplate html = strings.Replace(html, "TITLE_PLACEHOLDER", title, 1) html = strings.Replace(html, "CONTENT_PLACEHOLDER", content, 1) html = strings.Replace(html, "BUTTON_PLACEHOLDER", button, 1) html = strings.Replace(html, "STATUS_PLACEHOLDER", status, 1) return html }