cc_lib changelog
Versions before 1.2.0 are recorded in the git history only.
Versions before 1.2.0 are recorded in the git history only.
1.13.0 — 2026-12-01 (first product release)
The first release built for sale on The Code Cartel store (free asset). Starts from the Legacy city build 1.12.1; nothing a consumer calls changed shape.
Added
config.lua(public) andserver/config.lua(secret): every setting that was a convar is now also a config value. Order: convar > config file > default, so servers configured with convars keep working unchanged. Read byinit.luainto a sandbox (CC.cfg,CC.serverCfg), so a consumer's ownConfigglobal is never touched.server/config.luais not infilesand is never read on a client.CC.setting(convar, path, default): the one resolver every module uses (type-coerced, a junk convar falls through to the config, a config value of the wrong type is ignored).- Boot validation (
modules/settings.lua,server/validate.lua, consolecc_validate): types, enums, ranges, unknown keys, forced adapters that are not started, a webhook URL in the public config, malformed webhook URLs, a boost window that ends before it starts. - Locales (
locales/en.lua,CC.locale(key, ...),Config.Locale/cc:locale): the strings cc_lib shows itself (fallback menu, default titles, "Unemployed"). CC.billing(server):send(target, { amount, reason, society?, sender? })andprovider()for okokBilling and esx_billing, with an opt-in bank-charge fallback (Config.Billing.fallback).- Export surface for non-Lua code:
exports.cc_lib:call(module, fn, ...),getVersion(),getConfig(),modules()on both sides (server/exports.lua,client/exports.lua). - Webhooks per channel from
ServerConfig.Webhooksorset cc:webhook_<channel>. Config.Bridge.societyandcc:billingin the start-up override report, which now says whether an override came from a convar or config.lua.tests/product.lua(83 checks) for all of the above.
Changed
CC.boostis off by default. The Legacy launch-week window is no longer built in; setConfig.Boost(or the old convars, which still enable it on their own).cc:gms ""no longer turns the homebar portrait off (an empty convar now means "unset"); use'none'.escrow_ignorelists every file: cc_lib ships open because other resources load it across resources (see INSTALL.md).- cc_lib's own instance registers its scoped client routes, so
exports.cc_lib:callcan notify, give keys etc. - Doc examples no longer use Legacy ids.
Fixed
tests/smoketest.lualoaded../cc_lib(a sibling folder) instead of the checkout under test.
1.12.0 — 2026-11-25 (LEGACY)
CC.boost(modules/boost.lua): a timed pay and XP boost,pay(n),xp(n),active(),payRate(),xpRate(),state(). Defaults are the Legacy launch week (11 Dec 2026 18:30 to 18 Dec 23:59:59 AEDT, pay x1.3, XP x2); convarscc:boost_start,cc:boost_end,cc:boost_pay,cc:boost_xp,cc:boost_off. Server exportsboostPay,boostXp,boostState(server/boost.lua) for resources without cc_lib's init. Test:tests/boost.lua.
1.11.0 — 2026-11-23
preLoginoption onCC.security.event/CC.callback.register/gate(cc_lib #2): character select/create/delete run before a character exists; a loaded player is refused (loaded) and flagged. Needed by cc_multicharacter.
1.10.1 — 2026-11-16 (audit-1116)
Fixed
CC.inventory.isOpen()on ox_inventory calledexports.ox_inventory:IsInventoryOpen(), which ox_inventory does not export, so it always answered false. It readsLocalPlayer.state.invOpennow, the state bag ox_inventory sets on open and close (client side only).
1.10.0 — 2026-11-12
Added
- Shared page motion for every Cartel page (
ui/motion.js+ui/motion.css, loaded byui/homebar.js; owner, 12 Nov: "across all the cc UIs", from cc_paperroute 2.9.0). No page change needed:- Page to page: a
[data-view],[data-pane]or[role=tabpanel]that is shown drifts 24 px in from the side of the tab you came from and fades up (260 ms); its first blocks settle 40 ms apart. Not on the open itself. - Gliding tab fill: a filled selected tab's background slides from the old tab to the new one (300 ms). A tab row that draws its own indicator keeps it.
- Theme switch: every colour blends over 360 ms; the homebar's sun and moon turn past each other (320 ms). Dark stays the default and the choice still saves per player.
- More: dialogs inside a panel pop in (scale .96, 180 ms);
CCMotion.count(el, n, fmt)rolls a figure to a new value (600 ms);CCMotion.bump(el)pulses a changed badge.
- Page to page: a
- Never fights a page: skips elements the page already transforms or animates (paperroute's own slide), stays off under
prefers-reduced-motion, anddata-cc-motion="off"opts a page or part out. Transform and opacity only; nothing loops; no fetch.
1.9.2 — 2026-11-12
Fixed
- Homebar card blank on some pages (cc_detecting showed "?" and no name). A page that asks for the card twice as it opens (detecting asks on
openand again in its own boot) hit the profile callback's 1 s cooldown; the second answer wasniland the page drew an empty card over the good one.client/homebar.luanow answers every ask within 1.5 s from one server read, makes an ask wait for one already out, and falls back to the last good card (up to a minute) on a failed read.ui/homebar.jsnever wipes a drawn card with an empty answer. - Portrait key names the character. The once-per-photo key was the photo's length and tail; it now starts with the citizenid, so two characters' photos can never share a key on one client, and a key the client does not hold shows initials, never an older picture.
1.9.1 — 2026-11-12
Changed
- Every Cartel page is dark by default (owner, 12 Nov). A player who has never pressed the theme button now gets dark on every page, not light.
client/homebar.luatreats "nothing saved" as dark, andui/homebar.jsputsdata-cc-theme="dark"on the page before the saved choice comes back, so the first frame is dark too. A player who saved light keeps light. A page that must start light can still saydata-default="light"on its homebar mount. Still nocolor-scheme: darkon the root.
1.9.0 — 2026-11-11
Changed
- Homebar: the line under the name is the job. It was "GMS: ", which only repeated the character name (owner, 11 Nov). Now it is "Job · Grade" from
CC.framework.getJob, and it is hidden when the character is unemployed. The page'sgmslabel is no longer used. - Homebar: the portrait is the wallet photo. The server takes the GMS primary photo, the same one the government wallet shows, and it may be a base64 jpeg/png/webp data URL (up to 700 KB, strictly checked). Before, a primary photo kept in the database was skipped and an older approved https photo showed instead. This needs tcc_gms
GetCharacterPortraitto return the primary photo (LIVE CODE CHANGES/tcc_gms.md). - A portrait is sent to each client once per photo: the server remembers the key it sent, and
client/homebar.luafills it back in for every page. Re-opening a page no longer blinks the portrait to initials.
1.8.0 — 2026-11-09
Added
- Purchase receipts inside the open page. FiveM draws the focused NUI frame at z-index 99999 over every other frame, so ox_inventory's item box, ox_lib toasts and the HUD money flash were hidden under an open Cartel shop: a player bought a metal detector, saw nothing change, and kept buying. Now
CC.inventory.addItem/removeItemandCC.money.add/removesendCC.notify.receipton success, every clientCC.notify.sendis mirrored to the resource's own page, and the newui/receipt.jsdraws them as toasts inside the page - only while that page has focus, so a closed page stays silent. Display only. ui/receipt.jsloads itself on every page that loadsui/homebar.js. Other pages add<script src="nui://cc_lib/ui/receipt.js"></script>. A page with its own notify toasts sets<html data-cc-receipt="no-notify">. Labels/locale:CCReceipt.configure({ labels, locale }).
1.7.6 — 2026-11-06
Added
- Every
CC.money.addSociety/removeSociety(and sopaySalary) writes one log line, refused moves included: console always, Discord channelsociety= convarcc:log_society_webhook(server-only,set), else the consumer's owneconomychannel, else none. okokBanking society UPDATEs log nothing, so a treasury or society move used to leave no trail unless the caller logged it (Legacy core audit 6 Nov, H5). CC.logger.ensureChannel(name, convar?, fallback?): give a channel a webhook only if the consumer set none.
1.7.5 — 2026-11-03
Fixed
CC.securitydistance gates (Security.near,Security.nearAny, and everydistance = {...}option on events and callbacks) accept avector4or a plain{x, y, z}table; the heading is ignored. They did#(pedCoords - coords), and CfxLua errors onvector3 - vector4, so a config point written as vec4 refused every gate: players beside the ped were told "too far" (cc_scrapyard, legacy-live#426). The sim's vector mock allowed the mixed subtraction, which is why no suite caught it.
1.7.4 — 2026-11-02
Fixed
- Qbox core object: real qbx_core registers
GetCoreObjectonly as aqb-coreexport, sogetCore()now falls back toexports['qb-core']:GetCoreObject()(review A). Recorded here on 3 Nov; the code shipped with the 2 Nov autosave.
1.7.3 — 2026-11-02
Fixed
CC.vehicleget/setProperties without the consumer'slibglobal now call ox_lib's export (exports.ox_lib:getVehicleProperties/setVehicleProperties; everylib.xin@ox_lib/resourceis exported). 1.7.2 fell back to the framework path, which on Qbox has no core object (qbx_core registersGetCoreObjectonly as aqb-coreexport), so everyCC.vehicle.spawn({ props })lost its props in consumers without@ox_lib/init.lua(cc_business garage liveries, extras, max mods). The qb path now guards a non-table core.
1.7.2 — 2026-11-02
Fixed
CC.menu(open, close, input, confirm) no longer needs the consumer to load@ox_lib/init.lua: without thelibglobal it calls ox_lib's client exports. cc_tow's truck loan threwmenu.lua:133: attempt to index a nil value (global 'lib'); 25 cc_* resources load cc_lib without ox_lib's init.CC.vehicleproperties use ox_lib only whenlibexists in the consumer, else the framework path.
1.7.1 — 2026-11-01
Fixed
- Homebar: a page that is dark by design marks its mount
data-default="dark"; until the player saves a choice the bar then starts dark, so the theme button no longer claims the wrong mode on first open.
1.7.0 — 2026-11-01
Added
- The universal homebar.
ui/homebar.js+ui/homebar.css(served asnui://cc_lib/ui/...): theme button, GMS portrait, character name and GMS line, ported from cc-shops 2.0.0. A page adds<div data-cc-homebar></div>to its top bar. Profile from the server (server/homebar.lua:tcc_gmsGetPersonByCitizenId/GetCharacterPortrait, portrait host-allowlisted, initials fallback, GMS optional); alsoexports.cc_lib:GetProfile(src). Theme saved per player (one KVP, shared by every panel), written to<html data-cc-theme>and thecc-themewindow event.ui/theme-dark.cssis the dark token map for pages on the standard tokens. Convars:cc:gms,cc:avatarhosts,cc:gmscache. No config key changed.
1.6.0 — 2026-10-27
Mostly additions. Products may require cc_lib >= 1.6.0 for the functions marked new.
Changed (behaviour — read before upgrading)
distance.coordsreturningnilnow refuses the event. 1.5 skipped the check on nil, and some products used that as "no fixed point". Returnfalseto skip the check explicitly;nil(a lookup that found nothing) refuses and logs an error. Reported by cc_jobcentre, whose keybind boards lost every question until it changed.- Arg specs: unbounded numbers capped at ±2^31-1, tables depth/size-limited, unknown types refuse (details under Fixed).
CC.api.registry:unregister<X>only works for the entry's owner (or the hosting resource); the owner may re-register its own key (replaces it);get<X>sreturns a copy, not the live definitions.CC.dispatch.sendreturnsfalsewhen the built-in fallback delivered the alert.
Fixed
- cc_lib's own net events were global.
cc_lib:notify,cc_lib:keys:*,cc_lib:fuel:set,cc_lib:vehicle:applyPropsandcc_lib:dispatch:*were handled by every resource that had loaded the module: a server running five products showed oneCC.notify.sendas five toasts, five blips, five key grants. A product whose client had never touched the module dropped its own events. They are nowcc_lib:<resource>:<name>(CC.eventName), with one handler each ininit.luathat loads the module on first use. - Client-raised dispatch alerts could reach any job with any blip. The fallback event now keeps only jobs in
cc:dispatch_jobs(defaultpolice,sheriff,ambulance,fire, max 4, no duplicates,policeif none survive) and clamps sprite / colour / scale / time. Ported from the Legacy city's 21 Oct audit fix. onReadyfired with no character. The client gave up after 60 s and ran everyonReadyhandler from the character-select screen. It now waits for as long as it takes (Legacy city fix, 24 Oct).- ND_Core was detected but not bridged.
CC.framework.namesaid'nd'whilegetPlayer, jobs and money silently used the standalone path. ND_Core 2.x now has a real adapter (player, job/rank, loaded and job-change events, cash/bank). - Dispatch: rcore_dispatch, core_dispatch, origen_police and emergencydispatch were detected and then sent to the fallback with
sendreporting success. rcore_dispatch and core_dispatch now have adapters; the other two say so in theccreport and the README. - Fuel: on the server, a legacy-shaped provider with no server
SetFuel(LegacyFuel and most forks) madesetreturntruehaving done nothing. It returnsfalsenow; usesetFor. SCRIPT-STANDARDScallsCC.logger.info(...), which did not exist. It does now.
Fixed from the checker's review (REVIEW.md, 27 Oct):
exchangecould consume without producing. RewardaddItemresults were ignored, so a reward that did not land still returnedtruewith the inputs gone. Now checked, with rollback of rewards and inputs; capacity is checked after the inputs are removed; inputs may carry metadata for the rollback; a failed rollback is logged item by item.paySalarydestroyed society money when the player credit failed. The society is now refunded, and a failed refund is logged as an error.- A
distancegate withnilcoords passed. It now refuses (and a check that errors refuses too). - Society writes trust the provider: Renewed-Banking and qb-banking booleans are honoured; qb-management, qs-banking and okokBanking are read back after the write. A refused debit no longer reads as paid.
getSociety(nil)and friends return 0/false instead of raising. - ESX
add/removeare pcall-guarded andaddreads the balance back; ox_coreaddreturns the call's own result, not "did not throw". - Inventory exports are pcall-guarded at the public entry points.
CC.hasExportcaches per resource (dropped on that resource's start/stop):money.get,getItemCount,getSocietyno longer probe on every call.validate: unbounded numbers capped at ±2^31-1, tables walked for depth/size, unknown spec types refuse.- Logger: a 429 re-schedules its own flush;
captureSecurityFlagsposts at most 10 flags per player per minute and reports the rest as a count, so a flood cannot evict the first real flag.
Added
CC.phone—sendMail,notify,getNumberfor lb-phone, yseries, gksphone, qs-smartphone(-pro), npwd and qb-phone, with aCC.notifyfallback.setr cc:phone.- Dispatch adapters for rcore_dispatch, core_dispatch and lb-tablet (server
AddDispatch). Server-capable providers are called from the server directly. A provider call that throws falls back to the built-in alert. - Money: fd_banking society accounts; ND_Core cash/bank; standalone cash and black money as inventory items (
cc:cash_item,cc:black_item);CC.money.addByIdentifier(identifier, account, amount, reason)pays an online or (qb / Qbox) offline character. - Framework:
getPlayerByIdentifier(identifier),getMetadata(src, key),setMetadata(src, key, value)(session-only fallback with no framework). - Target: darktrace
interact, falling back to the native prompt per call. - Fuel: qb-fuel. Legacy-shaped providers are picked on the client only when they publish
GetFuel. - Vehicle:
CC.vehicle.getLabel(model), never nil. - Logger: every
log()now also writes a console line, fires the server-localcc_lib:logevent, and mirrors to Fivemanage (fmsdk) and the ox_lib logger when detected (set cc:log_mirror,cc:log_console). An empty webhook no longer means no log.CC.logger.channel(name),CC.logger.info/warn/error(msg, ...). Webhook name, avatar and footer icon fromset cc:log_username,cc:log_avatar,cc:log_footer_icon(the Legacy copy hard-coded its brand here). - Utilities:
CC.hasExport(res, fn),CC.pickExport(list, fn),CC.eventName(suffix). - The
ccreport lists phones, logging sinks, fd_banking, qs-banking, interact, qb-fuel, okokGasStation and lb-tablet, and the new convars. - Absorbed from
tcc_bridge(retired): identifier lookup, metadata get/set, offline money, vehicle labels, qb-fuel. Everything else it bridged cc_lib already had.
Tests
tests/mutate.lua: M15 and M119 re-anchored to the new distance gate and society pre-check; 128/128 caught (run against a copy with the sim version line bumped).tests/smoketest.luaruns with no argument (fverify-Suite smoketest), models per-resource exports and captures events; 65 new checks cover every addition above.tests/verify.lua: guide-12 provider coverage per module, no globalcc_lib:event literals, every init route has its receiver, the dispatch allowlist, theonReadygive-up gone, and the README documents every 1.6.0 function.
1.5.0 — 2026-10-17
Fixed
CC.garageon jg-advancedgarages v4 (checked against v4.1.1's docs and its unescrowed files):registerkeeps the idregisterGaragereturns. v4 prefixes it with the calling resource's name and stores cars under it, sounregistersent v4 an id it had never registered, and the client opened the wrong garage.- The vehicle type goes to jg as
vehicleType. It was sent astype, which v4 ignores, so every garage was a car garage.coordsnow goes as avector3, as the API says. - A refusal (
false, err) is nowfalseand logged. It used to count as registered. - On the client,
jgV4()asked forregisterGarage, which is a server-only export, so the client always took the v3 event path. It now asks for the client exportopenGarage, andopen/storecall v4'sopenGarage/storeVehicle.
Added
CC.garage.garageId(id): the id the garage resource knows the garage by. That is jg v4's prefixed id once registered, and the raw id everywhere else. Send this to the client foropen/store.registerreturns it as a second value.CC.garage.refreshAccess(id)calls v4'srefreshGarageAccessafter keys or ownership change. Access is still asked live on every use, so this only refreshes jg's prompts.def.interactions(defaultfalse) maps to v4'smanageInteractions. By default the product draws its own prompts and callsopen/store, as it does with every other garage.- Sim: the v4 scenario now uses a fake that returns a prefixed id and has separate server and client exports. New scenarios cover a v4 refusal and the v3 event path. Mutations M125-M128 cover the client export check, the returned id in unregister and in
garageId, andvehicleType. tests/verify.lua, the static suite fverify requires and cc_lib never had. It checks the version in the manifest, changelog and sim, the module shipping, webhook URLs, and the jg v4 contract.
1.4.0 — 2026-10-17
Added
acc_businesssociety provider forCC.money.getSociety/addSociety/removeSociety. Resolved ahead ofokokBanking, because acc_business re-exports okok's names and is the real society store on a city running both;cc:societystill overrides. CallsGetAccount(job),AddMoney(job, amount, meta)andRemoveMoney(job, amount, meta)with bare job names andmeta = { description = reason, txType = 'sale' | 'withdrawal' }; acc_business's booleans are returned as-is (itsRemoveMoneyis an atomic conditional debit), and an export that errors is afalse, not a crash. Each export is probed per call; a started acc_business missing one warns once and reads 0 / refuses.- Landmines documented in
modules/money.lua:AddMoneyto an unknown job auto-creates an active account when acc_business'sautoCreateJobAccountsis on, andGetAccountis 0 for missing and suspended accounts alike, sosocietyExistsreturnstrue. - The
ccreport listsacc_businessunder Banking. - Tests: 11 sim scenarios against a stub of acc_business 2.0.0's banking exports (with okokBanking running alongside); mutations M115-M124.
1.3.0 — 2026-10-15
Security
CC.loggeris safe with player-authored text. Through 1.2.0 a character named@everyone, or one carrying<@&roleid>, pinged the owner's staff from a log line, an item label could bold, spoiler or hyperlink itself, and one over-long description or invalid UTF-8 from a bad cut made Discord answer 400 — losing every log in that batch. Backward compatible: the API is unchanged and callers need do nothing.allowed_mentions = { parse = {} }on every request — batches, retries and theonResourceStopflush alike. Discord's own guarantee that a log pings nobody.- Every string
log()puts in an embed is sanitised: title, description, field names and values, footer, and the player name in the identity field (which also makescaptureSecurityFlagssafe). Zero-width, bidi, separator, joiner/isolate and BOM characters are stripped (lead bytes pinned, soJoséstaysJosé), control characters removed,@everyone/@here/<@broken with a zero-width space, and markdown escaped (* _ ` ~ | \ [ ] ( ) > #). Escaping is idempotent, so text a caller already escaped — cc_marketplace'sLog.safe— does not show its backslashes. - Line breaks: titles, field names and footers are one line; the description and field values keep their lines, with at most one blank line in a row.
- Discord's limits are enforced on UTF-8 boundaries, with an ellipsis: title 256, description 4096, field name 256 / value 1024, footer 2048, 25 fields (the
Playerfield included and reserved first), 6000 per embed — and 6000 across the embeds of one message, so a batch of ten legal embeds is split rather than refused. Sizes are counted in bytes, which never undercounts what Discord counts. Bytes that are not valid UTF-8 are replaced with U+FFFD. An empty field name or value becomes-. - Batching (10 per message), the 429 backoff and re-queue, and the 500-entry queue cap are unchanged.
Test notes
tests/sim.lua: thePerformHttpRequeststub now records the callback, method and body, and the logger scenarios read the payload table handed tojson.encode. New section "logger: Discord safety and limits":allowed_mentionson every post (batches, a retried 500, the stop flush), mentions in every embed string and the player name, markdown, idempotent escaping, nine invisible/control character classes, eleven non-ASCII names untouched, newline handling, eight oversize / invalid-UTF-8 / empty inputs against every limit, the per-message 6000 budget, the 429 path, and sanitised security flags. 650 checks.tests/mutate.lua: M86–M114 remove each defence in turn —allowed_mentions, each mention break, escaping, idempotence,#, each strip, lead-byte pinning, UTF-8 repair, the cut boundary and ellipsis room, every limit, the empty-value placeholder, the player name, both newline rules, and the 429 re-queue. All 114 mutations RED.
1.2.0 — 2026-10-15
Added
CC.inventory.getSlot(src, slot)(server) — what is in one slot of a player's inventory, as{ name, label, count, metadata, slot }, ornilwhen the slot is empty or the inventory cannot answer. Lets a product take a slot number from the client and read the item — and its metadata — itself, so an item escrowed from a slot comes back with the same serial and durability instead of as a fresh copy.Inventory How the slot is read ox_inventory GetSlot(src, slot)qb-inventory 1.x / 2.x, ps, lj, tgiann, ak47, codem, other forks GetItemBySlot(src, slot), probedqs-inventory GetInventory(src), the entry for that slot (keyed or listed)qb-core player, no inventory export Functions.GetItemBySlot, elsePlayerData.items[slot](qb-core 1.3.0)ESX, core_inventory no numbered slots: nil, logged onceany other detected inventory without GetItemBySlotnil, logged once — the framework's copy is not readMetadata is passed through untouched (ox
metadata, qbinfo); empty metadata isnil, as everywhere in the module. An entry that reports a different slot than the one asked for is refused, and a fractional slot is a bad request, not floored to a real one.
Test notes
tests/sim.lua: getSlot scenarios for ox, qb-inventory 2.x, ps-inventory, qs-inventory (keyed and listed), the qb-core player (with and withoutGetItemBySlot), ESX, core_inventory and an export-less fork. 446 checks.tests/mutate.lua: M77–M85 break the slot lookup (fixed slot on ox and onGetItemBySlot), the wrong-slot refusal, the qs list match, qbinfoas metadata, the no-guessing rule for forks, the qb-core 1.3.0 fallback, log-once, and integer slots. All 85 mutations RED.