Commit Graph

599 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
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
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
2968f7d80a Merge https://github.com/fraction/oasis into advisory-fix-1 2020-04-10 10:51:29 -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
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
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
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
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
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
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
Christian Bundy
7e22829578 Fix own profile error
Problem: A `null` relationship represents when it's your profile, which
isn't very intuitive. It causes an error when we try to check for the
`blocking` and `following` properties, which don't exist on `null`.

Solution: Instead of `null`, set a `me` property to tell whether this
relationship is our own profile.
2020-03-28 13:32:02 -07:00
Christian Bundy
e7bd3ed305 Add block and unblock to author profile
Problem: We have a way to follow and unfollow, but there's no way to
block or unblock. Also if you go to the profile of a blocked peer, their
posts still show up.

Solution: Add block and unblock and hide messages from blocked peers on
their profile page.

Fixes: https://github.com/fraction/oasis/issues/370
2020-03-28 10:03:31 -07:00
Sean Billig
0c5116ad0c
Merge branch 'master' into type-defs 2020-03-27 19:10:35 -07:00
Sean Billig
4aa2841247
Merge pull request #339 from christianbundy/add-auto-hops
Automatically connect to replicated peers
2020-03-27 17:20:18 -07:00
wuhei
6d396c16cc typos 2020-03-28 00:04:10 +01:00
Sean Billig
e96486b1d0
Merge pull request #366 from christianbundy/fix-double-channel
Avoid processing popular posts twice
2020-03-27 14:51:02 -07:00
Christian Bundy
4091fce767 Fix linter problems
Problem: This doesn't pass the linter.

Solution: Run `npm run fix` and disable the spell-checker when we
define language names.
2020-03-27 14:14:39 -07:00
wuhei
b27b6241f2 Italian translation, changed a string in the Spanish translation 2020-03-27 19:12:49 +01:00
Sean Billig
288d5f10fa
Merge pull request #341 from christianbundy/root-channel
Don't append channel to non-root posts
2020-03-27 10:46:07 -07:00
Christian Bundy
5b2ae2a219 Avoid processing popular posts twice
Problem: Messages are being fetched with `post.get()`, which runs the
`transform()` function to decorate them with Markdown/etc, but then
they're being passed through `transform()` a second time at the end of
the function. This is inefficient and applies side-effects (like adding
channels to the post) twice.

Solution: Remove the final `transform()` so that these posts are only
decorated once.

Fixes: https://github.com/fraction/oasis/issues/358
2020-03-27 09:43:57 -07:00
Christian Bundy
555249277f Remove @ts-ignore workaround
Problem: The workaround is no longer necessary now that the new version
of @types/koa has been published. Thanks to @peterblazejewicz,
@harryparkdotio, and @orta for the quick upstream fix.

Solution: Run `npm update` and remove the `@ts-ignore` comment.
2020-03-27 09:13:31 -07:00
Christian Bundy
fb23d25217 Add more type definitions to reduce implicit any
Problem: We still have heaps of implicit 'any' types that our linters
can't make sense of.

Solution: Keep on adding type documentation! Slowly but surely I'm
hoping we can reduce the amount of untyped JavaScript in the repo.
2020-03-27 08:21:40 -07:00
Christian Bundy
defb57321e Merge branch 'master' of github.com:fraction/oasis into type-defs 2020-03-27 08:02:44 -07:00
Nick Wynja
bae675f039 Revert selector to span to fix lock alignment 2020-03-27 10:11:11 -04:00
Nick Wynja
8efe326cdf
Merge pull request #357 from christianbundy/consistent-ui
Fix UI inconsistencies
2020-03-27 09:44:47 -04:00
mario siqueira
acba28af67 Prettiered 2020-03-26 18:13:38 -03:00
Mario Siqueira
2c86eb5cf1
fixed the fix
Previous fix did not take into account "unfollow". Now it does
2020-03-26 17:56:10 -03:00
Mario Siqueira
a5ae700b92
fix follow button link for non-english languages
currently if non-english language is set in configuration, the FOLLOW button doesn't work (it takes the i18n translation as part of the URL).
2020-03-26 16:48:16 -03:00
Christian Bundy
43c8310abf Reduce indent border size
Problem: The indent borders take up lots of space and visual attention
when you're in highly-nested threads.

Solution: Reduce their size by half.
2020-03-26 11:22:24 -07:00
Christian Bundy
3e6489db67 Fix CSRF and DNS rebind vulnerabilities
Problem: Since we don't validate the referer hostname or the HTTP host
header, an attacker who can trick an Oasis user into clicking a
malicious link can submit HTTP requests to localhost, potentially
publishing messages or extracting information.

Solution: Ensure that all requests have valid hostnames in the referer
to protect against CSRF attacks, ensure that all requests have valid
hostnames in the HTTP header to protect against DNS rebind attacks, and
ensure that errors are only output in the HTTP response when we're sure
that the request is valid.
2020-03-26 10:13:03 -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
Jacob Karlsson
7e1b38394b Fix style 2020-03-25 21:31:23 +01:00
Jacob Karlsson
e8b2a2d163 Merge branch 'master' of github.com:fraction/oasis into hide-forks 2020-03-25 21:24:09 +01:00
Jacob Karlsson
86450d49ce Auto-expand ancestors of the linked post 2020-03-25 21:09:04 +01:00
Jonathan Dahan
9bbf082304
Merge pull request #342 from christianbundy/connected-only
Only show connected peers in settings
2020-03-25 10:01:18 -04:00
Christian Bundy
3f335eedbf
Merge pull request #353 from nickwynja/threads
Introduces Threads
2020-03-25 06:36:54 -07:00
Nick Wynja
95e7a31dcd lint fix 2020-03-25 09:05:53 -04:00
Sean Billig
03a6a143cd
Merge pull request #349 from christianbundy/fix-theme
Fix theme using capitalization
2020-03-24 19:22:47 -07:00
Christian Bundy
4653bdb01f Fall back to TCP socket if Unix connection fails
Problem: We're only attempting connection via Unix sockets, but some SSB
services may choose to only listen on TCP sockets.

Solution: Start by attempting connection to Unix socket and fallback to
the TCP socket remote if that doesn't work, before just trying to start
our own SSB service.
2020-03-24 19:06:23 -07:00
Nick Wynja
48f8108340 Merge master 2020-03-24 21:00:38 -04:00
Nick Wynja
a96aaa5012 Merge conflict 2020-03-24 19:57:22 -04:00
Nick Wynja
3280956d3b Adds sticky section headers
While reading long conversations, it's easy to get a bit lost as to whom
 is saying what. With some basic CSS, we can keep the header of the post
 sticky so you can see more context above the message.
2020-03-24 19:40:12 -04:00
Nick Wynja
fa874e8f4f Fixes spacing issues in text-based browsers
Closes #329; Addresses spacing issues in text-based browsers by introducting block
elements and non-breaking spaces.
2020-03-24 19:40:12 -04:00
Christian Bundy
a4ccae8833 Fix theme using capitalization
Problem: Capitalization in "sulphurPool" was causing a file not found.

Solution: Replace "sulphurPool" with "sulphurpool".
2020-03-24 14:55:50 -07:00
Christian Bundy
11c413d447 Merge branch 'master' of github.com:fraction/oasis into npm-update-march-23 2020-03-24 12:09:39 -07:00
Nick Wynja
a4b00696ab Load theme using existing config mechanisms
This allow someone to pass in the theme as a command line arg or set the
theme in defaults.json, while still allowing someone to set the theme on
a per-browser basis as a cookie.
2020-03-24 14:11:27 -04:00
Christian Bundy
64ab443e27 Only show connected peers in settings
Problem: The peer list shows peers that are connected and in the process
of establishing a new connection, which has lots of turbulence. It's
confusing to see dozens of "connections" that only exist for a few
milliseconds when they're actually just connection attempts.

Solution: Only show peers with the state "connected".
2020-03-24 09:47:45 -07:00
Christian Bundy
f64a512e52
Merge pull request #335 from christianbundy/fix-private-message
Fix crash when linking directly to private message
2020-03-24 09:35:01 -07:00
Christian Bundy
aeebd2d4eb Don't append channel to non-root posts
Problem: When publishing a root post, other clients give you the option
of adding a `channel` property, which is basically just a hashtag. We
show this at the end of the message, but since replies often copy the
`channel` property then it gets appended to every reply.

Solution: Only append the channel as a hashtag for root posts.
2020-03-24 09:26:54 -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
1adbd15afd Don't append channel to non-root posts
Problem: When publishing a root post, other clients give you the option
of adding a `channel` property, which is basically just a hashtag. We
show this at the end of the message, but since replies often copy the
`channel` property then it gets appended to every reply.

Solution: Only append the channel as a hashtag for root posts.
2020-03-24 08:11:13 -07:00
Christian Bundy
42e051fc6a Merge branch 'add-auto-hop' 2020-03-23 19:55:46 -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
01a9ae6347 Automatically connect to replicated peers
Problem: By default we only connect to people that we're directly
following, which often don't have public IP addresses.

Solution: Automatically connect to all available peers within our
replication hops (default 2) to make peering more reliable.
2020-03-23 14:21:38 -07:00
Jacob Karlsson
cbb8ff381c Add previews of forks 2020-03-22 23:43:25 +01:00
Jacob Karlsson
3ed1e3e12f Rename variables with old names 2020-03-22 22:22:35 +01:00
Jacob Karlsson
3439433630 Don't make deep indented messages shrink 2020-03-22 22:14:39 +01:00
Jacob Karlsson
a84d469c7d Remove old way of indenting forks 2020-03-22 22:06:07 +01:00
Jacob Karlsson
66627be257 Simplify repeated logic 2020-03-22 21:48:59 +01:00
Jacob Karlsson
aae34fbfad Remove inner functions by combining them 2020-03-22 21:36:26 +01:00
Jacob Karlsson
3b1bdc9218 Fix off-by-1 error WAOW 2020-03-22 21:20:30 +01:00
Jacob Karlsson
7171732bc0 Remove old commented code 2020-03-22 20:58:27 +01:00
Jacob Karlsson
dba4ec2955 Add basic fork styling 2020-03-22 20:54:48 +01:00
Justin Abrahms
b5d37c7c8d Actually shift cards over, rather than just a minor indent. 2020-03-21 20:09:28 -07:00
Jacob Karlsson
7b05b78e52 Merge remote-tracking branch 'origin/master' into hide-forks 2020-03-21 14:43:37 +01:00
Christian Bundy
bdcc127674 Fix crash when linking directly to private message
Problem: Trying to view a private message crashes the server and leaks a
bunch of memory. That's bad. This problem is caused by faulty handling
in the function that finds thread ancestors. There's some code that says
"if the next ancestor is a private message, just return the ancestors
that we know about", which returns nothing when we're looking up a
private post (because we can't identify *any* ancestors).

Solution: Ensure that we're only resolving the promise once in the
function by chaining `else if`s and ensure that we only return the
ancestor list if there are actually ancestor in it. If the ancestor list
is empty, we can just return the single message that we know about and
pass it off.
2020-03-20 11:33:18 -07:00
Cinnamon
6f3a13d144
Merge pull request #325 from christianbundy/indexing-error-message
Indexing error message
2020-03-17 18:59:08 -07:00
Christian Bundy
122ed68a82 Merge commit 'refs/pull/316/head' of github.com:fraction/oasis 2020-03-17 10:22:22 -07:00
Christian Bundy
e5df3a1497 Rename errorView() to indexingView()
Problem: Since the `errorView()` has a refresh we can probably just call
it `indexingView()` and add the indexing-specific code.

Solution:  Rename `errorView()` to `indexingView()` and add a progress
bar for it.
2020-03-17 07:41:57 -07:00
Christian Bundy
1f050b18a4 Add auto-refreshing error page on indexing error
Problem: The indexing message is being thrown as an error, which is
pasted as plaintext, so we can't do a page refresh. This is frustrating
when you're waiting for the indexes to finish because you have to
manually refresh a bunch while you wait.

Solution: Use the prototype from @justinabrahms to add an HTML message
for the indexing error and automatically refresh the page every ten
seconds.
2020-03-17 07:24:46 -07:00
Justin Abrahms
5c2d536d92 An html error message. 2020-03-16 20:25:43 -07:00
f032cbcc7f
Added reference to "plain text" instead of just text 2020-03-12 19:44:28 +00:00
Nick Wynja
c3a4474256 Merge branch 'master' of https://github.com/fraction/oasis into threads 2020-03-11 23:22:11 -04:00
Cinnamon
dba544c9b5
Merge branch 'master' into add-profile-image-upload 2020-03-11 17:20:47 -07:00
Cinnamon
d2cdef8244
Merge pull request #299 from christianbundy/indexing-error
Present error message while waiting for indexing
2020-03-11 16:03:56 -07:00
4e27dd4b59
Added references to posts from yourself in Topics and Summaries 2020-03-11 21:54:22 +00:00
836c5a06ed
Changed desription to mention that latest also includes posts from yourself 2020-03-11 21:47:40 +00:00
Christian Bundy
2c806af919
Merge pull request #311 from georgeowell/rearrange-settings
Rearrange settings
2020-03-11 07:10:34 -07:00
Christian Bundy
861dc76524
Merge pull request #309 from hng/feature/fix-popular-link
Fix link to popular view in navigation
2020-03-11 07:09:26 -07:00
Christian Bundy
228cab563d
Merge pull request #310 from georgeowell/view-thread-label
View thread label
2020-03-11 07:08:42 -07:00
Henning Schumann
076f5f21c1 Fixed link to popular view in navigation 2020-03-11 11:30:49 +01:00
4232d0f05b
Moved peer connections to the top of settings 2020-03-11 09:26:02 +00:00
850d1d2373
Rearranged settings in order of most likely use 2020-03-11 09:14:14 +00:00
daf82588ab
Tweaked edit your profile description to make it clearer 2020-03-11 08:55:29 +00:00
dc723595b4
Removed reference to "basic post" 2020-03-11 08:52:27 +00:00
e4dd883e2a
Changed reference to message to comment for consistency 2020-03-11 08:51:03 +00:00
Christian Bundy
f3f8e3dda3
Merge pull request #307 from christianbundy/cherry-pick-2
finished spanish i18n
2020-03-10 20:16:50 -07:00
mario
8c3fc3f393 finished spanish i18n 2020-03-10 20:05:56 -07:00
mario
cc4f6caef2 lands on /mentions instead of /public/popular/day 2020-03-10 20:02:00 -07:00
seekr
fc2137381a
fix duplicate search for es 2020-03-10 14:49:47 -03:00
seekr
2117b9f76b
more updates to spanish 2020-03-10 11:31:27 -03:00
seekr
8fbbdaaaf4
started adding spanish translations 2020-03-10 10:01:06 -03:00
Nick Wynja
7e601ae35a Adds Threads view for seeing wider conversation 2020-03-10 08:42:56 -04: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
Henning Schumann
15417422a4 Made "private/public" comment translatable 2020-03-09 12:19:01 +01:00
Henning Schumann
314033cdd0 Made content warning text field placeholder translatable 2020-03-09 11:57:21 +01:00
Christian Bundy
a2e7f4ad6d
Merge pull request #293 from hng/feature/translations-de
Add German translations
2020-03-08 17:57:46 -07:00
Henning Schumann
b86eeeb3e5 Finished up German translations :) 2020-03-08 19:26:36 +01:00
Cinnamon
e7c38e3ec5
Merge pull request #285 from christianbundy/vanilla-markdown
Vanilla markdown
2020-03-06 11:57:08 -08:00
Henning Schumann
d035b165fd Even more German translations 2020-03-06 17:17:00 +01:00
Jacob Karlsson
5c1cd759bc Fix bug with missing flatness 2020-03-06 17:00:06 +01:00
Jacob Karlsson
e4a9548cda Add basic hiding of forks 2020-03-06 16:33:31 +01:00
Henning Schumann
d628486ae1 More German translations 2020-03-05 21:22:20 +01:00
Henning Schumann
6aca504921 Merge remote-tracking branch 'upstream/master' into feature/translations-de 2020-03-05 19:53:53 +01:00
3ed7a52d37
Specified "this post" rather than "the post" in /publish 2020-03-04 00:17:06 +00:00
Christian Bundy
cb1cf5e87e Render vanilla Markdown with basic renderer
Problem: The SSB-Markdown library has some SSB-flavored quirks, like
messing with newline behavior, and is inappropriate for rendering plain
Markdown like the readme.

Solution: Since SSB-Markdown uses Markdown-It under the hood, we can use
the same library and just render our Markdown *without* the SSB-flavored
quirks. This gives us the ability to wrap text and avoid SSB-Markdown
problems without having to rewrite all of our Markdown.
2020-03-03 16:13:56 -08:00
d4cb2cf9e9
Changed "warning to "content warning" 2020-03-04 00:11:45 +00:00
47aa7d3efb
Changed references to "messages" in /publish to "posts" 2020-03-04 00:04:20 +00:00
107bee5e52
Added word public for emphasis on /publish 2020-03-04 00:00:00 +00:00
Christian Bundy
2e7cb4ad66 Remove readme and startup focus on configuration
Problem: A big chunk of both the readme and the startup output is
dedicated to configuration, which feels to me to be focused on
developers and advanced users rather than beginners who just want to try
using Oasis.

Solution: Move readme configuration info to its own file and hide all
config output (except one line) behind `--debug`. While doing this I
noticed that we're `require()`ing a few modules that we don't need
before setting `process.env.DEBUG`, which I've reorganized so that we
don't accidentally disable debug mode for those modules.
2020-03-01 11:39:01 -08:00
Christian Bundy
1f6f635935 Remove debugging cruft
Problem: I have debug mode manually enabled and have `console.log()`
calls sprinkled through the code and I'm doing `require("crypto")` too
many times.

Solution: Remove debugging cruft so that we don't have a perma-debug
mode.
2020-03-01 11:19:23 -08:00
Christian Bundy
02d6d5adac Add profile image upload
Problem: We can set our name and profile description but profile images
are expected by most people and supported by most clients and we don't
have them. A profile without an image can sometimes lack the intimacy
you'd get if you let people upload profile images that they can use as a
visual avatar.

Solution: Add profile image upload to the Edit Profile page and add a
bunch of plumbing for `ssb.blobs.add()` to add the blob and publish a
message setting it as a profile image.
2020-03-01 11:11:09 -08:00
Cinnamon
3c1453db33
Merge pull request #270 from christianbundy/fix-extended
Fix Extended page sorting posts incorrectly
2020-02-28 14:53:28 -08:00
Christian Bundy
9d3553352f Show channel as text appended to posts
Problem: Other clients render a `channel` property, which is basically a
way to add a single hashtag to your post, but Oasis doesn't support
that. This means that someone might post "this is fun!" under the
channel #running and people using Oasis would just see "this is fun!"
without any context.

Solution: Add the hashtag to the bottom of the post, which visually
looks the same as someone adding two newlines and a hashtag to the end
of the text in their post.
2020-02-27 17:21:23 -08:00
Christian Bundy
dcd995140b Fix Extended page sorting posts incorrectly
Problem: The Extended page is sorting by received timestamp, not
asserted timestamp.

Solution: Find the `Date.now` and replace it with `Date.now()`, which
refers to the current date instead of `undefined`, which is what you get
if you try to `JSON.stringify(Date.now)`.
2020-02-27 16:53:41 -08:00
Cinnamon
e9fc29c592
Merge branch 'master' into edit-profile 2020-02-27 14:05:37 -08:00
Cinnamon
f9a787bef0
Merge pull request #260 from christianbundy/fix-dta-queries
Fix queries with an unused `{index: "DTA"}` option
2020-02-27 14:02:43 -08:00
Cinnamon
763c9f7672
Merge pull request #262 from christianbundy/existing-oasis
Detect existing Oasis server running on interface
2020-02-27 14:01:21 -08:00
Cinnamon
2e59c0e994
Merge pull request #263 from christianbundy/hide-blocked-search
Hide search results from blocked feeds
2020-02-27 14:00:27 -08:00
Christian Bundy
927026937c Add hashtag support to search
Problem: Searching for a hashtag should bring you to the hashtag page,
and the hashtag page should have some useful information about which
page you're on instead of just showing you the messages.

Solution: Add code so that if you search for a hashtag you're brought to
that page, and display some useful help text at the top of the page
explaining the hashtag page. While ensuring that the hashtag page showed
posts from around the network (instead of only people you're following)
I fixed the popular page so that it has the same behavior again (fixing
a regression) and filtered out gatherings (fixing *another* regression)
on the popular page. These probably should've happened in another commit
but I got carried away. :/

Happy to split this commit into two if it hurts to bundle the popular
fixes with the hashtag fix, but I'm low on energy and want to at least
open a PR in case it doesn't bother anyone.
2020-02-27 12:14:29 -08:00
Christian Bundy
340f2842fa Hide search results from blocked feeds
Problem: The search results weren't hiding results from blocked feeds.

Solution: Add `socialFilter()` to ensure that all blocked feeds are
removed from search results as the first step in the stream processing.
2020-02-26 15:26:40 -08:00
Christian Bundy
ddf57b227f Detect existing Oasis server running on interface
Problem: Sometimes you try to run Oasis twice and the second time you
run the program it blows up in your face about the port being taken.
Most other software just focuses or reopens the window instead of
throwing errors at you.

Solution: Implement `/.well-known/oasis` as a sanity check to see
whether the thing listening on the HTTP port. If it replies "oasis" then
we can open the tab (unless `config.open === false`) and avoid throwing
the error.
2020-02-26 14:11:14 -08:00
Christian Bundy
3686113043 Add profile edit page
Problem: An SSB client should allow you to declare your own name, but
Oasis didn't support that behavior at all.

Solution: Add a basic 'Edit Profile' page that lets you set your name
and description. This doesn't implement profile images because I had
limited time and didn't want to think about encoding formats, but it's
worth mentioning that I remember something about binary uploads with the
default form encoding actually send 3 times as much data because of
escapes or something? This might not effect us because we're on
localhost, but I want to make a note that this isn't implemented yet.

This also makes a small change regarding the `<label>` element --
previously we were writing them as siblings to the input and using the
`for` attribute to target the input, but while messing with the CSS I
tried putting them directly in the `label()` and it ends up having the
same effect with less code.
2020-02-26 13:45:40 -08:00
Christian Bundy
7db90bd5e9 Fix queries with an unused {index: "DTA"} option
Problem: Trying to use the DTA index when using SSB-Query doesn't work,
because that index only exists on SSB-Backlinks.

Solution: Change the filter to ensure that we're sorted by the asserted
timestamp and ignoring messages from the future. The SSB-Backlinks
plugin was taking the minimum between `.value.timestamp` and `timestamp`
but since we're not using SSB-Backlinks in this query (or maybe at all?)
we get to make our own little hacky query. Cel taught me that the
`$sort` option causes problems here because it buffers the entire result
in memory before doing the sort. Boo. Instead we just need to reference
the property that we want to be sorted by with some operation, even if
it does nothing (like `{ $gt: null }`), but since we're filtering time
travelers we actually need `{ $lge: Date.now() }` there anyway.
2020-02-26 12:16:02 -08:00
Daan Wynen
7ec64e04bf Add config documentation (addresses #254). 2020-02-23 12:09:51 +01:00
Christian Bundy
3838987d55 Refactor default config loader
Problem: We load the default config with `require()`, which would allow
arbitrary JavaScript execution, are producing debug output everywhere
with `console.log()` statements, and don't have instructions for how to
write the config file. The config file is also `.config/**/config.json`,
and I think it would be helpful to specify that this is the **default**
config rather than any other kind of config.

Solution: Rename the config to `~/.config/oasis/default.json`, replace
the `require()` with `fs.readFile()`, remove `console.log()` for
debugging, and add some example JSON for how to use the config file.
2020-02-22 11:23:59 -08:00
Daan Wynen
35c42f6b95 Read settings from ~/.config/oasis/config.json
This should give pretty much expected behaviour. Each config value
can be set by three sources:

1. By command-line argument. If it is not given, then
2. By config file. Or, lastly
3. By default value in the source code.

I can't test that the config file is searched and read from the right
place on windows or macOS, but on linux it works.
2020-02-22 10:32:50 +01:00
Christian Bundy
ed5e6e5f61 Add support for Unix socket with noauth
Problem: We're doing tons of unnecessary cryptography by encrypting the
connection between the "client" and "server", which are often running in
the same process.

Solution: Instead of connecting to the SSB service over TCP and
encrypting the stream, just connect over a socket (supported on Windows,
macOS, and Linux) and don't bother encrypting anything. This is what
Patchwork and Patchbay do already, and since our secret is at
`~/.ssb/secret` then we should be comfortable with `~/.ssb/socket` being
a trusted file where access implies authentication.

Local tests suggest that when sodium-native is available, this commit
reduces the time to render the 'Popular (Day)' page by 17%, but when we
have to fall back to JavaScript cryptography the same page now takes 30%
less time to render. My intuition is that this improvement is more
dramatic on mobile, but requires further testing before we can pat
ourselves on the back too much. :)
2020-02-21 09:23:46 -08:00
Christian Bundy
293dcabe68 Update SSB-Mentions and remove workaround
Problem: We've been using a workaround to filter the results of
SSB-Mentions, but that's just been fixed upstream and so we don't need
the workaround anymore.

Solution: Update the SSB-Mentions package and remove the workaround.
2020-02-19 14:38:10 -08:00
Christian Bundy
a775c99421 Remove private posts from public views
Problem: During the SSB-Query refactor I used `{ private: false }` in an
attempt to hide private messages, but apparently this option is only
available via SSB-Backlinks, so it was ignored without any warning (!).
This allowed private messages to be displayed in public views.

Solution: Remove the unused option and add a filter to public views that
ensures that private messages are always hidden.
2020-02-19 10:27:06 -08:00
Cinnamon
6f5de95d01
Merge pull request #230 from christianbundy/no-messages-by-type
Replace messagesByType() with SSB-Query read
2020-02-18 21:24:14 -08:00