diff --git a/CODE_OF_CONDUCT.MD b/CODE_OF_CONDUCT.md similarity index 97% rename from CODE_OF_CONDUCT.MD rename to CODE_OF_CONDUCT.md index 18e8952a2..9e11fd5b9 100644 --- a/CODE_OF_CONDUCT.MD +++ b/CODE_OF_CONDUCT.md @@ -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 diff --git a/yazi-config/preset/theme.toml b/yazi-config/preset/theme.toml index f6c1f347e..d98bdad0e 100644 --- a/yazi-config/preset/theme.toml +++ b/yazi-config/preset/theme.toml @@ -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" }, diff --git a/yazi-config/preset/yazi.toml b/yazi-config/preset/yazi.toml index e9d30cff5..863291cfd 100644 --- a/yazi-config/preset/yazi.toml +++ b/yazi-config/preset/yazi.toml @@ -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" }, ] diff --git a/yazi-plugin/preset/plugins/code.lua b/yazi-plugin/preset/plugins/code.lua index 78f495764..c4e9e61f8 100644 --- a/yazi-plugin/preset/plugins/code.lua +++ b/yazi-plugin/preset/plugins/code.lua @@ -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 diff --git a/yazi-plugin/preset/plugins/file.lua b/yazi-plugin/preset/plugins/file.lua index 23d8cd4fb..40ae48c28 100644 --- a/yazi-plugin/preset/plugins/file.lua +++ b/yazi-plugin/preset/plugins/file.lua @@ -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) diff --git a/yazi-plugin/preset/plugins/folder.lua b/yazi-plugin/preset/plugins/folder.lua index a890e1eda..0af4bf32e 100644 --- a/yazi-plugin/preset/plugins/folder.lua +++ b/yazi-plugin/preset/plugins/folder.lua @@ -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 diff --git a/yazi-plugin/preset/plugins/image.lua b/yazi-plugin/preset/plugins/image.lua index 3b398ec14..ca913417c 100644 --- a/yazi-plugin/preset/plugins/image.lua +++ b/yazi-plugin/preset/plugins/image.lua @@ -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()) diff --git a/yazi-plugin/preset/plugins/magick.lua b/yazi-plugin/preset/plugins/magick.lua index c188bbf54..75a5a7050 100644 --- a/yazi-plugin/preset/plugins/magick.lua +++ b/yazi-plugin/preset/plugins/magick.lua @@ -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 diff --git a/yazi-plugin/preset/plugins/mime.lua b/yazi-plugin/preset/plugins/mime.lua index 7ce3833f3..8fc2508af 100644 --- a/yazi-plugin/preset/plugins/mime.lua +++ b/yazi-plugin/preset/plugins/mime.lua @@ -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 diff --git a/yazi-plugin/preset/plugins/video.lua b/yazi-plugin/preset/plugins/video.lua index 52a34c997..be953c5b0 100644 --- a/yazi-plugin/preset/plugins/video.lua +++ b/yazi-plugin/preset/plugins/video.lua @@ -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