Commit Graph

1134 Commits

Author SHA1 Message Date
Luna Mendes f5db1038eb blueprints.invites: fix typo on get_channel_invites 2018-09-27 23:29:55 -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 f346a991c5 gateway.state_manager: handle member_states being empty 2018-09-26 20:32:43 -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 ea9bb52e4f Merge branch 'patch-1' into 'master'
fix script error that would happen randomly

See merge request luna/litecord!1
2018-09-26 21:49:49 +00:00
Bootsy 8a25c9767e fix script error that would happen randomly 2018-09-26 21:48:51 +00:00
Luna Mendes 34eda81e4f remove some print debug 2018-09-26 18:10:43 -03:00
Luna Mendes d242ef230a gateway.websocket: various fixes to presence
- handle BadRequest instead of passing raise_err=False
 - handle status.activities
 - ready: call update_status BEFORE subscribing and dispatching_ready

presence:
 - better presence object on guild_presences

schema:
 - handle activities, change required to false in game
2018-09-26 18:08:12 -03:00
Luna Mendes 14d3149f50 storage: add presence fetching on get_guild_extra 2018-09-22 22:00:25 -03:00
Luna Mendes 3858e20080 Add user notes
- blueprints.users: fix get_other
 - blueprints.users: add dummy get_user_settings,
     patch_current_settings, get_consent, get_harvest and get_library
 - enums: add ExplicitFilter
 - storage: add Storage.fetch_notes
 - schema.sql: add incomplete user_settings table
2018-09-22 20:18:48 -03:00
Luna Mendes 26931425c4 gateway.websocket: fix resuming woes 2018-09-22 19:01:42 -03:00
Luna Mendes bfa0e61a0c gateway.websocket: give random heartbeat_interval 2018-09-12 21:27:19 -03:00
Luna Mendes 25cd85d704 gateway.websocket: rudimentary resuming 2018-09-12 20:53:29 -03:00
Luna Mendes 213eb328b2 gateway.websocket: add implementation for _handle_3
- gateway.websocket: add dummy implementation for _handle_5
2018-09-12 20:35:50 -03:00
Luna Mendes dd4ae44080 gateway.websocket: rudimentary lazy guilds
implementation details are on the docstrings for _handle_14.

 - presence: merge member dict instead of copying some fields from it
2018-09-10 22:32:58 -03:00
Luna Mendes 952b66a28c blueprints.{channels, guilds}: use *Type as enums instead of classes 2018-09-10 20:29:04 -03:00
Luna Mendes ee8cfedf69 schema: change raise_err default to True 2018-09-10 20:25:03 -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 ee6ad56604
Revert "refactor out _dummy function"
This reverts commit 24a19c8736.
2018-09-01 19:23:13 -07:00
slice 24a19c8736
refactor out _dummy function 2018-09-01 19:06:49 -07:00
slice 13f6842232
remove unnecessary ** in dict 2018-09-01 19:02:42 -07:00
slice f463d6c934
rewrite readme 2018-09-01 18:54:28 -07:00
Luna Mendes 4a658aec95 README: change from pipenv shell to pipenv run
Do we really need the shell as an extra step?
2018-08-21 05:17:24 -03:00
Luna Mendes 85d4f9e593 run: Add some headers for Access-Control-Allow-Headers 2018-08-21 05:13:38 -03:00
Luna Mendes b323368ffc config: s/WEBSERVER_URL/WEBSOCKET_URL
Also add explanation on how to use WEBSOCKET_URL
2018-07-21 17:19:57 -03:00
Luna Mendes 5e4230bc31 Revert "use ws settings for gateway endpoint"
This reverts commit cb70842280.

WEBSERVER_URL was made for the case where litecord is behind
a reverse proxy (nginx / cloudflare, etc). If the instance
isn't behind a reverse proxy, you can set WEBSERVER_URL to your
own local address.
2018-07-21 17:08:41 -03:00
slice 753dc03fc7
remove required_action
this is needed as it breaks the client
2018-07-21 11:53:00 -07:00
slice 4ff0314ab6
disable game tab by default 2018-07-21 11:52:42 -07:00
slice fedfc97c96
make nonces strings 2018-07-21 11:52:37 -07: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
slice bc9d1e8908
fix state manager removal 2018-07-21 09:35:55 -07:00
slice 681e35db5a
fix incorrect converters 2018-07-21 09:35:50 -07:00
slice cb70842280
use ws settings for gateway endpoint 2018-07-21 09:35:43 -07:00
slice 491bdf31df
fix incorrect http status code for auth routes 2018-07-21 09:35:35 -07:00
slice 29342eb9db
update deps 2018-07-21 09:35:25 -07:00
Luna Mendes 7876c4153d blueprints.guilds: add kick/ban related routes
- schema: add voice_region type validator
2018-07-06 17:17:08 -03:00
Luna Mendes 93933fd8f5 add empty webhooks blueprint 2018-07-06 16:07:42 -03:00
Luna Mendes 1e8672656c add sample nginx.conf 2018-07-06 03:31:12 -03:00
Luna Mendes 6d8af8aef3 Add Quart-CORS 2018-07-06 03:17:38 -03:00
Luna Mendes 545d261bdd schema.sql: fix syntax 2018-07-06 02:29:17 -03:00
Luna Mendes 0ca45c781e blueprints.channels: add implementations for some routes
more specifically edit/delete message, and all 3 pin-related routes.

 - snowflake: add snowflake_datetime
2018-07-04 17:40:27 -03:00
Luna Mendes 59127ad197 blueprints.channels: add message sending
It is clunky when sending messages as Atomic, nor we have proper channel
management, but it works.

 - dispatcher: add sub_many
 - errors: add failsafe on LitecordError.message
 - errors: add ChannelNotFound
 - gateway.websocket: add dispatcher to WebsocketObjects
 - schemas: add regexes for mentions
 - storage: add get_channel, get_message
2018-07-03 01:02:26 -03:00
Luna Mendes 4ea3d353b3 litecord.blueprints: add channels blueprint 2018-07-02 05:06:57 -03:00
Luna Mendes d62db421b0 gateway.websocket: add basics of resuming
- gateway.state: add PayloadStore
 - state: add last_seq
 - gateway.websocket: send string on non zlib-stream
 - gateway.websocket: add cleanup of state on ws close
2018-06-24 18:28:28 -03:00
Luna Mendes 2276308c5d blueprints.guild: use guild_id = role_id on at-everyone's role
- gateway.websocket: add user_ready function
 - storage: add guild_id by default on member roles
 - storage: add get_role_data
 - schema.sql: change default color from 0 to 1
2018-06-23 21:18:19 -03:00
Luna Mendes 3258dc94d5 gateway.websocket: implement ZLIB streaming
With this comment we have a proper READY event that can be
successfully parsed by discord.py! hooray for progress!

 - gateway.websocket: add dummy handler for op 1
 - gateway.websocket: change op 0 to op 2
 - storage: fix 'None' strings on channel IDs
 - run: use logbook.compat.redirect_logging()
2018-06-23 20:16:10 -03:00
Luna Mendes 21da0e0d3a blueprints.guild: add implementations for more routes
- Pipfile: add Cerberus for data validation
 - blueprints.guilds: add guild_owner_check
 - blueprints.guilds: simplify GUILD_MEMBER_UPDATE dispatch
 - litecord: add schemas.py
 - run: get json of errors
2018-06-23 17:19:22 -03:00