diff --git a/plugin/src/App/StatusPages/Permissions/SourceListing.lua b/plugin/src/App/StatusPages/Permissions/SourceListing.lua index bef583786..b266e66c6 100644 --- a/plugin/src/App/StatusPages/Permissions/SourceListing.lua +++ b/plugin/src/App/StatusPages/Permissions/SourceListing.lua @@ -102,7 +102,7 @@ function SourceListing:render() Creator = e( "TextLabel", { - Text = callerInfoFromSource.Creator, + Text = callerInfoFromSource.Creator.Name, FontFace = theme.Font.Main, TextSize = theme.TextSize.Body, TextColor3 = theme.Settings.Setting.NameColor, @@ -118,7 +118,7 @@ function SourceListing:render() ), BackgroundTransparency = 1, }, - if callerInfoFromSource.HasVerifiedBadge + if callerInfoFromSource.Creator.HasVerifiedBadge then e( "ImageLabel", { diff --git a/plugin/src/App/init.lua b/plugin/src/App/init.lua index bc6651163..2e315a077 100644 --- a/plugin/src/App/init.lua +++ b/plugin/src/App/init.lua @@ -991,8 +991,7 @@ function App:render() end, onEdit = function(plugin, source, callerInfo, apiMap) - local name = callerInfo.Name - .. if callerInfo.Creator then " by " .. callerInfo.Creator else "" + local name = string.format("%s by %s", callerInfo.Name, callerInfo.Creator.Name) local apiList = {} for api in apiMap do table.insert(apiList, api) diff --git a/plugin/src/HeadlessAPI.lua b/plugin/src/HeadlessAPI.lua index 2042fdc02..24f72c241 100644 --- a/plugin/src/HeadlessAPI.lua +++ b/plugin/src/HeadlessAPI.lua @@ -21,8 +21,11 @@ export type CallerInfo = { Type: "Local" | "Cloud" | "Studio", Name: string, Description: string, - Creator: string, - HasVerifiedBadge: boolean?, + Creator: { + Name: string, + Id: number, + HasVerifiedBadge: boolean, + }, } local API = {} @@ -105,43 +108,6 @@ function API.new(app) return localPlugin end - local cloudId, cloudInstance = string.match(topLevel, "cloud_(%d-)%.(.-)[^%w_%-]") - if cloudId then - local info = cloudIdProductInfoCache[cloudId] - if info then - return info.Name .. " by " .. info.Creator.Name - else - local success, newInfo = - pcall(MarketplaceService.GetProductInfo, MarketplaceService, tonumber(cloudId), Enum.InfoType.Asset) - if success then - cloudIdProductInfoCache[cloudId] = newInfo - return newInfo.Name .. " by " .. newInfo.Creator.Name - end - end - - -- Fallback to the name of the instance uploaded inside this plugin - -- The reason this is not ideal is because creators often upload a folder named "Main" or something - return cloudInstance - end - - return "Command Bar" - end - - function Rojo:_getCallerInfo(): CallerInfo - local traceback = string.split(debug.traceback(), "\n") - local topLevel = traceback[#traceback - 1] - - local localPlugin = string.match(topLevel, "user_(.-)%.") - if localPlugin then - return { - Type = "Local", - Name = localPlugin, - Description = "Locally installed plugin.", - Creator = "Unknown", - HasVerifiedBadge = false, - } - end - local cloudId, cloudInstance = string.match(topLevel, "cloud_(%d-)%.(.-)[^%w_%-]") if cloudId then local info = cloudIdProductInfoCache[cloudId] @@ -155,31 +121,18 @@ function API.new(app) end if info then - return { - Type = "Cloud", - Name = info.Name, - Description = info.Description, - Creator = info.Creator.Name, - HasVerifiedBadge = info.Creator.HasVerifiedBadge, - } + return info.Name + .. " by " + .. (if info.Creator.CreatorType == "User" then "@" else "") + .. info.Creator.Name else - return { - Type = "Cloud", - Name = cloudInstance, - Description = "Could not retrieve plugin asset info.", - Creator = "Unknown", - HasVerifiedBadge = false, - } + -- Fallback to the name of the instance uploaded inside this plugin + -- The reason this is not ideal is because creators often upload a folder named "Main" or something + return cloudInstance end end - return { - Type = "Studio", - Name = "Command Bar", - Description = "Command bar in Roblox Studio.", - Creator = "Unknown", - HasVerifiedBadge = false, - } + return "Command Bar" end function Rojo:_getCallerInfoFromSource(source: string): CallerInfo @@ -189,8 +142,11 @@ function API.new(app) Type = "Local", Name = localPlugin, Description = "Locally installed plugin.", - Creator = "Unknown", - HasVerifiedBadge = false, + Creator = { + Name = "Unknown", + Id = 0, + HasVerifiedBadge = false, + }, } end @@ -211,16 +167,22 @@ function API.new(app) Type = "Cloud", Name = info.Name, Description = info.Description, - Creator = info.Creator.Name, - HasVerifiedBadge = info.Creator.HasVerifiedBadge, + Creator = { + Name = (if info.Creator.CreatorType == "User" then "@" else "") .. info.Creator.Name, + Id = info.Creator.CreatorTargetId, + HasVerifiedBadge = info.Creator.HasVerifiedBadge, + }, } else return { Type = "Cloud", Name = source, Description = "Could not retrieve plugin asset info.", - Creator = "Unknown", - HasVerifiedBadge = false, + Creator = { + Name = "Unknown", + Id = 0, + HasVerifiedBadge = false, + }, } end end @@ -229,8 +191,11 @@ function API.new(app) Type = "Studio", Name = "Command Bar", Description = "Command bar in Roblox Studio.", - Creator = "Unknown", - HasVerifiedBadge = false, + Creator = { + Name = "N/A", + Id = 0, + HasVerifiedBadge = false, + }, } end