From df92aca58c25bc38db669ead8a83204c00c887fc Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Tue, 28 Jul 2020 16:16:00 +0200 Subject: [PATCH 1/9] fix: run CI checks on PRs (#41) --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a9ee3ce..f852196 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,5 @@ name: Build -on: - push: +on: [push, pull_request] jobs: no-uncommitted-changes: From dc0400b2c84bed0927b46100a7bbe0cb6e56f50a Mon Sep 17 00:00:00 2001 From: Jessica Schilling Date: Mon, 24 Aug 2020 12:10:24 -0600 Subject: [PATCH 2/9] Create CHANGELOG.md --- CHANGELOG.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..47e8bd5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,54 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.0] - 2020-08-03 +This release streamlines the process for making future updates to this repo: + +- Moves source-of-truth HTML and CSS files into new `src` directory ([details](https://github.com/ipfs/dir-index-html/pull/40#issue-456530181)) +- Adds build script in `package.json` to generate minified/inlined `dir-index.html` at top level from individual files in `src` directory ([details](https://github.com/ipfs/dir-index-html/pull/40#issue-456530181)) +- Adds GitHub Action to guard against committing state where `dir-index.html` does not match source materials in `src` ([details](https://github.com/ipfs/dir-index-html/pull/40#pullrequestreview-456126397)) + +## [v1.1.0] - 2020-07-24 +This release brings general tidying, plus some substantial UI enhancements! Big thanks to @neatonk for all the work. + +- Adds a column for CIDs between the name and size columns; CIDs are clickable links that open the item as a new "root path", enabling users to copy direct links to images or subdirectories (see https://github.com/ipfs/dir-index-html/issues/37 and https://github.com/ipfs/dir-index-html/issues/15) +- Adds the size of the current directory to the header of the table (see https://github.com/ipfs/dir-index-html/issues/37 and https://github.com/ipfs/dir-index-html/issues/25) +- Makes path components in table headers into links, so clicking on segments between directory slashes will go to that level of the directory tree (see https://github.com/ipfs/dir-index-html/issues/37 and https://github.com/ipfs/dir-index-html/issues/2) +- Updates tests to include testing the above (see https://github.com/ipfs/dir-index-html/pull/38) +- Reconciles legacy discrepancies between `dir-index.html` and `dir-index-uncat.html` (see https://github.com/ipfs/dir-index-html/pull/39) + + +## [v1.0.6] - 2020-06-25 +- Adds favicon: visual consistency/prettiness, but more importantly prevents 404 error on an implicit /favicon.ico (see [#35](https://github.com/ipfs/dir-index-html/issues/35)) +- Adds social sharing metadata (see [#34](https://github.com/ipfs/dir-index-html/issues/34)) +- Updates contributing link in readme (thanks @stensonb!) + + +## [v1.0.5] - 2020-05-05 + +- Removes extraneous references to Glyphicons (closes [#23](https://github.com/ipfs/dir-index-html/issues/23)) +- Makes page responsive overall (closes [#24](https://github.com/ipfs/dir-index-html/issues/24)) +- Adds file icons for .wmv, .mov, .mkv (closes [#19](https://github.com/ipfs/dir-index-html/issues/19)) +- Strips out unneeded CSS +- Makes colors more accessible consistent with those in ipfs-css +- Tidies up in general + + +## [v1.0.4] - 2020-04-21 +- Update style to match IPFS branding +- Add links to ipfs.io, install help, and the bug tracker + + +## [v1.0.3] - 2016-08-31 +- No release notes added + + +## [v1.0.2] - 2016-08-31 +- No release notes added + + +## [v1.0.1] - 2016-08-31 +- No release notes added From 3f67a8105aa799b8ce0d79775d143601ed4a238b Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Sat, 26 Sep 2020 02:59:44 +0200 Subject: [PATCH 3/9] feat: improved CID column - Links to direct CIDs now have ?filename= param to preserve name and content type - When page is loaded on DNSLink website (based on Host header) then there is no public gateway endpoint. As a replacement, clicking on a CID opens it at cid.ipfs.io Context: https://github.com/ipfs/dir-index-html/issues/42 Closes #42 --- dir-index.html | 4 ++-- package.json | 1 + src/dir-index.html | 2 +- test/main.go | 16 ++++++++++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dir-index.html b/dir-index.html index e948603..64bab52 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 2390a11..858f5d0 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 a399152..81c926f 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 fc32083..c02523a 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, From b12c35a229dbb9ecb4aa6cb9459951972155221c Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Sat, 26 Sep 2020 03:14:10 +0200 Subject: [PATCH 4/9] fix(ci): avoid uncommited changes with custom shells for some reason `-e` gets interpreted literally at CI. This removes its use making the output look the same everywhere. CI will now show diff if uncommited changes to make it easier to see what caused CI to fail. --- .github/workflows/build.yml | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f852196..100a5af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,10 +12,10 @@ jobs: uses: actions/setup-node@v1 with: node-version: '12.x' - - run: npm run build + - run: npm run build - name: Check working tree id: changes uses: UnicornGlobal/has-changes-action@v1.0.11 - name: Check for uncommited changes if: steps.changes.outputs.changed == 1 - run: git status && echo "Output does not match src/, uncommitted changes exist, follow build instructions from README" && exit 1 + run: git status && git --no-pager diff --patch-with-raw && echo "Output does not match src/, uncommitted changes exist, follow build instructions from README" && exit 1 diff --git a/package.json b/package.json index 858f5d0..8769b4b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "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", - "build:minify-wrap-css": "(echo \"\") > ./minified-wrapped-style.html", + "build:minify-wrap-css": "(echo \"\") > ./minified-wrapped-style.html", "build:combine-html-css": "sed '// r ./minified-wrapped-style.html' ./base-html.html > ./dir-index.html", "build:remove-unused": "rm ./base-html.html && rm ./minified-wrapped-style.html" } From 594c218e013607f608ff679c0ac8608675410945 Mon Sep 17 00:00:00 2001 From: Jessica Schilling Date: Mon, 28 Sep 2020 16:03:09 -0600 Subject: [PATCH 5/9] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8769b4b..585e495 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "dir-index-html", "author": "lgierth", "description": "Directory listing HTML for go-ipfs gateways", - "version": "1.2.0", + "version": "1.2.1", "homepage": "https://github.com/ipfs/dir-index-html#readme", "bugs": { "url": "https://github.com/ipfs/dir-index-html" From 4ca119cefad669ec7549a027b289ecbc99a3f657 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Fri, 1 Oct 2021 08:51:45 -0500 Subject: [PATCH 6/9] fix: avoid unnecessary css parsing (#53) Closes #52 --- dir-index.html | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dir-index.html b/dir-index.html index 64bab52..4f902df 100644 --- a/dir-index.html +++ b/dir-index.html @@ -2,9 +2,6 @@ {{ $root := . }} - @@ -21,6 +18,9 @@ Codestin Search App +