From beb1120fde2f33fef0e2967f1cba9ab7526b2fcb Mon Sep 17 00:00:00 2001 From: Kevin Neaton Date: Wed, 1 Jul 2020 21:50:27 -0400 Subject: [PATCH 01/37] Display viewed directory's size --- dir-index.html | 65 +++++++++++++++++++++++++++++++++----------------- test/main.go | 2 ++ 2 files changed, 45 insertions(+), 22 deletions(-) diff --git a/dir-index.html b/dir-index.html index 945c1a1..2e5d507 100644 --- a/dir-index.html +++ b/dir-index.html @@ -20,6 +20,20 @@ + Codestin Search App @@ -39,7 +53,8 @@
-
+
+
Index of {{ .Path }} {{ if .Hash }}
@@ -47,28 +62,34 @@
{{ end }}
- - - - - - - {{ range .Listing }} - - - - - + {{ if .Size }} +
+  {{ .Size }} +
+ {{ end }} + +
-
 
-
- .. -
-
 
-
- {{ .Name }} - {{ .Size }}
+ + + + + + {{ range .Listing }} + + + + + {{ end }} -
+
 
+
+ .. +
+
 
+
+ {{ .Name }} + {{ .Size }}
+
diff --git a/test/main.go b/test/main.go index 22ea895..e4a4153 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 { Listing []directoryItem + Size string Path string BackLink string Hash string @@ -34,6 +35,7 @@ var testData = listingTemplateData{ Name: "this-piece-of-papers-got-47-words-37-sentences-58-words-we-wanna-know.txt", Path: "this-piece-of-papers-got-47-words-37-sentences-58-words-we-wanna-know.txt", }}, + Size: "25 MiB", Path: "/ipfs/QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm", BackLink: "/..", Hash: "QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm", From 8c03fc4579b8a65b019629eab08573c10b299285 Mon Sep 17 00:00:00 2001 From: Kevin Neaton Date: Thu, 2 Jul 2020 20:44:26 -0400 Subject: [PATCH 02/37] Make path components into links --- dir-index.html | 9 ++++++++- test/main.go | 32 +++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/dir-index.html b/dir-index.html index 2e5d507..7f2ce11 100644 --- a/dir-index.html +++ b/dir-index.html @@ -55,7 +55,14 @@
- Index of {{ .Path }} + + Index of + {{ range .Breadcrumbs -}} + /{{ if .Path }}{{ .Name }}{{ else }}{{ .Name }}{{ end }} + {{- else }} + {{ .Path }} + {{ end }} + {{ if .Hash }}
{{ .Hash }} diff --git a/test/main.go b/test/main.go index e4a4153..6c851ae 100644 --- a/test/main.go +++ b/test/main.go @@ -15,6 +15,7 @@ type listingTemplateData struct { Listing []directoryItem Size string Path string + Breadcrumbs []breadcrumb BackLink string Hash string } @@ -25,20 +26,41 @@ type directoryItem struct { Path string } +type breadcrumb struct { + Name string + Path string +} + +var testPath = "/ipfs/QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7/a/b/c" var testData = listingTemplateData{ Listing: []directoryItem{{ Size: "25 MiB", Name: "short-film.mov", - Path: "short-film.mov", + Path: testPath + "/short-film.mov", }, { Size: "1 KiB", Name: "this-piece-of-papers-got-47-words-37-sentences-58-words-we-wanna-know.txt", - Path: "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", }}, Size: "25 MiB", - Path: "/ipfs/QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm", - BackLink: "/..", - Hash: "QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm", + Path: testPath, + Breadcrumbs: []breadcrumb{{ + Name: "ipfs", + }, { + Name: "QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", + Path: testPath + "/../../..", + }, { + Name: "a", + Path: testPath + "/../..", + }, { + Name: "b", + Path: testPath + "/..", + }, { + Name: "c", + Path: testPath, + }}, + BackLink: testPath + "/..", + Hash: "QmFooBazBar2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", } func main() { From 51e423e4a6f82507d43dbbc9f8f2f322dea912ed Mon Sep 17 00:00:00 2001 From: Kevin Neaton Date: Fri, 3 Jul 2020 00:53:44 -0400 Subject: [PATCH 03/37] Add CID column --- dir-index.html | 22 ++++++++++++++++++++++ test/main.go | 3 +++ 2 files changed, 25 insertions(+) diff --git a/dir-index.html b/dir-index.html index 7f2ce11..75ec450 100644 --- a/dir-index.html +++ b/dir-index.html @@ -33,6 +33,17 @@ .ml-auto { margin-left: auto; } + .text-truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .table-responsive { + display: block; + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; + } Codestin Search App @@ -75,6 +86,7 @@
{{ end }}
+
+ {{ range .Listing }} @@ -93,10 +106,19 @@ + {{ end }}
@@ -84,6 +96,7 @@ ..
{{ .Name }} + {{ if .Hash }} + + {{ slice .Hash 0 40 }} + {{ slice .Hash 40 }} + + {{ end }} + {{ .Size }}
+
diff --git a/test/main.go b/test/main.go index 6c851ae..208b2ad 100644 --- a/test/main.go +++ b/test/main.go @@ -24,6 +24,7 @@ type directoryItem struct { Size string Name string Path string + Hash string } type breadcrumb struct { @@ -37,10 +38,12 @@ var testData = listingTemplateData{ Size: "25 MiB", Name: "short-film.mov", Path: testPath + "/short-film.mov", + Hash: "QmQuxBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", }, { 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", }}, Size: "25 MiB", Path: testPath, From 84cf3eb263838e0a7596885f817f9f1755573063 Mon Sep 17 00:00:00 2001 From: Kevin Neaton Date: Tue, 7 Jul 2020 08:32:46 -0400 Subject: [PATCH 04/37] minify css additions --- dir-index.html | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/dir-index.html b/dir-index.html index 75ec450..1fc14a8 100644 --- a/dir-index.html +++ b/dir-index.html @@ -18,32 +18,7 @@ - Codestin Search App From c5d042ac5fd9c15631f95c6656e686a65f9f65ba Mon Sep 17 00:00:00 2001 From: Kevin Neaton Date: Tue, 7 Jul 2020 09:18:22 -0400 Subject: [PATCH 05/37] Fix type-icon size at narrow viewport widths The presence of additional content in the table was causing the width of the type-icon column to be reduced. Applying the width to the column and it's contents prevents this from happening. --- dir-index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dir-index.html b/dir-index.html index 1fc14a8..342809e 100644 --- a/dir-index.html +++ b/dir-index.html @@ -18,7 +18,7 @@ Codestin Search App From ce0dceac341c878d42d27cc78f71cbe4bbb54237 Mon Sep 17 00:00:00 2001 From: Kevin Neaton Date: Tue, 14 Jul 2020 23:25:48 -0400 Subject: [PATCH 06/37] Use short hash for uniform CID presentation of directory items --- dir-index.html | 9 ++++----- test/main.go | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dir-index.html b/dir-index.html index 342809e..c4da35a 100644 --- a/dir-index.html +++ b/dir-index.html @@ -18,7 +18,7 @@ Codestin Search App @@ -81,11 +81,10 @@ {{ .Name }} - + {{ if .Hash }} - - {{ slice .Hash 0 40 }} - {{ slice .Hash 40 }} + + {{ .ShortHash }} {{ end }} diff --git a/test/main.go b/test/main.go index 208b2ad..625456e 100644 --- a/test/main.go +++ b/test/main.go @@ -25,6 +25,7 @@ type directoryItem struct { Name string Path string Hash string + ShortHash string } type breadcrumb struct { @@ -39,11 +40,13 @@ var testData = listingTemplateData{ Name: "short-film.mov", Path: testPath + "/short-film.mov", Hash: "QmQuxBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", + ShortHash: "QmQu\u2026xDu7", }, { 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", }}, Size: "25 MiB", Path: testPath, From deab971dd03db6cf9609d312c6fdb414d58f4c69 Mon Sep 17 00:00:00 2001 From: Kevin Neaton Date: Fri, 17 Jul 2020 22:42:15 -0400 Subject: [PATCH 07/37] Use gateway URL when linking to another CID root This is necessary to support subdomain resolution. E.g. {cid}.ipfs.localhost --- dir-index.html | 5 +++-- test/main.go | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dir-index.html b/dir-index.html index c4da35a..7c3b659 100644 --- a/dir-index.html +++ b/dir-index.html @@ -1,4 +1,5 @@ +{{ $root := . }} @@ -44,7 +45,7 @@ Index of {{ range .Breadcrumbs -}} - /{{ if .Path }}{{ .Name }}{{ else }}{{ .Name }}{{ end }} + /{{ if .Path }}{{ .Name }}{{ else }}{{ .Name }}{{ end }} {{- else }} {{ .Path }} {{ end }} @@ -83,7 +84,7 @@ {{ if .Hash }} - + {{ .ShortHash }} {{ end }} diff --git a/test/main.go b/test/main.go index 625456e..3c73cf4 100644 --- a/test/main.go +++ b/test/main.go @@ -12,6 +12,7 @@ const templateFile = "../dir-index.html" // Copied from go-ipfs/core/corehttp/gateway_indexPage.go type listingTemplateData struct { + GatewayURL string Listing []directoryItem Size string Path string @@ -35,6 +36,7 @@ type breadcrumb struct { var testPath = "/ipfs/QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7/a/b/c" var testData = listingTemplateData{ + GatewayURL: "//localhost:3000", Listing: []directoryItem{{ Size: "25 MiB", Name: "short-film.mov", From fbb6b729e93e3e170f37d2221cb4e0002c7fd146 Mon Sep 17 00:00:00 2001 From: Kevin Neaton Date: Fri, 17 Jul 2020 23:59:13 -0400 Subject: [PATCH 08/37] chore: format test/main.go --- test/main.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/main.go b/test/main.go index 3c73cf4..fc32083 100644 --- a/test/main.go +++ b/test/main.go @@ -12,20 +12,20 @@ const templateFile = "../dir-index.html" // Copied from go-ipfs/core/corehttp/gateway_indexPage.go type listingTemplateData struct { - GatewayURL string - Listing []directoryItem - Size string - Path string + GatewayURL string + Listing []directoryItem + Size string + Path string Breadcrumbs []breadcrumb - BackLink string - Hash string + BackLink string + Hash string } type directoryItem struct { - Size string - Name string - Path string - Hash string + Size string + Name string + Path string + Hash string ShortHash string } @@ -38,16 +38,16 @@ var testPath = "/ipfs/QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7/a/b/c" var testData = listingTemplateData{ GatewayURL: "//localhost:3000", Listing: []directoryItem{{ - Size: "25 MiB", - Name: "short-film.mov", - Path: testPath + "/short-film.mov", - Hash: "QmQuxBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", + Size: "25 MiB", + Name: "short-film.mov", + Path: testPath + "/short-film.mov", + Hash: "QmQuxBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7", ShortHash: "QmQu\u2026xDu7", }, { - 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", + 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", }}, Size: "25 MiB", From 3527e53c2c70e950c2336beaed7e7476a361a300 Mon Sep 17 00:00:00 2001 From: Jessica Schilling Date: Thu, 23 Jul 2020 14:17:10 -0600 Subject: [PATCH 09/37] Remove extraneous meta keywords --- dir-index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/dir-index.html b/dir-index.html index 7c3b659..35138a7 100644 --- a/dir-index.html +++ b/dir-index.html @@ -15,7 +15,6 @@ - Codestin Search App @@ -83,7 +83,7 @@ {{ if .Hash }} - + {{ .ShortHash }} {{ end }} From 06c0303c2bf2136f24f0116e8de5666025430f61 Mon Sep 17 00:00:00 2001 From: Jessica Schilling Date: Thu, 23 Jul 2020 14:38:11 -0600 Subject: [PATCH 11/37] Temp switch to in-project local style and icons; WILL NEED TO REVERT BEFORE RELEASE --- dir-index-uncat.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dir-index-uncat.html b/dir-index-uncat.html index 9a55c5c..43990aa 100644 --- a/dir-index-uncat.html +++ b/dir-index-uncat.html @@ -17,9 +17,9 @@ - + - + Codestin Search App From 96eed243f058211609655192b970ef9b7c355605 Mon Sep 17 00:00:00 2001 From: Jessica Schilling Date: Thu, 23 Jul 2020 15:25:11 -0600 Subject: [PATCH 12/37] Replaces style.css from style used in head of dir-index.html; replaces html in dir-index-uncat with that from dir-index --- dir-index-uncat.html | 94 +++++++++++++++++++++++++++----------------- gw-assets/style.css | 2 +- 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/dir-index-uncat.html b/dir-index-uncat.html index 43990aa..87a27ca 100644 --- a/dir-index-uncat.html +++ b/dir-index-uncat.html @@ -1,4 +1,5 @@ +{{ $root := . }} @@ -17,59 +18,80 @@ - + - + Codestin Search App -