@@ -157,18 +157,18 @@ def __init__(
157
157
if eventsub_secret and not 10 <= len (eventsub_secret ) <= 100 :
158
158
raise ValueError ("Eventsub Secret must be between 10 and 100 characters long." )
159
159
160
- self ._domain : str | None = None
160
+ self ._ssl_context : SSLContext | None = ssl_context
161
+ self ._proto = "https" if (ssl_context or domain ) else "http"
162
+
161
163
if domain :
162
164
domain_ = domain .removeprefix ("http://" ).removeprefix ("https://" ).removesuffix ("/" )
163
- self ._domain = f"https ://{ domain_ } "
165
+ self ._domain = f"{ self . _proto } ://{ domain_ } "
164
166
else :
165
- self ._domain = f"http ://{ self ._host } :{ self ._port } "
167
+ self ._domain = f"{ self . _proto } ://{ self ._host } :{ self ._port } "
166
168
167
169
path : str = eventsub_path .removeprefix ("/" ).removesuffix ("/" ) if eventsub_path else "callback"
168
170
self ._eventsub_path : str = f"/{ path } "
169
171
170
- self ._ssl_context : SSLContext | None = ssl_context
171
-
172
172
self ._runner_task : asyncio .Task [None ] | None = None
173
173
self .startup = self .event_startup
174
174
self .shutdown = self .event_shutdown
@@ -197,7 +197,7 @@ def redirect_url(self) -> str:
197
197
return f"{ self ._domain } /oauth/callback"
198
198
199
199
async def event_startup (self ) -> None :
200
- logger .info ("Starting %r on http ://%s:%s." , self , self ._host , self ._port )
200
+ logger .info ("Starting %r on %s ://%s:%s." , self , self . _proto , self ._host , self ._port )
201
201
202
202
async def event_shutdown (self ) -> None :
203
203
logger .info ("Successfully shutdown TwitchIO <%s>." , self .__class__ .__qualname__ )
0 commit comments