mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-27 18:06:02 +00:00
classicapi: two-tier version check + drop hardcoded github URLs
Splits the ClassicAPI version check into a hard floor (MIN, manual) and a soft target (LATEST, pinned by the release workflow). Below MIN pfUI disables itself entirely as before; between MIN and LATEST it runs normally but fires a delayed chat nudge after PLAYER_LOGIN with the available update. PLAYER_LOGIN handlers swap to EventUtil.ContinueOnPlayerLogin so we don't have to spin a frame for each branch. URLs centralize on toc X-Website fields. pfUI.lua factors out ClassicAPIReleaseUrl(version) sourcing from !!!ClassicAPI's metadata; modules/gui.lua and libs/libdebuff.lua replace hardcoded me0wg4ming/pfUI links with GetAddOnMetadata(pfUI.name, "X-Website") lookups. release.yml gains a pre-package step that queries ClassicAPI's latest release tag, packs it (X*10000 + Y*100 + Z), and seds only the LATEST line in pfUI.lua so the published zip ships with the correct soft target.
This commit is contained in:
@@ -17,6 +17,17 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Pin ClassicAPI latest version to current release
|
||||
run: |
|
||||
LATEST=$(gh api repos/brues-code/ClassicAPI/releases/latest --jq .tag_name | tr -d v)
|
||||
IFS=. read -r MAJOR MINOR PATCH <<<"$LATEST"
|
||||
PACKED=$((MAJOR * 10000 + MINOR * 100 + PATCH))
|
||||
echo "Pinning PFUI_CLASSIC_API_LATEST to $LATEST ($PACKED)"
|
||||
sed -i "s/^local PFUI_CLASSIC_API_LATEST = [0-9]*/local PFUI_CLASSIC_API_LATEST = $PACKED/" pfUI.lua
|
||||
grep '^local PFUI_CLASSIC_API_' pfUI.lua
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Package and release to GitHub
|
||||
uses: BigWigsMods/packager@v2
|
||||
env:
|
||||
|
||||
+2
-2
@@ -226,7 +226,7 @@ StaticPopupDialogs["LIBDEBUFF_NAMPOWER_UPDATE"] = {
|
||||
hideOnEscape = 0,
|
||||
preferredIndex = 3,
|
||||
OnAccept = function()
|
||||
pfUI.chat.urlcopy.CopyText("https://github.com/me0wg4ming/pfUI/wiki/How-to-install-nampower")
|
||||
pfUI.chat.urlcopy.CopyText(GetAddOnMetadata(pfUI.name, "X-Website") .. "/wiki/How-to-install-nampower")
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ StaticPopupDialogs["LIBDEBUFF_NAMPOWER_MISSING"] = {
|
||||
hideOnEscape = 0,
|
||||
preferredIndex = 3,
|
||||
OnAccept = function()
|
||||
pfUI.chat.urlcopy.CopyText("https://github.com/me0wg4ming/pfUI/wiki/How-to-install-nampower")
|
||||
pfUI.chat.urlcopy.CopyText(GetAddOnMetadata(pfUI.name, "X-Website") .. "/wiki/How-to-install-nampower")
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1401,7 +1401,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
donate:SetHeight(20)
|
||||
donate:SetText(T["Donate"])
|
||||
donate:SetScript("OnClick", function()
|
||||
pfUI.chat.urlcopy.CopyText("https://buymeacoffee.com/w1ot8abps4")
|
||||
pfUI.chat.urlcopy.CopyText("https://buymeacoffee.com/brues")
|
||||
end)
|
||||
SkinButton(donate)
|
||||
|
||||
@@ -1411,7 +1411,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
github:SetHeight(20)
|
||||
github:SetText(T["GitHub"])
|
||||
github:SetScript("OnClick", function()
|
||||
pfUI.chat.urlcopy.CopyText("https://github.com/me0wg4ming/pfUI")
|
||||
pfUI.chat.urlcopy.CopyText(GetAddOnMetadata(pfUI.name, "X-Website"))
|
||||
end)
|
||||
SkinButton(github)
|
||||
|
||||
@@ -1421,7 +1421,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
website:SetHeight(20)
|
||||
website:SetText(T["Website"])
|
||||
website:SetScript("OnClick", function()
|
||||
pfUI.chat.urlcopy.CopyText("https://github.com/me0wg4ming/pfUI")
|
||||
pfUI.chat.urlcopy.CopyText(GetAddOnMetadata(pfUI.name, "X-Website"))
|
||||
end)
|
||||
SkinButton(website)
|
||||
end)
|
||||
|
||||
@@ -26,20 +26,29 @@ pfUI.bootup = true
|
||||
-- ClassicAPI dependency check.
|
||||
-- pfUI relies pervasively on the modern C_* / SuperWoW / nameplate / focus
|
||||
-- API surface that ClassicAPI polyfills, so presence is required.
|
||||
local PFUI_CLASSIC_API_MIN = 10403 -- (X*10000 + Y*100 + Z)
|
||||
--
|
||||
-- MIN is the hard floor — bumped manually when pfUI starts using a new
|
||||
-- ClassicAPI feature. Below this, pfUI disables itself entirely.
|
||||
-- LATEST is the soft target — replaced by the release workflow with whatever
|
||||
-- ClassicAPI release was current at build time. Between MIN and LATEST,
|
||||
-- pfUI runs normally but nudges the user to update.
|
||||
local PFUI_CLASSIC_API_MIN = 10403 -- (X*10000 + Y*100 + Z)
|
||||
local PFUI_CLASSIC_API_LATEST = 99999999
|
||||
|
||||
local function FormatVersion(packed)
|
||||
local x = math.floor(packed / 10000)
|
||||
local y = math.floor(math.mod(packed, 10000) / 100)
|
||||
local z = math.mod(packed, 100)
|
||||
return string.format("v%d.%d.%d", x, y, z)
|
||||
end
|
||||
local function ClassicAPIReleaseUrl(version)
|
||||
return GetAddOnMetadata("!!!ClassicAPI", "X-Website") .. "/releases/tag/" .. version
|
||||
end
|
||||
if not CLASSIC_API_VERSION or CLASSIC_API_VERSION < PFUI_CLASSIC_API_MIN then
|
||||
pfUI.disabled = true
|
||||
|
||||
local minVersion = FormatVersion(PFUI_CLASSIC_API_MIN)
|
||||
local alertFrame = CreateFrame("Frame")
|
||||
alertFrame:RegisterEvent("PLAYER_LOGIN")
|
||||
alertFrame:SetScript("OnEvent", function()
|
||||
EventUtil.ContinueOnPlayerLogin(function()
|
||||
StaticPopupDialogs["PFUI_CLASSICAPI_REQUIRED"] = {
|
||||
text = "This fork of |cff33ffccpf|cffffffffUI|r requires ClassicAPI\n " .. minVersion .. " or newer.\n\nAll |cff33ffccpf|cffffffffUI|r modules have been disabled.\nInstall ClassicAPI from:",
|
||||
button1 = OKAY,
|
||||
@@ -52,7 +61,7 @@ if not CLASSIC_API_VERSION or CLASSIC_API_VERSION < PFUI_CLASSIC_API_MIN then
|
||||
OnShow = function()
|
||||
local editBox = _G[this:GetName().."EditBox"]
|
||||
if editBox then
|
||||
editBox:SetText("https://github.com/brues-code/ClassicAPI/releases/tag/" .. minVersion)
|
||||
editBox:SetText(ClassicAPIReleaseUrl(minVersion))
|
||||
editBox:HighlightText()
|
||||
editBox:SetFocus()
|
||||
end
|
||||
@@ -61,11 +70,26 @@ if not CLASSIC_API_VERSION or CLASSIC_API_VERSION < PFUI_CLASSIC_API_MIN then
|
||||
StaticPopup_Show("PFUI_CLASSICAPI_REQUIRED")
|
||||
if DEFAULT_CHAT_FRAME then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
"This fork of pfUI requires ClassicAPI " .. minVersion .. "+. Get it at https://github.com/brues-code/ClassicAPI/releases/tag/" .. minVersion,
|
||||
"This fork of pfUI requires ClassicAPI " .. minVersion .. "+. Get it at " .. ClassicAPIReleaseUrl(minVersion),
|
||||
1, 0.3, 0.3
|
||||
)
|
||||
end
|
||||
end)
|
||||
elseif CLASSIC_API_VERSION < PFUI_CLASSIC_API_LATEST then
|
||||
-- Above MIN but below the release-pinned LATEST — soft nudge in chat,
|
||||
-- delayed so it lands after the login welcome spam instead of getting
|
||||
-- buried.
|
||||
local latestVersion = FormatVersion(PFUI_CLASSIC_API_LATEST)
|
||||
EventUtil.ContinueOnPlayerLogin(function()
|
||||
C_Timer.After(8, function()
|
||||
if DEFAULT_CHAT_FRAME then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(
|
||||
"|cff33ffccpf|rUI: ClassicAPI " .. latestVersion .. " is available — " .. ClassicAPIReleaseUrl(latestVersion),
|
||||
1, 0.85, 0.3
|
||||
)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
-- initialize saved variables
|
||||
|
||||
Reference in New Issue
Block a user