dev@locazia: remove accept type whitelist
This commit is contained in:
1 parent
a75dc3f31a
commit
88583ddc4e
3 files changed
+16
-2
No files matched your search
+3
-1
@@ -15,7 +15,8 @@ from app.api.routes._index import s_index, s_favicon
|
||||
from app.api.routes._system import s_api_v1_node, s_api_system_version, s_api_system_send_status
|
||||
from app.api.routes.auth import s_api_v1_auth_twa
|
||||
from app.api.routes.statics import s_api_tonconnect_manifest, s_api_platform_metadata
|
||||
from app.api.routes.node_storage import s_api_v1_storage_post, s_api_v1_storage_get
|
||||
from app.api.routes.node_storage import s_api_v1_storage_post, s_api_v1_storage_get, \
|
||||
s_api_v1_storage_decode_cid
|
||||
from app.api.routes.account import s_api_v1_account_get
|
||||
from app.api.routes._blockchain import s_api_v1_blockchain_send_new_content_message, \
|
||||
s_api_v1_blockchain_send_purchase_content_message
|
||||
@@ -35,6 +36,7 @@ app.add_route(s_api_v1_auth_twa, "/api/v1/auth.twa", methods=["POST", "OPTIONS"]
|
||||
|
||||
app.add_route(s_api_v1_storage_post, "/api/v1/storage", methods=["POST", "OPTIONS"])
|
||||
app.add_route(s_api_v1_storage_get, "/api/v1/storage/<file_hash>", methods=["GET", "OPTIONS"])
|
||||
app.add_route(s_api_v1_storage_decode_cid, "/api/v1/storage.decodeContentId/<content_id>", methods=["GET", "OPTIONS"])
|
||||
|
||||
app.add_route(s_api_v1_account_get, "/api/v1/account", methods=["GET", "OPTIONS"])
|
||||
|
||||
|
||||
@@ -98,3 +98,15 @@ async def s_api_v1_storage_get(request, file_hash=None):
|
||||
return response.json({"error": "File not found"}, status=404)
|
||||
|
||||
return await response.file(file_path)
|
||||
|
||||
|
||||
async def s_api_v1_storage_decode_cid(request, content_id=None):
|
||||
cid, errmsg = resolve_content(content_id)
|
||||
if errmsg:
|
||||
return response.json({"error": errmsg}, status=400)
|
||||
|
||||
return response.json({
|
||||
"content_hash": b58encode(cid.content_hash).decode(),
|
||||
"onchain_index": cid.onchain_index,
|
||||
"accept_type": cid.accept_type,
|
||||
})
|
||||
Reference in new issue
Block a user