SourceMod WebLinks

Ingame web shortcuts API for CS:GO, TF2, CS:S

Download GIT Forum

Latest version: 1.6


Easy to use
Install, configure and use! You don't need to host own API / database.

Secure
Every request is stored max. 5 minutes in cache. Our API use HTTPS.

SteamID or IP
You can use SteamID or IP method to identify player request.

Installation

  1. Download & extract SteamWorks extension ( Download here ).
  2. Download & extract plugin
  3. Move Weblinks.txt and WebLinks.cfg (CS:GO only) to addons/sourcemod/configs
  4. Move .smx to addons/sourcemod/plugins
  5. Restart server / change map
  6. CS:GO only: change map twice (autogenerate) or manually edit motd.txt ( More information ).

Configuration

Edit Weblinks.txt file in addons/sourcemod/configs

                        
// Usage: "trigger/key" "Window size" address
// Window size can be: normal or height=xxx,width=xxx
// Variables: {NAME}, {STEAMID}, {STEAMID64}, {SERVER_IP}, {SERVER_PORT}
// Allow player to logout from WebLinks API (autologin)
"!logout" "normal" https://weblinks.hexa-core.eu/auth/logout
"google" "normal" https://www.google.cz/
"youtube" "normal" https://www.youtube.com/
"tracker" "normal" https://sm.hexa-core.eu/
"!facebook" "height=1010,width=1920" https://facebook.com/
"!test" "normal" "https://domain.com?name={NAME}&steamId={STEAMID}"
"!test2" "normal" "https://domain.com/user/{STEAMID64}"
                        
                    
First parameter is chat trigger

You can use chat trigger with ! or without "!forum" or just "forum"

Second parameter is window size

"height:1010,width:1920" (comma separated) or default "normal"

CS:GO - use only "normal", because API is different, so you can't change window size.

Third parameter is URL

You can also add variables to url:{NAME},{STEAMID},{STEAMID64},{SERVER_IP},{SERVER_PORT}

Advanced Configuration (CS:GO only)

Edit WebLinks.cfg file in addons/sourcemod/configs

                        
"WebLinks"
{
  "Settings"
  {
    // Method to identify players request - ip or steamid
    "FetchMethod" "ip"
    // If request not found redirect to this URL (homepage).
    "FallbackUrl" ""
  }
}                       
                    
Warning
This is only for motd.txt file! Don't add this values to config file!
If you change FetchMethod or FallbackUrl before server start, you need to change map twice (recommended) or manually edit motd.txt file:
FetchMethod: https://weblinks.hexa-core.eu/method/{ip or steamid}
FallbackUrl: {URL}?fallbackUrl=https://domain.com or ?fallbackUrl= to use default error page.
Why?
Because plugin autogenerate correct URL to motd.txt and server load motd.txt file before all plugins are loaded (so server uses old motd.txt file until map change).
Method to identify player

API use this as key in cache DB to temporary store player request data.

Sometimes is better to use SteamID method, because one IP can be shared with many people. But player must login via Steam, before API can process request.

After the player is logged in, we only store Steam ID in browser as cookie (for 7 days). Player does not need to login via Steam for 7 days.

Fallback URL

If players request can't be processed, API redirect player to this URL. So you probably want to redirect player to your domain.

If you want to use default page, leave blank value ("").

This configuration is only for CS:GO!