mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
removed dir-index-html submodule
This commit is contained in:
commit
24ab9af00e
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "assets/dir-index-html"]
|
||||
path = assets/dir-index-html
|
||||
url = https://github.com/ipfs/dir-index-html.git
|
||||
@ -1 +0,0 @@
|
||||
Subproject commit 67e75cdb39d6892468b46cf40b8e4e877512c519
|
||||
8
assets/dir-index-html/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
assets/dir-index-html/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Getting Help on IPFS
|
||||
url: https://ipfs.io/help
|
||||
about: All information about how and where to get help on IPFS.
|
||||
- name: IPFS Official Forum
|
||||
url: https://discuss.ipfs.io
|
||||
about: Please post general questions, support requests, and discussions here.
|
||||
19
assets/dir-index-html/.github/ISSUE_TEMPLATE/open_an_issue.md
vendored
Normal file
19
assets/dir-index-html/.github/ISSUE_TEMPLATE/open_an_issue.md
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
name: Open an issue
|
||||
about: Only for actionable issues relevant to this repository.
|
||||
title: ''
|
||||
labels: need/triage
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
<!--
|
||||
Hello! To ensure this issue is correctly addressed as soon as possible by the IPFS team, please try to make sure:
|
||||
|
||||
- This issue is relevant to this repository's topic or codebase.
|
||||
|
||||
- A clear description is provided. It should includes as much relevant information as possible and clear scope for the issue to be actionable.
|
||||
|
||||
FOR GENERAL DISCUSSION, HELP OR QUESTIONS, please see the options at https://ipfs.io/help or head directly to https://discuss.ipfs.io.
|
||||
|
||||
(you can delete this section after reading)
|
||||
-->
|
||||
68
assets/dir-index-html/.github/config.yml
vendored
Normal file
68
assets/dir-index-html/.github/config.yml
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
# 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: ""
|
||||
21
assets/dir-index-html/.github/workflows/build.yml
vendored
Normal file
21
assets/dir-index-html/.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
name: Build
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
no-uncommitted-changes:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
- name: Run Build
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- 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 && git --no-pager diff --patch-with-raw && echo "Output does not match src/, uncommitted changes exist, follow build instructions from README" && exit 1
|
||||
1
assets/dir-index-html/.gx/lastpubver
Normal file
1
assets/dir-index-html/.gx/lastpubver
Normal file
@ -0,0 +1 @@
|
||||
1.0.4: QmT1jwrqzSMjSjLG5oBd9w4P9vXPKQksWuf5ghsE3Q88ZV
|
||||
54
assets/dir-index-html/CHANGELOG.md
Normal file
54
assets/dir-index-html/CHANGELOG.md
Normal file
@ -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
|
||||
21
assets/dir-index-html/LICENSE
Normal file
21
assets/dir-index-html/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 IPFS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
54
assets/dir-index-html/README.md
Normal file
54
assets/dir-index-html/README.md
Normal file
@ -0,0 +1,54 @@
|
||||
# dir-index-html
|
||||
|
||||
[](https://protocol.ai)
|
||||
[](https://ipfs.io/)
|
||||
[](https://matrix.to/#/room/#ipfs:matrix.org)
|
||||
[](http://webchat.freenode.net/?channels=%23ipfs)
|
||||
[](https://github.com/RichardLitt/standard-readme)
|
||||
|
||||
> Directory listing HTML for `go-ipfs` gateways
|
||||
|
||||
**NOTE:** This repo is not intended to be used as a standalone project! This code is used by the gateway code within [`go-ipfs`](https://github.com/ipfs/go-ipfs). In the long term, once the the gateway is extracted from `go-ipfs`, the code in this repo will be merged into that gateway package.
|
||||
|
||||

|
||||
|
||||
## Updating
|
||||
|
||||
When making updates to the directory listing page template, please note the following:
|
||||
|
||||
1. Make your changes to the (human-friendly) source documents in the `src` directory
|
||||
2. Before testing or releasing, make sure to run the build script to update the minified version in the top-level directory:
|
||||
|
||||
```bash
|
||||
> npm run build
|
||||
```
|
||||
3. To get your updates into `go-ipfs`, you'll need to do the following:
|
||||
- Cut a new, appropriately versioned release of `dir-index-html` (don't forget to bump the version number in `package.json`)
|
||||
- Make a PR against `go-ipfs` following [these instructions](https://github.com/ipfs/go-ipfs/tree/master/assets#updating-dir-index-html) for updating the directory index
|
||||
|
||||
## Testing
|
||||
|
||||
1. Make sure you have [Go](https://golang.org/dl/) installed
|
||||
2. Start the test server, which lives in its own directory:
|
||||
|
||||
```bash
|
||||
> cd test
|
||||
> go run .
|
||||
```
|
||||
This will listen on [`localhost:3000`](http://localhost:3000/) and reload the template every time you refresh the page.
|
||||
|
||||
If you get a "no such file or directory" error upon trying `go run .`, make sure you ran `npm run build` to generate the minified artifact that the test is looking for.
|
||||
|
||||
## Contribute
|
||||
|
||||
Feel free to join in. All are welcome! A good place to start is to check the [issues](https://github.com/ipfs/dir-index-html/issues) for anything you find interesting.
|
||||
|
||||
This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
|
||||
|
||||
### Want to hack on IPFS?
|
||||
|
||||
[](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
97
assets/dir-index-html/dir-index.html
Normal file
97
assets/dir-index-html/dir-index.html
Normal file
File diff suppressed because one or more lines are too long
1
assets/dir-index-html/index.go
Normal file
1
assets/dir-index-html/index.go
Normal file
@ -0,0 +1 @@
|
||||
package dirindexhtml
|
||||
65
assets/dir-index-html/knownIcons.txt
Normal file
65
assets/dir-index-html/knownIcons.txt
Normal file
@ -0,0 +1,65 @@
|
||||
.aac
|
||||
.aiff
|
||||
.ai
|
||||
.avi
|
||||
.bmp
|
||||
.c
|
||||
.cpp
|
||||
.css
|
||||
.dat
|
||||
.dmg
|
||||
.doc
|
||||
.dotx
|
||||
.dwg
|
||||
.dxf
|
||||
.eps
|
||||
.exe
|
||||
.flv
|
||||
.gif
|
||||
.h
|
||||
.hpp
|
||||
.html
|
||||
.ics
|
||||
.iso
|
||||
.java
|
||||
.jpg
|
||||
.jpeg
|
||||
.js
|
||||
.key
|
||||
.less
|
||||
.mid
|
||||
.mkv
|
||||
.mov
|
||||
.mp3
|
||||
.mp4
|
||||
.mpg
|
||||
.odf
|
||||
.ods
|
||||
.odt
|
||||
.otp
|
||||
.ots
|
||||
.ott
|
||||
.pdf
|
||||
.php
|
||||
.png
|
||||
.ppt
|
||||
.psd
|
||||
.py
|
||||
.qt
|
||||
.rar
|
||||
.rb
|
||||
.rtf
|
||||
.sass
|
||||
.scss
|
||||
.sql
|
||||
.tga
|
||||
.tgz
|
||||
.tiff
|
||||
.txt
|
||||
.wav
|
||||
.wmv
|
||||
.xls
|
||||
.xlsx
|
||||
.xml
|
||||
.yml
|
||||
.zip
|
||||
28
assets/dir-index-html/package.json
Normal file
28
assets/dir-index-html/package.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "dir-index-html",
|
||||
"author": "lgierth",
|
||||
"description": "Directory listing HTML for go-ipfs gateways",
|
||||
"version": "1.2.1",
|
||||
"homepage": "https://github.com/ipfs/dir-index-html#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ipfs/dir-index-html"
|
||||
},
|
||||
"gx": {
|
||||
"dvcsimport": "github.com/ipfs/dir-index-html",
|
||||
"goversion": "1.5.2"
|
||||
},
|
||||
"gxDependencies": [],
|
||||
"gxVersion": "0.14.0",
|
||||
"language": "go",
|
||||
"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 '/<link rel=\"stylesheet\"/d' ./src/dir-index.html > ./base-html.html",
|
||||
"build:minify-wrap-css": "(echo \"<style>\" && cat ./src/icons.css ./src/style.css | tr -d \"\t\n\r\" && echo && echo \"</style>\") > ./minified-wrapped-style.html",
|
||||
"build:combine-html-css": "sed '/<\\/title>/ r ./minified-wrapped-style.html' ./base-html.html > ./dir-index.html",
|
||||
"build:remove-unused": "rm ./base-html.html && rm ./minified-wrapped-style.html"
|
||||
}
|
||||
}
|
||||
96
assets/dir-index-html/src/dir-index.html
Normal file
96
assets/dir-index-html/src/dir-index.html
Normal file
@ -0,0 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
{{ $root := . }}
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="description" content="A directory of files hosted on the distributed, decentralized web using IPFS">
|
||||
<meta property="og:title" content="Files on IPFS">
|
||||
<meta property="og:description" content="{{ .Path }}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:image" content="https://gateway.ipfs.io/ipfs/QmSDeYAe9mga6NdTozAZuyGL3Q1XjsLtvX28XFxJH8oPjq">
|
||||
<meta name="twitter:title" content="{{ .Path }}">
|
||||
<meta name="twitter:description" content="A directory of files hosted on the distributed, decentralized web using IPFS">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content="https://gateway.ipfs.io/ipfs/QmSDeYAe9mga6NdTozAZuyGL3Q1XjsLtvX28XFxJH8oPjq">
|
||||
<meta name="twitter:creator" content="@ipfs">
|
||||
<meta name="twitter:site" content="@ipfs">
|
||||
<meta name="image" content="https://gateway.ipfs.io/ipfs/QmSDeYAe9mga6NdTozAZuyGL3Q1XjsLtvX28XFxJH8oPjq">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlo89/56ZQ/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACUjDu1lo89/6mhTP+zrVP/nplD/5+aRK8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHNiIS6Wjz3/ubFY/761W/+vp1D/urRZ/8vDZf/GvmH/nplD/1BNIm8AAAAAAAAAAAAAAAAAAAAAAAAAAJaPPf+knEj/vrVb/761W/++tVv/r6dQ/7q0Wf/Lw2X/y8Nl/8vDZf+tpk7/nplD/wAAAAAAAAAAAAAAAJaPPf+2rVX/vrVb/761W/++tVv/vrVb/6+nUP+6tFn/y8Nl/8vDZf/Lw2X/y8Nl/8G6Xv+emUP/AAAAAAAAAACWjz3/vrVb/761W/++tVv/vrVb/761W/+vp1D/urRZ/8vDZf/Lw2X/y8Nl/8vDZf/Lw2X/nplD/wAAAAAAAAAAlo89/761W/++tVv/vrVb/761W/++tVv/r6dQ/7q0Wf/Lw2X/y8Nl/8vDZf/Lw2X/y8Nl/56ZQ/8AAAAAAAAAAJaPPf++tVv/vrVb/761W/++tVv/vbRa/5aPPf+emUP/y8Nl/8vDZf/Lw2X/y8Nl/8vDZf+emUP/AAAAAAAAAACWjz3/vrVb/761W/++tVv/vrVb/5qTQP+inkb/op5G/6KdRv/Lw2X/y8Nl/8vDZf/Lw2X/nplD/wAAAAAAAAAAlo89/761W/++tVv/sqlS/56ZQ//LxWb/0Mlp/9DJaf/Kw2X/oJtE/7+3XP/Lw2X/y8Nl/56ZQ/8AAAAAAAAAAJaPPf+9tFr/mJE+/7GsUv/Rymr/0cpq/9HKav/Rymr/0cpq/9HKav+xrFL/nplD/8vDZf+emUP/AAAAAAAAAACWjz3/op5G/9HKav/Rymr/0cpq/9HKav/Rymr/0cpq/9HKav/Rymr/0cpq/9HKav+inkb/nplD/wAAAAAAAAAAAAAAAKKeRv+3slb/0cpq/9HKav/Rymr/0cpq/9HKav/Rymr/0cpq/9HKav+1sFX/op5G/wAAAAAAAAAAAAAAAAAAAAAAAAAAop5GUKKeRv/Nxmf/0cpq/9HKav/Rymr/0cpq/83GZ/+inkb/op5GSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAop5G16KeRv/LxWb/y8Vm/6KeRv+inkaPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAop5G/6KeRtcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/n8AAPgfAADwDwAAwAMAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAwAMAAPAPAAD4HwAA/n8AAA==" />
|
||||
<link rel="stylesheet" href="style.css"/>
|
||||
<link rel="stylesheet" href="icons.css">
|
||||
<title>{{ .Path }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="page-header">
|
||||
<div id="page-header-logo" class="ipfs-logo"> </div>
|
||||
<div id="page-header-menu">
|
||||
<div class="menu-item-wide"><a href="https://ipfs.io" target="_blank" rel="noopener noreferrer">About IPFS</a></div>
|
||||
<div class="menu-item-wide"><a href="https://ipfs.io#install" target="_blank" rel="noopener noreferrer">Install IPFS</a></div>
|
||||
<div class="menu-item-narrow"><a href="https://ipfs.io" target="_blank" rel="noopener noreferrer">About</a></div>
|
||||
<div class="menu-item-narrow"><a href="https://ipfs.io#install" target="_blank" rel="noopener noreferrer">Install</a></div>
|
||||
<div>
|
||||
<a href="https://github.com/ipfs/dir-index-html/issues/" target="_blank" rel="noopener noreferrer">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18.4 21"><circle cx="7.5" cy="4.8" r="1"/><circle cx="11.1" cy="4.8" r="1"/><path d="M12.7 8.4c-0.5-1.5-1.9-2.5-3.5-2.5 -1.6 0-3 1-3.5 2.5H12.7z"/><path d="M8.5 9.7H5c-0.5 0.8-0.7 1.7-0.7 2.7 0 2.6 1.8 4.8 4.2 5.2V9.7z"/><path d="M13.4 9.7H9.9v7.9c2.4-0.4 4.2-2.5 4.2-5.2C14.1 11.4 13.9 10.5 13.4 9.7z"/><circle cx="15.7" cy="12.9" r="1"/><circle cx="15.1" cy="15.4" r="1"/><circle cx="15.3" cy="10.4" r="1"/><circle cx="2.7" cy="12.9" r="1"/><circle cx="3.3" cy="15.4" r="1"/><circle cx="3.1" cy="10.4" r="1"/></svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="content-header" class="d-flex flex-wrap">
|
||||
<div>
|
||||
<strong>
|
||||
Index of
|
||||
{{ range .Breadcrumbs -}}
|
||||
/{{ if .Path }}<a href="{{ $root.GatewayURL }}{{ .Path | urlEscape }}">{{ .Name }}</a>{{ else }}{{ .Name }}{{ end }}
|
||||
{{- else }}
|
||||
{{ .Path }}
|
||||
{{ end }}
|
||||
</strong>
|
||||
{{ if .Hash }}
|
||||
<div class="ipfs-hash" translate="no">
|
||||
{{ .Hash }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ if .Size }}
|
||||
<div class="no-linebreak flex-shrink-1 ml-auto">
|
||||
<strong> {{ .Size }}</strong>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="type-icon">
|
||||
<div class="ipfs-_blank"> </div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{.BackLink | urlEscape}}">..</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{ range .Listing }}
|
||||
<tr>
|
||||
<td class="type-icon">
|
||||
<div class="{{iconFromExt .Name}}"> </div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ .Path | urlEscape }}">{{ .Name }}</a>
|
||||
</td>
|
||||
<td class="no-linebreak">
|
||||
{{ if .Hash }}
|
||||
<a class="ipfs-hash" translate="no" href={{ if $root.DNSLink }}"https://cid.ipfs.io/#{{ .Hash | urlEscape}}" target="_blank" rel="noreferrer noopener"{{ else }}"{{ $root.GatewayURL }}/ipfs/{{ .Hash | urlEscape}}?filename={{ .Name | urlEscape }}"{{ end }}>
|
||||
{{ .ShortHash }}
|
||||
</a>
|
||||
{{ end }}
|
||||
</td>
|
||||
<td class="no-linebreak">{{ .Size }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
403
assets/dir-index-html/src/icons.css
Normal file
403
assets/dir-index-html/src/icons.css
Normal file
File diff suppressed because one or more lines are too long
212
assets/dir-index-html/src/style.css
Normal file
212
assets/dir-index-html/src/style.css
Normal file
@ -0,0 +1,212 @@
|
||||
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:#117eb3;
|
||||
text-decoration:none
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color:#00b0e9;
|
||||
text-decoration:underline
|
||||
}
|
||||
|
||||
a:active,
|
||||
a:visited {
|
||||
color:#00b0e9
|
||||
}
|
||||
|
||||
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,
|
||||
.type-icon>* {
|
||||
width:1.15em
|
||||
}
|
||||
|
||||
.no-linebreak {
|
||||
white-space:nowrap
|
||||
}
|
||||
|
||||
.ipfs-hash {
|
||||
color:#7f8491;
|
||||
font-family:monospace
|
||||
}
|
||||
|
||||
@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
|
||||
}
|
||||
|
||||
.d-flex {
|
||||
display:flex
|
||||
}
|
||||
|
||||
.flex-wrap {
|
||||
flex-flow:wrap
|
||||
}
|
||||
|
||||
.flex-shrink-1 {
|
||||
flex-shrink:1
|
||||
}
|
||||
|
||||
.ml-auto {
|
||||
margin-left:auto
|
||||
}
|
||||
|
||||
.table-responsive {
|
||||
display:block;
|
||||
width:100%;
|
||||
overflow-x:auto;
|
||||
-webkit-overflow-scrolling:touch
|
||||
}
|
||||
3
assets/dir-index-html/test/go.mod
Normal file
3
assets/dir-index-html/test/go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module github.com/ipfs/dir-index-html/test
|
||||
|
||||
go 1.14
|
||||
116
assets/dir-index-html/test/main.go
Normal file
116
assets/dir-index-html/test/main.go
Normal file
@ -0,0 +1,116 @@
|
||||
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 {
|
||||
GatewayURL string
|
||||
DNSLink bool
|
||||
Listing []directoryItem
|
||||
Size string
|
||||
Path string
|
||||
Breadcrumbs []breadcrumb
|
||||
BackLink string
|
||||
Hash string
|
||||
}
|
||||
|
||||
type directoryItem struct {
|
||||
Size string
|
||||
Name string
|
||||
Path string
|
||||
Hash string
|
||||
ShortHash string
|
||||
}
|
||||
|
||||
type breadcrumb struct {
|
||||
Name string
|
||||
Path string
|
||||
}
|
||||
|
||||
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: "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: "bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi",
|
||||
ShortHash: "bafy\u2026bzdi",
|
||||
}},
|
||||
Size: "25 MiB",
|
||||
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() {
|
||||
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)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user