mirror of
https://github.com/sxyazi/yazi.git
synced 2026-05-13 08:16:40 +00:00
fix!: eliminate the x- prefix in mime-types (#1927)
This commit is contained in:
parent
202751b46a
commit
22e7d579d2
10 changed files with 29 additions and 31 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
# Code of Conduct
|
||||
|
||||
## Goal
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ Our standards are as follows:
|
|||
Examples of unacceptable behavior include:
|
||||
|
||||
- Trolling, insulting or derogatory comments, and personal attacks
|
||||
- Harasing or bullying another person
|
||||
- Harassing or bullying another person
|
||||
- Publishing others' private information without their explicit permission
|
||||
- Posting things unrelated to the topic being discussed
|
||||
- Other conduct that could reasonably be considered inappropriate in a professional setting
|
||||
|
|
@ -191,13 +191,13 @@ rules = [
|
|||
|
||||
# Archives
|
||||
{ mime = "application/{,g}zip", fg = "red" },
|
||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "red" },
|
||||
{ mime = "application/{tar,bzip*,7z-compressed,xz,rar}", fg = "red" },
|
||||
|
||||
# Documents
|
||||
{ mime = "application/{pdf,doc,rtf,vnd.*}", fg = "cyan" },
|
||||
|
||||
# Empty files
|
||||
# { mime = "inode/x-empty", fg = "red" },
|
||||
# { mime = "inode/empty", fg = "red" },
|
||||
|
||||
# Special files
|
||||
{ name = "*", is = "orphan", bg = "red" },
|
||||
|
|
|
|||
|
|
@ -68,12 +68,12 @@ rules = [
|
|||
{ mime = "{audio,video}/*", use = [ "play", "reveal" ] },
|
||||
# Archive
|
||||
{ mime = "application/{,g}zip", use = [ "extract", "reveal" ] },
|
||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", use = [ "extract", "reveal" ] },
|
||||
{ mime = "application/{tar,bzip*,7z-compressed,xz,rar}", use = [ "extract", "reveal" ] },
|
||||
# JSON
|
||||
{ mime = "application/{json,x-ndjson}", use = [ "edit", "reveal" ] },
|
||||
{ mime = "application/{json,ndjson}", use = [ "edit", "reveal" ] },
|
||||
{ mime = "*/javascript", use = [ "edit", "reveal" ] },
|
||||
# Empty file
|
||||
{ mime = "inode/x-empty", use = [ "edit", "reveal" ] },
|
||||
{ mime = "inode/empty", use = [ "edit", "reveal" ] },
|
||||
# Fallback
|
||||
{ name = "*", use = [ "open", "reveal" ] },
|
||||
]
|
||||
|
|
@ -96,7 +96,7 @@ spotters = [
|
|||
{ name = "*/", run = "folder" },
|
||||
# Code
|
||||
{ mime = "text/*", run = "code" },
|
||||
{ mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code" },
|
||||
{ mime = "*/{xml,javascript,wine-extension-ini}", run = "code" },
|
||||
# Image
|
||||
{ mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" },
|
||||
{ mime = "image/*", run = "image" },
|
||||
|
|
@ -121,9 +121,9 @@ previewers = [
|
|||
{ name = "*/", run = "folder", sync = true },
|
||||
# Code
|
||||
{ mime = "text/*", run = "code" },
|
||||
{ mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code" },
|
||||
{ mime = "*/{xml,javascript,wine-extension-ini}", run = "code" },
|
||||
# JSON
|
||||
{ mime = "application/{json,x-ndjson}", run = "json" },
|
||||
{ mime = "application/{json,ndjson}", run = "json" },
|
||||
# Image
|
||||
{ mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" },
|
||||
{ mime = "image/*", run = "image" },
|
||||
|
|
@ -133,12 +133,12 @@ previewers = [
|
|||
{ mime = "application/pdf", run = "pdf" },
|
||||
# Archive
|
||||
{ mime = "application/{,g}zip", run = "archive" },
|
||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" },
|
||||
{ mime = "application/{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" },
|
||||
# Font
|
||||
{ mime = "font/*", run = "font" },
|
||||
{ mime = "application/vnd.ms-opentype", run = "font" },
|
||||
# Empty file
|
||||
{ mime = "inode/x-empty", run = "empty" },
|
||||
{ mime = "inode/empty", run = "empty" },
|
||||
# Fallback
|
||||
{ name = "*", run = "file" },
|
||||
]
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ function M:seek(units)
|
|||
})
|
||||
end
|
||||
|
||||
function M:spot(args) require("file"):spot(args) end
|
||||
function M:spot(job) require("file"):spot(job) end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ local hovered_mime = ya.sync(function()
|
|||
end
|
||||
end)
|
||||
|
||||
function M:spot(args)
|
||||
function M:spot(job)
|
||||
local mime = hovered_mime()
|
||||
if not mime then
|
||||
return
|
||||
end
|
||||
|
||||
local file = args.file
|
||||
local file = job.file
|
||||
local spotter = PLUGIN.spotter(file.url, mime)
|
||||
local previewer = PLUGIN.previewer(file.url, mime)
|
||||
local fetchers = PLUGIN.fetchers(file.url, mime)
|
||||
|
|
@ -64,7 +64,7 @@ function M:spot(args)
|
|||
row(" Preloaders:", #preloaders ~= 0 and preloaders or "-")
|
||||
|
||||
ya.spot_table(
|
||||
args,
|
||||
job,
|
||||
ui.Table(rows)
|
||||
:area(ui.Pos { "center", w = 60, h = 20 })
|
||||
:row(1)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,6 @@ function M:seek(units)
|
|||
end
|
||||
end
|
||||
|
||||
function M:spot(args) require("file"):spot(args) end
|
||||
function M:spot(job) require("file"):spot(job) end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ function M:preload()
|
|||
return ya.image_precache(self.file.url, cache) and 1 or 2
|
||||
end
|
||||
|
||||
function M:spot(args)
|
||||
local info = ya.image_info(args.file.url)
|
||||
function M:spot(job)
|
||||
local info = ya.image_info(job.file.url)
|
||||
|
||||
local rows = {}
|
||||
local row = function(key, value)
|
||||
|
|
@ -37,10 +37,10 @@ function M:spot(args)
|
|||
row("Color:", tostring(info.color))
|
||||
|
||||
ya.spot_table(
|
||||
args,
|
||||
job,
|
||||
ui.Table(rows)
|
||||
:area(ui.Pos { "center", w = 60, h = 20 })
|
||||
:row(args.skip)
|
||||
:row(job.skip)
|
||||
:col(1)
|
||||
:col_style(ui.Style():fg("blue"))
|
||||
:cell_style(ui.Style():fg("yellow"):reverse())
|
||||
|
|
|
|||
|
|
@ -41,6 +41,6 @@ function M:preload()
|
|||
return status and status.success and 1 or 2
|
||||
end
|
||||
|
||||
function M:spot(args) require("file"):spot(args) end
|
||||
function M:spot(job) require("file"):spot(job) end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@ local SUPPORTED_TYPES = "application/audio/biosig/chemical/font/image/inode/mess
|
|||
local M = {}
|
||||
|
||||
local function match_mimetype(s)
|
||||
local type, sub = s:match("([-a-z]+/)([+-.a-zA-Z0-9]+)%s*$")
|
||||
if type and sub and SUPPORTED_TYPES:find(type, 1, true) then
|
||||
return type .. sub
|
||||
local type, sub = s:match("^([-a-z]+/)([+-.a-zA-Z0-9]+)%s*$")
|
||||
if type and sub and SUPPORTED_TYPES:find(type, 1, true) then
|
||||
return type:gsub("^x%-", "", 1) .. sub:gsub("^x%-", "", 1)
|
||||
end
|
||||
end
|
||||
|
||||
function M:fetch(args)
|
||||
function M:fetch(job)
|
||||
local urls = {}
|
||||
for _, file in ipairs(args.files) do
|
||||
for _, file in ipairs(job.files) do
|
||||
urls[#urls + 1] = tostring(file.url)
|
||||
end
|
||||
|
||||
|
|
@ -44,9 +44,7 @@ function M:fetch(args)
|
|||
end
|
||||
|
||||
valid = match_mimetype(line)
|
||||
if valid and line:find(valid, 1, true) ~= 1 then
|
||||
goto continue
|
||||
elseif valid then
|
||||
if valid then
|
||||
j, updates[urls[i]] = j + 1, valid
|
||||
flush(false)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -62,6 +62,6 @@ function M:preload()
|
|||
return status and status.success and 1 or 2
|
||||
end
|
||||
|
||||
function M:spot(args) require("file"):spot(args) end
|
||||
function M:spot(job) require("file"):spot(job) end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue