| 
									
										
										
										
											2022-04-04 09:29:54 +00:00
										 |  |  | __filename__ = "qrcode.py" | 
					
						
							|  |  |  | __author__ = "Bob Mottram" | 
					
						
							|  |  |  | __license__ = "AGPL3+" | 
					
						
							| 
									
										
										
										
											2024-12-22 23:37:30 +00:00
										 |  |  | __version__ = "1.6.0" | 
					
						
							| 
									
										
										
										
											2022-04-04 09:29:54 +00:00
										 |  |  | __maintainer__ = "Bob Mottram" | 
					
						
							|  |  |  | __email__ = "bob@libreserver.org" | 
					
						
							|  |  |  | __status__ = "Production" | 
					
						
							|  |  |  | __module_group__ = "Core" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import pyqrcode | 
					
						
							| 
									
										
										
										
											2024-05-12 12:35:26 +00:00
										 |  |  | from utils import data_dir | 
					
						
							| 
									
										
										
										
											2022-04-04 09:29:54 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def save_domain_qrcode(base_dir: str, http_prefix: str, | 
					
						
							| 
									
										
										
										
											2024-05-01 10:22:31 +00:00
										 |  |  |                        domain_full: str, scale: int) -> None: | 
					
						
							| 
									
										
										
										
											2022-04-04 09:29:54 +00:00
										 |  |  |     """Saves a qrcode image for the domain name
 | 
					
						
							|  |  |  |     This helps to transfer onion or i2p domains to a mobile device | 
					
						
							|  |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2024-05-12 12:35:26 +00:00
										 |  |  |     qrcode_filename = data_dir(base_dir) + '/qrcode.png' | 
					
						
							| 
									
										
										
										
											2022-04-04 09:29:54 +00:00
										 |  |  |     url = pyqrcode.create(http_prefix + '://' + domain_full) | 
					
						
							|  |  |  |     url.png(qrcode_filename, scale) |