mirror of https://gitlab.com/gpvkt/twitchtts.git
Improved oauth handling
This commit is contained in:
parent
479078444a
commit
a3358bf9f9
|
@ -4,3 +4,4 @@ dist
|
|||
tts.spec
|
||||
random*.txt
|
||||
quotes.txt
|
||||
tts.zip
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
All notable changes to this project will be documented in this file. If there is a `Changed` section please read carefully, as this often means that you will need to adapt your `config.yml`.
|
||||
|
||||
## [1.7.4]
|
||||
|
||||
### Changed 1.7.4
|
||||
|
||||
* "oauth_token doesn't need to start with "oauth:" anymore
|
||||
* Improved oauth-token detection
|
||||
|
||||
## [1.7.3] - 2022-10-20
|
||||
|
||||
### Fixed 1.7.3
|
||||
|
|
12
tts.py
12
tts.py
|
@ -84,6 +84,8 @@ class IRC:
|
|||
logging.info("Connecting to: %s", server)
|
||||
logging.info('Waiting...')
|
||||
|
||||
botpass = botpass.replace('oauth:','')
|
||||
|
||||
try:
|
||||
self.irc.connect((server, port))
|
||||
except ConnectionResetError:
|
||||
|
@ -92,7 +94,7 @@ class IRC:
|
|||
|
||||
self.irc.settimeout(1)
|
||||
|
||||
self.irc.send(bytes("PASS " + botpass + "\r\n", "UTF-8"))
|
||||
self.irc.send(bytes("PASS oauth:" + botpass + "\r\n", "UTF-8"))
|
||||
self.irc.send(bytes(
|
||||
"USER " + botnick + " " + botnick +" " + botnick + " :python\r\n", "UTF-8")
|
||||
)
|
||||
|
@ -1257,8 +1259,10 @@ class HTTPserv(BaseHTTPRequestHandler):
|
|||
function displayCode() {\
|
||||
var url = window.location.href;\
|
||||
var test = url.indexOf(\"access_token\");\
|
||||
const queryString = window.location.search;\
|
||||
const urlParams = new URLSearchParams(queryString);\
|
||||
const token = urlParams.get(\"access_token\")\
|
||||
if (test != -1) { \
|
||||
token = url.substring(42,72); \
|
||||
document.getElementById(\"code\").innerHTML = \"\
|
||||
<p>oauth:\" + token + \"</p>\
|
||||
<p>Copy the token into your config.yml and restart \
|
||||
|
@ -1530,8 +1534,6 @@ def load_config():
|
|||
if not CONF['IRC_OAUTH_TOKEN']:
|
||||
CONF['IRC_OAUTH_TOKEN'] = "Invalid"
|
||||
return CONF
|
||||
if not CONF['IRC_OAUTH_TOKEN'].startswith('oauth:'):
|
||||
raise ValueError('Your oauth-token is invalid, it has to start with: "oauth:"')
|
||||
|
||||
return CONF
|
||||
|
||||
|
@ -1617,7 +1619,7 @@ if __name__ == "__main__":
|
|||
|
||||
sys.tracebacklimit = 3
|
||||
|
||||
VERSION = "1.7.3"
|
||||
VERSION = "1.7.4"
|
||||
CONF = {}
|
||||
tts_done = []
|
||||
MSG_QUEUE_RAW = []
|
||||
|
|
Loading…
Reference in New Issue