finished block list endpoint for lan and added get data endpoint
This commit is contained in:
		
							parent
							
								
									e90d7e96f4
								
							
						
					
					
						commit
						d4f4487fb6
					
				
					 2 changed files with 16 additions and 1 deletions
				
			
		|  | @ -7,11 +7,13 @@ from flask import Flask | |||
| from flask import Response | ||||
| from gevent import sleep | ||||
| 
 | ||||
| from onionrblocks.onionrblockapi import Block | ||||
| from httpapi.fdsafehandler import FDSafeHandler | ||||
| from netcontroller import get_open_port | ||||
| import config | ||||
| from coredb.blockmetadb import get_block_list | ||||
| from lan.getip import lan_ips, best_ip | ||||
| from onionrutils import stringvalidators | ||||
| """ | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|  | @ -40,7 +42,13 @@ class LANServer: | |||
| 
 | ||||
|         @app.route('/blist/<time>') | ||||
|         def get_block_list_for_lan(time): | ||||
|             return Response(get_block_list(dateRec=time).split('\n')) | ||||
|             return Response('\n'.join(get_block_list(dateRec=time))) | ||||
| 
 | ||||
|         @app.route('/get/<block>') | ||||
|         def get_block_data(block): | ||||
|             if not stringvalidators.validate_hash(block): | ||||
|                 raise ValueError | ||||
|             return Response(Block(block).raw, mimetype='application/octet-stream') | ||||
| 
 | ||||
|         @app.route("/ping") | ||||
|         def ping(): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue