mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-29 02:28:57 +01:00 
			
		
		
		
	configurable port plus support for SSL
This commit is contained in:
		
							parent
							
								
									f80f073874
								
							
						
					
					
						commit
						3c924afbca
					
				
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -5,4 +5,6 @@ npm-debug.log | ||||
| yarn-error.log | ||||
| app.pyc | ||||
| demo.ncdb | ||||
| config.ini | ||||
| config.ini | ||||
| cert.key | ||||
| cert.crt | ||||
| @ -1,8 +1,13 @@ | ||||
| [Network] | ||||
| port=5000 | ||||
| certPath=cert.crt | ||||
| certKeyPath=cert.key | ||||
| 
 | ||||
| [Login] | ||||
| # Enter below credentials with with which you want to authenticate to Notecase web app | ||||
| username=adam | ||||
| username=your_username | ||||
| # This is bcrypt password hash. You can use generate-password.py (in this directory) to hash your password | ||||
| password-hash=$2b$12$4Ia5lYbbpOv3pxxdoDgjUeAJ9z4FhqyEhhX52ra78FH03wPGx8zGu | ||||
| password-hash=$2b$12$FHT8keXp3BGTfzAV/VnrkuLpkwN8Vpj5iIh4RwCbHTNWYSBI9hGAK | ||||
| 
 | ||||
| [Sync] | ||||
| sync-server-url=https://localhost:57201 | ||||
|  | ||||
							
								
								
									
										16
									
								
								generate-cert.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								generate-cert.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | ||||
| #!/bin/bash | ||||
| 
 | ||||
| openssl genrsa -des3 -out cert.key 2048 | ||||
| 
 | ||||
| openssl req -new -key cert.key -out cert.csr | ||||
| 
 | ||||
| # Remove passphrase from key | ||||
| cp cert.key cert.key.org | ||||
| 
 | ||||
| openssl rsa -in cert.key.org -out cert.key | ||||
| 
 | ||||
| # Generate self signed certificate | ||||
| openssl x509 -req -days 730 -in cert.csr -signkey cert.key -out cert.crt | ||||
| 
 | ||||
| rm cert.key.org | ||||
| rm cert.csr | ||||
							
								
								
									
										6
									
								
								run-debug.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								run-debug.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| export FLASK_DEBUG=0 | ||||
| export FLASK_APP=src/app.py | ||||
| 
 | ||||
| flask run | ||||
							
								
								
									
										2
									
								
								run.sh
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								run.sh
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| export FLASK_DEBUG=1 | ||||
| export FLASK_DEBUG=0 | ||||
| export FLASK_APP=src/app.py | ||||
| 
 | ||||
| flask run | ||||
| @ -42,6 +42,10 @@ config.read('config.ini') | ||||
| user = User() | ||||
| user.id = config['Login']['username'] | ||||
| 
 | ||||
| port = config['Network']['port'] | ||||
| certPath = config['Network']['certPath'] | ||||
| certKeyPath = config['Network']['certKeyPath'] | ||||
| 
 | ||||
| hashedPassword = config['Login']['password-hash'].encode('utf-8') | ||||
| 
 | ||||
| @app.route('/login', methods=['POST']) | ||||
| @ -85,5 +89,5 @@ def load_user(user_id): | ||||
| 
 | ||||
| api.add_resource(Notes, '/notes/<string:note_id>') | ||||
| 
 | ||||
| if __name__ == '__main__': | ||||
|     app.run(host='0.0.0.0') | ||||
| if __name__ == "__main__": | ||||
|     app.run(host='0.0.0.0', port=port, ssl_context = (certPath, certKeyPath)) | ||||
| @ -44,7 +44,7 @@ | ||||
|         </div> | ||||
|     </div> | ||||
|      | ||||
|     <link href="static/lib/bootstrap/css/bootstrap.css" rel="stylesheet"> | ||||
|     <script src="static/lib/bootstrap/js/bootstrap.js"></script> | ||||
|     <link href="stat/lib/bootstrap/css/bootstrap.css" rel="stylesheet"> | ||||
|     <script src="stat/lib/bootstrap/js/bootstrap.js"></script> | ||||
|   </body> | ||||
| </html> | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 azivner
						azivner