Skip to content

Feature Request: VyHub profile link #119

@Serpensin

Description

@Serpensin

Hi,
on our server, we use VyHub, to sync bans, roles, etc... It would be really cool, if there is an option to display the link to the VyHub profiles of the plaintiff and defendant. I don't realy have that much experience with lua, so I used GPT, to get an example for the module:

local http = http
local use_chttp = pcall(require, "chttp")

if use_chttp then
    http = CHTTP
end

local vyhub = {}
local apiUrl = CreateConVar("ttt_dmglogs_vyhub_api", "", FCVAR_PROTECTED + FCVAR_LUA_SERVER, "VyHub API URL")
local profileUrl = CreateConVar("ttt_dmglogs_vyhub_profil", "", FCVAR_PROTECTED + FCVAR_LUA_SERVER, "VyHub Profile Base URL")

-- Ensures the URL ends with a trailing slash
local function ensureTrailingSlash(url)
    if not url:match("/$") then
        return url .. "/"
    end
    return url
end

function vyhub.GetVyHubID(steamID64, callback)
    local baseUrl = apiUrl:GetString()
    if baseUrl == "" then
        return callback(nil, "VyHub API URL is not set")
    end

    local requestUrl = ensureTrailingSlash(baseUrl) .. "user/" .. steamID64 .. "?type=STEAM"

    http.Fetch(requestUrl, function(body)
        local data = util.JSONToTable(body)
        if not data or not data.id then
            return callback(nil, "Invalid response from VyHub API")
        end
        callback(data.id, nil)
    end, function(err)
        callback(nil, err)
    end)
end

function vyhub.GetProfileURL(uuid)
    local baseProfileUrl = profileUrl:GetString()
    if baseProfileUrl == "" then
        return nil, "VyHub Profile URL is not set"
    end
    return ensureTrailingSlash(baseProfileUrl) .. uuid
end

print("[TTT Damagelogs] VyHub support loaded")
return vyhub

It would be nice, if you could make this the way it's supposed to be. Here you can find the relevant part of the api documentation.
This specific endpoint also doesn't need authorization.
You basically only need to input the steamid64, to get the uuid back, which you can then attach to the url: https://shop.hrp-community.net/user/<UUID>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions