syncing with web-ui
This commit is contained in:
		| @@ -20,6 +20,11 @@ def index(): | |||||||
| def wifi_setup(): | def wifi_setup(): | ||||||
|     return render_template('wifi.html', title='Wifi-setup') |     return render_template('wifi.html', title='Wifi-setup') | ||||||
|  |  | ||||||
|  | # SSH file | ||||||
|  | @app.route('/create_ssh') | ||||||
|  | def create_ssh(): | ||||||
|  |     return render_template('create_ssh.html', title='SSH file generator') | ||||||
|  |  | ||||||
|  |  | ||||||
| # Inkycal-setup | # Inkycal-setup | ||||||
| @app.route('/inkycal-config-v2-0-0', methods=['GET', 'POST']) | @app.route('/inkycal-config-v2-0-0', methods=['GET', 'POST']) | ||||||
|   | |||||||
| @@ -31,11 +31,17 @@ | |||||||
|                         </li> |                         </li> | ||||||
|  |  | ||||||
|                         <li class="nav-item"> |                         <li class="nav-item"> | ||||||
|                             <a class="nav-link" href="/inkycal-config-v2-0-0">Setup</a> |                             <a class="nav-link" href="/inkycal-config-v2-0-0">Create settings file</a> | ||||||
|                         </li> |                         </li> | ||||||
|  |  | ||||||
|                         <li class="nav-item"> |                         <li class="nav-item"> | ||||||
|                             <a class="nav-link" href="/setup_wifi">WiFi-setup</a> |                             <a class="nav-link" href="/setup_wifi">Setup Wifi</a> | ||||||
|                         </li> |                         </li> | ||||||
|  |  | ||||||
|  |                         <li class="nav-item"> | ||||||
|  |                             <a class="nav-link" href="/create_ssh">Setup SSH</a> | ||||||
|  |                         </li> | ||||||
|  |  | ||||||
|                     </ul> |                     </ul> | ||||||
|                 </div> |                 </div> | ||||||
|             </div> |             </div> | ||||||
|   | |||||||
							
								
								
									
										47
									
								
								server/app/templates/create_ssh.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								server/app/templates/create_ssh.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | |||||||
|  | {% extends "base.html" %} | ||||||
|  |  | ||||||
|  | <!-- Main container --> | ||||||
|  | {% block content %} | ||||||
|  |  | ||||||
|  | <!-- Wrap everything in a container--> | ||||||
|  | <div class="container"> | ||||||
|  |  | ||||||
|  | <!-- heading --> | ||||||
|  | <h3>SSH file generator</h3> | ||||||
|  |  | ||||||
|  | <!-- Instructions --> | ||||||
|  | <div class="alert alert-primary" role="alert"> | ||||||
|  |     <h4 class="alert-heading">Instructions</h4> | ||||||
|  |     After flashing your microSD card with Raspberry Pi OS, click on Download SSH file. <br> | ||||||
|  |     Place the generated file in the /BOOT folder to enable ssh.<br> | ||||||
|  |     At the next boot, ssh will be enabled and this file will be deleted. | ||||||
|  |     <hr> | ||||||
|  |     You can now access the Raspberry Pi via it's IP address using a SSH Client of your choice.<br> | ||||||
|  |     If you don't know the IP address, you can try using: raspberrypi.local<br> | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  | <!-- Create a hidden div to prevent a fully empty file --> | ||||||
|  | <div id='ssh' hidden># nothing in here</div> | ||||||
|  |  | ||||||
|  | <div class="form-group"> | ||||||
|  |     <button type="button" class="btn btn-primary" onclick="getHTML('ssh.txt', 'ssh', 'text/plain')">Download SSH file</button> | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  | <script> | ||||||
|  | function getHTML(filename, id, mimeType) { | ||||||
|  | var elHtml = document.getElementById(id).innerText; | ||||||
|  | if (navigator.msSaveBlob) { | ||||||
|  |   navigator.msSaveBlob(new Blob([elHtml], { type: mimeType + ';charset=utf-8;' }), filename); | ||||||
|  | } else { | ||||||
|  |     var link = document.createElement('a'); | ||||||
|  |     mimeType = mimeType || 'text/plain'; | ||||||
|  |     link.setAttribute('download', filename); | ||||||
|  |     link.setAttribute('href', 'data:' + mimeType  +  ';charset=utf-8,' + encodeURIComponent(elHtml)); | ||||||
|  |     link.click(); | ||||||
|  | }} | ||||||
|  | </script> | ||||||
|  |  | ||||||
|  |  | ||||||
|  | </div> | ||||||
|  |  | ||||||
|  | {% endblock %} | ||||||
		Reference in New Issue
	
	Block a user