mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-03 18:24:53 +00:00
9d27207fbc
- Simplified structure validation by re-exporting functions from structure_config and validate_structure modules for better maintainability. - Consolidated validation logic in validate.lua, delegating to validate_package module for clearer orchestration. - Introduced new quick guide functionalities including step management (add, remove, update, reset ordering) and media handling (thumbnail and video URL validation). - Added utility functions for URL validation and step creation, enhancing the quick guide's usability. - Established type definitions for steps and media states to improve code clarity and type safety. - Enhanced schema editor with new field and relation definitions, providing a more robust structure for database schema management.
20 lines
491 B
Lua
20 lines
491 B
Lua
local is_valid_url = require("is_valid_url")
|
|
|
|
--- Check if URL is an image
|
|
---@param url? string URL to check
|
|
---@return boolean Whether URL points to an image
|
|
local function is_image_url(url)
|
|
if not is_valid_url(url) then
|
|
return false
|
|
end
|
|
local patterns = { "%.png$", "%.jpg$", "%.jpeg$", "%.gif$", "%.webp$", "%.svg$" }
|
|
for _, pattern in ipairs(patterns) do
|
|
if string.match(url:lower(), pattern) then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
return is_image_url
|