Commit Graph

983 Commits

Author SHA1 Message Date
Christian Bundy cbdf00e648 Replace initial ensureConnection() with open()
Problem: When we use `ensureConnection()`, it doesn't have any handling
for when the database is being closed, and therefore can keep the
database up and running forever (which fails the tests).

Solution: Use `cooler.open()`, which has some database close handling
built in, and doesn't keep the tests open forever (causing them to time
out and fail).
2020-04-13 08:52:12 -07:00
Nick Wynja fd1d63ffba Introduces sync endpoint
Starts, waits until connected to peers, waits for progress, disconnects
2020-04-13 11:28:36 -04:00
Christian Bundy 6fe0d1c39c Replace setImmediate() with .on('listening')
Problem: Unfortunately `setImmediate()` doesn't actually ensure that
`server !== null`, so we can get fun race condition errors that have
been reported on Windows.

Solution: Replace `setImmediate()` hack with event emitter that actually
ensures that the server is listening (and hopefully isn't `null)`.

Fixes: https://github.com/fraction/oasis/issues/401
2020-04-13 08:27:14 -07:00
Sean Billig e5703770ff
Merge pull request #398 from christianbundy/allow-host
Add --allow-host CLI flag for for proxy use-case
2020-04-12 09:50:31 -07:00
Christian Bundy f9674b9377
Merge pull request #397 from sbillig/fix-likehover
Fix 'liked by' hover in replies in Thread view
2020-04-11 10:01:38 -07:00
Christian Bundy ebf6e17389 Add --allow-host CLI flag for for proxy use-case
Problem: When proxying Oasis, the CSRF + DNS rebind security precautions
will respond with HTTP 400 if you use a hostname that Oasis doesn't
know about. For example, if Oasis is listening on `localhost` and you
use Caddy/Nginx/etc to proxy that to `oasis.example.com`, then Oasis
will see GET requests as DNS rebind attacks and POST requests as CSRF
attacks.

Solution: Add `--allow-host` command-line flag so that you can
`--allow-host oasis.example.com` and ensure that the host is allowed by
the security measures.
2020-04-11 08:36:29 -07:00
sean billig dcbd37d941 Remove postInAside() in favor of post(); fixes 'liked by' in replies 2020-04-10 20:59:28 -07:00
Christian Bundy f30fb20b5e Start SSB service immediately instead of waiting
Problem: During a refactor the SSB connection management was changed to
be more conservative, so it only ensures that we have a connection once
the server is started. This isn't good, because it means `oasis
--no-open` no longer starts an SSB service in the background.

Solution: Run `ensureConnection()` to ensure that we have a connection
to the SSB service regardless of regardless of whether we've received
any requests over HTTP.
2020-04-10 15:24:33 -07:00
Fred 84bb9051cc
Added french "fr" translation
1st "fr" translation
2020-04-11 00:11:35 +02:00
Christian Bundy 8e4a1c8e53 2.15.0 2020-04-10 12:51:36 -07:00
Christian Bundy a24b5a7acf Fix broken changelog moving logic
Problem: The `npm version` command is supposed to do some changelog
magic but the paths are broken.

Solution: Use the correct paths.
2020-04-10 12:50:45 -07:00
Christian Bundy ff77308033 Fix broken getMessages() logic
Problem: When replying to a private thread you only see the root post
because it's hiding all private comments. Instead, it should be hiding
all *encrypted* comments that we can't decrypt.

Solution: Use `isNotEncrypted()` instead of `isNotPrivate()`.
2020-04-10 12:46:44 -07:00
Christian Bundy 012db59be2
Merge pull request from GHSA-j438-45hc-vjhm
Fix CSRF and DNS rebind vulnerabilities
2020-04-10 12:40:20 -07:00
Christian Bundy 627e1b3c76 Add tests for CSRF and DNS rebind
Problem: We had these problems in the past and we can't have them again.
Solution: Tests make it really easy to double-check that we remain immune.
2020-04-10 12:33:22 -07:00
Christian Bundy 2968f7d80a Merge https://github.com/fraction/oasis into advisory-fix-1 2020-04-10 10:51:29 -07:00
Cinnamon 475949be1a
Merge pull request #393 from christianbundy/fix-public-threads
Fix private posts rendered alongside public posts
2020-04-09 20:09:36 -07:00
Christian Bundy 5cd0432f2e Fix private posts rendered alongside public posts
Problem: The Threads view advertises that it only shows public posts,
but is showing some private posts as well. This is not a security
concern, it's just a UI inconsistency.

Solution: Ensure that private posts are filtered from the view before
rendering. This also integrates a refactor that uses functions to check
for basic info like whether a message is a post, whether it's
encrypted/decrypted, whether it has a root, whether it has a fork, etc.
2020-04-09 08:16:43 -07:00
Sean Billig 33b83f1ae8
Merge pull request #387 from christianbundy/update-deps
Update npm dependencies
2020-04-08 18:28:43 -07:00
Christian Bundy ecdd78c42e Merge branch 'master' of github.com:fraction/oasis into update-deps 2020-04-08 14:52:06 -07:00
Cinnamon 84546cf6ee
Merge pull request #392 from christianbundy/fix-windows-test
Fix Windows test on Travis CI
2020-04-08 14:48:07 -07:00
Christian Bundy 7d168f8de3 Fix Windows test on Travis CI
Problem: There's an intermittent test failure on Travis CI that seems on
only happen when we have two test suites. Since the lifecycle suite only
tests a subset of the basic test, we can safely remove it without
compromising any test coverage.

Solution: Remove the redundant lifecycle test and try not to think about
the problem too much. Maybe in the future when we need a second test
suite we can resolve this problem, or maybe the underlying bug will be
resolved downstream (e.g. https://github.com/tapjs/node-tap/pull/662),
but right now I think the benefits of "no intermittent test failures"
outweights the costs of "all tests must go in one file".
2020-04-08 10:23:27 -07:00
Cinnamon 9a880fc6c6
Merge pull request #389 from christianbundy/add-tests
Add very basic test suite
2020-04-07 18:27:56 -07:00
Christian Bundy 8582dc40f8 Attempt fixing Windows test
Problem: For some reason the Windows test is timing out but I'm really
not sure why.

Solution: Try to make the lifecycle test copy the basic test.
2020-04-06 15:17:21 -07:00
Christian Bundy 3886b1fc53 Increase test timeout and remove log statements
Problem: The Windows tests seem to be failing, it looks like a timeout
problem? Also there are a handful of debug statements around the code
that can be safely removed.

Solution: Double the timeout length and remove debug statements.
2020-04-06 13:22:07 -07:00
Christian Bundy cb1be6bc8b Fix open sockets that weren't closing during tests
Problem: The test suite isn't closing the database because `app.close()`
only affects the HTTP server. This means that tests don't exit cleanly
and sockets remain open and all sorts of really fun stuff that we don't
want while writing tests.

Solution: Refactor `src/ssb.js` so that we can exit cleanly and have
less rope to hang ourselves with. Add a small lifecycle test that can
help us ensure that the bare minimum lifecycle events are working
correctly, plus now the previous tests are passing on my machine too.
2020-04-06 12:14:58 -07:00
Christian Bundy 12dfd04536 Merge branch 'master' of github.com:fraction/oasis into add-tests 2020-04-03 13:50:04 -07:00
Nick Wynja 6353286f05
Merge pull request #388 from christianbundy/fix-config
Fix config bug
2020-04-03 16:49:26 -04:00
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 cc36f03bb1 Fix config bug
Problem: I made a bad merge in 2836c80 which broke the server in some
environments. I had issues running the globablly installed binary,
whereas `npm start` seemed to work fine. Anyway, there's an error about
some missing config options because we weren't importing SSB-Config into
the server configuration. Instead, the full config was just:

```json
{ "conn": { "autostart": true } }
```

This lacks important properties like `shs`, which means that the server
can't start. Fun!

Solution: Pass SSB-Config first and then overlay our custom config on
top. I've also added comments and changed the variable names so that
this is harder to miss in the future.
2020-04-03 07:20:37 -07:00
Christian Bundy 182d6d68bc Update npm dependencies
Problem: Our dependencies are getting ahead of us!

Solution: Catch up with `npm update`. I think Markdown-It was the only
breaking change, and it didn't affect us.
2020-04-03 07:11:11 -07:00
Sean Billig a2d6b59703
Merge pull request #352 from christianbundy/tcp-connect
Fall back to TCP socket if Unix connection fails
2020-04-02 10:50:51 -07:00
Sean Billig 4318b9a22a
Merge pull request #384 from christianbundy/clean-up-root
Clean up root of project directory
2020-04-02 07:39:47 -07:00
Sean Billig b97e27b24b
Merge pull request #350 from christianbundy/add-mailmap
Add .mailmap for canonical identities
2020-04-02 07:38:06 -07:00
Sean Billig b9aaa698fa
Merge pull request #383 from christianbundy/fix-button-hover
Fix footer button hover background
2020-04-02 07:36:06 -07:00
Christian Bundy 7f95a6f7ac Re-add stylelint config
Problem: Apparently we were still using that.

Solution: Re-add the file.
2020-04-01 18:28:59 -07:00
Christian Bundy b01ff74dbc Clean up root of project directory
Problem: Project root has a handful of files that aren't used at all or
could be placed elsewhere.

Solution: Delete unused files and move the changelog to the
documentation directory with the other Markdown files (other than the
readme, of course).
2020-04-01 15:04:57 -07:00
Christian Bundy 2836c80941 Merge branch 'master' of github.com:fraction/oasis into tcp-connect 2020-04-01 08:08:41 -07:00
Christian Bundy 72ee2e90fb Fix footer button hover background
Problem: Footer buttons have the normal button background hover state
that makes them difficult to read. This was meant to be fixed in another
PR but I think I got the CSS order wrong.

Solution: Reorder the CSS hierarchy to fix the bug. For real this time.
2020-04-01 07:45:15 -07:00
Sean Billig 8fc5437b6b
Merge pull request #381 from christianbundy/fix-italian
Fix linter problems with Italian translation
2020-03-31 15:14:08 -07:00
Christian Bundy 361fe9783e
Merge pull request #382 from timjrobinson/improve-liked-by
Show liked-by in title attr, handle many likes
2020-03-31 11:38:57 -07:00
Tim Robinson 48fc0e0086 Don't show likedby with zero likes. Improve style.
- Don't add "Liked by..." title when there are zero likes.
- Refactor code to use const's and have a single defined message.
2020-03-31 11:05:12 -07:00
Tim Robinson 206044e21f Show liked-by in title attr, handle many likes
- Instead of having a custom on hover effect, just add the Liked by
message to the title of the heart.
- When there are > 16 likes on a post, show +X more to convey this to
users.
2020-03-31 10:56:49 -07:00
Christian Bundy 302bd3fa8c Merge commit 'refs/pull/367/head' of github.com:fraction/oasis into fix-italian 2020-03-31 10:27:02 -07:00
Christian Bundy ac6441d3e0
Merge pull request #377 from timjrobinson/add-liked-names
Show who liked content on hover
2020-03-31 10:13:55 -07:00
Christian Bundy 81b6c907bb
Merge pull request #378 from nickwynja/thread-query
Updates query for threads
2020-03-31 10:11:30 -07:00
Jonathan Dahan 044ab08565
Merge pull request #379 from nickwynja/header-index
Fix z-index on sticky header
2020-03-31 12:13:11 -04:00
Nick Wynja 922086199d Fix z-index on sticky header 2020-03-31 11:05:38 -04:00
Nick Wynja 0e698df8f3 Updates query for threads
Previous query incorrectly pulled and sorted posts, often showing years
old posts from newly followed people. This now behaves more consistently
as "recent threads from people in your extended network".
2020-03-31 10:34:47 -04:00
Tim Robinson 4884a49dfb Pretty-ify code. Remove unnecessary comment 2020-03-31 00:19:58 -07:00
Tim Robinson 8cce580008 Show who liked content on hover
- Adds a hover popup that shows the names of everyone who liked a post
when hovering of the heart.
- Add new call to post.get that retrieves the names of all voters and
returns them instead of their ID's.
2020-03-30 23:53:27 -07:00