Skip to content

Commit

Permalink
refactor: move gateway to go-libipfs
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Jan 27, 2023
1 parent 8e32707 commit 29da615
Show file tree
Hide file tree
Showing 45 changed files with 1,411 additions and 2,687 deletions.
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Code owners are automatically requested for review when someone opens a pull
# request that modifies code that they own. Code owners are not automatically
# requested to review draft pull requests.

# HTTP Gateway
gateway/ @lidel @hacdias
4 changes: 2 additions & 2 deletions gateway/core/corehttp/gateway/README.md → gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Documentation

* Go Documentation: https://pkg.go.dev/github.com/ipfs/kubo/core/corehttp/gateway
* Go Documentation: https://pkg.go.dev/github.com/ipfs/go-libipfs/gateway

## Example

Expand Down Expand Up @@ -32,4 +32,4 @@ mux.Handle("/ipns/", gwHandler)
// Start the server on :8080 and voilá! You have an IPFS gateway running
// in http://localhost:8080.
_ = http.ListenAndServe(":8080", mux)
```
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions gateway/assets/test/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module gateway-test

go 1.19
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"net/http"
"net/url"
"os"

"github.com/ipfs/kubo/core/corehttp/gateway/assets"
)

const (
Expand All @@ -17,10 +15,10 @@ const (
testPath = "/ipfs/QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7/a/b/c"
)

var directoryTestData = assets.DirectoryTemplateData{
var directoryTestData = DirectoryTemplateData{
GatewayURL: "//localhost:3000",
DNSLink: true,
Listing: []assets.DirectoryItem{{
Listing: []DirectoryItem{{
Size: "25 MiB",
Name: "short-film.mov",
Path: testPath + "/short-film.mov",
Expand All @@ -41,7 +39,7 @@ var directoryTestData = assets.DirectoryTemplateData{
}},
Size: "25 MiB",
Path: testPath,
Breadcrumbs: []assets.Breadcrumb{{
Breadcrumbs: []Breadcrumb{{
Name: "ipfs",
}, {
Name: "QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7",
Expand All @@ -60,7 +58,7 @@ var directoryTestData = assets.DirectoryTemplateData{
Hash: "QmFooBazBar2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7",
}

var dagTestData = assets.DagTemplateData{
var dagTestData = DagTemplateData{
Path: "/ipfs/baguqeerabn4wonmz6icnk7dfckuizcsf4e4igua2ohdboecku225xxmujepa",
CID: "baguqeerabn4wonmz6icnk7dfckuizcsf4e4igua2ohdboecku225xxmujepa",
CodecName: "dag-json",
Expand Down Expand Up @@ -124,3 +122,35 @@ func main() {
fmt.Printf("listening on localhost:3000\n")
_ = http.ListenAndServe("localhost:3000", mux)
}

// Copied from ../assets.go
type DagTemplateData struct {
Path string
CID string
CodecName string
CodecHex string
}

type DirectoryTemplateData struct {
GatewayURL string
DNSLink bool
Listing []DirectoryItem
Size string
Path string
Breadcrumbs []Breadcrumb
BackLink string
Hash string
}

type DirectoryItem struct {
Size string
Name string
Path string
Hash string
ShortHash string
}

type Breadcrumb struct {
Name string
Path string
}
193 changes: 0 additions & 193 deletions gateway/core/corehttp/commands.go

This file was deleted.

Loading

0 comments on commit 29da615

Please sign in to comment.