assets

package
v0.0.0-...-c0cc0bc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 0

README

Required Assets for the Gateway

DAG and Directory HTML for HTTP gateway

Updating

When making updates to the templates, please note the following:

  1. Make your changes to the (human-friendly) source documents in the src directory.
  2. Before testing or releasing, go to assets/ and run go generate ..

Testing

  1. Make sure you have Go installed
  2. Start the test server, which lives in its own directory:
> cd test
> go run .

This will listen on localhost:3000 and reload the template every time you refresh the page. Here you have two pages:

If you get a "no such file or directory" error upon trying go run ., make sure you ran go generate . to generate the minified artifact that the test is looking for.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DirectoryTemplate *template.Template
	DagTemplate       *template.Template
)
View Source
var AssetHash string

AssetHash a non-cryptographic hash of all embedded assets

Functions

func HasDNSLinkOrigin

func HasDNSLinkOrigin(gwURL string, path string) bool

helper to detect DNSLink website context (when hostname from gwURL is matching /btns/<fqdn> in path)

func ShortHash

func ShortHash(hash string) string

Types

type Breadcrumb struct {
	Name string
	Path string
}
func Breadcrumbs(urlPath string, dnslinkOrigin bool) []Breadcrumb

type DagTemplateData

type DagTemplateData struct {
	Path      string
	CID       string
	CodecName string
	CodecHex  string
}

type DirectoryItem

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

type DirectoryTemplateData

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL