diff --git a/assets/dag-index-html/README.md b/assets/dag-index-html/README.md new file mode 100644 index 00000000000..de38a9504a1 --- /dev/null +++ b/assets/dag-index-html/README.md @@ -0,0 +1,3 @@ +# dag-index-html + +> HTML representation for non-UnixFS DAGs such as DAG-CBOR. diff --git a/assets/dag-index-html/index.go b/assets/dag-index-html/index.go new file mode 100644 index 00000000000..214b06a3822 --- /dev/null +++ b/assets/dag-index-html/index.go @@ -0,0 +1,81 @@ +package dagindexhtml + +import "html/template" + +// TODO: DagIndexTemplate - replace static CSS with shared one with ../dir-index-html + +// DagIndexTemplate is HTML-based template for non-UnixFS DAGs when request was +// made with Accept: text/html (web browsers). +var DagIndexTemplate = template.Must(template.New("redirect").Parse(` + + + + + + + + + + + + + + + + + + {{ .Path }} + + + + +
+
+

CID: {{.CID}}
+ Codec: {{.CodecName}} ({{.CodecHex}})

+
+
+ + + + + + + +
+

Preview as JSON
(application/json)

+
+

Or download as: +

+

+
+
+
+ +`)) + +type DagIndexTemplateData struct { + Path string + CID string + CodecName string + CodecHex string +} diff --git a/assets/dir-index-html/README.md b/assets/dir-index-html/README.md index ad5fa68b2db..3dd45eb5905 100644 --- a/assets/dir-index-html/README.md +++ b/assets/dir-index-html/README.md @@ -1,6 +1,6 @@ # dir-index-html -> Directory listing HTML for `go-ipfs` gateways +> Directory listing HTML for HTTP gateway ![](https://user-images.githubusercontent.com/157609/88379209-ce6f0600-cda2-11ea-9620-20b9237bb441.png) diff --git a/assets/dir-index-html/dir-index.html b/assets/dir-index-html/dir-index.html index a2d662d19c7..1d00e5fe73f 100644 --- a/assets/dir-index-html/dir-index.html +++ b/assets/dir-index-html/dir-index.html @@ -26,12 +26,12 @@