remove token from QR code
This commit is contained in:
		
							parent
							
								
									d9ee20efaa
								
							
						
					
					
						commit
						bb98b27040
					
				| 
						 | 
					@ -201,20 +201,6 @@ def _run(
 | 
				
			||||||
        def run_command(command):
 | 
					        def run_command(command):
 | 
				
			||||||
            subprocess.run(command, shell=True, check=True)
 | 
					            subprocess.run(command, shell=True, check=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        def getToken():
 | 
					 | 
				
			||||||
            token = (
 | 
					 | 
				
			||||||
                api.AccessToken("devkey", "secret")
 | 
					 | 
				
			||||||
                .with_identity("identity")
 | 
					 | 
				
			||||||
                .with_name("my name")
 | 
					 | 
				
			||||||
                .with_grants(
 | 
					 | 
				
			||||||
                    api.VideoGrants(
 | 
					 | 
				
			||||||
                        room_join=True,
 | 
					 | 
				
			||||||
                        room="my-room",
 | 
					 | 
				
			||||||
                    )
 | 
					 | 
				
			||||||
                )
 | 
					 | 
				
			||||||
            )
 | 
					 | 
				
			||||||
            return token.to_jwt()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # Create threads for each command and store handles
 | 
					        # Create threads for each command and store handles
 | 
				
			||||||
        interpreter_thread = threading.Thread(
 | 
					        interpreter_thread = threading.Thread(
 | 
				
			||||||
            target=run_command, args=("poetry run interpreter --server",)
 | 
					            target=run_command, args=("poetry run interpreter --server",)
 | 
				
			||||||
| 
						 | 
					@ -233,19 +219,17 @@ def _run(
 | 
				
			||||||
            thread.start()
 | 
					            thread.start()
 | 
				
			||||||
            time.sleep(7)
 | 
					            time.sleep(7)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        token = getToken()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # Create QR code
 | 
					        # Create QR code
 | 
				
			||||||
        if expose and domain:
 | 
					        if expose and domain:
 | 
				
			||||||
            listener = ngrok.forward("localhost:7880", authtoken_from_env=True, domain=domain)
 | 
					            listener = ngrok.forward("localhost:7880", authtoken_from_env=True, domain=domain)
 | 
				
			||||||
            url= listener.url()
 | 
					            url= listener.url()
 | 
				
			||||||
            print(url)
 | 
					            print(url)
 | 
				
			||||||
            content = json.dumps({"livekit_server": url, "token": token})
 | 
					            content = json.dumps({"livekit_server": url})
 | 
				
			||||||
        elif expose and not domain:
 | 
					        elif expose and not domain:
 | 
				
			||||||
            listener = ngrok.forward("localhost:7880", authtoken_from_env=True)
 | 
					            listener = ngrok.forward("localhost:7880", authtoken_from_env=True)
 | 
				
			||||||
            url= listener.url()
 | 
					            url= listener.url()
 | 
				
			||||||
            print(url)
 | 
					            print(url)
 | 
				
			||||||
            content = json.dumps({"livekit_server": url, "token": token})
 | 
					            content = json.dumps({"livekit_server": url})
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            # Get local IP address
 | 
					            # Get local IP address
 | 
				
			||||||
            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 | 
					            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 | 
				
			||||||
| 
						 | 
					@ -255,7 +239,7 @@ def _run(
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            url = f"ws://{ip_address}:7880"
 | 
					            url = f"ws://{ip_address}:7880"
 | 
				
			||||||
            print(url)
 | 
					            print(url)
 | 
				
			||||||
            content = json.dumps({"livekit_server": url, "token": token})
 | 
					            content = json.dumps({"livekit_server": url})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        qr_code = segno.make(content)
 | 
					        qr_code = segno.make(content)
 | 
				
			||||||
        qr_code.terminal(compact=True)
 | 
					        qr_code.terminal(compact=True)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue