28 |
29 |
30 |
31 |
36 |
37 |
38 | ## Demo
39 |
40 | https://dir-demo.adriansoftware.de
41 |
42 | ## Features
43 | - **Download counter** for all files
44 | - Secure by default. **Read-only** access
45 | - Extremly **fast** file serving through **nginx**
46 | - **README** markdown rendering support
47 | - **JSON API** for programmatic access
48 | - **Batch download** of files and folders in a zip archive
49 | - **file integrity** check with **hashes**
50 | - **custom description** and **labels** for files and folders
51 | - **Search** and **sorting** built-in
52 | - **Password** protection
53 | - **Hide** files and folders
54 | - Light and **Darkmode**
55 | - File **icons**
56 | - Many **Themes** available
57 | - **Clean URLs** equivalent to file system paths
58 | - **Low memory** footprint (~10MB)
59 | - Easy setup using single **Docker** image
60 | - **Responsive** design for mobile devices and desktop
61 | - Easily configurable using **environment variables**
62 | - File stats like modification dates and sizes
63 | - Custom JS and CSS support
64 | - Highlight recently updated files
65 | - Track request timing
66 | - **arm64** support
67 | - Works **without JavaScript** enabled
68 |
--------------------------------------------------------------------------------
/cliff.toml:
--------------------------------------------------------------------------------
1 | # git-cliff ~ default configuration file
2 | # https://git-cliff.org/docs/configuration
3 | #
4 | # Lines starting with "#" are comments.
5 | # Configuration options are organized into tables and keys.
6 | # See documentation for more information on available options.
7 |
8 | [changelog]
9 | # changelog header
10 | header = """
11 | # Changelog\n
12 | All notable changes to this project will be documented in this file.\n
13 | """
14 | # template for the changelog body
15 | # https://keats.github.io/tera/docs/#introduction
16 | body = """
17 | {% if version %}\
18 | ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
19 | {% else %}\
20 | ## [unreleased]
21 | {% endif %}\
22 | {% for group, commits in commits | group_by(attribute="group") %}
23 | ### {{ group | striptags | trim | upper_first }}
24 | {% for commit in commits %}
25 | - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
26 | {% if commit.breaking %}[**breaking**] {% endif %}\
27 | {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/adrianschubek/dir-browser/commit/{{ commit.id }}))\
28 | {% endfor %}
29 | {% endfor %}\n
30 | """
31 | # template for the changelog footer
32 | footer = """
33 |
34 | """
35 | # remove the leading and trailing s
36 | trim = true
37 | # postprocessors
38 | postprocessors = [
39 | # { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
40 | ]
41 |
42 | [git]
43 | # parse the commits based on https://www.conventionalcommits.org
44 | conventional_commits = true
45 | # filter out the commits that are not conventional
46 | filter_unconventional = true
47 | # process each line of a commit as an individual commit
48 | split_commits = false
49 | # regex for preprocessing the commit messages
50 | commit_preprocessors = [
51 | # Replace issue numbers
52 | #{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/issues/${2}))"},
53 | # Check spelling of the commit with https://github.com/crate-ci/typos
54 | # If the spelling is incorrect, it will be automatically fixed.
55 | #{ pattern = '.*', replace_command = 'typos --write-changes -' },
56 | ]
57 | # regex for parsing and grouping commits
58 | commit_parsers = [
59 | { message = "^feat", group = "🚀 Features" },
60 | { message = "^fix", group = "🐛 Bug Fixes" },
61 | { message = "^doc", group = "📚 Documentation" },
62 | { message = "^perf", group = "⚡ Performance" },
63 | { message = "^refactor", group = "🚜 Refactor" },
64 | { message = "^style", group = "🎨 Styling" },
65 | { message = "^test", group = "🧪 Testing" },
66 | { message = "^chore\\(release\\): prepare for", skip = true },
67 | { message = "^chore\\(deps.*\\)", skip = true },
68 | { message = "^chore\\(pr\\)", skip = true },
69 | { message = "^chore\\(pull\\)", skip = true },
70 | { message = "^chore|^ci", group = "⚙️ Miscellaneous Tasks" },
71 | { body = ".*security", group = "🛡️ Security" },
72 | { message = "^revert", group = "◀️ Revert" },
73 | ]
74 | # protect breaking changes from being skipped due to matching a skipping commit_parser
75 | protect_breaking_commits = false
76 | # filter out the commits that are not matched by commit parsers
77 | filter_commits = false
78 | # regex for matching git tags
79 | # tag_pattern = "v[0-9].*"
80 | # regex for skipping tags
81 | # skip_tags = ""
82 | # regex for ignoring tags
83 | # ignore_tags = ""
84 | # sort the tags topologically
85 | topo_order = false
86 | # sort the commits inside sections by oldest/newest order
87 | sort_commits = "oldest"
88 | # limit the number of commits included in the changelog.
89 | # limit_commits = 42
90 |
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependencies
2 | /node_modules
3 |
4 | # Production
5 | /build
6 |
7 | # Generated files
8 | .docusaurus
9 | .cache-loader
10 |
11 | # Misc
12 | .DS_Store
13 | .env.local
14 | .env.development.local
15 | .env.test.local
16 | .env.production.local
17 |
18 | npm-debug.log*
19 | yarn-debug.log*
20 | yarn-error.log*
21 |
--------------------------------------------------------------------------------
/docs/CNAME:
--------------------------------------------------------------------------------
1 | dir.adriansoftware.de
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # Website
2 |
3 | This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4 |
5 | ### Installation
6 |
7 | ```
8 | $ yarn
9 | ```
10 |
11 | ### Local Development
12 |
13 | ```
14 | $ yarn start
15 | ```
16 |
17 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18 |
19 | ### Build
20 |
21 | ```
22 | $ yarn build
23 | ```
24 |
25 | This command generates static content into the `build` directory and can be served using any static contents hosting service.
26 |
27 | ### Deployment
28 |
29 | Using SSH:
30 |
31 | ```
32 | $ USE_SSH=true yarn deploy
33 | ```
34 |
35 | Not using SSH:
36 |
37 | ```
38 | $ GIT_USER= yarn deploy
39 | ```
40 |
41 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
42 |
--------------------------------------------------------------------------------
/docs/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3 | };
4 |
--------------------------------------------------------------------------------
/docs/docs/advanced/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "⚡ Advanced",
3 | "position": 5,
4 | "link": {
5 | "type": "generated-index",
6 | "description": "Advanced guides"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/docs/docs/advanced/caching.md:
--------------------------------------------------------------------------------
1 | # Caching
2 |
3 | :::info
4 | Work in progress. Do not use in production.
5 | :::
6 |
7 | import EnvConfig from '@site/src/components/EnvConfig';
8 |
9 |
--------------------------------------------------------------------------------
/docs/docs/advanced/performance.mdx:
--------------------------------------------------------------------------------
1 | # Performance Tuning
2 |
3 | The performance is already pretty good, but there are a few configuration options that can be tweaked to further improve performance.
4 |
5 |
6 |
7 | 
8 |
9 |
10 |
11 | [Default](/getting-started/installation.md) performance running version 1.1.0 on a Ryzen 5 5600X processor
12 |
13 |
14 |
15 |
16 |
17 | ## Disable Download count
18 |
19 | By default, the download count is enabled. This means that every time a file is downloaded, the download count is incremented by one. This is done by incrementing a Redis key.
20 | However this has a performance impact.
21 |
22 | If you don't need the download count, you can disable it by setting the `DOWNLOAD_COUNTER` environment variable to `false`.
23 |
24 |
25 |
26 | 
27 |
28 |
29 |
30 | Throughput after starting the container with env variable `DOWNLOAD_COUNTER=false`
31 |
32 |
33 |
34 |
35 |
36 | ## Disable Readme Renderer
37 |
38 | Set `README_RENDER` to `false` to disable the rendering of README files for improved performance.
--------------------------------------------------------------------------------
/docs/docs/advanced/php.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 2
3 | ---
4 |
5 | # PHP
6 |
7 | ## display_errors
8 |
9 | By default `display_errors` is set to `Off` in the `php.ini` file.
10 |
11 | ## memory_limit
12 |
13 | By default `memory_limit` is set to `128M` in the `php.ini` file.
14 |
15 |
16 | import EnvConfig from '@site/src/components/EnvConfig';
17 |
18 |
--------------------------------------------------------------------------------
/docs/docs/advanced/redis.md:
--------------------------------------------------------------------------------
1 | # Redis
2 |
3 | Redis is used to store the [download counter](./../configuration/download-count.md) data. If the download counter is disabled, Redis will not be loaded/started at all.
4 |
5 | ### Access
6 |
7 | Sometimes it is useful to access the Redis instance directly e.g. for resetting a counter. This can be done using the `redis-cli` tool inside the container.
8 |
9 | 1. First create a shell. Replace `` with the name of the container.
10 | ```bash
11 | docker exec -it sh
12 | ```
13 | 2. Start the Redis CLI.
14 | ```bash
15 | redis-cli
16 | ```
17 |
18 | See https://redis.io/docs/latest/commands/ for a list of available commands.
19 |
20 | ### List all stored counters
21 | ```bash title="$> KEYS *"
22 | ...
23 | 25) "/src/index.php"
24 | 26) "/docs/versioned_docs/version-1.x/configuration/download-count.md"
25 | 27) "/docs/static/img/pw1.png"
26 | 28) "/docs/versioned_docs/version-1.x/development/_category_.json"
27 | 29) "/docs/versioned_docs/version-1.x/getting-started/installation.md"
28 | 30) "/docs/static/img/cerulean_dark.png"
29 | 31) "/docs/versioned_sidebars/version-1.x-sidebars.json"
30 | 32) "/docs/versioned_docs/version-2.x/configuration/highlight-updated.md"
31 | 33) "/docs/static/img/secure.svg"
32 | 34) "/docs/src/pages/index.module.css"
33 | ...
34 | ```
35 | ### Read a counter
36 | ```bash title="$> GET /src/index.php"
37 | 123
38 | ```
39 | ### Reset/Modify a counter
40 | ```bash title="$> SET /src/index.php 0"
41 | OK
42 | ```
--------------------------------------------------------------------------------
/docs/docs/api/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "🤖 API Reference",
3 | "position": 4,
4 | "link": {
5 | "type": "generated-index",
6 | "description": "API Reference"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/docs/docs/configuration/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "⚙️ Configuration",
3 | "position": 3,
4 | "link": {
5 | "type": "generated-index",
6 | "description": "Configuration"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/docs/docs/configuration/attribution.md.x:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 5
3 | ---
4 |
5 | # Attribution
6 |
7 | You can hide the attribution by setting the environment variable `HIDE_ATTRIBUTION` to `true`.
8 |
--------------------------------------------------------------------------------
/docs/docs/configuration/batch.mdx:
--------------------------------------------------------------------------------
1 | # Batch Downloads
2 |
3 | The batch download feature allows you to download multiple files at once in a zip file.
4 |
5 | Enable the multi selection mode by clicking the checkbox in the top right corner of the file list. You can then select multiple files by clicking on the files.
6 |
7 | 
8 |
9 | Or download the current folder.
10 |
11 | 
12 |
13 | :::info
14 | Selecting a folder will also recursively select all files and folders inside it.
15 | :::
16 |
17 | :::warning
18 | [Ignored](ignore.mdx), [hidden](metadata.md#hidden) and [password protected](password.mdx) files/folders cannot be batch downloaded and will be skipped.
19 | :::
20 |
21 | import EnvConfig from "@site/src/components/EnvConfig";
22 |
23 |
24 |
--------------------------------------------------------------------------------
/docs/docs/configuration/batch1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adrianschubek/dir-browser/012f608713e3dc9e14acc372a74a8547f8df1f0a/docs/docs/configuration/batch1.gif
--------------------------------------------------------------------------------
/docs/docs/configuration/batch2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adrianschubek/dir-browser/012f608713e3dc9e14acc372a74a8547f8df1f0a/docs/docs/configuration/batch2.png
--------------------------------------------------------------------------------
/docs/docs/configuration/download-count.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 1
3 | ---
4 | # Download Counter
5 |
6 | Download count tracks the number of times a file has been downloaded/visited/opened. It will be saved in a persistent redis database (`-v redissave:/var/lib/redis/`).
7 | Folders itself will not be tracked. In [batch downloads](batch.mdx) the download count will intuitively be increased for each (nested) file in the batch.
8 |
9 | Files are tracked based on their (full) file path. Therefore renaming a file will change/reset the download count.
10 |
11 |
12 | import EnvConfig from '@site/src/components/EnvConfig';
13 |
14 |
--------------------------------------------------------------------------------
/docs/docs/configuration/hashes.md:
--------------------------------------------------------------------------------
1 | # Integrity & Hashes
2 |
3 | It is possible to verify the integrity of a file by setting the `?hash` query parameter to the hash of the file. If the hash does not match the actual hash of the file, an error will be returned instead.
4 |
5 | The [file info API](http.mdx) will also include the hash of the file.
6 |
7 | `sha256` is used as the default hashing algorithm but can be changed to any of the [supported](https://www.php.net/manual/en/function.hash-algos.php) algorithms.
8 |
9 | #### Example
10 |
11 | https://dir-demo.adriansoftware.de/Dockerfile?hash=foobar123
12 |
13 | will return an access denied error.
14 |
15 | Setting it to the correct hash will return the file as usual.
16 |
17 | https://dir-demo.adriansoftware.de/Dockerfile?hash=8102c6372ce8afd35c87df8a78cbd63386538211f45c0042b1a9a7e73630a9bb
18 |
19 | You can also use a POST request to verify the hash:
20 |
21 | ```bash
22 | curl -X POST https://dir-demo.adriansoftware.de/Dockerfile -d "hash=8102c6372ce8afd35c87df8a78cbd63386538211f45c0042b1a9a7e73630a9bb"
23 | ```
24 |
25 | ### Mandatory hashes
26 |
27 | Set in the [metadata](metadata.md) config of the file to require the hash to be set. If the hash is not set, an error will be returned.
28 |
29 | ```json title=".dbmeta.json"
30 | {
31 | "hash_required": true
32 | }
33 | ```
34 |
35 | Or set it globally using the `HASH_REQUIRED` variable.
36 |
37 | :::warning
38 | This feature should not be used to restrict access as the hash is publicly available through the [API](http.mdx) if enabled. It is only meant to make an integrity verification of the file mandatory for every request.
39 |
40 | To protect the file use the [password protection](password.mdx) feature.
41 | :::
42 |
43 | import EnvConfig from '@site/src/components/EnvConfig';
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/docs/configuration/http.mdx:
--------------------------------------------------------------------------------
1 | # API
2 |
3 | ### Folder listing
4 |
5 | Add `?ls` to a folder URL to get a JSON response of the folder content.
6 |
7 | 
8 |
9 | 
10 |
11 | https://dir-demo.adriansoftware.de/?ls
12 |
13 | ### File info
14 |
15 | Add `?info` to a file URL to get a JSON response of the file info. A password is required if the file is password protected.
16 |
17 | 
18 |
19 | https://dir-demo.adriansoftware.de/Dockerfile?info
20 |
21 | :::warning
22 | Disabling this feature will also disable the `Copy Hash` feature as it relies on the API.
23 | :::
24 |
25 | import EnvConfig from "@site/src/components/EnvConfig";
26 |
27 |
28 |
--------------------------------------------------------------------------------
/docs/docs/configuration/http1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adrianschubek/dir-browser/012f608713e3dc9e14acc372a74a8547f8df1f0a/docs/docs/configuration/http1.gif
--------------------------------------------------------------------------------
/docs/docs/configuration/i18n.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 3
3 | ---
4 | # Format
5 |
6 | ## Date & Time
7 |
8 | The date and time format for files/folders displayed in the file tree.
9 |
10 |
11 | | Value | Description |
12 | | --- | --- |
13 | | `local` | Format based on user's localized date format (e.g. `12.1.2024, 04:36:30` in German) |
14 | | `utc` | UTC time (e.g. `2021-08-01 12:32:55 UTC`) |
15 | | `relative` (Default) | Relative time based on user's localized date format (e.g. `2 days ago` in English) |
16 |
17 | All times will be displayed in the user's local timezone.
18 |
19 | When using the `relative` format you can override the language by setting the environment variable `DATE_FORMAT_RELATIVE_LANG` (e.g. `DATE_FORMAT_RELATIVE_LANG=de` will output relative times in German). By default it uses the locale of the user.
20 |
21 |
22 | import EnvConfig from '@site/src/components/EnvConfig';
23 |
24 |
--------------------------------------------------------------------------------
/docs/docs/configuration/icons.md:
--------------------------------------------------------------------------------
1 | # File Icons
2 |
3 | Display file and folders icons in the file tree. Increases the css bundle.
4 |
5 | import EnvConfig from '@site/src/components/EnvConfig';
6 |
7 |
--------------------------------------------------------------------------------
/docs/docs/configuration/ignore.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 6
3 | ---
4 |
5 | # Hide Files & Folders
6 |
7 | :::info
8 | In contrast to using [metadata](./metadata.md) the file or folder is completely hidden/ignored from the filetree, all APIs and cannot be accessed via URL.
9 | :::
10 |
11 | ### Ignore patterns
12 |
13 | Hide specific files or folders by defining an ignore pattern using regular expressions.
14 |
15 | It uses [preg_match](https://www.php.net/manual/en/function.preg-match.php) to match the file path. Pattern matching is case insensitive.
16 | If a match is found the file/folder will be hidden.
17 | The path always starts with a `/`, which is the mounted folder.
18 |
19 | #### Examples
20 |
21 | | Pattern | Description | Hidden | Not Hidden |
22 | | ------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
23 | | `/\..*` | Hide everything starting with a dot `.` like `.env`, `.git`... | `/foo/.bar`, `/.foo/bar` | `/foo/bar` |
24 | | `^/foo/.*\.txt$` | Hide everything in the folder `/foo` ending with `.txt` | `/foo/abc.txt` | `/foo/abc.md`, `/bar/foo/abc.txt` |
25 | | `^/node_modules/` | Hide the folder `/node_modules` and its content | `/node_modules` | `/foo/node_modules` |
26 | | `/node_modules/` | Hide the folder `node_modules` and its content at any level | `/node_modules`, `/foo/node_modules` | `/node_modules_123` |
27 | | `^/reports/2023.*\.pdf` | Hide all pdf files in the folder `/reports` starting with `2023` | `/reports/2023-01.pdf`, `/reports/2023-02.pdf` | `/reports/2022-01.pdf`, `/reports/2023-01.txt` |
28 | | `^/secret/.*\.(jpg\|png)$` | Hide all images deep inside the folder `/secret` | `/secret/foo.jpg`, `/secret/bar/abc.png` | `/secret/foo.png.txt`, `/foo/secret/abc.png` |
29 |
30 |
31 | You can hide some files and folders by setting the environment variable `IGNORE` to a pattern. By default everything is shown.
32 |
33 |
34 | Legacy (v1.2 - v3.2) ignore pattern matching
35 |
36 | Patterns are matched against the file name and every parent folder name **individually** not as a path.
37 |
38 | For example if you have a file `foo/bar/secret.txt`. This path will be split into an array `['foo', 'bar', 'secret.txt']` and each part will be matched against the pattern. If at any point the pattern matches the name, it will be hidden.
39 |
40 | Usecase: Hide everything starting with a dot . using a `.*` pattern globally at any nesting level. This will hide `/foo/bar/.foobar`, `/.baz`, `/foo/.secret/bar` etc.
41 |
42 | It uses [fnmatch](https://www.php.net/manual/en/function.fnmatch.php) to match the pattern.
43 |
44 | | Pattern | Description |
45 | | -------- | -------------------------------------- |
46 | | `*` | Matches everything (including nothing) |
47 | | `?` | Matches any single character |
48 | | `[seq]` | Matches any character in seq |
49 | | `[!seq]` | Matches any character not in seq |
50 |
51 | - pattern `foo` will hide the file `foo/bar/secret.txt` because `foo` matches the first array element `foo`.
52 | - pattern `*bar*` will hide the file `foo/bar/secret.txt` because `*bar*` matches the second array element `bar`.
53 | - pattern `*.txt` will hide the file `foo/bar/secret.txt` because `*.txt` matches the third array element `secret.txt`.
54 |
55 | #### Examples
56 |
57 | - `*[ab].txt` hides all files or folder ending with either `a.txt` or `b.txt`.
58 |
59 | - `.*` hides all files or folder starting with a dot .
60 |
61 | - `[a-zA-Z0-9]*` hides all files or folder starting with a letter or number.
62 |
63 | - `[!a-zA-Z0-9]*` hides all files or folder not starting with a letter or number.
64 |
65 | - `report-???.pdf` hides `report-001.pdf`, `report-123.pdf` but not `report-1.pdf`.
66 |
67 |
68 |
69 | ### Multiple patterns
70 |
71 | You can specify multiple patterns and seperate them using a `;`. If any of the patterns matches, the file or folder will be hidden.
72 |
73 | import EnvConfig from "@site/src/components/EnvConfig";
74 |
75 |
82 |
--------------------------------------------------------------------------------
/docs/docs/configuration/js.mdx:
--------------------------------------------------------------------------------
1 | # Custom JavaScript
2 |
3 | import EnvConfig from '@site/src/components/EnvConfig';
4 |
5 |
--------------------------------------------------------------------------------
/docs/docs/configuration/language.md.todo:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 4
3 | ---
4 |
5 | # Language
6 |
7 | Available Languages: `en` (English), `de` (Deutsch)
8 |
9 | By default the language is set to `en`. You can change it by setting the `LANGUAGE` environment variable.
10 |
11 | ```
12 | docker run -d -p 8080:80 -v /my/local/folder:/var/www/html/public:ro -e LANGUAGE=de -v redissave:/var/lib/redis/ -it adrianschubek/dir-browser
13 | ```
--------------------------------------------------------------------------------
/docs/docs/configuration/layout.md:
--------------------------------------------------------------------------------
1 | # Layout
2 |
3 |
9 | import EnvConfig from '@site/src/components/EnvConfig';
10 |
11 |
--------------------------------------------------------------------------------
/docs/docs/configuration/metadata.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: -1
3 | ---
4 |
5 | import Image from "@theme/IdealImage";
6 |
7 | # Metadata
8 |
9 | Files and folders can be annotated with metadata. Metadata is stored in a file called `.dbmeta.json`, where `` is the exact file (including extension) or folder name. Put it in the same folder as the target file or folder. Metadata is stored in a JSON format specified below.
10 |
11 | The `*.dbmeta.json` files are hidden from the user and cannot be viewed.
12 |
13 |
14 |
15 |
16 |
17 | ```json title="/foo bar/cool project.dbmeta.json"
18 | {
19 | "description": "A short project description ⭐",
20 | "labels": ["danger:Laravel", "primary:PHP 8", "dark:Hot 🔥"],
21 | "hidden": false,
22 | "password": "mysecurepassword",
23 | "hash_required": false
24 | }
25 | ```
26 |
27 |
28 | :::info
29 | If you are looking for the ".dbmeta.**md**" files, see [Readme Rendering](./readme.md).
30 | :::
31 |
32 | ## Properties
33 |
34 | #### Description
35 |
36 | A short description of the file or folder. This is displayed in the file tree.
37 |
38 | > Default is empty.
39 |
40 | #### Labels
41 |
42 | Labels always start with a style and a colon `:`, followed by the label text. The following styles are available:
43 | - `primary`
44 | - `secondary`
45 | - `success`
46 | - `danger`
47 | - `warning`
48 | - `info`
49 | - `light`
50 | - `dark`
51 |
52 | :::warning
53 | Labels must not contain a semicolon `;`.
54 | :::
55 |
56 | > Default is empty.
57 |
58 | #### Hidden
59 |
60 | :::warning
61 | The file can still be accessed via URL directly. If you want to ignore it completely, consider using an [IGNORE](./ignore.mdx) pattern.
62 | :::
63 |
64 | If set to `true`, the file or folder is hidden from the file tree. Can be combined with password protection.
65 |
66 | > Default is `false`.
67 |
68 | #### Password
69 |
70 | See [Password Protection](password.mdx).
71 |
72 | > Default is empty.
73 |
74 | #### Hash Required
75 |
76 | See [Integrity & Hashes](hashes.md).
77 |
78 | > Default is `false`.
79 |
80 | import EnvConfig from "@site/src/components/EnvConfig";
81 |
82 |
--------------------------------------------------------------------------------
/docs/docs/configuration/pagination.mdx:
--------------------------------------------------------------------------------
1 | # Pagination
2 |
3 | import Image from "@theme/IdealImage";
4 | import EnvConfig from "@site/src/components/EnvConfig";
5 |
6 | Display a large number of items in a list by splitting them into multiple pages.
7 |
8 | Pagination only visible when the number of items exceeds the number of items per page.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/docs/docs/configuration/password.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 0.5
3 | ---
4 |
5 | import Image from "@theme/IdealImage";
6 |
7 | # Password Protection
8 |
9 | Individual files can be protected with a password.
10 | It is also possible to protect the entire dir-browser instance with a global password.
11 |
12 | Both file passwords and a global password can be used at the same time.
13 |
14 | ## File password
15 |
16 |
17 |
18 | A file can be protected with a password, which is stored in a [dbmeta.json](/configuration/metadata.md) file.
19 |
20 | Protected files can only be downloaded/viewed after unlocking them with the correct password. However, they are still visible in the file tree.
21 |
22 | Protected files will display a key icon next to their name in the file tree.
23 |
24 | ### Definition
25 |
26 | See [Metadata](metadata.md) for more information on how to define metadata for a file.
27 |
28 | :::info
29 | At this time, only files can be protected with a password, not directories. This may change in the future.
30 | :::
31 |
32 | #### Hash
33 |
34 | The hash should be generated using PHP's [`password_hash`](https://www.php.net/manual/en/function.password-hash.php) function.
35 | You can generate one using the following command or use an online generator.
36 | ```bash
37 | php -r "echo password_hash('foobar', PASSWORD_DEFAULT);"
38 | ```
39 |
40 | 
41 |
42 |
43 | ```json title="/examples/pwhash protected.txt.dbmeta.json"
44 | {
45 | "password_hash": "$2y$10$kwS/gp3aGLQ.DqUNhiqiPe1HDBN4mYlyfd06DIC/157L9WAaWngIy"
46 | }
47 | ```
48 |
49 | #### Plaintext
50 |
51 | ```json title="/examples/foo bar/bla bla.txt.dbmeta.json"
52 | {
53 | "password": "foobar"
54 | }
55 | ```
56 |
57 | :::warning
58 | Do not specify both `password` and `password_hash`.
59 | :::
60 |
61 |
62 | ### Access
63 |
64 | #### Via UI
65 |
66 | When accessing a protected file, you will be prompted to enter the password.
67 |
68 | https://dir-demo.adriansoftware.de/examples/foo%20%20%20bar/bla%20bla.txt
69 |
70 | {/* */}
71 | 
72 |
73 | #### GET request
74 |
75 | Specify the password as a `key` parameter in the URL:
76 |
77 | https://dir-demo.adriansoftware.de/examples/foo%20%20%20bar/bla%20bla.txt?key=foobar
78 |
79 | #### POST request
80 |
81 | Or as part of a POST request
82 |
83 | ```
84 | curl -X POST https://dir-demo.adriansoftware.de/examples/foo%20%20%20bar/bla%20bla.txt -d "key=foobar"
85 | ```
86 |
87 | ## Global password
88 |
89 | The entire dir-browser instance can be protected with a global password using [basic auth](https://en.wikipedia.org/wiki/Basic_access_authentication).
90 |
91 | ### Definition
92 |
93 | import EnvConfig from '@site/src/components/EnvConfig';
94 |
95 |
96 |
97 | :::warning
98 | `PASSWORD_USER` and either `PASSWORD_RAW` or `PASSWORD_HASH` is mandatory to specify.
99 | :::
100 |
101 | {/* :::info
102 | Support for LDAP, OAuth, and other authentication methods is planned.
103 | :::
104 |
105 | support Basic Auth */}
106 |
107 | ### Access
108 |
109 | #### Via UI
110 |
111 | When accessing the dir-browser, your browser will prompt you to enter a username and password.
112 |
113 | #### GET request
114 |
115 | Specify the `username:password` pair base64 encoded in the `Authorization` header.
116 |
117 | For example if the username is `admin` and the password is `foobar` then Base64 encode `admin:foobar` to `YWRtaW46Zm9vYmFy`.
118 |
119 | ```
120 | curl https://dir-demo.adriansoftware.de/examples/burger.jpg -H "Authorization: Basic YWRtaW46Zm9vYmFy"
121 | ```
122 |
123 | #### POST request
124 |
125 | Or as part of a POST request
126 |
127 | ```
128 | curl -X POST https://dir-demo.adriansoftware.de/examples/burger.jpg -H "Authorization: Basic YWRtaW46Zm9vYmFy"
129 | ```
130 |
--------------------------------------------------------------------------------
/docs/docs/configuration/password1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adrianschubek/dir-browser/012f608713e3dc9e14acc372a74a8547f8df1f0a/docs/docs/configuration/password1.png
--------------------------------------------------------------------------------
/docs/docs/configuration/password3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adrianschubek/dir-browser/012f608713e3dc9e14acc372a74a8547f8df1f0a/docs/docs/configuration/password3.png
--------------------------------------------------------------------------------
/docs/docs/configuration/prefetch.mdx:
--------------------------------------------------------------------------------
1 | # Prefetching on Hover
2 |
3 | By default, hovering over a folder link in the filetree will prefetch the contents of the folder. This can be disabled by setting the `PREFETCH_FOLDERS` environment variable to `false`.
4 | Prefetching of files is disabled by default because it downloads the file in the background and may increase the counter inadvertently. This can be enabled again by setting the `PREFETCH_FILES` environment variable to `true`.
5 |
6 | import EnvConfig from '@site/src/components/EnvConfig';
7 |
8 |
--------------------------------------------------------------------------------
/docs/docs/configuration/readme.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 4
3 | slug: readme
4 | ---
5 | # Readme Rendering
6 |
7 | If there is a `readme.md` (case insensitive) (can be configured) file in the current directory, it will be rendered. GitHub flavored markdown is supported. See [Demo Page](https://dir-demo.adriansoftware.de/examples/).
8 |
9 | ### `.dbmeta.md` file
10 | You can specify a `.dbmeta.md` file in a directory to render it while also hiding it from the file tree, API and downloads at the same time. A `.dbmeta.md` file will override a existing `readme.md` file. See [Demo](https://dir-demo.adriansoftware.de/examples/markdown/).
11 |
12 | :::info
13 | By default unsafe HTML inside markdown (such as `