Commit Graph

1152 Commits

Author SHA1 Message Date
Luna Mendes 55f8919689 pubsub.lazy_guilds: add support for 'everyone'-type GMLs
if the everyone role can read the channel, then the member list
will be equivalent to any other list where the everyone role
can read the channel. with this in mind we can generate a "global"
member list directed only for that usecase.

 - permissions: add role_permissions
2018-11-07 04:11:17 -03:00
Luna Mendes 86923cc6e3 README: add migrate instructions 2018-11-06 20:49:43 -03:00
Luna Mendes db9fd783f5 manage.cmd.migration: add rudimentary implementation
Also add table changes for future message embeds.
2018-11-06 20:46:17 -03:00
Luna Mendes c3210bf5b0 manage: add dummy migration command 2018-11-06 18:43:36 -03:00
Luna Mendes a1a914dc87 add manage.py 2018-11-06 17:42:27 -03:00
Luna Mendes 04d89a2214 pubsub.lazy_guilds: major refactor
This makes the whole process of generating a member list
easier to understand and modify (from my point of view).

The actual event dispatching functionality is not on this
commit.

 - permissions: add optional storage kwarg
2018-11-05 22:04:48 -03:00
Luna Mendes 7c274f0f70 channels: add PUT /api/v6/:chan_id/permissions/:overwrite_id
This finishes the basics on channel overwrites.

SQL for instances:
```sql
DROP TABLE channel_overwrites;
```
Then run `schema.sql`.

 - channels: finish implementations for update_{text,voice}_channel
 - storage: fix _overwrite_convert
 - schema.sql: use unique constraint instead of primary key in
    channel_overwrites
2018-11-05 04:12:16 -03:00
Luna Mendes 8ffa14d934 ratelimits.handler: add check for when rule is none (404s) 2018-11-05 03:15:46 -03:00
Luna Mendes c200ab8707 channels: add untested basic channel update
- channels: fix upserts
 - users: fix upserts
2018-11-05 03:12:09 -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 03e42d9a43 users: use UPSERT when setting chan overrides
- channels: fix UPSERT
2018-11-04 23:46:18 -03:00
Luna Mendes 7ce59398c4 channels: use UPSERT on channel_ack 2018-11-04 23:41:52 -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 87dd70b4d9 permissions: add basic permission api
- litecord.auth: insert request.user_id
 - storage: add get_member_role_ids
2018-11-04 17:54:48 -03:00
Luna Mendes 818571d336 gateway: add session_start_limit 2018-11-04 16:43:38 -03:00
Luna Mendes c710ad5aaf gateway.websocket: add _ws.session ratelimit 2018-11-04 16:36:11 -03:00
Luna Mendes 1f5f736a8e ratelimits.main: rollback global_bucket to 50/1 2018-11-04 02:24:13 -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 afb429ec77 gateway: change from 1200 guilds per shard to 1000
to more closely reproduce discord.
2018-11-03 20:58:01 -03:00
Luna Mendes 0f7ffaf717 storage: add Storage.get_reactions
This finishes basic reaction code (both inserting and putting a reaction).

SQL for instances:
```sql
DROP TABLE message_reactions;
```

Then rerun `schema.sql`

 - channel.reactions: fix partial_emoji
 - schema.sql: add message_reactions.react_ts and unique constraint
    instead of primary key
2018-11-02 22:07:32 -03:00
Luna Mendes db7fbdb954 run: load channel_reactions bp 2018-11-02 20:11:23 -03:00
Luna Mendes 1db27a811f litecord.storage: proper fix for missing guild everyone role 2018-11-02 19:20:39 -03:00
Luna Mendes 378809bdd6 all: misc fixes
- gateway.websocket: fix etf dict decode
 - auth: better token parsing
 - auth: fix new_discrim calc
 - channel.messages: call _dm_pre_dispatch on get_messages
 - channels: fix get_pins
 - guilds: make sure guild owner has guild everyone role
 - invites: replace sub_guild to sub
2018-11-02 19:14:41 -03:00
Luna Mendes 2b1f9489b7 channel: add reactions blueprint
SQL for instances:
```sql
DROP TABLE message_reactions;
```
Then rerun `schema.sql`.
2018-11-02 18:29:07 -03:00
Luna Mendes 2f822408b9 channel.messages: add implementation for before, after and around
for GET /api/v6/channels/:id/messages.
2018-11-02 15:26:31 -03:00
Luna Mendes f2d5913672 blueprints: split channels to channel.messages bp 2018-10-28 17:29:43 -03:00
Luna Mendes 8352a3cab4 guild.mod: add POST /guilds/:id/prune 2018-10-28 00:15:56 -03:00
Luna Mendes 5133aab849 guild.mod: fix get_prune 2018-10-28 00:01:59 -03:00
Luna Mendes 4d4b075de9 auth: move last_session update from gateway to auth
this should help in cases where the client has long-lived sessions (more
than a day)
2018-10-27 23:48:28 -03:00
Luna Mendes 80c29265f3 schema.sql: add users.last_session
- gateway.websocket: update users.last_session

SQL for instances:
```sql
ALTER TABLE users ADD COLUMN last_session timestamp without time zone default (now() at time zone 'utc');
```
2018-10-27 23:40:35 -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 bbc39a953a roles: add DELETE /guilds/:gid/roles/:rid 2018-10-27 22:20:36 -03:00
Luna Mendes 8678c84355 roles: add GET /api/v6/guilds/:id/roles
- guild: add DELETE /api/v6/guilds/:id/bans/:uid
2018-10-27 22:16:03 -03:00
Luna Mendes ce5b75921a members: add role change impl
- lazy_guild: add to online/offline groups when role isnt hoisted
 - schemas: fix MEMBER_UPDATE.nick
2018-10-27 21:50:15 -03:00
Luna Mendes 72465abdcb channels: make sure we release the connection 2018-10-27 20:44:59 -03:00
Luna Mendes ba794de47a channels: add implementation for change channel position 2018-10-27 20:36:04 -03:00
Luna Mendes 660c8d43d9 blueprints.guild.roles: move main pairs algorithm to gen_pairs 2018-10-27 19:36:00 -03:00
Luna Mendes 0e3db251b8 guild.channels: subscribe users to the newly created channel 2018-10-27 02:17:29 -03:00
Luna Mendes 43b0482581 blueprints.guild: split blueprint into channels, members, roles 2018-10-27 02:04:47 -03:00
Luna Mendes 86705b0645 blueprints.guilds: add 2 role endpoints
Add PATCH /api/v6/guilds/:id/roles for multiple position changes for
roles and PATCH /api/v6/guilds/:id/roles/:id for single guild
role changes

 - permissions: add int maigc method
 - schemas: add ROLE_UPDATE and ROLE_UPDATE_POSITION
2018-10-26 21:05:45 -03:00
Luna Mendes 956498ac65 blueprints.guilds: fix guild_owner_check
- blueprints.guilds: fix create_guild_role
 - blueprints.guilds: fix giving ints in the place of snowflakes in some
    events
2018-10-26 16:35:00 -03:00
Luna Mendes a08eb0d068 blueprints.guilds: calculate new role position
- blueprints.guilds: add basic POST /api/v6/guilds/:id/roles
 - schemas: add ROLE_CREATE
 - litecord: add types
2018-10-26 16:21:27 -03:00
Luna Mendes dca1adc6f8 blueprints.guilds: add create_role function 2018-10-26 15:57:24 -03:00
Luna Mendes f8e44d62bd gateway.websocket: handle missing 'channels' on op 14 2018-10-26 04:30:56 -03:00
Luna Mendes 8888534580 blueprints.guilds: misc fixes to channel creation
Instances should run this SQL to maintain consistency with `schema.sql`
```sql
ALTER TABLE guild_channels DROP CONSTRAINT guild_channels_guild_id_fkey;

ALTER TABLE guild_channels ADD CONSTRAINT guild_id_fkey
FOREIGN KEY (guild_id)
REFERENCES guilds (id)
ON DELETE CASCADE;
```
2018-10-26 04:27:48 -03:00
Luna Mendes d2562d3262 schemas: add role_name and verification_level types
- schemas: also fix GUILD_UPDATE.icon and GUILD_CREATE.icon
2018-10-26 04:15:51 -03:00