feat: new mime-ext plugin

This commit is contained in:
sxyazi
2024-08-21 20:24:10 +08:00
parent 49ec78e68a
commit b659791954
5 changed files with 1090 additions and 1 deletions

21
mime-ext.yazi/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 yazi-rs
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.

31
mime-ext.yazi/README.md Normal file
View File

@@ -0,0 +1,31 @@
# mime-ext.yazi
A _common_ file type MIME-type library specifically designed for Yazi. Ensuring strict compliance with IANA-registered media types is not its primary goal.
It is still in a very early stage and currently requires the [latest nightly build of Yazi](https://github.com/sxyazi/yazi/releases/tag/nightly).
## Installation
```sh
ya pack -a yazi-rs/plugins:mime-ext
```
## Usage
Add this to your `~/.config/yazi/yazi.toml`:
```toml
[[plugin.prepend_fetchers]]
id = "mime"
if = "!mime"
name = "*"
run = "mime-ext"
prio = "high"
```
## TODO
- Add more file types (PRs welcome!).
- Allow configuring the plugin and overriding some of its rules.
- Eliminating `x-` as part of Yazi v0.4 as it's discouraged as per [rfc6838#section-3.4](https://datatracker.ietf.org/doc/html/rfc6838#section-3.4)
- Compress mime-type tables.

1036
mime-ext.yazi/init.lua Normal file

File diff suppressed because it is too large Load Diff