diff --git a/dir-index.html b/dir-index.html index e948603bfc4331530b8b49a8f02764445a9fc4e5..64bab523a1014b9a3ef7f25df2ccc5451da7829c 100644 --- a/dir-index.html +++ b/dir-index.html @@ -3,7 +3,7 @@ @@ -82,7 +82,7 @@ {{ if .Hash }} - + {{ .ShortHash }} {{ end }} diff --git a/package.json b/package.json index 2390a11051fd7195797f9777cad6d04b0466abf4..858f5d0110d1ee1e3ce501408e6a401bac72c48a 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "license": "MIT", "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", "scripts": { + "start": "cd test && go run .", "build": "npm run build:clean && npm run build:remove-style-links && npm run build:minify-wrap-css && npm run build:combine-html-css && npm run build:remove-unused", "build:clean": "rm dir-index.html", "build:remove-style-links": "sed '/ ./base-html.html", diff --git a/src/dir-index.html b/src/dir-index.html index a399152c2060d994a7e71d8e283390cc83531edc..81c926f71f7984d5335ba564f6f3f2e5e21ad23d 100644 --- a/src/dir-index.html +++ b/src/dir-index.html @@ -81,7 +81,7 @@ {{ if .Hash }} - + {{ .ShortHash }} {{ end }} diff --git a/test/main.go b/test/main.go index fc3208335c8492edec1b4f279943d4fca9f4b1b6..c02523a9f40ad8a7aaf54271f9e52ba19265e25b 100644 --- a/test/main.go +++ b/test/main.go @@ -13,6 +13,7 @@ const templateFile = "../dir-index.html" // Copied from go-ipfs/core/corehttp/gateway_indexPage.go type listingTemplateData struct { GatewayURL string + DNSLink bool Listing []directoryItem Size string Path string @@ -37,18 +38,25 @@ type breadcrumb struct { var testPath = "/ipfs/QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7/a/b/c" var testData = listingTemplateData{ GatewayURL: "//localhost:3000", + DNSLink: true, Listing: []directoryItem{{ Size: "25 MiB", Name: "short-film.mov", Path: testPath + "/short-film.mov", - Hash: "QmQuxBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", - ShortHash: "QmQu\u2026xDu7", + Hash: "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR", + ShortHash: "QmbW\u2026sMnR", + }, { + Size: "23 KiB", + Name: "250pxيوسف_الوزاني_صورة_ملتقطة_بواسطة_مرصد_هابل_الفضائي_توضح_سديم_السرطان،_وهو_بقايا_مستعر_أعظم._.jpg", + Path: testPath + "/250pxيوسف_الوزاني_صورة_ملتقطة_بواسطة_مرصد_هابل_الفضائي_توضح_سديم_السرطان،_وهو_بقايا_مستعر_أعظم._.jpg", + Hash: "QmUwrKrMTrNv8QjWGKMMH5QV9FMPUtRCoQ6zxTdgxATQW6", + ShortHash: "QmUw\u2026TQW6", }, { Size: "1 KiB", Name: "this-piece-of-papers-got-47-words-37-sentences-58-words-we-wanna-know.txt", Path: testPath + "/this-piece-of-papers-got-47-words-37-sentences-58-words-we-wanna-know.txt", - Hash: "QmquXbaRQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", - ShortHash: "Qmqu\u2026xDu7", + Hash: "bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi", + ShortHash: "bafy\u2026bzdi", }}, Size: "25 MiB", Path: testPath,