Commit Graph

73 Commits

Author SHA1 Message Date
Luna Mendes 3e28501bdb run: replace other/peer to user
- discord_endpoints: remove ambiguity on PUT/PATCH Modify Channel route
2018-11-20 14:52:35 -03:00
Luna Mendes 437f8de643 run: replace member/banned/target to user in api_index 2018-11-20 14:48:44 -03:00
Luna Mendes deddc82360 run: add api compliance score
Closes #21.
2018-11-20 14:32:32 -03:00
slice 2f377e1d69
return status code 500 when handling http 500s 2018-11-18 23:44:48 -08:00
Luna Mendes 6921f3b6b1 run: remove unused import
- static.invite_register: retab
2018-11-19 01:47:35 -03:00
Luna Mendes 2ff7f796fc run: add static blueprint to set_blueprints
- run: remove old handler for /register
2018-11-19 01:40:31 -03:00
Luna Mendes e949dbdc3f blueprints.auth: add *dummy* POST /api/v6/auth/register_inv
- litecord.schemas: add REGISTER, REGISTER_WITH_INVITE
 - run: add GET /register
 - add static/invite_register.html
2018-11-18 19:24:17 -03:00
Luna Mendes 339d1b0c8b blueprints: add nodeinfo blueprint 2018-11-18 17:04:31 -03:00
Luna Mendes 0aa679677f user_storage: add UserStorage.get_user_guilds
So that we're consistent.

 - gateway.websocket, presence: change to UserStorage for
    get_user_guilds
2018-11-17 18:41:54 -03:00
Luna Mendes 64af426035 guild: add emoji blueprint
- storage: add get_emoji, get_guild_emojis
2018-11-17 17:06:27 -03:00
Luna Mendes a7f8852324 test.test_websocket: add test_ready_fields
- RatelimitManager: add a test flag to overwrite _ws.connect ratelimit
2018-11-17 04:09:22 -03:00
Luna Mendes 00c976c552 gateway.gateway: add default args when connecting
- gateway.gateway: pass app instance instead of a 7-tuple
2018-11-17 02:20:48 -03:00
Luna Mendes 11d4b54f87 split Storage into UserStorage
this should help with the amount of methods being tossed in the Storage
class.
2018-11-17 02:14:10 -03:00
Luna Mendes 0ec615f3bd user.billing: add create_payment
- user: add billing_job for recurring payments (monthly or weekly)
 - user.billing: make main functions accept external db object
 - user.billing: fix get_payment's fields
 - litecord: add job module with JobManager
2018-11-14 19:49:36 -03:00
Luna Mendes b9ef4c6d8c litecord.blueprints: split users bp into user sub-bp
- blueprints.user: add biling bp
 - blueprints.user: add settings bp
 - schema.sql: add user_payment_sources, user_subscriptions,
    user_payments
2018-11-14 03:43:40 -03:00
Luna Mendes 5480a669a3 all: add guild icon support
- fix update_guild's methods
 - fix update_guild's sql statements
 - litecord: add images module
 - schemas: add splash to GUILD_UPDATE
 - schemas: add validate to INVITE
 - manage.cmd.migration: add script 2
2018-11-13 21:12:40 -03:00
Luna Mendes e54bcc312a blueprints: add icons blueprint
- Pipfile: add pillow
2018-11-13 17:33:28 -03:00
Luna Mendes 40f7efd1df tests: add test_ratelimits, test_gateway
- tests: use event_loop fixture instead of get_event_loop
 - tests: move custom fixtures to conftest
2018-11-13 01:10:43 -03:00
Luna Mendes 1711192ac9 tests.test_main: fix testing 2018-11-12 17:39:30 -03:00
Luna Mendes 62332e15c3 run: add set_blueprints 2018-11-12 04:26:16 -03:00
Luna Mendes 7b75202311 tests: add basic test 2018-11-12 04:10:31 -03:00
Luna Mendes a1a914dc87 add manage.py 2018-11-06 17:42:27 -03:00
Luna Mendes 22fe0f07c6 channel: create channel.pins blueprint
- schemas: add CHAN_UPDATE and CHAN_OVERWRITE
2018-11-05 00:15:59 -03:00
Luna Mendes da8b049174 channel.messages: add permission checks
this commit only adds permission checking to most parts of the
message endpoints.

 - channel.messages: fix extract_limit's default param
 - channel.messages: check send_messages, mention_everyone, send_tts_messages
 - channel.messages: check manage_messages
 - blueprints.checks: add guild_perm_check, channel_perm_check
 - errors: add error_code property, change some inheritance
 - permissions: fix base_permissions
 - storage: fix get_reactions
 - storage: remove print-debug
 - run: use error_code property when given
2018-11-04 19:55:21 -03:00
Luna Mendes a96b9c5e7f ratelimits.handler: five better retry_after and global flag
- run: add X-RateLimit-Global and Retry-After headers
2018-11-04 02:23:26 -03:00
Luna Mendes 33f893c0ff all: add ratelimit implementation
haven't tested yet, but it should work in theory.

 - gateway.websocket: add the 3 main ws ratelimits
 - litecord: add ratelimits package
 - ratelimits.main: add implementation
 - run: add app_set_ratelimit_headers
2018-11-04 02:06:40 -03:00
Luna Mendes b17cfd46eb run: add dummy ratelimiting handler 2018-11-03 22:48:36 -03:00
Luna Mendes 69fbd9c117 gateway.state_manager: send OP 7 Reconnect to clients
- gateway.websocket: check StateManager flags on new connections
 - gateway.websocket: cancel all tasks on GatewayWebsocket.wsp.tasks
 - run: call StateManager.gen_close_tasks() and StateManager.close() on
    app shutdown
2018-11-03 21:58:51 -03:00
Luna Mendes db7fbdb954 run: load channel_reactions bp 2018-11-02 20:11:23 -03:00
Luna Mendes f2d5913672 blueprints: split channels to channel.messages bp 2018-10-28 17:29:43 -03:00
Luna Mendes 9aa9b3839b guild.mod: add GET /guilds/:gid/prune
- users: fix get_me_guilds
 - run: fix importing mod blueprint
2018-10-27 23:32:50 -03:00
Luna Mendes 65b47e74bf guild: add mod blueprint
to keep moderation-related routes in a single blueprint
2018-10-27 22:27:05 -03:00
Luna Mendes 43b0482581 blueprints.guild: split blueprint into channels, members, roles 2018-10-27 02:04:47 -03:00
Luna Mendes ef5d4f30e1 blueprints: create dms blueprint
It should be safe for instances to run the `schema.sql` file and update.

 - blueprints.users: s/GUILD_SETTINGS_UPDATE/USER_GUILD_SETTINGS_UPDATE
 - storage: fix get_guild_settings returning a dict instead of a list
 - schema.sql: fix types and syntax
2018-10-19 16:21:33 -03:00
Luna Mendes b7f0bd1bb4 run: pass app instance to EventDispatcher
this should help with future DM channel pub/sub, as we'll
have to query the `dm_channel_state` table.
2018-10-11 16:52:15 -03:00
Luna Mendes c7923da124 relationship support!
friendships and blocks are possible, however presence code isn't ready
to handle presences of people who are friends.

SQL for instances, this is going to fix bad timestamps on the messages:

```sql
ALTER TABLE ONLY members ALTER COLUMN joined_at SET DEFAULT (now() at time zone 'utc');
 ALTER TABLE ONLY messages ALTER COLUMN created_at SET DEFAULT (now() at time zone 'utc');
ALTER TABLE ONLY invites ALTER COLUMN created_at SET DEFAULT (now() at time zone 'utc');
```

After that, rerun the schema.sql file to have the new relationships
table.

 - blueprints: add relationships blueprint
 - enums: add RelationshipType
 - storage: add get_relationships
 - storage: fix bug on lazy guild changes and messages
 - schemas: return validator.document instead of reqjson
 - gateway.websocket: use Storage.get_relationships
2018-10-02 03:43:57 -03:00
Luna Mendes bff5700d06 blueprints.users: add user setting patch impl
- schemas: add explicit type
 - schemas: add USER_SETTINGS
 - run: make Access-Control-Allow-Methods the same as Allow header when
    possible
2018-09-29 23:43:02 -03:00
Luna Mendes 624eb6eb0e blueprints.users: use Storage.get_user_settings
paving the way for user settings support.

 - storage: add Storage.get_user_settings
 - storage: add methods to fetch with json/jsonb codecs enabled
2018-09-29 23:10:42 -03:00
Luna Mendes e7d97ecdef run: have a fallback when Origin header is missing 2018-09-27 23:25:23 -03:00
Luna Mendes 92f6e3cf75 add invite usage
users can now join guilds!

invites:
 - add GET /api/v6/invites/<invite_code>
 - add DELETE /api/v6/invites/<invite_code>
 - add GET /api/v6/guilds/<guild_id>/invites
 - add GET /api/v6/channels/<channel_id>/invites
 - add POST /api/v6/invite/<invite_code>

storage:
 - add verification_level to invites
 - add empty invite.guild.features

gateway.state_manager:
 - add StateManager.user_states
 - give a dummy offline state on guild_states
    - this makes it possible for people to see offline members even when
       those members never logged in (since the would have no state being
       reffered to them)

 - gateway.websocket: use get_member_ids on lazy guild handler
 - auth: add GET /api/v6/auth/consent-required
 - dispatcher: add dispatch_user_guild and dispatch_user
 - run: use Origin header on Access-Control-Allow-Origin
2018-09-27 23:10:30 -03:00
Luna Mendes dc62de37b2 basic invites
- add invites blueprint
 - add POST /api/v6/channels/<channel_id>/invites
 - add GET /api/v6/invites/<invite_code>
 - schema: add INVITE
 - storage: add get_member_ids, get_invite, get_invite_extra,
 get_invite_metadata
2018-09-26 20:29:22 -03:00
Luna Mendes 14d3149f50 storage: add presence fetching on get_guild_extra 2018-09-22 22:00:25 -03:00
Luna Mendes cd5dbc4886 Rough presence management
Lots of changes to get it working.

One day changes will be able to be small enough to be split across
commits.

 - enums: use enum.Enum, make EasyEnum subclass
 - enums: add ActivityType, ActivityFlags, StatusType
 - gateway.state: use 128 random bits instead of 256
 - gateway.state: add MAX_STORE_SIZE in PayloadStore and check it when
    adding a new payload
 - gateway.websocket: add GatewayWebsocket.update_status
 - presence: add PresenceManager.dispatch_guild_pres and
    PresenceManager.dispatch_pres
 - schema: add snowflake, activity_type, status_external types
 - schema: add GW_ACTIVITY, GW_STATUS_UPDATE
 - storage: fix _channels_extra and fixes for ChannelType as enum instead of
    class
2018-09-10 01:09:09 -03:00
Luna Mendes d39783e666 Add barebones implementation for GUILD_SYNC
- state_manager: add StateManager.guild_states
 - add PresenceManager in the presence module
 - fix get_user_guilds not returning ints
 - gateway: add dummy handler for op 4
 - gateway: add hazmat implementation for op 14
 - run: keep websockets logger on INFO
 - run: add more headers on app_after_request
2018-09-01 23:53:36 -03:00
slice 13f6842232
remove unnecessary ** in dict 2018-09-01 19:02:42 -07:00
Luna Mendes 85d4f9e593 run: Add some headers for Access-Control-Allow-Headers 2018-08-21 05:13:38 -03:00
slice db7ea18f09
add voice and science bps 2018-07-21 11:52:21 -07:00
slice 77a260706d
remove quart-cors 2018-07-21 09:37:34 -07:00
Luna Mendes 93933fd8f5 add empty webhooks blueprint 2018-07-06 16:07:42 -03:00
Luna Mendes 6d8af8aef3 Add Quart-CORS 2018-07-06 03:17:38 -03:00