mirror of
				https://gitlab.com/gpvkt/twitchtts.git
				synced 2025-10-31 09:07:34 +01:00 
			
		
		
		
	Improved oauth handling
This commit is contained in:
		
							parent
							
								
									479078444a
								
							
						
					
					
						commit
						a3358bf9f9
					
				
					 4 changed files with 15 additions and 5 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -4,3 +4,4 @@ dist | ||||||
| tts.spec | tts.spec | ||||||
| random*.txt | random*.txt | ||||||
| quotes.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`. | 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 | ## [1.7.3] - 2022-10-20 | ||||||
| 
 | 
 | ||||||
| ### Fixed 1.7.3 | ### Fixed 1.7.3 | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								tts.exe
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tts.exe
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										12
									
								
								tts.py
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								tts.py
									
										
									
									
									
								
							|  | @ -84,6 +84,8 @@ class IRC: | ||||||
|         logging.info("Connecting to: %s", server) |         logging.info("Connecting to: %s", server) | ||||||
|         logging.info('Waiting...') |         logging.info('Waiting...') | ||||||
| 
 | 
 | ||||||
|  |         botpass = botpass.replace('oauth:','') | ||||||
|  | 
 | ||||||
|         try: |         try: | ||||||
|             self.irc.connect((server, port)) |             self.irc.connect((server, port)) | ||||||
|         except ConnectionResetError: |         except ConnectionResetError: | ||||||
|  | @ -92,7 +94,7 @@ class IRC: | ||||||
| 
 | 
 | ||||||
|         self.irc.settimeout(1) |         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( |         self.irc.send(bytes( | ||||||
|             "USER " + botnick + " " + botnick +" " + botnick + " :python\r\n", "UTF-8") |             "USER " + botnick + " " + botnick +" " + botnick + " :python\r\n", "UTF-8") | ||||||
|         ) |         ) | ||||||
|  | @ -1257,8 +1259,10 @@ class HTTPserv(BaseHTTPRequestHandler): | ||||||
|                                                 function displayCode() {\ |                                                 function displayCode() {\ | ||||||
|                                                     var url = window.location.href;\ |                                                     var url = window.location.href;\ | ||||||
|                                                     var test = url.indexOf(\"access_token\");\ |                                                     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) { \ |                                                     if (test != -1) { \ | ||||||
|                                                     token = url.substring(42,72); \ |  | ||||||
|                                                     document.getElementById(\"code\").innerHTML = \"\ |                                                     document.getElementById(\"code\").innerHTML = \"\ | ||||||
|                                                     <p>oauth:\" + token + \"</p>\ |                                                     <p>oauth:\" + token + \"</p>\ | ||||||
|                                                     <p>Copy the token into your config.yml and restart \ |                                                     <p>Copy the token into your config.yml and restart \ | ||||||
|  | @ -1530,8 +1534,6 @@ def load_config(): | ||||||
|     if not CONF['IRC_OAUTH_TOKEN']: |     if not CONF['IRC_OAUTH_TOKEN']: | ||||||
|         CONF['IRC_OAUTH_TOKEN'] = "Invalid" |         CONF['IRC_OAUTH_TOKEN'] = "Invalid" | ||||||
|         return CONF |         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 |     return CONF | ||||||
| 
 | 
 | ||||||
|  | @ -1617,7 +1619,7 @@ if __name__ == "__main__": | ||||||
| 
 | 
 | ||||||
|     sys.tracebacklimit = 3 |     sys.tracebacklimit = 3 | ||||||
| 
 | 
 | ||||||
|     VERSION = "1.7.3" |     VERSION = "1.7.4" | ||||||
|     CONF = {} |     CONF = {} | ||||||
|     tts_done = [] |     tts_done = [] | ||||||
|     MSG_QUEUE_RAW = [] |     MSG_QUEUE_RAW = [] | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue