From fecbddd938e48fdec0eb12d1e19699e5a8554f6e Mon Sep 17 00:00:00 2001 From: PeppeSg <59803939+PeppeSess@users.noreply.github.com> Date: Tue, 5 May 2026 02:01:11 +0200 Subject: [PATCH 1/9] Update server.lua Added missing command registration support for the Qbox framework module. The ESX and QBCore framework modules already expose `Framework.Commands.Add`, but the Qbox module did not define `Framework.Commands`, causing resources that rely on the unified Community Bridge command API to fail on Qbox --- modules/framework/qbx_core/server.lua | 35 ++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/modules/framework/qbx_core/server.lua b/modules/framework/qbx_core/server.lua index f8431aa..7c33fd6 100644 --- a/modules/framework/qbx_core/server.lua +++ b/modules/framework/qbx_core/server.lua @@ -547,4 +547,37 @@ AddEventHandler("playerDropped", function() TriggerEvent("community_bridge:Server:OnPlayerUnload", src) end) -return Framework \ No newline at end of file +AddEventHandler("playerDropped", function() + local src = source + TriggerEvent("community_bridge:Server:OnPlayerUnload", src) +end) + +Framework.Commands = Framework.Commands or {} + +---@description Adds a command to the Qbox framework +---@param name string +---@param help string +---@param arguments table +---@param argsrequired boolean +---@param callback function +---@param permission string +---@param ... any +Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...) + lib.addCommand(name, { + help = help or "", + params = arguments or {}, + restricted = false + }, function(source, args, raw) + if permission and permission ~= "user" then + if not Framework.GetIsFrameworkAdmin(source) then + return + end + end + + callback(source, args or {}, raw) + end) +end + +return Framework + +return Framework From 162598a3f955e26b17dd23d260a46d9e8d47a42b Mon Sep 17 00:00:00 2001 From: PeppeSg <59803939+PeppeSess@users.noreply.github.com> Date: Tue, 5 May 2026 11:01:19 +0200 Subject: [PATCH 2/9] Update server.lua fixed a small careless error --- modules/framework/qbx_core/server.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/framework/qbx_core/server.lua b/modules/framework/qbx_core/server.lua index 7c33fd6..b305054 100644 --- a/modules/framework/qbx_core/server.lua +++ b/modules/framework/qbx_core/server.lua @@ -579,5 +579,3 @@ Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, end return Framework - -return Framework From a4a7c4927b0635238599f8b5f541ab3e3b8e3079 Mon Sep 17 00:00:00 2001 From: PeppeSg <59803939+PeppeSess@users.noreply.github.com> Date: Wed, 3 Jun 2026 22:16:49 +0200 Subject: [PATCH 3/9] Update server.lua removed duplicates --- modules/framework/qbx_core/server.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/framework/qbx_core/server.lua b/modules/framework/qbx_core/server.lua index b305054..53071bd 100644 --- a/modules/framework/qbx_core/server.lua +++ b/modules/framework/qbx_core/server.lua @@ -547,11 +547,6 @@ AddEventHandler("playerDropped", function() TriggerEvent("community_bridge:Server:OnPlayerUnload", src) end) -AddEventHandler("playerDropped", function() - local src = source - TriggerEvent("community_bridge:Server:OnPlayerUnload", src) -end) - Framework.Commands = Framework.Commands or {} ---@description Adds a command to the Qbox framework From e8ba8e1837e98b48743c989994d02f767eff9cfe Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 6 Jun 2026 22:36:44 -0400 Subject: [PATCH 4/9] Support optional requiredCount in HasItem Add an optional requiredCount parameter to Inventory.HasItem and default it to 1 when not provided. The function now forwards the count to tgiann:HasItem, allowing callers to check for multiple item quantities; updated the LuaDoc param annotation accordingly. --- modules/inventory/tgiann-inventory/server.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/inventory/tgiann-inventory/server.lua b/modules/inventory/tgiann-inventory/server.lua index c77e0e1..a3d8e99 100644 --- a/modules/inventory/tgiann-inventory/server.lua +++ b/modules/inventory/tgiann-inventory/server.lua @@ -129,9 +129,10 @@ end ---@description This will return a boolean if the player has the item. ---@param src number ---@param item string +---@param requiredCount number (optional) ---@return boolean -Inventory.HasItem = function(src, item) - return tgiann:HasItem(src, item, 1) +Inventory.HasItem = function(src, item, requiredCount) + return tgiann:HasItem(src, item, requiredCount or 1) end ---@description This is to get if there is available space in the inventory, will return boolean. From 48c58f45e0b582b4958fdf4024c90028bfd0706c Mon Sep 17 00:00:00 2001 From: Musiker15 Date: Sun, 28 Jun 2026 10:15:55 +0200 Subject: [PATCH 5/9] feat: add MSK Scripts provider integrations - fuel/msk_fuel: Fuel provider via msk_fuel exports (Get/SetVehicleFuel) - vehiclekey/msk_vehiclekeys: VehicleKey provider (Add/RemovePrimaryKey) - notify/msk_core: config-driven Notify provider via msk_core:Notify - progressbar/msk_core: ProgressBar provider mapping label/duration/anim/disable - settings: whitelist comments for msk_core / msk_fuel / msk_vehiclekeys --- modules/fuel/msk_fuel/client.lua | 33 ++++++++++ modules/notify/msk_core/client.lua | 38 +++++++++++ modules/progressbar/msk_core/client.lua | 66 +++++++++++++++++++ .../msk_vehiclekeys/client/client.lua | 33 ++++++++++ settings/clientConfig.lua | 6 +- settings/sharedConfig.lua | 2 +- 6 files changed, 174 insertions(+), 4 deletions(-) create mode 100644 modules/fuel/msk_fuel/client.lua create mode 100644 modules/notify/msk_core/client.lua create mode 100644 modules/progressbar/msk_core/client.lua create mode 100644 modules/vehiclekey/msk_vehiclekeys/client/client.lua diff --git a/modules/fuel/msk_fuel/client.lua b/modules/fuel/msk_fuel/client.lua new file mode 100644 index 0000000..acca07b --- /dev/null +++ b/modules/fuel/msk_fuel/client.lua @@ -0,0 +1,33 @@ +---@diagnostic disable: duplicate-set-field +local resourceName = "msk_fuel" +if GetResourceState(resourceName) == 'missing' then return end +Fuel = Fuel or {} + +---@description Returns the name of the active fuel resource. +---@return string +Fuel.GetResourceName = function() + return resourceName +end + +---@description Returns the current fuel level of a vehicle. +---@param vehicle number The vehicle entity handle. +---@return number The vehicle fuel level. +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0 end + return exports.msk_fuel:GetVehicleFuel(vehicle) +end + +---@description Sets the fuel level of a vehicle. +---@param vehicle number The vehicle entity handle. +---@param fuel number The fuel level to assign. +---@param type? string The fuel type, used only in ti_fuel / msk_fuel. (default: nil) +---@return nil +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + exports.msk_fuel:SetVehicleFuel(vehicle, fuel) + if type then + exports.msk_fuel:SetVehicleFuelType(vehicle, type) + end +end + +return Fuel diff --git a/modules/notify/msk_core/client.lua b/modules/notify/msk_core/client.lua new file mode 100644 index 0000000..59838e6 --- /dev/null +++ b/modules/notify/msk_core/client.lua @@ -0,0 +1,38 @@ +---@diagnostic disable: duplicate-set-field +Notify = Notify or {} +local resourceName = "msk_core" +local configValue = BridgeSharedConfig.Notify +if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end + +Notify.GetResourceName = function() + return resourceName +end + +local Language = Language or Require("modules/locales/shared.lua") +local locale = Language.Locale +local placeHolderText = locale("Notifications.PlaceholderTitle") + +---DEPRICATED: PLEASE SWITCH TO Notify.SendNotification +---@param message string +---@param _type string +---@param time number +---@return nil +Notify.SendNotify = function(message, _type, time) + time = time or 3000 + return exports.msk_core:Notify(nil, message, _type, time) +end + +---This will send a notify message of the type and time passed +---@param title string +---@param message string +---@param _type string +---@param time number +---@param props table optional +---@return nil +Notify.SendNotification = function(title, message, _type, time, props) + time = time or 3000 + if not title then title = placeHolderText end + return exports.msk_core:Notify(title, message, _type or "success", time) +end + +return Notify diff --git a/modules/progressbar/msk_core/client.lua b/modules/progressbar/msk_core/client.lua new file mode 100644 index 0000000..5c993d8 --- /dev/null +++ b/modules/progressbar/msk_core/client.lua @@ -0,0 +1,66 @@ +---@diagnostic disable: duplicate-set-field +local resourceName = "msk_core" +local configValue = BridgeClientConfig.ProgressBarSystem +if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end + +ProgressBar = ProgressBar or {} + +---Converts bridge/ox-style progress options into the msk_core Progress.Start format. +---@param options table +---@return table +local function convertToMsk(options) + options = options or {} + + -- QB exposes animation under .animation.animDict/.anim and disables under .controlDisables + local anim = options.anim or options.animation + local animation + if anim then + animation = { + dict = anim.dict or anim.animDict, + anim = anim.clip or anim.anim, + flag = anim.flag or anim.flags or 49, + } + end + + -- ox uses options.disable.{move,car,combat,mouse}, QB uses options.controlDisables.* + local d = options.disable or options.controlDisables or {} + local disable = { + move = d.move or d.disableMovement, + vehicle = d.car or d.disableCarMovement, + combat = d.combat or d.disableCombat, + mouse = d.mouse or d.disableMouse, + } + + return { + duration = options.duration, + text = options.label or options.text or '', + disable = disable, + animation = animation, + forceOverride = options.forceOverride, + } +end + +---This will open a progress bar (blocking until it completes). +---@param options table +---@param cb any optional callback receiving the success boolean +---@param isQBInput boolean optional +---@return boolean success true if the progress completed without being cancelled +function ProgressBar.Open(options, cb, isQBInput) + local data = convertToMsk(options) + + -- msk_core Progress.Start blocks for the full duration; if it is interrupted + -- it stops early. We treat a fully elapsed bar as success. + exports.msk_core:Progressbar(data) + + local active = exports.msk_core:ProgressActive() + local success = not active + + if cb then cb(success) end + return success +end + +ProgressBar.GetResourceName = function() + return resourceName +end + +return ProgressBar diff --git a/modules/vehiclekey/msk_vehiclekeys/client/client.lua b/modules/vehiclekey/msk_vehiclekeys/client/client.lua new file mode 100644 index 0000000..1928c15 --- /dev/null +++ b/modules/vehiclekey/msk_vehiclekeys/client/client.lua @@ -0,0 +1,33 @@ +---@diagnostic disable: duplicate-set-field +local resourceName = "msk_vehiclekeys" +if GetResourceState(resourceName) == 'missing' then return end + +VehicleKey = VehicleKey or {} + +---Gives the player (self) the keys of the specified vehicle. +---@param vehicle number The vehicle entity handle. +---@param plate? string The plate of the vehicle. +---@return nil +VehicleKey.GiveKeys = function(vehicle, plate) + assert(vehicle, "vehicle is nil") + assert(DoesEntityExist(vehicle), "vehicle does not exist") + + exports.msk_vehiclekeys:AddPrimaryKey(vehicle) +end + +---Removes the keys of the specified vehicle from the player (self). +---@param vehicle number The vehicle entity handle. +---@param plate? string The plate of the vehicle. +---@return nil +VehicleKey.RemoveKeys = function(vehicle, plate) + assert(vehicle, "vehicle is nil") + assert(DoesEntityExist(vehicle), "vehicle does not exist") + + exports.msk_vehiclekeys:RemovePrimaryKey(vehicle) +end + +VehicleKey.GetResourceName = function() + return resourceName +end + +return VehicleKey diff --git a/settings/clientConfig.lua b/settings/clientConfig.lua index f1d54d9..8168116 100644 --- a/settings/clientConfig.lua +++ b/settings/clientConfig.lua @@ -1,9 +1,9 @@ BridgeClientConfig = {} BridgeClientConfig.InputSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-input ] BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | qb-menu ] -BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | ZSX_UIV2 | keep-progressbar | progressbar ] -BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem -BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation ] +BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | ZSX_UIV2 | keep-progressbar | progressbar | msk_core ] +BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem | msk_vehiclekeys +BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation | msk_fuel ] BridgeClientConfig.TargetSystem = "auto" -- [ auto | ox_target | qb-target | sleepless_interact ] -- sleepless is only partially supported and would need another system in place BridgeClientConfig.Debug = false return BridgeClientConfig diff --git a/settings/sharedConfig.lua b/settings/sharedConfig.lua index 3bc3a79..7b55311 100644 --- a/settings/sharedConfig.lua +++ b/settings/sharedConfig.lua @@ -1,7 +1,7 @@ BridgeSharedConfig = {} BridgeSharedConfig.Lang = "auto" -- Change this to your preferred language (must match the locale file name ex. en or fr etc) BridgeSharedConfig.DebugLevel = 0 -- Change this to your Debug level, 0 for none, 1 for some, 2 for all data -BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | wasabi_notify | lation_ui | ZSX_UIV2 | okokNotify | mythic_notify | pNotify | t-notify | brutal_notify | FL-Notify] +BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | wasabi_notify | lation_ui | ZSX_UIV2 | okokNotify | mythic_notify | pNotify | t-notify | brutal_notify | FL-Notify | msk_core] BridgeSharedConfig.HelpText = "auto" -- [ auto | ox_lib | jg-textui | lation_ui | ZSX_UIV2 | cd_drawtextui | lab-HintUI | okokTextUI] BridgeSharedConfig.Phone = "auto" -- [ auto | qs-smartphone | lb-phone | gksphone] BridgeSharedConfig.Skills = "auto" -- [ auto | OT_skills | evolent_skills | pickle_xp] From 93f4545c9d3f927a3380d30fb010b7402f2712f8 Mon Sep 17 00:00:00 2001 From: Musiker15 Date: Mon, 29 Jun 2026 18:18:41 +0200 Subject: [PATCH 6/9] refactor: keep only msk_core integration per maintainer guidelines Remove msk_fuel and msk_vehiclekeys providers (below 100-server threshold). Retain msk_core Notify + ProgressBar integration. --- modules/fuel/msk_fuel/client.lua | 33 ------------------- .../msk_vehiclekeys/client/client.lua | 33 ------------------- settings/clientConfig.lua | 4 +-- 3 files changed, 2 insertions(+), 68 deletions(-) delete mode 100644 modules/fuel/msk_fuel/client.lua delete mode 100644 modules/vehiclekey/msk_vehiclekeys/client/client.lua diff --git a/modules/fuel/msk_fuel/client.lua b/modules/fuel/msk_fuel/client.lua deleted file mode 100644 index acca07b..0000000 --- a/modules/fuel/msk_fuel/client.lua +++ /dev/null @@ -1,33 +0,0 @@ ----@diagnostic disable: duplicate-set-field -local resourceName = "msk_fuel" -if GetResourceState(resourceName) == 'missing' then return end -Fuel = Fuel or {} - ----@description Returns the name of the active fuel resource. ----@return string -Fuel.GetResourceName = function() - return resourceName -end - ----@description Returns the current fuel level of a vehicle. ----@param vehicle number The vehicle entity handle. ----@return number The vehicle fuel level. -Fuel.GetFuel = function(vehicle) - if not DoesEntityExist(vehicle) then return 0.0 end - return exports.msk_fuel:GetVehicleFuel(vehicle) -end - ----@description Sets the fuel level of a vehicle. ----@param vehicle number The vehicle entity handle. ----@param fuel number The fuel level to assign. ----@param type? string The fuel type, used only in ti_fuel / msk_fuel. (default: nil) ----@return nil -Fuel.SetFuel = function(vehicle, fuel, type) - if not DoesEntityExist(vehicle) then return end - exports.msk_fuel:SetVehicleFuel(vehicle, fuel) - if type then - exports.msk_fuel:SetVehicleFuelType(vehicle, type) - end -end - -return Fuel diff --git a/modules/vehiclekey/msk_vehiclekeys/client/client.lua b/modules/vehiclekey/msk_vehiclekeys/client/client.lua deleted file mode 100644 index 1928c15..0000000 --- a/modules/vehiclekey/msk_vehiclekeys/client/client.lua +++ /dev/null @@ -1,33 +0,0 @@ ----@diagnostic disable: duplicate-set-field -local resourceName = "msk_vehiclekeys" -if GetResourceState(resourceName) == 'missing' then return end - -VehicleKey = VehicleKey or {} - ----Gives the player (self) the keys of the specified vehicle. ----@param vehicle number The vehicle entity handle. ----@param plate? string The plate of the vehicle. ----@return nil -VehicleKey.GiveKeys = function(vehicle, plate) - assert(vehicle, "vehicle is nil") - assert(DoesEntityExist(vehicle), "vehicle does not exist") - - exports.msk_vehiclekeys:AddPrimaryKey(vehicle) -end - ----Removes the keys of the specified vehicle from the player (self). ----@param vehicle number The vehicle entity handle. ----@param plate? string The plate of the vehicle. ----@return nil -VehicleKey.RemoveKeys = function(vehicle, plate) - assert(vehicle, "vehicle is nil") - assert(DoesEntityExist(vehicle), "vehicle does not exist") - - exports.msk_vehiclekeys:RemovePrimaryKey(vehicle) -end - -VehicleKey.GetResourceName = function() - return resourceName -end - -return VehicleKey diff --git a/settings/clientConfig.lua b/settings/clientConfig.lua index 8168116..69dc9e5 100644 --- a/settings/clientConfig.lua +++ b/settings/clientConfig.lua @@ -2,8 +2,8 @@ BridgeClientConfig = {} BridgeClientConfig.InputSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-input ] BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | qb-menu ] BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | wasabi_uikit | lation_ui | ZSX_UIV2 | keep-progressbar | progressbar | msk_core ] -BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem | msk_vehiclekeys -BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation | msk_fuel ] +BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem +BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation ] BridgeClientConfig.TargetSystem = "auto" -- [ auto | ox_target | qb-target | sleepless_interact ] -- sleepless is only partially supported and would need another system in place BridgeClientConfig.Debug = false return BridgeClientConfig From cd7fa10f54e5509f825fb0c6b427d07455f0c5b4 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 1 Aug 2026 01:09:39 -0400 Subject: [PATCH 7/9] fix(sql): parameterize SQL helpers and deprecate the module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All values now bind through ? placeholders instead of string concatenation, Get/Delete take { column = value } filter tables (raw WHERE strings error loudly), and table/column identifiers are validated and backtick-quoted. The whole module is deprecated with a once-per-resource console warning and will be removed on 2026-08-22 — migrate to oxmysql directly (MySQL.query.await with ? placeholders). Closes #198 Reported-by: Pajt9whauht283as Co-Authored-By: Claude Fable 5 --- lib/sql/server/sqlHandler.lua | 94 +++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 14 deletions(-) diff --git a/lib/sql/server/sqlHandler.lua b/lib/sql/server/sqlHandler.lua index 644467e..9e35fec 100644 --- a/lib/sql/server/sqlHandler.lua +++ b/lib/sql/server/sqlHandler.lua @@ -1,21 +1,67 @@ +--[[ + DEPRECATED: the SQL helper module is deprecated in its entirety and will be + REMOVED on 2026-08-22. Migrate to oxmysql directly — MySQL.query.await(query, + params) with ? placeholders — which is safer and more flexible than these + wrappers ever were. +]] + SQL = {} Require("lib/MySQL.lua", "oxmysql") +local warnedResources = {} + +local function warnDeprecated() + local caller = GetInvokingResource() or GetCurrentResourceName() + if warnedResources[caller] then return end + warnedResources[caller] = true + print(("^3[community_bridge] SQL helpers are deprecated and will be REMOVED on 2026-08-22. '%s' should migrate to oxmysql directly (MySQL.query.await with ? placeholders).^0"):format(caller)) +end + +-- Identifiers (table/column names) cannot be parameterized, so they are +-- validated against a strict pattern and backtick-quoted instead. Values are +-- never concatenated into queries - they always go through ? placeholders. +local function quoteIdentifier(name) + assert(type(name) == "string" and name:match("^[%a_][%w_]*$"), + ("SQL: unsafe identifier '%s' - table/column names may only contain letters, digits and underscores"):format(tostring(name))) + return "`" .. name .. "`" +end + +--- Builds a parameterized WHERE clause from a table of column = value pairs. +-- Raw WHERE strings are intentionally rejected: they made SQL injection +-- unavoidable whenever a player-influenced value reached these helpers. +local function buildWhere(where) + assert(type(where) == "table" and next(where) ~= nil, + "SQL: where must be a non-empty table of column = value pairs (raw WHERE strings are no longer accepted)") + + local conditions = {} + local params = {} + + for column, value in pairs(where) do + table.insert(conditions, quoteIdentifier(column) .. " = ?") + table.insert(params, value) + end + + return table.concat(conditions, " AND "), params +end + --- Creates a table in the database if it does not exist. -- @param tableName The name of the table to create. Example: {{ name = "identifier", type = "VARCHAR(50)", primary = true }} -- @param columns A table containing column definitions, where each column is a table with 'name' and 'type'. ---@return nil +---@deprecated Removed on 2026-08-22 — use oxmysql directly. function SQL.Create(tableName, columns) + warnDeprecated() assert(MySQL, "Tried using module SQL without MySQL being loaded") local columnsList = {} for i, column in pairs(columns) do - table.insert(columnsList, string.format("%s %s", column.name, column.type)) + assert(type(column.type) == "string", "SQL: column type must be a string") + table.insert(columnsList, string.format("%s %s", quoteIdentifier(column.name), column.type)) end local query = string.format("CREATE TABLE IF NOT EXISTS %s (%s);", - tableName, + quoteIdentifier(tableName), table.concat(columnsList, ", ") ) @@ -23,50 +69,70 @@ function SQL.Create(tableName, columns) end -- insert if not exist otherwise update +---@deprecated Removed on 2026-08-22 — use oxmysql directly. function SQL.InsertOrUpdate(tableName, data) + warnDeprecated() assert(MySQL, "Tried using module SQL without MySQL being loaded") local columns = {} - local values = {} + local placeholders = {} local updates = {} + local params = {} for column, value in pairs(data) do - table.insert(columns, column) - table.insert(values, "'" .. value .. "'") -- Ensure values are properly quoted - table.insert(updates, column .. " = VALUES(" .. column .. ")") -- Use VALUES() for update + local quoted = quoteIdentifier(column) + table.insert(columns, quoted) + table.insert(placeholders, "?") + table.insert(updates, quoted .. " = VALUES(" .. quoted .. ")") -- Use VALUES() for update + table.insert(params, value) end local query = string.format( "INSERT INTO %s (%s) VALUES (%s) ON DUPLICATE KEY UPDATE %s;", - tableName, + quoteIdentifier(tableName), table.concat(columns, ", "), - table.concat(values, ", "), + table.concat(placeholders, ", "), table.concat(updates, ", ") ) - MySQL.query.await(query) + MySQL.query.await(query, params) end +--- Selects rows matching the given filters. +-- @param tableName The table to query. +-- @param where Table of column = value pairs, joined with AND. Example: { citizenid = cid } +---@deprecated Removed on 2026-08-22 — use oxmysql directly. function SQL.Get(tableName, where) + warnDeprecated() assert(MySQL, "Tried using module SQL without MySQL being loaded") - local query = string.format("SELECT * FROM %s WHERE %s;", tableName, where) - local result = MySQL.query.await(query) + local conditions, params = buildWhere(where) + local query = string.format("SELECT * FROM %s WHERE %s;", quoteIdentifier(tableName), conditions) + local result = MySQL.query.await(query, params) return result end +---@deprecated Removed on 2026-08-22 — use oxmysql directly. function SQL.GetAll(tableName) + warnDeprecated() assert(MySQL, "Tried using module SQL without MySQL being loaded") - local query = string.format("SELECT * FROM %s;", tableName) + local query = string.format("SELECT * FROM %s;", quoteIdentifier(tableName)) local result = MySQL.query.await(query) return result end +--- Deletes rows matching the given filters. +-- @param tableName The table to delete from. +-- @param where Table of column = value pairs, joined with AND. Example: { citizenid = cid } +---@deprecated Removed on 2026-08-22 — use oxmysql directly. function SQL.Delete(tableName, where) + warnDeprecated() assert(MySQL, "Tried using module SQL without MySQL being loaded") - local query = string.format("DELETE FROM %s WHERE %s;", tableName, where) - MySQL.query.await(query) + local conditions, params = buildWhere(where) + local query = string.format("DELETE FROM %s WHERE %s;", quoteIdentifier(tableName), conditions) + MySQL.query.await(query, params) end exports('SQL', function() + warnDeprecated() return SQL end) From 94620315c65fcc746aa51137839998f15f5ac50c Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 1 Aug 2026 01:21:27 -0400 Subject: [PATCH 8/9] ci: auto-release on main when the fxmanifest version bumps Pushes to main that change fxmanifest.lua compare the version against the previous commit and publish a release only when it actually changed, packaging the drag-drop community_bridge.zip with generated notes. Tags and titles stay bare (0.13.4) to match existing releases, and an existing-tag guard prevents re-announcing a shipped version. Uses RELEASE_PAT when configured so the release-published Discord webhook still fires; GITHUB_TOKEN-created releases do not trigger it. Co-Authored-By: Claude Fable 5 --- .github/workflows/release.yml | 116 ++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6806385 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,116 @@ +name: Release + +# Publishes a release when a push to main bumps the fxmanifest.lua version. +# Tags/titles are bare versions (0.13.4) to match this repo's existing releases. +# +# The "Update Webhook Notification" workflow listens for release:published, and +# GitHub suppresses workflow triggers for events raised by GITHUB_TOKEN. Add a +# classic PAT with repo scope as the RELEASE_PAT secret to keep the Discord +# announcement firing; without it the release still publishes, silently. + +on: + push: + branches: + - main + paths: + - 'fxmanifest.lua' + workflow_dispatch: + +permissions: + contents: write + +jobs: + check-version: + runs-on: ubuntu-latest + outputs: + should_release: ${{ steps.meta.outputs.should_release }} + version: ${{ steps.meta.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Detect fxmanifest version change + id: meta + run: | + CURRENT=$(grep -E '^version ' fxmanifest.lua | sed -E "s/^version[[:space:]]+['\"]([^'\"]+)['\"].*/\1/") + echo "version=$CURRENT" >> "$GITHUB_OUTPUT" + + if [ -z "$CURRENT" ]; then + echo "::error::No version found in fxmanifest.lua" + exit 1 + fi + + # Never re-release an existing version: a duplicate release would + # announce itself to Discord as if it were new. + if git rev-parse "refs/tags/$CURRENT" >/dev/null 2>&1; then + echo "should_release=false" >> "$GITHUB_OUTPUT" + echo "Tag $CURRENT already exists; skipping release." + exit 0 + fi + + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "should_release=true" >> "$GITHUB_OUTPUT" + echo "Manual run; releasing version $CURRENT" + exit 0 + fi + + BEFORE="${{ github.event.before }}" + if [ "$BEFORE" = "0000000000000000000000000000000000000000" ] || [ -z "$BEFORE" ]; then + echo "should_release=true" >> "$GITHUB_OUTPUT" + echo "Initial or force push; releasing version $CURRENT" + exit 0 + fi + + PREVIOUS=$(git show "$BEFORE:fxmanifest.lua" 2>/dev/null | grep -E '^version ' | sed -E "s/^version[[:space:]]+['\"]([^'\"]+)['\"].*/\1/" || true) + if [ "$CURRENT" = "$PREVIOUS" ]; then + echo "should_release=false" >> "$GITHUB_OUTPUT" + echo "fxmanifest changed but version is still $CURRENT; skipping release." + else + echo "should_release=true" >> "$GITHUB_OUTPUT" + echo "Version updated: ${PREVIOUS:-unknown} -> $CURRENT" + fi + + release: + runs-on: ubuntu-latest + needs: check-version + if: needs.check-version.outputs.should_release == 'true' + + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Prepare release package + run: | + RELEASE_ROOT="release/community_bridge" + mkdir -p "$RELEASE_ROOT" + + rsync -a \ + --exclude '.git' \ + --exclude '.gitattributes' \ + --exclude '.gitignore' \ + --exclude '.github' \ + --exclude 'release' \ + --exclude 'node_modules' \ + ./ "$RELEASE_ROOT/" + + - name: Create zip archive + run: | + cd release + zip -r "../community_bridge.zip" community_bridge + + - name: Upload workflow artifact + uses: actions/upload-artifact@v5 + with: + name: community_bridge + path: community_bridge.zip + + - name: Publish GitHub Release + uses: softprops/action-gh-release@v2 + with: + token: ${{ secrets.RELEASE_PAT || github.token }} + tag_name: ${{ needs.check-version.outputs.version }} + name: ${{ needs.check-version.outputs.version }} + files: community_bridge.zip + generate_release_notes: true From 9ce75dccedcc2feb908590685a2ecebb1a0a7a7e Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 1 Aug 2026 01:29:48 -0400 Subject: [PATCH 9/9] Update fxmanifest.lua --- fxmanifest.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 58b471c..b2f17b5 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -5,7 +5,7 @@ use_experimental_fxv2_oal 'yes' author 'The Order of the Sacred Framework' name 'community_bridge' description 'A Universal Bridge for Our Community, created by a group of contributors with a shared vision to enhance both user and developer experiences. This bridge connects various frameworks, inventories, target systems, notification systems, and more, fostering compatibility and seamless integration.' -version '0.13.4' +version '0.13.5' shared_scripts { '@ox_lib/init.lua',