TribesNext

TribesNext.com Forums => Support => Topic started by: Thyth on May 21, 2014, 10:16:49 PM



Title: TribesNext Profile and Clan API [BETA]
Post by: Thyth on May 21, 2014, 10:16:49 PM
I spent a couple of hours shaking out cobwebs and skeletons from the unfinished TribesNext community backend system. This is the system responsible for managing clans, tags, player profiles, and so forth. The implementation was mostly complete 2 years ago, but not fully stable or fully abuse resistant. The remaining blocker issues to general availability have been resolved now.

I won't have time any time in the near future (or ever?) to complete the in-game UIs for T-Mail or player/clan browser -- if you're interested, capable, and would like to take on the task, you're welcome to try.

This is a "beta" release of JSON APIs covering password based authentication (over plaintext HTTP-- oh my!), and all of the APIs required to create and manage clans and user profiles within the TribesNext system. I made use of these APIs by hand when managing the first three or four seasons of the Draft League tournaments (before moving on to assorted level of completeness in-game UIs). The API endpoints support JSONP to permit bypassing cross origin policy restrictions if you would like to build an alternative UI for yourself.

Endpoints are as follow:
http://tribesnext.thyth.com/tn/json/json_session.php -- this is responsible for password authentication methods
http://tribesnext.thyth.com/tn/json/json_browser.php -- this provides browser APIs once an authenticated session is established

Source code to both endpoints in PHP can be viewed:
http://tribesnext.thyth.com/tn/json/json_session.phps
http://tribesnext.thyth.com/tn/json/json_browser.phps
This source code should be sufficient information to get started. I'll write more complete documentation as time allows later.

To have a visible clan tag in game, you will need to download and install the in-game community stub script used for the Draft League tournaments: http://tribesnext.thyth.com/tn/tournamentNetClient2.zip

Be advised that these endpoints may change or become inactive without warning. If people actually start using them, I may move them to a tribesnext.com subdomain. Also, there are certain policy restrictions on the number of times an account will be able to issue certain types of requests in a time period (esp. new clan creation).

All TN accounts should be able to authenticate against this endpoint now that the account and community services have been integrated.

Enjoy.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on May 22, 2014, 08:03:55 PM
Session API (http://tribesnext.thyth.com/tn/json/json_session.php):
In order to use the browser APIs, you must first establish an authenticated session with the system. For the JSON API, the only currently supported method is with a direct password authentication over plaintext HTTP. The T2 targeted "robot" API is capable of doing an RSA key challenge response with an account key; see the tournamentNetClient.zip for the script implementation of this method if you would like to initialize sessions without transmitting plaintext credentials. If there is demand, I will expose access to these capabilities to the JSON side. Sessions initialized via "robot" API and JSON API are equivalent once established -- you can alternatively extract the session ID variable from a T2 authenticated instance for use as the "uuid" parameter.

The API responds to all HTTP methods (GET/POST/etc.) effectively equivalently. I suggest using POST method and form encoding of the request parameters to avoid accidental transmission of the session identifier in referrer fields.

Accepted request parameters
  • method: "login", "logout"
  • guid: account unique identifier
  • uuid: authenticated session identifier
  • un: account username
  • pw: account password
  • jsonp: callback function name

Parameter Table
method=Required parameters:Successful output:Failed output:
loginun, pw{"status":"success","guid":<guid>,"uuid":<session id>,"message":"logged in"}{"status":"error","message":<user printable error message>}
logoutguid, uuid{"status":"success"}<blank>

Looks like the TribesNext forum style is stripping table borders. Copy/paste to another HTML document for enhanced readability.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on May 22, 2014, 08:44:02 PM
Browser API (http://tribesnext.thyth.com/tn/json/json_browser.php):
Once you have initiated an authenticated session with the system, you can invoke requests against the browser API.
Accepted request parameters
  • method: <see table below>
  • guid: account unique identifier
  • uuid: authenticated session identifier
  • payload: JSON encoded method parameters
  • jsonp: callback function name
The output of most methods is nearly identical.
On successful invocation, you will get: {"status": "success"}
On failed invocation, you will get: {"status": "error", "msg": <user printable error message>}
The output example is only specified if the method output deviates from these possibilities.
Parameter Table
method=Description:Payload example:Output example:
clansearchSearch for clans by name.{"q":"name"}[{"id": "clanid", "name": "clan name"}]
clanviewView clan details, suitable for showing a clan profile page.{"id":"numeric clan id"}{"id":"clanid", "name": "clan name", "tag": "clan tag", "append": "tag at end of name?",
"recruiting": "clan recruiting?", "website": "clan website", "info": "clan profile page text",
"creation": "UNIX timestamp for clan creation time", "picture": "in-game picture shown in profile",
"active": "whether or not this clan is active or abandoned/disbanded"
"members": [{"guid":"member GUID", "name":"member name", "tag":"member's active tag",
  "append":"member's tag at end of name?", "rank": "member's rank in this clan",
  "title": "member's title in this clan", "online": "player is currently online?"}]}
clanhistoryView clan audit history.{"id":"numeric clan id"}<see notes on history payload>
clanrecruitSet clan recruiting status.{"id":"clan ID","v":"true/false recruitment status"}
claninfoSet the clan browser page info.{"id","clan ID","v","Text for the clan's info page."}
clantagSet the tag on a clan.{"id":"clan ID","tag":"tag string","append":"true/false boolean controlling tag at start/end of name"}
clansiteSet the clan website.{"id":"clan ID","v":"www.example.com"}
clannameRename a clan.{"id":"clan ID","v":"New Clan Name"}
clanpictureSet which picture is used on the clan info page for the in-game GUIs.{"id":"clan ID","v":"path/to/in-game-img.png"}
claninviteSend an invitation to join the clan to another player.{"id":"clan ID","to":"invitee GUID"}
clanviewinvitesView outstanding invites to a clan.{"id":"clan ID"}{"status": "success", "payload":
   [{"sender": {"guid": "sender GUID", "name": "sender name", "tag": "sender tag", "append": "append tag?"},
     "recipient": {"guid": "invitee GUID", "name": "invitee name", "tag": "invitee tag", "append": "append tag?"},
     "expire": "UNIX timestamp for invitation expiration"}]}
clanrankChange rank/title of a player in a clan. Can be on self.{"id":"clan ID","to":"target GUID","rank":"integer 0 to 4","title":"Text Title in Clan"}
clankickKick a player from a clan.{"id":"clan ID","to":"kickee"}
clandisbandAuthorize disband of a clan, or retract that authorization (if the clan is still around).{"id":"clan ID","v":"yes/no disband authorization status"}
usersearchSearch for players by name.{"q":"player name"}[{"guid":"account GUID", "name":"player name", "tag":"player active tag", "append":"tag at end?"}]
userviewView user details, suitable for showing a user profile page.{"id":"account GUID"}{"guid":"account GUID", "name": "player name", "tag": "active tag", "append": "tag at end of name?",
"creation": "UNIX timestamp of account creation", "website": "player's website", "info": "Player profile text..."
"online": "is player online?", "memberships": [{"id":"clanid","name":"clan name","rank":"clan rank",
  "title":"clan title", "tag","tag of clan", "append":"is clan's tag appended?"}]}
userhistoryView user audit history.{"id":"account GUID"}<see notes on history payload>
usernameRequest an account name change. {"name": "New desired account name"}
userclanSet which clan tag is active. Client must be a member of a clan to set the tag. Supplying -1 will set no active tag.{"id", "clanid or -1"}
usersiteSet player profile website link.{"site": "www.example.com"}
userinfoSet player profile page text contents.{"info": "Profile page contents..."}
userinvitesGet a list of invitations for this player.<no payload>[{"sender":{"guid":"inviter GUID", "tag": "inviter tag", "append": "inviter tag append?",
  "name": "inviter name"}, "clan":{"name": "clan name", "id": "clanid", "tag": "clan tag",
  "append": "clan tag appended?"}, "expire":"UNIX timestamp for when invitation expires"}]
useracceptAccept a clan join invitation.{"id": "clanid from the invitation"}
userrejectDecline a clan join invitation.{"id": "clanid from the invitation"}
userleaveLeave a clan.{"id", "clanid to leave"}
createclanCreate a new clan.{"tag": "desired clan tag", "append": "yes/no/true/false", "name": "desired clan name", "recruiting": "yes/no/true/false", "info": "initial clan profile page"}<TODO notes>


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Ragora on May 23, 2014, 11:10:09 AM
This doesn't seem to be nearly as difficult as I initially thought when I made this post (http://www.tribesnext.com/forum/index.php?topic=3337.msg26836#new). At this point the only thing I'm really worried about is proper JSON parsing ingame (the Tourny script at a quick glance seems to be doing it in a rather hacky way), since everything else should be relatively trivial beyond that. But for that I'm pondering using some custom C++ code to provide a regex engine from something like Boost since it's pretty easy to have both TribesNext and 3rd party C++ coding (https://github.com/Ragora/Tribes-2-Bullet/blob/master/source/t2dll.cpp#L45) operating at the same time.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: F9 on May 23, 2014, 05:34:54 PM
For the Password or pw would it be the 3 part of the public.store? or would it be the actual player password non encrypted or anything?


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on May 23, 2014, 06:53:53 PM
I'm not sure how "direct password authentication over plaintext HTTP" can be interpreted any differently than "direct password authentication over plaintext HTTP". I also wouldn't have called attention to the complete lack of security if it was something else.

If you're interested in producing an in-game client, you'll likely want to use the "robot" API instead of the JSON API. Parsing JSON will not be a fun exercise in T2 script, and the "robot" API produces a line oriented regular data format more amenable to parsing with the limited string processing capabilities exposed by the game. Get in touch with me directly if you want to go that route.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: F9 on May 23, 2014, 08:20:44 PM
i misread certain parts because of tiredness and i had DX help me out a bit... odd thing is trying to get the password into a global var at login so then it can be used to be put into the authentication of the session... i tried more of the logical ways of doing so for some reason i am unable to get the password though

EDIT: nvm i got it took some time and effort and major brain farts to figure out that i needed to delete the dso files in the T2csri.vl2 oh well at least it works now


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on May 24, 2014, 10:06:37 AM
thanks Thyth for chiming in on things and everyone else for inspiration.

Some reason I missed notifications for this thread..checked now.


I need to review thread, as it looks encouraging at a glance.

We are planning some new tourneys now for cash, to get the revival started!

 ::)


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on May 24, 2014, 11:10:07 AM
Thanks for posting this stuff Thyth.

I have working web interface with login/logout. I'll go ahead and add the other features in and then maybe someone else can look about doing it in-game. I doubt I have the time to grind through crappy T2 code.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on May 24, 2014, 01:22:14 PM
There is a roughly 5000 line of code implementation for in-game UIs that's nearly complete (the ones I showed off http://www.tribesnext.com/forum/index.php?topic=3132.0). I'll put together a git repo so people can look at it and contribute patches for remaining bugs/polish and the couple missing features.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on May 24, 2014, 06:23:00 PM
There is a roughly 5000 line of code implementation for in-game UIs that's nearly complete (the ones I showed off http://www.tribesnext.com/forum/index.php?topic=3132.0). I'll put together a git repo so people can look at it and contribute patches for remaining bugs/polish and the couple missing features.

Now we are talking, thanks again!

 :o


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: F9 on May 24, 2014, 06:41:17 PM
remember that this is more so of the finished product for the entire community to use...


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on May 24, 2014, 09:33:20 PM
http://tribes2stats.com/browser/
I will periodically check here or this thread ( http://www.t2forums.com/index.php?topic=85.0 ) for feedback.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: F9 on May 25, 2014, 05:56:38 AM
Seems when you have switched the tribe name and tag in the creation page, seems you are unable to change your name in the profile


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Phantom139 on May 25, 2014, 08:19:02 AM
Alright, So I poked through a bit, Created a testing clan, and then messed around with settings and other stuff.

Aside from the bug mentioned by F9 above, there's just a few formatting errors I'm seeing.

Here's an example:
Code:
Phantom139 set clan website to: "http://www.phantomdev.netquot;.

Here's another one:
Code:
append mode: 0^

Everything else appears to be functioning as it should. I'll keep poking around a bit to see if there's anything that's doing what it shouldn't do.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on May 25, 2014, 08:20:04 AM
Seems when you have switched the tribe name and tag in the creation page
Actually, I don't think so. Maybe you expected them in a different order or something?

seems you are unable to change your name in the profile
You mean the player/account profile?

Everything appears to be okay - did you notice an error message anywhere?


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Phantom139 on May 25, 2014, 08:30:11 AM
Seems when you have switched the tribe name and tag in the creation page
Actually, I don't think so. Maybe you expected them in a different order or something?

seems you are unable to change your name in the profile
You mean the player/account profile?

Everything appears to be okay - did you notice an error message anywhere?

What he means is the segment under the account information page where you can set the player name.

When you try to change the name you get the following:
Code:
Name Change: error []


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on May 25, 2014, 08:35:08 AM
Okay, I'll have to look at that a little more. I don't know what the problem is right now.

Alright, So I poked through a bit, Created a testing clan, and then messed around with settings and other stuff.

Aside from the bug mentioned by F9 above, there's just a few formatting errors I'm seeing.

Here's an example:
Code:
Phantom139 set clan website to: "http://www.phantomdev.netquot;.

Here's another one:
Code:
append mode: 0^

Everything else appears to be functioning as it should. I'll keep poking around a bit to see if there's anything that's doing what it shouldn't do.
Thanks! Fixed both.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: F9 on May 25, 2014, 08:51:38 AM
i mean that the T2 Tag and T2 Clan are switch meaning that the clan tag is the name of the clan and the clan name is the tag that is set.. i had to fix it manually in the settings since that seems to be working fine


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on May 25, 2014, 08:57:55 AM
i mean that the T2 Tag and T2 Clan are switch meaning that the clan tag is the name of the clan and the clan name is the tag that is set.. i had to fix it manually in the settings since that seems to be working fine
I'm not trying to be difficult but I have created six tribes without any issue and no one else has reported this issue. I really think you just typed the name in the tag box. I just tried it again ( http://tribes2stats.com/browser/tribe.php?tid=201323 ) without issue.

I have added logging to both the player name change and the tribe creation to help me figure this out.
I also fixed the success/error message display so that you can see the actual message.
Can you please try again for me?


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on May 25, 2014, 09:04:43 AM
{"status":"error","msg":"The player account rename feature is not currently available."}
^ That one might be Thyth and not me. =)


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Phantom139 on May 25, 2014, 09:04:56 AM
i mean that the T2 Tag and T2 Clan are switch meaning that the clan tag is the name of the clan and the clan name is the tag that is set.. i had to fix it manually in the settings since that seems to be working fine
I'm not trying to be difficult but I have created six tribes without any issue and no one else has reported this issue. I really think you just typed the name in the tag box. I just tried it again ( http://tribes2stats.com/browser/tribe.php?tid=201323 ) without issue.

I have added logging to both the player name change and the tribe creation to help me figure this out.
I also fixed the success/error message display so that you can see the actual message.
Can you please try again for me?

Looks like you need to add it to the list of currently not available features. Otherwise you've got a code block in there that has this turned off.

Code:
Name Change: error [The player account rename feature is not currently available.]


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on May 25, 2014, 11:50:22 AM
{"status":"error","msg":"The player account rename feature is not currently available."}
^ That one might be Thyth and not me. =)
Yeah, that's me. Final integration between account server and browser codebase is required for that feature -- just not quite there yet.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on May 25, 2014, 01:30:27 PM
created clan and seems to be working  :)


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on May 26, 2014, 04:06:41 PM
request invite option to join clan, not seeing how to do so, at a glance, or is it just me?

thanks again thyth and Teratos and everyone else who has helped make this happen....noticed Sylock already got a clan and I hope to see the assasins in the Tourney coming up, as that is one team, I offered to sponsor and pay the entry fee for, as like to make sure we got some strong teams out there and bring in some contenders...


Check forums here for briefing on tourney http://www.tribesnext.com/forum/index.php?topic=3342.0


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on May 26, 2014, 05:07:58 PM
That isn't an option. With enough interest I might work some extras in like that but I want to make sure it isn't a duplicate effort as the stats are what I'm most interested in doing.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Jack Booted Thug on May 26, 2014, 07:15:42 PM
thanks Thyth for chiming in on things and everyone else for inspiration.

Some reason I missed notifications for this thread..checked now.


I need to review thread, as it looks encouraging at a glance.

We are planning some new tourneys now for cash, to get the revival started!

 ::)

That sounds good. I'll keep my eye open so I can help promote this as things develop.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Heat Killer on June 01, 2014, 04:01:29 PM
Any reason that this isn't on github (or some other git collab site)?  Would love to contribute (and get back into this game).


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: rJay on June 01, 2014, 06:39:44 PM
I'm seeing a 403 forbidden error on tribes2stats.com. What is this sorcery?


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on June 02, 2014, 02:30:14 AM
Any reason that this isn't on github (or some other git collab site)?  Would love to contribute (and get back into this game).
It will be soon. I've committed to my local repo. I just haven't pushed yet.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Ragora on June 02, 2014, 03:23:33 AM
Any reason that this isn't on github (or some other git collab site)?  Would love to contribute (and get back into this game).
It will be soon. I've committed to my local repo. I just haven't pushed yet.

Waiting on Thyth to create the repo, as well.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on June 02, 2014, 05:18:07 PM
What I'm calling 1.0 because it exposes web GUI to all of Thyth's calls.
https://gitorious.org/t2advstats/t2advstats/
This is my first experience with JSON and it has been a few years since I've done much of any PHP. Probably some things I'd do differently if I restarted now, but it is good enough.

I will probably polish up what is there and may go into some of the requested extras, but I may just leave it like it is today. Most people seem to have all the features they need/want. Still open to suggestions and looking forward to the in-game version.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on June 03, 2014, 04:27:56 AM
Any reason that this isn't on github (or some other git collab site)?  Would love to contribute (and get back into this game).
It will be soon. I've committed to my local repo. I just haven't pushed yet.

Waiting on Thyth to create the repo, as well.

thx  DX


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on June 03, 2014, 04:28:37 AM
What I'm calling 1.0 because it exposes web GUI to all of Thyth's calls.
https://gitorious.org/t2advstats/t2advstats/
This is my first experience with JSON and it has been a few years since I've done much of any PHP. Probably some things I'd do differently if I restarted now, but it is good enough.

I will probably polish up what is there and may go into some of the requested extras, but I may just leave it like it is today. Most people seem to have all the features they need/want. Still open to suggestions and looking forward to the in-game version.

thx T


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Heat Killer on June 04, 2014, 08:01:00 PM
Any reason that this isn't on github (or some other git collab site)?  Would love to contribute (and get back into this game).
It will be soon. I've committed to my local repo. I just haven't pushed yet.

Awesome.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on June 07, 2014, 01:10:48 PM
I have attached the stripped down version of it and should be able to run in any directory.

The two files required are included, so links will work for those.

Cleaned up a few PHP notices and made few minor changes to style sheet and elements.

For an example of it in action:

http://star.is-great.net/

Will work on updating this to keep up with Teratos' Master release, and a special thanks to Thyth and Teratos for making this happen.

If you notice any bugs or anything, you can pm me here or contact via the feedback button the website here http://star.is-great.net/

Side note, is since tags and clans are back now, there is a invite request button on our clan website to join us and a list of those that have been invited.





Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Jack Booted Thug on June 07, 2014, 02:16:59 PM
What I'm calling 1.0 because it exposes web GUI to all of Thyth's calls.
https://gitorious.org/t2advstats/t2advstats/
This is my first experience with JSON and it has been a few years since I've done much of any PHP. Probably some things I'd do differently if I restarted now, but it is good enough.

I will probably polish up what is there and may go into some of the requested extras, but I may just leave it like it is today. Most people seem to have all the features they need/want. Still open to suggestions and looking forward to the in-game version.

Thanks for this.

I too am looking forward to the in game version.

Once we have the ingame tmail and clan system working we can really focus on a marketing push for the game as the client will have an inbuilt hub which I think will help hold interest.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on June 07, 2014, 06:15:26 PM
Your website is still broken.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on June 07, 2014, 06:40:25 PM
I have attached the stripped down version of it and should be able to run in any directory.

The two files required are included, so links will work for those.

Cleaned up a few PHP notices and made few minor changes to style sheet and elements.

For an example of it in action:

http://star.is-great.net/

Will work on updating this to keep up with Teratos' Master release, and a special thanks to Thyth and Teratos for making this happen.

If you notice any bugs or anything, you can pm me here or contact via the feedback button the website here http://star.is-great.net/

Side note, is since tags and clans are back now, there is a invite request button on our clan website to join us and a list of those that have been invited.
Why did you reformat everything?
Makes it hard to diff!
Also you didn't submit your fixes as merge requests to git!

So some of your changes make sense to me. The changes to header() are wrong.
You have some spelling issues (index.php) and some naked amps.

I also noticed you removed the security warning link and removed the file containing the security notice which is extremely sketchy!!!!!!

It makes me think you are stealing passwords.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on June 08, 2014, 04:05:02 AM
I am not stealing any passwords or any thing wrong.

 I will add the security notice back to it, so you and everyone else can relax with your false sense of security, by reading it...


Someone who might do it, would be diemonkeys Mick G, who tried to hack into my gmail....not I, not now or ever.

Thanks for your concern and protection of the community T, as I assure you if I ever did have anyone's password, and I do not, that their password would be safe with me, though as far as anyone else, having their password, I cannot speak for them, only myself...

Anyone suggesting I am trying to do anything malicious, is full of shit.

( i just pulled the package and will add the security notice and reload it later today...)

I thought I requested yesterday, by  asking you to make a zip of the current version of your master available and I would download and go through line for line commenting the changes... the download link failed on this end and had to cut and paste the code to text editor to get before and it took 30 minutes or so to do..

So if you can package it up, will be more than happy to do anything you want.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: teratos on June 08, 2014, 08:42:38 AM
How is the download link broken? This is gitorious...not some homebrewed website. Download git or TortoiseGit or something and go at it. You should be using git or some other source control for your own code anyway.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on June 08, 2014, 09:13:33 AM
How is the download link broken? This is gitorious...not some homebrewed website. Download git or TortoiseGit or something and go at it. You should be using git or some other source control for your own code anyway.

ok thanks, you and thyth both over estimate me, as far as my technical skills goes, and intentions...will get on it, thanks again.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on June 10, 2014, 07:57:31 AM
Spoke with Teratos yesterday about adding a CAPTCHA and he suggested ReCAPTCHA by google.


Anyways I have not quiet figured out how to get with git and all, so posting the basics here and maybe T and others can check over it and see what they think, as  the box size needs to be adjusted to fit the layout by Teratos in left column or can be set to open in AJAX.


Here is the updated form code that goes in inc/template.inc

The Key provided is a global key and you can get/use your own, for your website if your prefer.
The one registered for this example is global and points to global-key@tribes2stats.com
Code:
<form action="verify.php?page=<?php echo $page?>" method="post">
<fieldset>
<legend>Browser Login</legend>
<div class="formtext">
<input type="text" placeholder="Username" autofocus="" required="" name="username" id="username" />
<input type="password" placeholder="Password" required="" name="password" id="password" />
<?php
    
require_once('inc/recaptchalib.php');
    
$publickey "6Lek-vQSAAAAAFrpzM2Jt4lKQafpsW8_uO2H9HNW"// you got this from the signup page
    
echo recaptcha_get_html($publickey);
?>

<input type="submit" value="Login" />
</div>
</fieldset>
</form>

for the verify.php, that goes in root directory in this example

Save as= verify.php

Code:
<?php
  
require_once('inc/recaptchalib.php');
  
$privatekey "6Lek-vQSAAAAAH8fzqdr4B_LQ8UjjE5RF5MGCh_4";
  
$resp recaptcha_check_answer ($privatekey,
                                
$_SERVER["REMOTE_ADDR"],
                                
$_POST["recaptcha_challenge_field"],
                                
$_POST["recaptcha_response_field"]);

  if (!
$resp->is_valid) {
    
// What happens when the CAPTCHA was entered incorrectly
    
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         
"(reCAPTCHA said: " $resp->error ")");
  } else {
    
// Your code here to handle a successful verification
function std_login_box($page) {
global 
$session;
if(
$session->isAuthenticated()) {
?>

<p>Authenticated as:<br /><?php echo htmlentities($session->getValue('tn_name'),ENT_QUOTES); ?><br /><a href="logout.php" title="Logout">Logout</a></p>
<?php
return;
}
?>

Then there is the recaptchalib.php from google that goes in /inc folder fro this example and is attached to this post and code is as follows:
Code:
<?php
  
require_once('inc/recaptchalib.php');
  
$privatekey "6Lek-vQSAAAAAH8fzqdr4B_LQ8UjjE5RF5MGCh_4";
  
$resp recaptcha_check_answer ($privatekey,
                                
$_SERVER["REMOTE_ADDR"],
                                
$_POST["recaptcha_challenge_field"],
                                
$_POST["recaptcha_response_field"]);

  if (!
$resp->is_valid) {
    
// What happens when the CAPTCHA was entered incorrectly
    
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         
"(reCAPTCHA said: " $resp->error ")");
  } else {
    
// Your code here to handle a successful verification
function std_login_box($page) {
global 
$session;
if(
$session->isAuthenticated()) {
?>

<p>Authenticated as:<br /><?php echo htmlentities($session->getValue('tn_name'),ENT_QUOTES); ?><br /><a href="logout.php" title="Logout">Logout</a></p>
<?php
return;
}
?>


Will work on the layout and I may have made some mistakes in modding this, so maybe Teratos or someone else can chime in on things and review.

I believe this should be mandatory for any sites running the code, anywhere, as a minor security precaution and there may be some other layers that can help with the plain text issue, as it may be best to require SSL on all sites running the code or establish an API interface that is encrypted and secure from a site that does have SSL, or something like that may be more secure and possible...not the one to really know or suggest, just my thoughts.

I have not released the new version here or anywhere at this time, after the backlash for removing the security note before...

Though if anyone is interested in it, please send me a pm and will zip it up and upload it for downloading...with reCAPTCHA of course :D

Teratos & thyth thanks again for sharing the code to make this possible







Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Blue Jello on July 11, 2014, 07:26:29 PM
hi guys, sorry to be a nuisance, I wanted to see if there are any updates on the Profile/Clan interface.  If not, I wanted to ask what my options are for being able to add a tag to my name through, http://www.tribes2stats.com/browser/.

Unfortunately, from what I have been told by a few people, my username needs to be added to a particular database because it did not exist until after the last tournament (username created in April '14).  Please let me know if there is anyone in particular I need to speak with on here or IRC to get added to the database.  I am willing to pay a fair price for the effort/time spent.

Thanks,
Blue Jello


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on July 12, 2014, 04:11:24 AM
hi guys, sorry to be a nuisance, I wanted to see if there are any updates on the Profile/Clan interface.  If not, I wanted to ask what my options are for being able to add a tag to my name through, http://www.tribes2stats.com/browser/.

Unfortunately, from what I have been told by a few people, my username needs to be added to a particular database because it did not exist until after the last tournament (username created in April '14).  Please let me know if there is anyone in particular I need to speak with on here or IRC to get added to the database.  I am willing to pay a fair price for the effort/time spent.

Thanks,
Blue Jello

my guess is, it takes about 5-30 minutes to do or less...less than an hour, ask Thyth in IRC, he is the only one who can do, and I have asked several times and was told by him, he would do it, when he has time to do it...other than that I have an account I can give you, if you want one that is old enough and synced with ms.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Blue Jello on July 13, 2014, 06:45:02 PM
Thanks earth, I will reach out to him on IRC... Sadly, no real rush at the moment because my motherboard died on me yesterday, so I won't be able to game until I get that straightened out.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on July 15, 2014, 03:32:56 PM
always something, been there and done that, take a look on craiglist for used computers, normally some good deals on there, maybe in your in area...


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on July 29, 2014, 11:10:25 PM
Found a little time to work on TribesNext stuff.

Accounts generated between September 2013 and now have been copied over to the browser system. The account server is now programmed to automatically keep both systems synchronized whenever a new account is created.

I've put this code into production without running any kind of full test, so, if it's broken, you get to keep both pieces (and let me know on IRC so I can fix it).

Edit: sashimi ran a quick test of account generation and log in via browser. Worked for him. I verified correct database rows generated. Looks like it's all working.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on August 01, 2014, 12:38:57 PM
thx T


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Jack Booted Thug on August 02, 2014, 06:46:41 PM
Is this in the T2 browser or just web browser stuff?


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on August 03, 2014, 05:45:39 AM
JBT,

I think this is just web browser.

The hold up on the in game GUI is the tmail function, that has a bug, that DxDragon can describe and go into detail about it, that is holding, the in game browser GUI

I just watched a documentary, called "video games" ...on a side note, a worthy watch about the history of gaming.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on August 18, 2014, 09:06:20 PM
I put together a script to check for clients running a new enough version of TribesNext with the mini-browser client created for the tournaments: http://thyth.com/tn/checkver.cs

It's totally untested, but, if you install that script on a T2 server (RC2a+ on server side), it will prevent anyone without RC2 & tournamentNetClient.vl2 from joining for gameplay -- they will be stuck in observer mode. Admins can override this if necessary with the team force join admin option in the server lobby.

There was some preliminary anti-cheat work in RC2 targeting HM2 (causes the game to crash if HM2 is used). By running this script, you can enforce a minimum TribesNext version to the anti-HM2 versions. The HM2 killer isn't that sophisticated, but the kind of script kiddies that run HM2 and complain about how it crashes on cheat forums aren't smart enough to do anything other than downgrade to RC1x versions of TribesNext.

Edit: I should also clarify... you do not need to have a tag on the account for this to work. Just having RC2 and the tournamentNetClient.vl2 is enough.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Blakhart on August 19, 2014, 07:09:57 AM
Yay!


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: GeEkOfWiReS1097 on August 19, 2014, 01:05:58 PM
Double sweetness!
Wait, so you have to have the tournamentNetClient.vl2 to get this to work? I'll have to re-add it to my game.

I didn't know there was any HM2 prevention in TribesNext, I thought it was 100% authentication and matchmaking. But hey, you learn something new everyday.

Bookmarking Thyth.com


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Blue Jello on August 20, 2014, 06:43:10 PM
I am a little late to the party on this post, but I wanted to thank you Thyth for your work on this.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: rJay on August 21, 2014, 10:13:29 AM
yes thank you!


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on August 31, 2014, 01:05:09 PM
An updated version of checkver.cs is now available from the link above. Heat Killer had done some tests and helped track down a couple issues.

A version of this script is now live on Snap Crackle Pub, and will eliminate people still running HM2 by reverting to the older patch.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on February 07, 2015, 09:45:36 PM
I've copied code from the TribesNext SVN repository to Github: https://github.com/TribesNext/t2-scripts

This includes the incomplete in-game GUIs, but is intended for developers, not general users at this time.

Heat has some bandwidth to work on this stuff. I'll be accepting pull requests, and if we end up finishing the browser code, we might cut an RC3 release.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Ragora on February 07, 2015, 11:52:55 PM
I've already had some of my own code (that I've been holding onto for quite some time) contributions that totally enables the mail and tribal browser UI's which appear to work without much issue aside from a few small issues in the tribal browser still.

Probably still needs some formal testing beyond what I did, though.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Turkeh on January 25, 2016, 04:55:47 PM
I got a bit bored (and felt like learning AngularJS) and threw together an alternate web-based UI for the community server. You can access it here: http://turkeh.net/browser/ (http://turkeh.net/browser/). Source is available on github (https://github.com/itorquey/tn-community-browser) (no guarantee that it's pretty, or good).


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on January 26, 2016, 07:30:30 PM
Glad to see someone using the JSONP capabilities of the API to implement a browser client that runs totally in the user's web browser, instead of reflecting off another server.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on September 16, 2017, 01:58:30 PM
I've just made a few changes to the URLs in the first 3 posts. All URLs to "thyth.com" are now "tribesnext.thyth.com", and I have also made a new version of the tournamentNetClient available with this change: http://tribesnext.thyth.com/tn/tournamentNetClient2.zip

All existing API endpoints are now active on this new sub-domain, and behave the exact same way.

In approximately 1 month (probably around 2017/10/21), I will be *deactivating* the API endpoint on the non-sub-domain "thyth.com" endpoint as part of overhauls to my personal website. For multiple reasons (including site-wide default to HTTPS, and a vastly different underlying system design), it isn't tenable to provide these older services on the top-level domain.

Please update your TribesNext installs with the new tournamentNetClient2, and update any remote websites using the TribesNext Community APIs to the new hostname by this time.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: _Unknown _ on September 17, 2017, 11:33:16 AM
nice when there is final version

for windows and linux



Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on September 17, 2017, 02:25:16 PM
I'm not doing any new development for TribesNext. Just keeping things up and running as they were before.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on September 18, 2017, 11:47:31 AM
What is the status of the tmail functioning and buddy list, with clan browser, so we can allow invite requests and accepts?

I looked at GIt and thought saw Lou credited for coding it, though had not seen it implemented in clan browser anywhere yet.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on September 18, 2017, 08:35:32 PM
Viewing, accepting, and declining invitations were added to the browser API rather than doing it via t-mail (see message #3 in this thread, specifically the userinvites, useraccept, userdecline methods). That's different from the way the game did it originally, but there's no reason it has to work the exact same way as before. There is no in-game UI to do it the new way, but, like I said above: I'm not doing any new development for TribesNext.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on September 19, 2017, 05:17:57 AM
Viewing, accepting, and declining invitations were added to the browser API rather than doing it via t-mail (see message #3 in this thread, specifically the userinvites, useraccept, userdecline methods). That's different from the way the game did it originally, but there's no reason it has to work the exact same way as before. There is no in-game UI to do it the new way, but, like I said above: I'm not doing any new development for TribesNext.

Okay, reviewed  #3, though I just looked at Teratos site and only thing really missing, is ability to  request an invitation to join clans by players.

http://tribes2stats.com/browser

I did not see it in the specific list functions, maybe I am missing something...

What would be use for player to request invite to clans?

Also, on tmail, is it not working or is it?  Thought Lou got it working.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on September 19, 2017, 10:44:19 PM
T-Mail was never completed. The APIs are partly in place, and it's possible that most things are working, but in the time that I was willing to spend on it, I preferred to add the userinvite method the browser API when I did this beta API release 3 years ago.

I've intentionally not documented the Mail JSON API. If you look at the script source code, there is an implementation against the robot API, but I'll actively discourage you from using it. There are probably bugs, and I don't have the time to track them down, or fix any issues that may cause problems with accounts that attempt to use them. Buyer beware if you try using them.

I was actually never going to implement invitation requesting, since I couldn't come up with a satisfactory way to actually do it (i.e. who would you send the request mail to?). In the browser UI code I implemented in the game, I think I removed all references to that capability.

Generally speaking, there are far better ways to communicate and coordinate available today than a crappy half-implemented private messaging system that I never finished. Use Discord, Slack, IRC, or whatever else the gaming community uses nowadays.

As a final point, you're best off using the API references I've already posted, and the T2 script code on GitHub if you want to build on top of this system to do things. Almost all of your questions should be answerable by reading through the information I've already made available. To reiterate: I don't have time to do new development for TribesNext, and that includes answering more than the questions I've already addressed.

You're absolutely free to build on top of my systems, but you'll need to be self-directed in learning and understanding how the existing stuff was put together. I simply don't have the time to say more than this.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on September 20, 2017, 06:58:04 AM
Right on, totally understand...was just thinking maybe I overlooking the ability for player to request invite, as that would make it completed, imo, for clan management system, and if tmail was functioning, it would seem like the logical mailer, rather than external social sources or ways, that could be skipped, if request clan invite feature was working....

Has anyone seen Lou around?



Title: Re: TribesNext Profile and Clan API [BETA]
Post by: rJay on September 21, 2017, 06:02:25 PM
There is a section in the FAQ about patch 3 coming soon... I'd maybe update that.  ::)  ;)


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on September 22, 2017, 07:54:57 AM
There is a section in the FAQ about patch 3 coming soon... I'd maybe update that.  ::)  ;)

got a link to the FAQ?

 if it is in this thread and when posted by thyth?

.... think thyth is no longer available to work on anymore tribesnext projects...

Love to see a patch 3 coming soon...


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Thyth on October 21, 2017, 05:18:03 PM
This is a reminder to update any of your software to use the new "tribesnext.thyth.com" API hostname. If you're using the old tournamentNetClient, be sure to replace it with touernamentNetClient2. If you're using pre-RC3 code from GitHub, make sure you've pulled latest from t2-scripts/master as of September 25th. Sites using the API will need to update themselves too.

I will be making the changes to systems on my end soon without further advanced notice. If you neglect to update and your stuff breaks: you have been warned.


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: ({STAR})earthinhabitant on October 23, 2017, 06:56:39 AM
maybe should add this to announcements or sticky note it...also attach the file inline


Title: Re: TribesNext Profile and Clan API [BETA]
Post by: Chocotaco on October 25, 2017, 11:39:36 PM
This is a reminder to update any of your software to use the new "tribesnext.thyth.com" API hostname. If you're using the old tournamentNetClient, be sure to replace it with touernamentNetClient2. If you're using pre-RC3 code from GitHub, make sure you've pulled latest from t2-scripts/master as of September 25th. Sites using the API will need to update themselves too.

I will be making the changes to systems on my end soon without further advanced notice. If you neglect to update and your stuff breaks: you have been warned.

Thanks Thyth