mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 03:17:43 +08:00
Merge pull request #1650 from rht/directory-listing-css
Bump version of dir-index-html
This commit is contained in:
commit
ebbf569ca6
@ -1,4 +1,5 @@
|
||||
//go:generate go-bindata -pkg=assets init-doc
|
||||
//go:generate go-bindata -pkg=assets init-doc ../vendor/dir-index-html-v1.0.0
|
||||
//go:generate gofmt -w bindata.go
|
||||
|
||||
package assets
|
||||
|
||||
@ -29,18 +30,12 @@ func SeedInitDocs(nd *core.IpfsNode) (*key.Key, error) {
|
||||
}
|
||||
|
||||
var initDirIndex = []string{
|
||||
"../vendor/src/QmeMZwyPnHMkvgdUNtdNcTX425gTCi5DCMeHLwTXbKoUB8/dir-index-html/knownIcons.txt",
|
||||
"../vendor/src/QmeMZwyPnHMkvgdUNtdNcTX425gTCi5DCMeHLwTXbKoUB8/dir-index-html/dir-index.html",
|
||||
"../vendor/dir-index-html-v1.0.0/knownIcons.txt",
|
||||
"../vendor/dir-index-html-v1.0.0/dir-index.html",
|
||||
}
|
||||
|
||||
var initGwAssets = []string{
|
||||
"gw-assets/icons.css",
|
||||
"gw-assets/bootstrap.min.css",
|
||||
}
|
||||
|
||||
// SeedGatewayAssets adds the list of embedded gateway inidex assets to the passed node, pins it and returns the root key
|
||||
func SeedGatewayAssets(nd *core.IpfsNode) (*key.Key, error) {
|
||||
return addAssetList(nd, initGwAssets)
|
||||
func SeedInitDirIndex(nd *core.IpfsNode) (*key.Key, error) {
|
||||
return addAssetList(nd, initDirIndex)
|
||||
}
|
||||
|
||||
func addAssetList(nd *core.IpfsNode, l []string) (*key.Key, error) {
|
||||
|
||||
@ -12,10 +12,6 @@ func TestEmbeddedDocs(t *testing.T) {
|
||||
testNFiles(initDocPaths, 6, t, "documents")
|
||||
}
|
||||
|
||||
func TestGatewayAssets(t *testing.T) {
|
||||
testNFiles(initGwAssets, 2, t, "assets")
|
||||
}
|
||||
|
||||
func TestDirIndex(t *testing.T) {
|
||||
testNFiles(initDirIndex, 2, t, "assets")
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
../vendor/src/QmeMZwyPnHMkvgdUNtdNcTX425gTCi5DCMeHLwTXbKoUB8/dir-index-html/gw-assets
|
||||
@ -172,16 +172,11 @@ func addDefaultAssets(out io.Writer, repoRoot string) error {
|
||||
}
|
||||
defer nd.Close()
|
||||
|
||||
gwAkey, err := assets.SeedGatewayAssets(nd)
|
||||
if err != nil {
|
||||
return fmt.Errorf("init: seeding init docs failed: %s", err)
|
||||
}
|
||||
log.Debugf("init: seeded gateway assets %s", gwAkey)
|
||||
|
||||
dkey, err := assets.SeedInitDocs(nd)
|
||||
if err != nil {
|
||||
return fmt.Errorf("init: seeding init docs failed: %s", err)
|
||||
}
|
||||
log.Debugf("init: seeded init docs %s", dkey)
|
||||
|
||||
if _, err = fmt.Fprintf(out, "to get started, enter:\n"); err != nil {
|
||||
return err
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
package corehttp
|
||||
|
||||
import (
|
||||
"github.com/ipfs/go-ipfs/assets"
|
||||
"html/template"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/ipfs/go-ipfs/assets"
|
||||
)
|
||||
|
||||
// structs for directory listing
|
||||
@ -23,7 +24,7 @@ type directoryItem struct {
|
||||
var listingTemplate *template.Template
|
||||
|
||||
func init() {
|
||||
assetPath := "../vendor/src/QmeMZwyPnHMkvgdUNtdNcTX425gTCi5DCMeHLwTXbKoUB8/dir-index-html/"
|
||||
assetPath := "../vendor/dir-index-html-v1.0.0/"
|
||||
knownIconsBytes, err := assets.Asset(assetPath + "knownIcons.txt")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "dir-index-html",
|
||||
"hash": "QmeMZwyPnHMkvgdUNtdNcTX425gTCi5DCMeHLwTXbKoUB8"
|
||||
"hash": "QmdDfkqDWheE4gsCXNrhixwTwSHnZMPT2cGLcNbiBNcMyU"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -65,11 +65,9 @@ test_expect_failure "ipfs repo gc fully reverse ipfs add" '
|
||||
'
|
||||
|
||||
test_expect_success "file no longer pinned" '
|
||||
# we expect the welcome files and gw assets to show up here
|
||||
# we expect the welcome files to show up here
|
||||
echo "$HASH_WELCOME_DOCS" >expected2 &&
|
||||
ipfs refs -r "$HASH_WELCOME_DOCS" >>expected2 &&
|
||||
echo "$HASH_GATEWAY_ASSETS" >>expected2 &&
|
||||
ipfs refs -r "$HASH_GATEWAY_ASSETS" >>expected2 &&
|
||||
EMPTY_DIR=QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn &&
|
||||
echo "$EMPTY_DIR" >>expected2 &&
|
||||
ipfs pin ls --type=recursive --quiet >actual2 &&
|
||||
@ -131,7 +129,6 @@ test_expect_success "adding multiblock random file succeeds" '
|
||||
test_expect_success "'ipfs pin ls --type=indirect' is correct" '
|
||||
ipfs refs "$MBLOCKHASH" >refsout &&
|
||||
ipfs refs -r "$HASH_WELCOME_DOCS" >>refsout &&
|
||||
ipfs refs -r "$HASH_GATEWAY_ASSETS" >>refsout &&
|
||||
sed -i="" "s/\(.*\)/\1 indirect/g" refsout &&
|
||||
ipfs pin ls --type=indirect >indirectpins &&
|
||||
test_sort_cmp refsout indirectpins
|
||||
@ -158,10 +155,8 @@ test_expect_success "'ipfs pin ls --type=direct' is correct" '
|
||||
test_expect_success "'ipfs pin ls --type=recursive' is correct" '
|
||||
echo "$MBLOCKHASH" >rp_expected &&
|
||||
echo "$HASH_WELCOME_DOCS" >>rp_expected &&
|
||||
echo "$HASH_GATEWAY_ASSETS" >>rp_expected &&
|
||||
echo "$EMPTY_DIR" >>rp_expected &&
|
||||
ipfs refs -r "$HASH_WELCOME_DOCS" >>rp_expected &&
|
||||
ipfs refs -r "$HASH_GATEWAY_ASSETS" >>rp_expected &&
|
||||
sed -i="" "s/\(.*\)/\1 recursive/g" rp_expected &&
|
||||
ipfs pin ls --type=recursive >rp_actual &&
|
||||
test_sort_cmp rp_expected rp_actual
|
||||
|
||||
1
vendor/QmdDfkqDWheE4gsCXNrhixwTwSHnZMPT2cGLcNbiBNcMyU/dir-index-html/.gxlastpubver
vendored
Normal file
1
vendor/QmdDfkqDWheE4gsCXNrhixwTwSHnZMPT2cGLcNbiBNcMyU/dir-index-html/.gxlastpubver
vendored
Normal file
@ -0,0 +1 @@
|
||||
QmeZ95gjQtxEbMbnttTiViadqjVb2JDZqQDsYQA4BBZpE4
|
||||
60
vendor/QmdDfkqDWheE4gsCXNrhixwTwSHnZMPT2cGLcNbiBNcMyU/dir-index-html/dir-index.html
vendored
Normal file
60
vendor/QmdDfkqDWheE4gsCXNrhixwTwSHnZMPT2cGLcNbiBNcMyU/dir-index-html/dir-index.html
vendored
Normal file
File diff suppressed because one or more lines are too long
1
vendor/dir-index-html-v1.0.0
vendored
Symbolic link
1
vendor/dir-index-html-v1.0.0
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
QmdDfkqDWheE4gsCXNrhixwTwSHnZMPT2cGLcNbiBNcMyU/dir-index-html
|
||||
@ -1 +0,0 @@
|
||||
QmeNXKecZ7CQagtkQUJxG3yS7UcvU6puS777dQsx3amkS7
|
||||
Loading…
Reference in New Issue
Block a user