Commit Graph

263 Commits

Author SHA1 Message Date
Howl
ff1d2fa1c3 .HIDE. shit 2016-07-06 19:36:46 +02:00
Howl
15559d0be2 use c.ClientIP() rather than manually accessing c.Request.RemoteAddr 2016-07-06 19:35:49 +02:00
Howl
45d0de234b Fix race condition in specificRateLimiter 2016-07-06 19:24:11 +02:00
Howl
faf948b037 Implement rate limiting
- 60 requests per minute for requests without a valid API token
- 2000 requests per minute per user for requests with a valid API token
2016-07-06 16:33:58 +02:00
Howl
0a870ee742 Remove read privilege. Public data is now readable by everyone without having to pass an API token. Feel free to test around as much as you like! 2016-07-06 14:22:43 +02:00
Howl
534d5183ed It's not rank, it's privileges 2016-07-06 14:12:57 +02:00
Howl
fcdd042d6c Finish up with new ranks and stuff on the API 2016-07-04 00:06:23 +02:00
Nyo
39f6b2bbcf New privileges on API (allowed column only) 2016-07-03 21:55:03 +02:00
Nyo
244186cf4e Allow compilation of the API on Windows 2016-06-22 13:13:33 +02:00
Howl
7cbbb626c1 LEFT JOIN -> INNER JOIN 2016-06-18 02:42:47 +02:00
Howl
b3e31734f5 Release logging to sentry 2016-06-17 10:34:53 +02:00
Howl
427f2ff890 Remove errore_meme 2016-06-16 14:06:09 +02:00
Howl
02f0449b39 Stack traces are only useful for panics 2016-06-16 14:05:26 +02:00
Howl
6554447cbc Use ID rather than IP, memes 2016-06-16 14:01:37 +02:00
Howl
ef9c0c6c6a When erroring from c.Error(), give actual error, not a *gin.Error 2016-06-16 13:59:18 +02:00
Howl
9658957067 Better recovery 2016-06-16 13:49:35 +02:00
Howl
cbcfacb06a Fix misplaced if 2016-06-16 13:14:19 +02:00
Howl
06eb64ecf5 error logging with schiavo -> error logging with sentry 2016-06-16 12:45:10 +02:00
Howl
24d34eb741 v1.TokenNewPOST => /tokens, /tokens/new 2016-06-15 00:23:55 +02:00
Howl
fc38503bdd add GET /tokens/self 2016-06-14 12:01:30 +02:00
Howl
4d9ec829a8 Add token listing at GET /tokens, also add a token-fixing tool at /tokens/fix_privileges.
By the way, 100th commit on the API!
2016-06-14 11:32:11 +02:00
Howl
52d7b65493 Add /api/v1/tokens/self/delete 2016-06-14 10:03:53 +02:00
Howl
a9b82f99b5 Add global leaderboard 2016-06-14 09:37:11 +02:00
Howl
a65cf086f0 Add Documentation API 2016-06-13 22:40:01 +02:00
Howl
32738aaae0 Simplify string to int conversion where possible 2016-06-13 21:48:09 +02:00
Howl
2f027ce853 Remove Message from 404 response, to allow easy distinction between missing method and data not found 2016-06-13 21:47:35 +02:00
Howl
da6fcb83f7 Don't allow "weird" characters in jsonp callback 2016-06-13 21:17:43 +02:00
Howl
f32de541a4 Fix set_status 500 ing when beatmap is not found by ID 2016-06-09 10:52:55 +02:00
Howl
d87027c85a always rank the whole mapset, not just a single diff 2016-06-09 00:29:00 +02:00
Howl
b1fc609706 Add BeatmapsRankedFrozenFullGET, an endpoint to get all beatmaps having a frozen ranked status 2016-06-08 23:33:08 +02:00
Howl
9b821e3230 Add /api/v1/beatmaps 2016-06-08 19:55:52 +02:00
Howl
155fbabbbc Allow auth through cookie X-Ripple-Token 2016-06-08 18:55:48 +02:00
Howl
ee51b999f1 Allow passing a beatmap_id to BeatmapSetStatus 2016-06-08 18:30:23 +02:00
Howl
e27569261a Update ban_datetime on allowed status change 2016-06-06 12:27:54 +02:00
Howl
122e2afa1b Don't log message in get_user if it's an ErrNoRows 2016-05-30 19:18:31 +02:00
Howl
ba5a078db3 forgot allowed check 2016-05-29 13:09:36 +02:00
Howl
0c6237ed01 Use userid rather than username 2016-05-28 23:48:29 +02:00
Howl
fb08a80308 fixes 2016-05-28 20:31:46 +02:00
Howl
571325e98f Send error logs asynchronously 2016-05-28 20:28:13 +02:00
Howl
6a374a4f9d Implement get_user_best and get_user_recent in peppyapi 2016-05-28 20:24:39 +02:00
Howl
0fcb1cc391 diobono 2016-05-26 21:19:00 +02:00
Howl
fde01c6f84 Don't print 0pp scores on std on user/scores/best 2016-05-26 21:13:36 +02:00
Howl
d5caa1fdc2 Report errors in API to #bunker 2016-05-22 17:11:07 +02:00
Howl
a25512fb96 Add completed status in users/scores/* 2016-05-22 16:22:13 +02:00
Howl
ce739a8ae5 Implement users/scores/recent 2016-05-19 17:31:49 +02:00
Howl
da2a36537e Implement user/scores/best 2016-05-19 17:15:17 +02:00
Howl
45c67cf9b7 Start implementing get_beatmaps 2016-05-18 18:37:36 +02:00
Howl
de2aeb338b Revert "Fix normalisation not actually happening in users/full"
This reverts commit ef14f027b7.
2016-05-18 18:00:39 +02:00
Howl
52e1fa09ca Revert "Normalise floats (don't use Inf in JSON)"
This reverts commit 330757ec78.
2016-05-18 18:00:22 +02:00
Howl
ef14f027b7 Fix normalisation not actually happening in users/full 2016-05-18 17:49:46 +02:00
Howl
330757ec78 Normalise floats (don't use Inf in JSON) 2016-05-18 17:48:19 +02:00
Howl
2afc557ef8 peppyapi: replicate behaviour of original API (check for user ID first, then for username) 2016-05-18 17:47:39 +02:00
Howl
5320c62e17 Be more permissive in UserLookupGET (wildcard both at start and at end of username) 2016-05-17 17:40:30 +02:00
Howl
c86bc1e420 Use precise level in /api/v1/users/full 2016-05-17 17:06:15 +02:00
Howl
a16c196799 Add level in /api/get_user 2016-05-17 17:00:09 +02:00
Howl
32b9d1e2d5 Escape backslashes in UserLookupGET 2016-05-17 15:35:18 +02:00
Howl
f7559e8cc5 Implement /api/get_match (will return empty array, match data is currently not stored in ripple) 2016-05-15 14:04:59 +02:00
Howl
e043dd9cdf Remove useless println 2016-05-15 13:57:28 +02:00
Howl
d6f67915c5 Start implementing peppyapi; implement /api/get_user 2016-05-15 13:57:04 +02:00
Howl
a939d15779 Force private API keys to have Privileges write, read, read confidential 2016-05-15 07:20:11 +02:00
Howl
42437bde44 Add user lookup (search for user with only initial part of their username) 2016-05-14 22:43:47 +02:00
Howl
35fb27e3c1 Add PP in /users/full 2016-05-14 21:27:42 +02:00
Howl
3942f63446 use querystring in /friends methods. remove useless POST methods in /friends 2016-05-14 21:23:17 +02:00
Howl
9481de5e4e Merge /badges/:id into /badges 2016-05-14 21:02:05 +02:00
Howl
4448fcdfdb Update /users/userpage to use querystring parameters 2016-05-14 20:55:42 +02:00
Howl
5f97315d49 i memi 2016-05-14 20:31:28 +02:00
Howl
417409030a Fix 500 on tokens/new 2016-05-14 20:18:29 +02:00
Howl
09582361a3 /users/full now using querystring. /users requests from now on will have an uniform system for getting the user (?id=self | ?id=1337 | ?name=Howl) 2016-05-14 19:51:33 +02:00
Howl
8114329d38 /users/whatid using querystring param name 2016-05-14 18:52:55 +02:00
Howl
3a199b8c41 Merge /users/id/:id and /users/name/:name into /users (with querystring params id and name) 2016-05-14 18:32:43 +02:00
Howl
1b1f2503a2 fuck nyo 2016-04-27 21:03:16 +02:00
Howl
8dbacc5ed9 add privilege beatmap to privileges.go 2016-04-27 20:25:53 +02:00
Howl
6936d7932f OOOH RIGHT 2016-04-27 20:18:55 +02:00
Howl
b8c013c0ad go get -u -v -d -xd 2016-04-27 20:17:59 +02:00
Howl
3782ed3c7c beatmap ranking in API 2016-04-27 20:03:06 +02:00
Howl
32029d963e We git.zxq.co now 2016-04-19 16:07:27 +02:00
Howl
7387ed4295 Completely change response structure 2016-04-16 18:05:24 +02:00
Howl
14d926e31d Just testing ~ 2016-04-12 22:53:56 +02:00
Howl
4bf5673bd0 Allow PrivilegeViewUserAdvanced owners to see all users' user IDs. 2016-04-12 22:21:39 +02:00
Howl
c4e03dc189 Yay banning people! 2016-04-12 21:41:08 +02:00
Howl
c108da9bb3 implement unmarshaling straight into MethodData 2016-04-12 21:23:02 +02:00
Howl
b29c64023f Ooops, it was status 2016-04-10 23:18:56 +02:00
Howl
189a0cbb02 Add GET /api/status for Ripple's status page. 2016-04-10 23:14:44 +02:00
Howl
0418adc8c3 Add login rate limiting 2016-04-10 11:51:34 +02:00
Howl
c5863063f1 Everything is plural except for this, so yeah 2016-04-10 00:07:16 +02:00
Howl
0b7ca1a370 Well I guess I fucked up a bit o'er there 2016-04-10 00:03:05 +02:00
Howl
62969581bf Badges are useless on most requests. 2016-04-09 23:58:27 +02:00
Howl
98c8206946 Fix default message when there's no API key pointing to wrong method 2016-04-09 23:53:49 +02:00
Howl
98137678eb Remove useless stuff from privileges 2016-04-09 23:50:52 +02:00
Howl
f0e444cdea Auto-update. Or at least, so it should do. 2016-04-09 20:31:50 +02:00
Howl
92d308879b Add /meta/{up_since,kill} 2016-04-09 18:14:38 +02:00
Howl
c016796303 Friend deletion 2016-04-08 19:23:52 +02:00
Howl
44d12d2493 Ability to add friends. Also, made a few helper functions. 2016-04-08 19:05:54 +02:00
Howl
7b82c98352 Don't be a Nyo 2016-04-08 18:18:42 +02:00
Howl
0d1a298065 Implement JSONP, also save a few bytes by using tabs in indent 2016-04-08 18:06:26 +02:00
Howl
e3cb4aed09 perhaps a memory/performance improvement? by not recreating the same function over and over? maybe. 2016-04-08 17:27:55 +02:00
Howl
ed2778e2cc Graceful restart! 2016-04-07 19:32:48 +02:00
Howl
8d99ff1070 add a method for retrieving an user's userpage. 2016-04-07 14:42:17 +02:00
Howl
fb3d2e88dd Full user data retrieval! 2016-04-07 13:47:42 +02:00
Howl
ea2d418a53 more LIMIT 1s 2016-04-07 12:43:39 +02:00
Howl
aae4c5de50 Add GET /friends/with/:id 2016-04-07 12:21:54 +02:00
Howl
cf3b30d851 Add /users/whatid/:username 2016-04-07 11:59:38 +02:00
Howl
d84aafebb7 Top forgetting to add r.Code = and r.Message = 2016-04-07 11:44:46 +02:00
Howl
ae743cb395 Add error handler middleware 2016-04-07 11:38:57 +02:00
Howl
af71442e79 Add basic friend logic 2016-04-07 11:20:35 +02:00
Howl
b484fe2761
Add API handler for /users/self 2016-04-05 22:38:33 +02:00
Howl
d02f3f9951 Add token creation (login) 2016-04-05 22:22:13 +02:00
Howl
b3b4dde8f2 Use resp.Code as the HTTP response code, unless the client has specifield they want 200-codes only. 2016-04-04 16:47:15 +02:00
Howl
851c90764a Standardise function names (Ping -> PingGET, SurpriseMe -> SurpriseMeGET) 2016-04-04 14:36:37 +02:00
Howl
6bae1e2390 User retrieval by both ID and username 2016-04-03 23:09:28 +02:00
Howl
2932ba3dd7 add badge read API 2016-04-03 22:31:41 +02:00
Howl
6b70214810 Show country if we have confidential privileges and we're looking at our user 2016-04-03 21:49:51 +02:00
Howl
3ddab1de15 Initial commit 2016-04-03 19:59:27 +02:00