Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add region information in :serverinfo #411

Merged
merged 8 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion MainModule/Client/UI/Default/ServerDetails.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ return function(data)
end
end
end






local i = 1
local function addOverviewEntry(name, value, toolTip)
local entry = overviewtab:Add("TextLabel", {
Expand All @@ -81,7 +86,7 @@ return function(data)

i = i + 1
end

addOverviewEntry("Place Name:", service.MarketPlace:GetProductInfo(game.PlaceId).Name)
addOverviewEntry("Place ID:", game.PlaceId)
addOverviewEntry("Place Version:", game.PlaceVersion)
Expand All @@ -100,6 +105,21 @@ return function(data)
addOverviewEntry("Private Server ID:", data.PrivateServerId)
addOverviewEntry("Private Server Owner:", (game:GetService("Players"):GetNameFromUserIdAsync(data.PrivateServerOwnerId) or "[Unknown Username]").." ("..game.PrivateServerOwnerId..")")
end
if data.ServerInternetInfo then
--Server Internet Info
local serii = data.ServerInternetInfo
addOverviewEntry("Timezone:", serii.timezone or "[Error]")
addOverviewEntry("Country:", serii.country or "[Error]")
if game:GetService("RunService"):IsStudio() then else
addOverviewEntry("Region:", serii.region or "[Error]")
addOverviewEntry("City:", serii.city or "[Error]")
addOverviewEntry("Zipcode:", serii.zipcode or "[Error]")
addOverviewEntry("IP Address:", serii.query or "[Error]")
addOverviewEntry("Coordinates:", serii.coords or "[Error]") --"0 LAT 0 LON"
--Sensitive Data when running on studio
end

end
i = i + 1
addOverviewEntry("Server Speed:", service.Round(service.Workspace:GetRealPhysicsFPS()))
addOverviewEntry("Server Start Time:", data.ServerStartTime)
Expand Down
14 changes: 14 additions & 0 deletions MainModule/Server/Commands/Moderators.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1656,13 +1656,27 @@ return function(Vargs, env)
nilPlayers = nilPlayers + 1
end
end
local s, r = pcall(service.HttpService.GetAsync, service.HttpService, "http://ip-api.com/json")
if s then
r = service.HttpService:JSONDecode(r)
end
local serverInfo = s and {
country = r.country,
city = r.city,
region = r.region,
zipcode = r.zip,
timezone = r.timezone,
query = r.query,
coords = r.lat .. " LAT ".. r.lon .. " LON"
} or nil
Remote.MakeGui(plr,"ServerDetails",{
CreatorId = game.CreatorId;
PrivateServerId = game.PrivateServerId;
PrivateServerOwnerId = game.PrivateServerOwnerId;
ServerStartTime = service.FormatTime(server.ServerStartTime);
ServerAge = service.FormatTime(os.time()-server.ServerStartTime);
HttpEnabled = HTTP.CheckHttp();
ServerInternetInfo = serverInfo;
LoadstringEnabled = HTTP.LoadstringEnabled;
Admins = adminDictionary;
Donors = donorList;
Expand Down