Skip to content

Commit 8e0e8f1

Browse files
Merge pull request #62 from everFinance/develop
Develop
2 parents d777ad6 + 1534128 commit 8e0e8f1

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

api.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ func (s *Arseeding) runAPI(port string) {
7676
v1.GET("/bundle/fees", s.bundleFees)
7777
v1.GET("/bundle/fee/:size/:currency", s.bundleFee)
7878
v1.GET("/bundle/orders/:signer", s.getOrders)
79-
v1.GET("/:id", s.dataRoute) // get arTx data or bundleItem data
79+
v1.GET("/:id", s.dataRoute) // get arTx data or bundleItem data
80+
v1.HEAD("/:id", s.dataRoute) // get arTx data or bundleItem data
81+
v1.GET("/bridge/:id", s.dataBridgeToArio) // bridge to ario
82+
v1.HEAD("/bridge/:id", s.dataBridgeToArio) // bridge to ario
83+
8084
if s.EnableManifest {
8185
v1.POST("/manifest_url/:id", s.setManifestUrl)
8286
}
@@ -743,6 +747,18 @@ func (s *Arseeding) bundleFees(c *gin.Context) {
743747
c.JSON(http.StatusOK, s.bundlePerFeeMap)
744748
}
745749

750+
func (s *Arseeding) dataBridgeToArio(c *gin.Context) {
751+
txId := c.Param("id")
752+
tags, data, err := getArTxOrItemData(txId, s.store)
753+
if err != nil {
754+
c.JSON(http.StatusNotFound, "Not Found")
755+
return
756+
}
757+
contentLength := len(data)
758+
c.Header("x-content-length", strconv.Itoa(contentLength))
759+
c.Data(200, fmt.Sprintf("%s; charset=utf-8", getTagValue(tags, schema.ContentType)), data)
760+
}
761+
746762
func (s *Arseeding) dataRoute(c *gin.Context) {
747763
txId := c.Param("id")
748764
tags, data, err := getArTxOrItemData(txId, s.store)

middleware.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func CORSMiddleware() gin.HandlerFunc {
5858
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
5959
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
6060
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
61-
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
61+
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, HEAD")
6262

6363
if c.Request.Method == "OPTIONS" {
6464
c.AbortWithStatus(204)

schema/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
)
66

77
const (
8-
AllowMaxItemSize = 200 * 1024 * 1024 // 200 MB
8+
AllowMaxItemSize = 500 * 1024 * 1024 // 500 MB
99
AllowMaxNativeDataSize = 500 * 1024 * 1024 // 500 MB
10-
AllowMaxRespDataSize = 50 * 1024 * 1024 // 50 MB
10+
AllowMaxRespDataSize = 500 * 1024 * 1024 // 500 MB
1111
)
1212

1313
type RespOrder struct {

0 commit comments

Comments
 (0)