Commit Graph

761 Commits

Author SHA1 Message Date
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
Luna Mendes b0d5a97c36 blueprints.guilds: add GUILD_MEMBER_UPDATE dispatch 2018-06-23 15:19:04 -03:00
Luna Mendes de98d0f609 blueprints.guild: use EventDispatcher
- dispatcher: add sub_guild, unsub_guild, remove_guild, dispatch_guild
 - gateway.state_manager: fix fetch_states
 - gateway.websocket: add current_shard, shard_count to atributes
 - schema: add ON DELETE CASCADE to channel tables
2018-06-21 17:59:08 -03:00
Luna Mendes b085df207d blueprints.guilds: add implementations for some routes
- errors: add NotFound, GuildNotFound
 - storage: add get_member_data_one, get_member_multi
2018-06-21 16:54:23 -03:00
Luna Mendes 183013f8f9 blueprints: add guilds blueprint
- gateway.websocket: merge get_guild and get_guild_extra
 - gateway.websocket: only apply too many shards close when
     guilds > 2500
 - storage: detach state usage
 - storage: fix large calc on get_guild_extra
2018-06-21 03:16:13 -03:00
Luna Mendes f5ea44c8d7 blueprints: add users.py blueprint
- errors: change AuthError to Unauthorized and Forbidden
 - auth: fix bug on token_check
 - storage: add Storage.get_user_guilds
2018-06-20 23:29:30 -03:00
Luna Mendes cb8ab6d836 gateway.websocket: remove comment about bots 2018-06-20 17:40:35 -03:00
Luna Mendes c477b2ed50 storage: add channel fetching logic
- litecord: add enums
 - storage: add get_user
 - storage: use column::text instead of str() in some cases
2018-06-20 17:39:21 -03:00
Luna Mendes 3eb6d5e60f litecord: add Storage
Storage serves as a way to reduce code repeatbility. So that we
don't need to keep repeating the same SQL statements over and over,
and to detach some SQL calls into their own code (like guild fetching)

 - gateway.websocket: add WebsocketObjects to hold db, state_manager,
    storage and loop

 - gateway.websocket: add _make_guild_list
 - schema: add members.deafened, members.muted
2018-06-20 16:53:22 -03:00
slice f7d530c787
add a HTTP 500 handler 2018-06-19 18:17:00 -07:00
slice c88148271d
make make_app set app.debug as specified in config 2018-06-19 18:13:13 -07:00
slice efbcbafce4
remove jsonified exception handler 2018-06-19 18:13:03 -07:00
slice ab4857086a
migrate to logbook for logging 2018-06-19 18:04:17 -07:00
slice d1fad574c3
merge 2018-06-19 17:55:43 -07:00
slice ff05e278f6
rename state_man -> state_manager 2018-06-19 17:55:23 -07:00
slice 75c79a6503
add newline before constructor in classes
pep8
2018-06-19 17:55:12 -07:00
slice 0853a9fce6
export websocket_handler in module 2018-06-19 17:55:00 -07:00
slice e8b29ddd90
general code cleanup
* remove encoding from .encode()/.decode() calls as 'utf-8' is already
  the default
* code cleanup/compactify
2018-06-19 17:53:56 -07:00
slice d41641929c
add ws stuff to example config 2018-06-19 17:52:25 -07:00
Luna Mendes 4de78a4e16 gateway.websocket: remove despacito 2018-06-19 21:46:57 -03:00
slice 7d64716487
tweak some logging calls 2018-06-19 17:46:44 -07:00
slice a6a4845778
fix NameError 2018-06-19 17:42:21 -07:00
Luna Mendes 6f0528eaec gateway.websocket: detach app object from GatewayWebsocket
It doesn't work since quart's objects only work with stuff
that is already from quart, e.g the current_app stuff
requires you to be inside a special hidden context
that only quart functions get.

Gateway code is detached from quart since quart's websocket
stuff can't handle custom error codes.

 - auth: optional db detach
 - gateway.errors: add InvalidShard, ShardingRequired
 - gateway.gateway: pass asyncpg connection and StateManager
 - gateway.state: add repr, etc
 - gateway.state_man: add remove(), fetch_states()
2018-06-19 21:05:26 -03:00
Luna Mendes 77c5a101c6 gateway.websocket: add basics of identify
- auth: add raw_token_check
 - gateway.gateway: pass the app object to GatewayWebsocket
 - gateway.state: add gen_session_id()
 - gateway: add state_man
2018-06-19 19:09:12 -03:00