updatenotify: isolate fork from upstream pfUI traffic + handle dev builds

Switches the addon-message prefix to "pfUI-brues" so we don't share an
inbound queue with upstream pfUI installs at all — they don't register
a listener for this prefix, so our broadcasts get dropped at the engine
level instead of needing branch-string filtering on their end. The
"main" branch tag stays as a tiebreaker for any future fork variant
sharing this prefix.

Source/dev installs leave the toc Version as "@project-version@" until
release tooling substitutes it. pfUI.lua now stamps those as "dev" with
major/minor/fix=0 instead of silently falling back to 1.2.0, and
updatenotify short-circuits on pfUI.version.string == "dev" before
broadcasting so dev installs don't ship a stale low version to everyone
in guild/raid. Single source of truth — the dev marker lives in pfUI.lua.

URLs centralize via the toc's X-Website. updatenotify and firstrun read
it via GetAddOnMetadata + string.format("%s"), and all eight translation
files swap their hardcoded shagu.org references for the same %s slot.

Drive-bys: groupsize math uses ClassicAPI's IsInRaid/IsInGroup; toc
Author typo "modfied" → "modified".
This commit is contained in:
Brues
2026-06-22 13:51:00 -05:00
parent 95e936e9a1
commit ee17a39445
12 changed files with 46 additions and 37 deletions
+12 -12
View File
@@ -1,15 +1,15 @@
pfUI:RegisterModule("updatenotify", function ()
local alreadyshown = false
if pfUI.version.string == "dev" then return end
local alreadyshown
local localversion = tonumber(pfUI.version.major*10000 + pfUI.version.minor*100 + pfUI.version.fix)
local remoteversion = tonumber(pfUI_init.updateavailable) or 0
local loginchannels = { "BATTLEGROUND", "RAID", "GUILD" }
local groupchannels = { "BATTLEGROUND", "RAID" }
-- Determine branch from toc version string.
-- experiment toc has "9.x.x (experiment version)", master does not.
-- Only notify players on the same branch about updates.
local tocversion = GetAddOnMetadata(pfUI.name, "Version") or ""
local localbranch = strfind(tocversion, "experiment") and "exp" or "master"
local ADDON_PREFIX = "pfUI-brues"
local localbranch = "main"
local versionmsg = "VERSION:" .. localversion .. ":" .. localbranch
pfUI.updater = CreateFrame("Frame")
@@ -17,9 +17,9 @@ pfUI:RegisterModule("updatenotify", function ()
pfUI.updater:RegisterEvent("PLAYER_ENTERING_WORLD")
pfUI.updater:RegisterEvent("PARTY_MEMBERS_CHANGED")
pfUI.updater:SetScript("OnEvent", function()
if event == "CHAT_MSG_ADDON" and arg1 == "pfUI" then
if event == "CHAT_MSG_ADDON" and arg1 == ADDON_PREFIX then
local v, rv, branch = pfUI.api.strsplit(":", arg2)
local rv = tonumber(rv)
rv = tonumber(rv)
-- only process VERSION messages from the same branch
-- messages without a branch tag (old versions) are ignored
if v == "VERSION" and rv and branch == localbranch then
@@ -30,10 +30,10 @@ pfUI:RegisterModule("updatenotify", function ()
end
if event == "PARTY_MEMBERS_CHANGED" then
local groupsize = GetNumRaidMembers() > 0 and GetNumRaidMembers() or GetNumPartyMembers() > 0 and GetNumPartyMembers() or 0
local groupsize = IsInRaid() and GetNumRaidMembers() or IsInGroup() and GetNumPartyMembers() or 0
if ( this.group or 0 ) < groupsize then
for _, chan in pairs(groupchannels) do
SendAddonMessage("pfUI", versionmsg, chan)
SendAddonMessage(ADDON_PREFIX, versionmsg, chan)
end
end
this.group = groupsize
@@ -41,14 +41,14 @@ pfUI:RegisterModule("updatenotify", function ()
if event == "PLAYER_ENTERING_WORLD" then
if not alreadyshown and localversion < remoteversion then
DEFAULT_CHAT_FRAME:AddMessage(T["|cff33ffccpf|rUI: New version available! Have a look at http://shagu.org !"])
DEFAULT_CHAT_FRAME:AddMessage(string.format(T["|cff33ffccpf|rUI: New version available! Get it at %s"], GetAddOnMetadata(pfUI.name, "X-Website") .. "/releases"))
DEFAULT_CHAT_FRAME:AddMessage(T["|cffddddddIt's always safe to upgrade |cff33ffccpf|rUI. |cffddddddYou won't lose any of your configuration."])
pfUI_init.updateavailable = localversion
alreadyshown = true
end
for _, chan in pairs(loginchannels) do
SendAddonMessage("pfUI", versionmsg, chan)
SendAddonMessage(ADDON_PREFIX, versionmsg, chan)
end
end
end)