mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 13:21:38 +00:00
Simplify creator info and differentiate user/group
This commit is contained in:
parent
37d893e42c
commit
83a4fce721
3 changed files with 36 additions and 72 deletions
|
|
@ -102,7 +102,7 @@ function SourceListing:render()
|
||||||
Creator = e(
|
Creator = e(
|
||||||
"TextLabel",
|
"TextLabel",
|
||||||
{
|
{
|
||||||
Text = callerInfoFromSource.Creator,
|
Text = callerInfoFromSource.Creator.Name,
|
||||||
FontFace = theme.Font.Main,
|
FontFace = theme.Font.Main,
|
||||||
TextSize = theme.TextSize.Body,
|
TextSize = theme.TextSize.Body,
|
||||||
TextColor3 = theme.Settings.Setting.NameColor,
|
TextColor3 = theme.Settings.Setting.NameColor,
|
||||||
|
|
@ -118,7 +118,7 @@ function SourceListing:render()
|
||||||
),
|
),
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
},
|
},
|
||||||
if callerInfoFromSource.HasVerifiedBadge
|
if callerInfoFromSource.Creator.HasVerifiedBadge
|
||||||
then e(
|
then e(
|
||||||
"ImageLabel",
|
"ImageLabel",
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -991,8 +991,7 @@ function App:render()
|
||||||
end,
|
end,
|
||||||
|
|
||||||
onEdit = function(plugin, source, callerInfo, apiMap)
|
onEdit = function(plugin, source, callerInfo, apiMap)
|
||||||
local name = callerInfo.Name
|
local name = string.format("%s by %s", callerInfo.Name, callerInfo.Creator.Name)
|
||||||
.. if callerInfo.Creator then " by " .. callerInfo.Creator else ""
|
|
||||||
local apiList = {}
|
local apiList = {}
|
||||||
for api in apiMap do
|
for api in apiMap do
|
||||||
table.insert(apiList, api)
|
table.insert(apiList, api)
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,11 @@ export type CallerInfo = {
|
||||||
Type: "Local" | "Cloud" | "Studio",
|
Type: "Local" | "Cloud" | "Studio",
|
||||||
Name: string,
|
Name: string,
|
||||||
Description: string,
|
Description: string,
|
||||||
Creator: string,
|
Creator: {
|
||||||
HasVerifiedBadge: boolean?,
|
Name: string,
|
||||||
|
Id: number,
|
||||||
|
HasVerifiedBadge: boolean,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local API = {}
|
local API = {}
|
||||||
|
|
@ -105,43 +108,6 @@ function API.new(app)
|
||||||
return localPlugin
|
return localPlugin
|
||||||
end
|
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_%-]")
|
local cloudId, cloudInstance = string.match(topLevel, "cloud_(%d-)%.(.-)[^%w_%-]")
|
||||||
if cloudId then
|
if cloudId then
|
||||||
local info = cloudIdProductInfoCache[cloudId]
|
local info = cloudIdProductInfoCache[cloudId]
|
||||||
|
|
@ -155,31 +121,18 @@ function API.new(app)
|
||||||
end
|
end
|
||||||
|
|
||||||
if info then
|
if info then
|
||||||
return {
|
return info.Name
|
||||||
Type = "Cloud",
|
.. " by "
|
||||||
Name = info.Name,
|
.. (if info.Creator.CreatorType == "User" then "@" else "")
|
||||||
Description = info.Description,
|
.. info.Creator.Name
|
||||||
Creator = info.Creator.Name,
|
|
||||||
HasVerifiedBadge = info.Creator.HasVerifiedBadge,
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return {
|
-- Fallback to the name of the instance uploaded inside this plugin
|
||||||
Type = "Cloud",
|
-- The reason this is not ideal is because creators often upload a folder named "Main" or something
|
||||||
Name = cloudInstance,
|
return cloudInstance
|
||||||
Description = "Could not retrieve plugin asset info.",
|
|
||||||
Creator = "Unknown",
|
|
||||||
HasVerifiedBadge = false,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return "Command Bar"
|
||||||
Type = "Studio",
|
|
||||||
Name = "Command Bar",
|
|
||||||
Description = "Command bar in Roblox Studio.",
|
|
||||||
Creator = "Unknown",
|
|
||||||
HasVerifiedBadge = false,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Rojo:_getCallerInfoFromSource(source: string): CallerInfo
|
function Rojo:_getCallerInfoFromSource(source: string): CallerInfo
|
||||||
|
|
@ -189,8 +142,11 @@ function API.new(app)
|
||||||
Type = "Local",
|
Type = "Local",
|
||||||
Name = localPlugin,
|
Name = localPlugin,
|
||||||
Description = "Locally installed plugin.",
|
Description = "Locally installed plugin.",
|
||||||
Creator = "Unknown",
|
Creator = {
|
||||||
HasVerifiedBadge = false,
|
Name = "Unknown",
|
||||||
|
Id = 0,
|
||||||
|
HasVerifiedBadge = false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -211,16 +167,22 @@ function API.new(app)
|
||||||
Type = "Cloud",
|
Type = "Cloud",
|
||||||
Name = info.Name,
|
Name = info.Name,
|
||||||
Description = info.Description,
|
Description = info.Description,
|
||||||
Creator = info.Creator.Name,
|
Creator = {
|
||||||
HasVerifiedBadge = info.Creator.HasVerifiedBadge,
|
Name = (if info.Creator.CreatorType == "User" then "@" else "") .. info.Creator.Name,
|
||||||
|
Id = info.Creator.CreatorTargetId,
|
||||||
|
HasVerifiedBadge = info.Creator.HasVerifiedBadge,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return {
|
return {
|
||||||
Type = "Cloud",
|
Type = "Cloud",
|
||||||
Name = source,
|
Name = source,
|
||||||
Description = "Could not retrieve plugin asset info.",
|
Description = "Could not retrieve plugin asset info.",
|
||||||
Creator = "Unknown",
|
Creator = {
|
||||||
HasVerifiedBadge = false,
|
Name = "Unknown",
|
||||||
|
Id = 0,
|
||||||
|
HasVerifiedBadge = false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -229,8 +191,11 @@ function API.new(app)
|
||||||
Type = "Studio",
|
Type = "Studio",
|
||||||
Name = "Command Bar",
|
Name = "Command Bar",
|
||||||
Description = "Command bar in Roblox Studio.",
|
Description = "Command bar in Roblox Studio.",
|
||||||
Creator = "Unknown",
|
Creator = {
|
||||||
HasVerifiedBadge = false,
|
Name = "N/A",
|
||||||
|
Id = 0,
|
||||||
|
HasVerifiedBadge = false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue