Commit 174672ab authored by Jessica Schilling's avatar Jessica Schilling

Merge branch 'makeresponsive-removefontrefs' of...

Merge branch 'makeresponsive-removefontrefs' of https://github.com/ipfs/dir-index-html into makeresponsive-removefontrefs
parents d1706c9d 6332a7da
# Configuration for welcome - https://github.com/behaviorbot/welcome
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
# Comment to be posted to on first time issues
newIssueWelcomeComment: >
Thank you for submitting your first issue to this repository! A maintainer
will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the
necessary information to make this process easy! Any information that can
help save additional round trips is useful! We currently aim to give
initial feedback within **two business days**. If this does not happen, feel
free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an
overview of priorities, assignments and additional actions requested by the
maintainers:
- "Priority" labels will show how urgent this is for the team.
- "Status" labels will show if this is ready to be worked on, blocked, or in progress.
- "Need" labels will indicate if additional input or analysis is required.
Finally, remember to use https://discuss.ipfs.io if you just need general
support.
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
# Comment to be posted to on PRs from first time contributors in your repository
newPRWelcomeComment: >
Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure
that:
* The context for this PR is clear, with relevant discussion, decisions
and stakeholders linked/mentioned.
* Your contribution itself is clear (code comments, self-review for the
rest) and in its best form. Follow the [code contribution
guidelines](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md#code-contribution-guidelines)
if they apply.
Getting other community members to do a review would be great help too on
complex PRs (you can ask in the chats/forums). If you are unsure about
something, just leave us a comment.
Next steps:
* A maintainer will triage and assign priority to this PR, commenting on
any missing things and potentially assigning a reviewer for high
priority items.
* The PR gets reviews, discussed and approvals as needed.
* The PR is merged by maintainers when it has been approved and comments addressed.
We currently aim to provide initial feedback/triaging within **two business
days**. Please keep an eye on any labelling actions, as these will indicate
priorities and status of your contribution.
We are very grateful for your contribution!
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
# Comment to be posted to on pull requests merged by a first time user
# Currently disabled
#firstPRMergeComment: ""
......@@ -17,6 +17,18 @@ This repo is not be used standalone. It's used by the gateway code in go-ipfs. I
1. Make changes to _both_ dir-index.html and dir-index-uncat.html.
2. Follow the instructions in [go-ipfs](https://github.com/ipfs/go-ipfs/tree/master/assets#updating-dir-index-html) for updating the directory index.
## Testing
1. Install [go](https://golang.org/dl/).
2. Run the test server:
```bash
> cd test
> go run .
```
This will listen on `localhost:3000` and re-load the template every time you refresh the page.
## Contribute
Feel free to join in. All welcome. A good place to start is [the issues](https://github.com/ipfs/dir-index-html/issues).
......
......@@ -3,9 +3,9 @@
<head>
<meta charset="utf-8" />
<!-- TODO: seed these - maybe like the starter ex or the webui? -->
<link rel="stylesheet" href="/ipfs/QmXB7PLRWH6bCiwrGh2MrBBjNkLv3mY3JdYXCikYZSwLED/bootstrap.min.css"/>
<!-- helper to construct this is here: https://github.com/cryptix/exp/blob/master/imgesToCSSData/convert.go -->
<link rel="stylesheet" href="/ipfs/QmXB7PLRWH6bCiwrGh2MrBBjNkLv3mY3JdYXCikYZSwLED/icons.css">
<link rel="stylesheet" href="/ipfs/Qme2SZFZhhgzT4v3d2R87c8KwaozjyqqUrXPzzA85QbGnj/style.css"/>
<!-- Icon art is https://fileicons.org/ -->
<link rel="stylesheet" href="/ipfs/Qme2SZFZhhgzT4v3d2R87c8KwaozjyqqUrXPzzA85QbGnj/icons.css">
<style>
.narrow {width: 0px;}
.padding { margin: 100px;}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
body{color:#34373f;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.43;margin:0;word-break:break-all;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}a{color:#378085;text-decoration:none}a:hover{color:#69c4cd;text-decoration:underline}a:active,a:visited{color:#69c4cd}strong{font-weight:700}table{border-collapse:collapse;border-spacing:0;max-width:100%;width:100%}table:last-child{border-bottom-left-radius:3px;border-bottom-right-radius:3px}tr:first-child td{border-top:0}tr:nth-of-type(even){background-color:#f7f8fa}td{border-top:1px solid #d9dbe2;padding:.65em;vertical-align:top}#page-header{align-items:center;background:#0b3a53;border-bottom:4px solid #69c4cd;color:#fff;display:flex;font-size:1.12em;font-weight:500;justify-content:space-between;padding:0 1em}#page-header a{color:#69c4cd}#page-header a:active{color:#9ad4db}#page-header a:hover{color:#fff}#page-header-logo{height:2.25em;margin:.7em .7em .7em 0;width:7.15em}#page-header-menu{align-items:center;display:flex;margin:.65em 0}#page-header-menu div{margin:0 .6em}#page-header-menu div:last-child{margin:0 0 0 .6em}#page-header-menu svg{fill:#69c4cd;height:1.8em;margin-top:.125em}#page-header-menu svg:hover{fill:#fff}.menu-item-narrow{display:none}#content{border:1px solid #d9dbe2;border-radius:4px;margin:1em}#content-header{background-color:#edf0f4;border-bottom:1px solid #d9dbe2;border-top-left-radius:3px;border-top-right-radius:3px;padding:.7em 1em}.type-icon{width:1.15em}.no-linebreak{white-space:nowrap}.ipfs-hash{color:#7f8491}@media only screen and (max-width:500px){.menu-item-narrow{display:inline}.menu-item-wide{display:none}}@media print{#page-header{display:none}#content-header,.ipfs-hash,body{color:#000}#content-header{border-bottom:1px solid #000}#content{border:1px solid #000}a,a:visited{color:#000;text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}tr{page-break-inside:avoid}tr:nth-of-type(even){background-color:transparent}td{border-top:1px solid #000}}@-ms-viewport{width:device-width}
......@@ -28,6 +28,8 @@
.key
.less
.mid
.mkv
.mov
.mp3
.mp4
.mpg
......@@ -55,6 +57,7 @@
.tiff
.txt
.wav
.wmv
.xls
.xlsx
.xml
......
module github.com/ipfs/dir-index-html/test
go 1.14
package main
import (
"fmt"
"net/http"
"net/url"
"os"
"text/template"
)
const templateFile = "../dir-index.html"
// Copied from go-ipfs/core/corehttp/gateway_indexPage.go
type listingTemplateData struct {
Listing []directoryItem
Path string
BackLink string
Hash string
}
type directoryItem struct {
Size string
Name string
Path string
}
var testData = listingTemplateData{
Listing: []directoryItem{{
Size: "25 MiB",
Name: "short-film.mov",
Path: "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: "/ipfs/QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm",
BackLink: "/..",
Hash: "QmFooBarQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm",
}
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
http.Error(w, "Ha-ha, tricked you! There are no files here!", http.StatusNotFound)
return
}
listingTemplate, err := template.New("dir-index.html").Funcs(template.FuncMap{
"iconFromExt": func(name string) string {
return "ipfs-_blank" // place-holder
},
"urlEscape": func(rawUrl string) string {
pathUrl := url.URL{Path: rawUrl}
return pathUrl.String()
},
}).ParseFiles(templateFile)
if err != nil {
http.Error(w, fmt.Sprintf("failed to parse template file: %s", err), http.StatusInternalServerError)
return
}
err = listingTemplate.Execute(w, &testData)
if err != nil {
http.Error(w, fmt.Sprintf("failed to execute template: %s", err), http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusOK)
})
if _, err := os.Stat(templateFile); err != nil {
wd, _ := os.Getwd()
fmt.Printf("could not open template file %q, relative to %q: %s\n", templateFile, wd, err)
os.Exit(1)
}
fmt.Printf("listening on localhost:3000\n")
http.ListenAndServe("localhost:3000", mux)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment