forked from TrueCloudLab/frostfs-http-gw
[#XX] poc
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
fc86ab3511
commit
db31e6f510
3 changed files with 32 additions and 0 deletions
|
@ -593,6 +593,10 @@ func (a *app) configureRouter(handler *handler.Handler) {
|
|||
r.POST("/upload/{cid}", a.tracer(a.logger(a.canonicalizer(a.tokenizer(a.reqNamespace(handler.Upload))))))
|
||||
a.log.Info(logs.AddedPathUploadCid)
|
||||
r.GET("/get/{cid}/{oid:*}", a.tracer(a.logger(a.canonicalizer(a.tokenizer(a.reqNamespace(handler.DownloadByAddressOrBucketName))))))
|
||||
r.OPTIONS("/get/{cid}/{oid:*}", func(ctx *fasthttp.RequestCtx) {
|
||||
ctx.Response.Header.Set(fasthttp.HeaderAccessControlAllowOrigin, "*")
|
||||
ctx.Response.Header.Set(fasthttp.HeaderAccessControlAllowHeaders, "Authorization")
|
||||
})
|
||||
r.HEAD("/get/{cid}/{oid:*}", a.tracer(a.logger(a.canonicalizer(a.tokenizer(a.reqNamespace(handler.HeadByAddressOrBucketName))))))
|
||||
a.log.Info(logs.AddedPathGetCidOid)
|
||||
r.GET("/get_by_attribute/{cid}/{attr_key}/{attr_val:*}", a.tracer(a.logger(a.canonicalizer(a.tokenizer(a.reqNamespace(handler.DownloadByAttribute))))))
|
||||
|
|
|
@ -120,6 +120,7 @@ func (h *Handler) receiveFile(ctx context.Context, req request, objAddress oid.A
|
|||
|
||||
req.setDisposition(shouldDownload, filename)
|
||||
|
||||
req.Response.Header.Set(fasthttp.HeaderAccessControlAllowOrigin, "*")
|
||||
req.Response.Header.Set(fasthttp.HeaderContentLength, strconv.FormatUint(payloadSize, 10))
|
||||
|
||||
if len(contentType) == 0 {
|
||||
|
|
27
web/index.html
Normal file
27
web/index.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>HLS DEMO</title>
|
||||
|
||||
<script type="module" src="https://cdn.jsdelivr.net/npm/@vime/core@^5/dist/vime/vime.esm.js"></script>
|
||||
|
||||
<script>
|
||||
// document.cookie = "Bearer=CiQSGwoZNer6BLA9gR/BkHhEjaslCQwAOIB61j6S4RoDCJBOIAESZgohAxpsb7vfAso1F0X6hrm6WpRS14WsT3/Ct1SMoqRsT89KEkEEvePlLHzzI93xPbdiCwUPZdegyGrAaSOzPrH/sMPU1wpwR1pD5+jW3XnheX1CN1d1AnnJtXSPAbCgt9h2PWp8Og==; path=/";
|
||||
|
||||
var origSend = XMLHttpRequest.prototype.send;
|
||||
XMLHttpRequest.prototype.send = function () {
|
||||
this.setRequestHeader('Authorization', 'Bearer CiQSGwoZNer6BLA9gR/BkHhEjaslCQwAOIB61j6S4RoDCJBOIAESZgohAxpsb7vfAso1F0X6hrm6WpRS14WsT3/Ct1SMoqRsT89KEkEEvePlLHzzI93xPbdiCwUPZdegyGrAaSOzPrH/sMPU1wpwR1pD5+jW3XnheX1CN1d1AnnJtXSPAbCgt9h2PWp8Og==')
|
||||
origSend.apply(this, arguments);
|
||||
};
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<vm-player controls debug="true">
|
||||
<vm-hls version="latest" crossOrigin="use-credentials">
|
||||
<source data-src="http://localhost:8082/get/hls/index.m3u8" type="application/x-mpegURL"/>
|
||||
</vm-hls>
|
||||
</vm-player>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue