Commit Graph

13 Commits

Author SHA1 Message Date
Christian Bundy 3c9ec37d2f Add very basic test suite
Problem: ESLint and TypeScript help catch some types of regressions, but
they don't protect us against obvious stuff like "the server won't
start". This means that humans need to test a bunch of stuff manually,
and that can be really tedious and exhausting.

Solution: Yesterday someone invented this cool concept called "testing"
where you write automated tests for your software to ensure it actually
works the way you expect. It might have beeen invented before yesterday,
I don't know. Anyway, this solution adds a bunch of tests that send HTTP
GET requests to a bunch of endpoints to make sure the server is at least
returning HTTP 200 responses. It also fixes a race condition where HTTP
server was available before the readme / version strings were loaded.
2020-04-03 09:17:13 -07:00
Christian Bundy defb57321e Merge branch 'master' of github.com:fraction/oasis into type-defs 2020-03-27 08:02:44 -07:00
Christian Bundy 9ddb23b501 Fix UI inconsistencies
Problem: After some fantastic new pull requests, there are some
inconsistencies between how each author implemented different features.

Solution: Fix regressions and iron out inconsistencies. This fixes the
heart highlight bug, uses the same indentation for Summaries + Threads +
the thread view, tightens up the CSP now that we don't need
unsafe-inline styles, and uses a neutral tone for indents with the same
width as the blockquote border (so far violet has been reserved for
private messages).
2020-03-25 16:03:51 -07:00
Christian Bundy c9fffe2b9c Add TypeScript definitions for better guardrails
Problem: We have TypeScript enabled on the project but have been missing
lots of definition files, so there are like 500 errors when you enable
`--noImplicitAny`.

Solution: Add definitions and fix the bugs that they point out. This
reduces the number of errors with `--noImplicitAny` to 285.
2020-03-24 09:23:52 -07:00
Christian Bundy 32465e5983 Update npm dependencies
Problem: Our dependencies are falling behind and it'd be nice to have
them up-to-date. The only big update it that Common-Good upgraded to the
latest version of Prettier.

Solution: Update them!
2020-03-23 18:59:53 -07:00
Christian Bundy f2cf067b67 Present error message while waiting for indexing
Problem: When our views are still indexing the database they apparently
don't respond over MuxRPC, which means that we're just waiting forever
until they finish. This means that people who are indexing the database
get an HTTP response that might take an hour to finish.

Solution: If we have more than 1 mebibyte of backlog, present an error
message explaining the situation and asking for a bit of patience.
2020-03-09 15:14:28 -07:00
Christian Bundy 0240401413 Remove nosniff from blob URLs
Problem: We use nosniff to keep the web browser from getting confused
about what kinds of content we're serving in Oasis, but this causes
problems for blob URLs that have arbitrary data.

Solution: Remove nosniff on blob URLs to let the browser figure out what
kind of content we're serving.

Resolves https://github.com/fraction/oasis/issues/138
2020-02-05 17:03:04 -08:00
Christian Bundy 1099395dfa Merge branch 'master' of github.com:fraction/oasis into add-i18n 2020-02-03 21:51:59 -08:00
Christian Bundy d0e98b9663 Fix /image/ URL returning a broken image
Problem: I think during a refactor this code was changed and ended up
breaking the "fake image" that we return when the user doesn't have an
image. We also don't see image errors because they aren't in the browser
viewport if they return text and we don't `console.error()` our errors.

Solution: Fix the image code to return a PNG as a buffer and duplicate
errors to stderr.
2020-02-02 14:42:40 -08:00
Christian Bundy edf87a70df Persist language in cookies and fix fork drop-down
Problem: The previous commits didn't persist language choices and the
drop-down's initial value wasn't respecting the language you selected.

Solution: Persist the language choice in a cookie, defaulting to
English, and build the drop-down with the selected language. This also
changes the word "Spanish" to "Español", and slightly refactors
`http.js` to accept *middleware* rather than just routes. This lets us
add other middleware, such as the language selection middleware added in
this commit.
2020-02-02 09:31:43 -08:00
Christian Bundy b6314309f6 Add some basic type info with JSDoc
Problem: When we don't have any documentation for variable types it's
difficult for both humans and machines to parse our code.

Solution: As discussed in https://github.com/fraction/oasis/issues/78,
adding some JSDoc information on function signatures would be a nice
step in the right direction and could make debugging easier.
2020-01-26 12:42:28 -08:00
Christian Bundy b34b04c2c2 Experiment with common-good module 2020-01-21 16:22:19 -08:00
Christian Bundy 5f528588b1 Change src directory to use mediator pattern 2020-01-08 08:37:52 -08:00