Skip to content

Commit 1313bf3

Browse files
committed
Allow overriding redirect html w/ InAppWalletBrowser
1 parent 670faac commit 1313bf3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWalletBrowser.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ public class InAppWalletBrowser : IThirdwebBrowser
1010
private TaskCompletionSource<BrowserResult> _taskCompletionSource;
1111
private static readonly HttpListener _httpListener = new();
1212

13+
private readonly string _redirectHtmlOverride;
14+
15+
public InAppWalletBrowser(string redirectHtmlOverride = null)
16+
{
17+
_httpListener.Prefixes.Add("http://localhost:8080/");
18+
this._redirectHtmlOverride = redirectHtmlOverride;
19+
}
20+
1321
/// <summary>
1422
/// Initiates a login process using the in-app browser.
1523
/// </summary>
@@ -86,7 +94,7 @@ private void IncomingHttpRequest(IAsyncResult result)
8694
var httpContext = httpListener.EndGetContext(result);
8795
var httpRequest = httpContext.Request;
8896
var httpResponse = httpContext.Response;
89-
var buffer = System.Text.Encoding.UTF8.GetBytes(Constants.REDIRECT_HTML);
97+
var buffer = System.Text.Encoding.UTF8.GetBytes(this._redirectHtmlOverride ?? Constants.REDIRECT_HTML);
9098

9199
httpResponse.ContentLength64 = buffer.Length;
92100
var output = httpResponse.OutputStream;

0 commit comments

Comments
 (0)