Commit Graph

82 Commits

Author SHA1 Message Date
Eric Eastwood 5d444d5044
Rename project from "Matrix Public Archive" to "Matrix Viewer" (#280)
Mentioned in the recent blog post:

The canonical `` instance is not live yet but this is pre-requisite work for that to happen.
2023-07-14 15:52:35 -05:00
Eric Eastwood dd2cd9126d
Only show `world_readable` rooms in the room directory (#276)
Happens to address part of
but made primarily as a follow-up to


Only 42% rooms on the `` room directory are `world_readable` which means we will get pages of rooms that are half-empty most of the time if we just naively fetch 9 rooms at a time.

Ideally, we would be able to just add a filter directly to `/publicRooms` in order to only grab the `world_readable` rooms and still get full pages but the filter option doesn't allow us to slice by `world_readable` history visibility.

Instead, we have to paginate until we get a full grid of 9 rooms, then make a final `/publicRooms` request to backtrack to the exact continuation point so next page won't skip any rooms in between.


We had empty spaces in the grid before because some rooms in the room directory are private which we filtered out before. But that was a much more rare experience since only 2% of rooms were private .
2023-06-30 03:08:32 -05:00
Eric Eastwood 59c9d3180e
Fix `18+` false positives with NSFW check (#279)
Was noticing false positives with our test room names like: `planet-1688081266353-room-18`


2023-06-29 18:58:53 -05:00
Eric Eastwood 0fc4421432
Indicate when the room was set to `world_readable` and by who (#278) 2023-06-28 20:29:49 -05:00
Eric Eastwood 9d55b4a505
Remove as a default since their rooms are not accessible in the archive (#263)
The history visibility in Libera rooms is set to `join` which means it's not
accessible in the archive at all. Instead of leading a bunch of people to
`403 Forbidden`, we can just remove it from the default list.

The default list was mostly just copied from the Element list of defaults.
2023-06-06 11:33:56 -05:00
Eric Eastwood c26bdc5ffb
Fix Firefox sorting room cards in the wrong direction (#261)
Room cards will now sort by room members descending (highest to lowest) as expected. 


The `/publicRooms` (room directory) endpoint already returns rooms in the correct order which is why we didn't care about the order before but the different `[].sort(...)` implementations in browsers necessitates we be explicit about it. Ideally, we wouldn't have to use the `ObservableMap.sortValues()` method at all but it seems like one of the only ways to get the values out. In any case, maybe it's more clear what order things are in now.

This bug stems from the fact that `[1, 2, 3, 4, 5].sort((a, b) => 1)` returns different results in Chrome vs Firefox (found from

 - Chrome: `[1, 2, 3, 4, 5].sort((a, b) => 1)` -> `[1, 2, 3, 4, 5]`  
 - Firefox: `[1, 2, 3, 4, 5].sort((a, b) => 1)` -> `[5, 4, 3, 2, 1]` 
2023-06-02 17:19:58 -05:00
Eric Eastwood dfeae90829
Link FAQ about indexing in the right-panel footer (#258)
Link FAQ about indexing in the right-panel footer so people can more easily
understand what goes into the result and find issues to track about opting out.

 - 5caf9dc1b8/docs/ (how-do-i-opt-out-and-keep-my-room-from-being-indexed-by-search-engines)
2023-05-31 01:23:39 -05:00
Eric Eastwood a9aa08f24a
Catch NSFW rooms with underscores (#231)
`\b` includes `_` which is a bit unexpected since we expect a room that looks like `NSFW_foo` to be caught in safe search
2023-05-23 12:29:19 -05:00
Eric Eastwood 16323df054
Add image metadata for URL previews (#224)
- Default to a nice `[matrix]` banner
    -  There is room for improvement here when the Matrix Public Archive gets it's own logo ( and maybe says "Matrix Public Archive" somewhere in the banner.
    - This is good enough for now (and certainly better than downstream previews using the first image on the page).
 - For rooms, it will use the room avatar

Part of

Image is sized to 1200x630 to match conventions of `og:image`.

Crafted the banner image by modifying the header on the room directory homepage and taking a node screenshot. Page zoom @ 175%
2023-05-10 00:50:12 -05:00
Eric Eastwood bf8040f48e
Fix checkbox being checked by default when the value was actually `null` (#221)
Fix `debugActiveDateIntersectionObserver` checkbox being checked by default when the value was actually `null`.
Now we properly only care about explicit `'true'`, `'false'` from local storage.

<input id="debugActiveDateIntersectionObserver" type="checkbox" checked="null">

<input id="debugActiveDateIntersectionObserver" type="checkbox">
2023-05-05 19:44:49 -05:00
Eric Eastwood 198e8c09be
Mark NSFW room pages with `<meta name="rating" content="adult">` (#216)
Related docs:

2023-05-05 15:36:26 -05:00
Eric Eastwood b10884505a
Fix time selector showing when less than the page limit of messages (#213)
2023-05-04 20:50:43 -05:00
Eric Eastwood b70439e95b
Add safe search filter for NSFW rooms (#208)
2023-05-03 04:45:33 -05:00
Eric Eastwood 8bea5e0355
Protect from no IntersectionObserver while SSR (#206) 2023-05-02 00:28:10 -05:00
Eric Eastwood 8255e644e6
Fix broken links with the matrix-media-repo because there are too many slashes (#199)
The extra slash seems to work fine with the built-in media repo in Synapse but noticed broken links when using `` which delegates to the `matrix-media-repo`


2023-04-27 21:36:30 -05:00
Eric Eastwood addb02198d
Don't jump calendar around for events which appear in the future (#196)
Don't jump calendar around for events which appear in the future compared to the timestamp in the URL.

This sort of situation occurs often for Gitter imported historical rooms where we have a bunch of history that is timestamp massaged intermixed with a bunch of join events which we couldn't timestamp massage at the time.

2023-04-27 03:16:06 -05:00
Eric Eastwood ab9154bec2
Fix typos where I mispelled homeserver (#195) 2023-04-27 00:00:56 -05:00
Eric Eastwood f0a11139cb
Update Hydrogen SDK dependency `0.26.0-scratch` - 2023-04-26 (#189)
Of note:

 - Adds date headers,
 - Add "Copy permalink" message action,
 - Removes `?v=3.13` query parameters from Inter font references in CSS,
    - This is what we need to solve
2023-04-26 16:18:34 -05:00
Eric Eastwood 551b4e72d1
Follow tombstone and predecessor history (#167)

Other updates:

 - Update tests to use `/roomid/room1/date/2022/01/03` format instead of trying to retrofit the weird alias stuff on there. Which also makes the fancy to actual URL utilities much more simple.
 - Update to specify `archiveMessageLimit` in the test case because pages have different number of events depending on if we are against a boundary, hidden events, etc.
2023-04-19 01:26:15 -05:00
Eric Eastwood 57d2cb3dd3
Refactor tests to use single source of truth ASCII diagram (#164)
- Less test bulk
 - Single source of truth: there is no mismatch between the comment and the expectations (we already caught a few mistakes in the conversion thanks to this benefit)
 - Easier to maintain and update
2023-04-07 12:52:41 -05:00
Eric Eastwood 954b22995a
Add a way to select time of day (#139)
- Fix
 - A URL with time looks like
    - `/r/too-many-messages-on-day:my.synapse.server/date/2022/11/16T23:59`
    - Or when more precision is required (seconds): `/r/too-many-messages-on-day:my.synapse.server/date/2022/11/16T23:59:59`
 - Add new custom time picker/scrubber (pictured below) with momentum scrubbing
    - Native built-in `<input type="time">` for easier picking if you prefer that and accessibility.
    - Uses localized time strings
    - Design inspired by Thiago Sanchez's *Time Zone Translate* concept,
2023-04-05 04:25:31 -05:00
Eric Eastwood b41d15a92c
Add `Copy permalink` option to messages (``) (#136)
This might be a little ambiguous since we'll have permalinks within the Matrix Public Archive with `?at=$xxx` (related which is different from `` permalinks 🤔

But will just go with it for now 
2022-11-14 17:55:00 -06:00
Eric Eastwood 776347207e
Updates to be compatible with the latest Hydrogen changes (rename `urlCreator` -> `urlRouter`) (#134)
Hydrogen changes:

2022-11-10 17:37:08 -06:00
Eric Eastwood 8a2dabe97b
Fix room image avatars not showing in the room directory (#133)
Fix room image avatars not showing in the room directory

2022-11-10 00:29:44 -06:00
Eric Eastwood fa4720af04
Increase perceived performance by scrolling to the right spot before Hydrogen loads (#128) 2022-11-09 18:57:33 -06:00
Eric Eastwood 3671da0405
Fix NPE with non-existent event permalink `?at=$doesnotexist` (#130) 2022-11-09 02:07:10 -06:00
Eric Eastwood 5bae040d72
Add permalink highlighting - `?at=$xxx` (#123)


Split out from
2022-11-03 04:49:07 -05:00
Eric Eastwood 91d84fcc08
Don't change the URL as you scroll around (#119)

Reverting behavior originally introduced in
2022-11-02 04:35:36 -05:00
Eric Eastwood 08254cbb49
Add a way to jump forwards and backwards to more activity in the room (seamless navigation) (#114)
Follow-up to


 - Changes the "Jump to next activity in room" to actually continue you to the next 100 messages ahead. Previously, it only jumped you to the single next event in the room which meant a lot of backwards overlap each time.
    - Jumping this direction will also start your scroll position at the top of the timeline to continue reading seamlessly `?continue=top`
 - Adds "Jump to previous activity in room" to the top of the timeline to continue reading the previous part of the conversation.

[1]: There is a caveat with seamless here which is also commented on in the code:

> XXX: This is flawed in the fact that when we go `/messages?dir=b` it could  backfill messages which will fill up the response before we perfectly connect and  continue from the position they were jumping from before. When `/messages?dir=f`  backfills, we won't have this problem anymore because any messages backfilled in  the forwards direction would be picked up the same going backwards.

(need forwards fill MSC)
2022-11-02 04:27:30 -05:00
Eric Eastwood dc7017ae4c
Move Hydrogen `timelineViewModel` creation to our main view model (#118)
Move Hydrogen `timelineViewModel` creation to our main view model.

Was it better to keep this Hydrogen boilerplate outside? Maybe 🤷. It's possible that all of this will go away with something like

Should we also move the [`room` VM creation](8275f120a6/shared/hydrogen-vm-render-script.js (L88-L111))? Maybe but it's not as much noise as all of this tile/timeline stuff.
2022-11-01 08:54:43 -05:00
Eric Eastwood 718f01e5a4
Refactor to use `TimelineView` (#117)
We have to figure out our own layout but does get rid of some of the `RoomView` boilerplate.
The `TimelineView` still has outside boilerplate styles to work.

There shouldn't be any visible change.
2022-11-01 08:36:32 -05:00
Eric Eastwood 2b4ecb737a
Add support for client-side room alias hash `#` redirects to the correct URL (#111)
This helps when someone just pastes a room alias on the end of the domain,

 - `/#room-alias:server` -> `/r/room-alias:server`
 - `/r/#room-alias:server/date/2022/10/27` -> `/r/room-alias:server/date/2022/10/27`

Since these redirects happen on the client, we can't write any e2e tests. Those e2e tests do everything but run client-side JavaScript.

Follow-up to

Part of
2022-10-28 00:32:24 -05:00
Eric Eastwood 7a88ea0c19
Add support for room aliases (#107)
Also does friendly redirects if you don't exactly use the right URL pattern.
For example, if you paste the full room ID with the `!` like `/roomid/!foo:bar`,
it will properly redirect you to `/roomid/foo:bar`. It also does this sort of
thing for URL encoded room ID's and aliases.

2022-10-27 01:09:13 -05:00
Eric Eastwood b7c00c31c1
Fix URL being duplicated in query param (#110)

### What was the problem?

We were previously seeing this behavior with the old code:

Before: http://localhost:3050/!xxx:server/date/2022/09/20?via=my.synapse.server
After: http://localhost:3050/!xxx:server/date/2022/09/20?via=my.synapse.serverhttp://localhost:3050/!xxx:server/date/2022/07/29

Because `replacingUrl` was evaluating to `replacingUrl = '?via=my.synapse.serverhttp://!HBehERstyQBxyJDLfR:my.synapse.server/date/2022/07/29'` which is relative and was appended to the current URL.

### Solution

Now with the new code, we more clearly handle the 3 cases:

 - Normal Hydrogen `#/foo-bar` hash routing on the end of the URL
 - When `url=''` and we just need clear the Hydrogen hash route and maintain the current path and query parameters
 - An absolute URL which we can completely replace the page URL with
2022-10-25 01:59:23 -05:00
Eric Eastwood d19c08397a
Fixup room directory fetch error message (#108)
Follow-up to
2022-10-24 15:49:23 -05:00
Eric Eastwood 2bda335f1c
Clean up spurious logs when SSR rendering Hydrogen (#106)

Child printed something to stdout: Mounting Hydrogen...

Child printed something to stderr: Skipping `addedHomservers` read from LocalStorage since LocalStorage is not available

Child printed something to stdout: Completed mounting Hydrogen: 22.188ms

Child printed something to stdout: 2 uncaughtException TypeError: this.dialogNode.close is not a function
    at ModalView.closeModal (C:\Users\MLM\Documents\GitHub\element\matrix-public-archive\shared\views\ModalView.js:115:21)
    at Timeout._onTimeout (C:\Users\MLM\Documents\GitHub\element\matrix-public-archive\shared\views\ModalView.js:87:18)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)


Child printed something to stdout: Mounting Hydrogen...

Child printed something to stderr: Skipping `addedHomservers` read from LocalStorage since LocalStorage is not available

Child printed something to stdout: Completed mounting Hydrogen: 14.2ms
2022-10-21 17:27:10 -05:00
Eric Eastwood 7c09ac13f9
Fix form <select> value not being up to date by the time we auto-submit the form on selection (#105)
Follow-up to
2022-10-21 16:24:22 -05:00
Eric Eastwood d2d6c5a580
Link rooms with `?via` query paramter from room directory landing page (#104)

So we're always able to join the room from our origin homeserver to the remote room we don't know about yet.
2022-10-21 16:06:11 -05:00
Eric Eastwood 3b4fb52bfe
Fix pagination links not accounting for homeserver selection (#103)

Previously caused the `?homeserver` query parameter to be lost when paginating
2022-10-21 15:52:07 -05:00
Eric Eastwood 048f03fff7
Stop using `selectEl.value` as crutch over swapping `selected` attribute (#102)
Originally introduced in:

2022-10-21 15:35:11 -05:00
Eric Eastwood dcc2f5dd03
Fix typo in room fetch error section (#100) 2022-10-21 02:15:42 -05:00
Eric Eastwood 1e89179f09
Page-load with the correct homeserver selected (#98)
Page-load with the correct homeserver selected (according to `?homeserver`).


Also makes sure that the `?homeserver` is always available somewhere in the list; whether that be in the available homeserver list or the added homeserver list depending on it someone cleared it out or never had it because they visited from someone else's link.
2022-10-21 02:09:26 -05:00
Eric Eastwood 75d4a14845
Fix hash and query parameter ordering and repeating (#99)
This would happen after opening the "Add server" modal


2022-10-21 01:14:06 -05:00
Eric Eastwood 6bb88b1ecd
Load room directory and show error message when we're unable to fetch rooms (#96)
Follow-up to to address

Also explains why we show the details of the error message.

Part of

Related to
2022-10-20 22:48:00 -05:00
Eric Eastwood b34c1b817d
Add homeserver selector to room directory landing page (#87)
Opting for the simple solution and using `include_all_networks` instead of needing to fetch the information about the third-party networks.

Fix (last piece done with this PR)
2022-10-20 02:06:43 -05:00
Eric Eastwood 27ed76c7a9
Implement `ModalView` with native `<dialog>` element (#88)
The main benefit we're getting from this refactor is semantics, `Escape` to close modal, and focus lock.

We have one existing modal with the Developer Options.

This refactor is happening so it can be used to add a new homeserver in the homeserver selector on the room directory page,
2022-10-19 01:04:19 -05:00
Eric Eastwood 5142e508a2
Have full room description readable from tooltip (#85)
The `RoomCard`  clips text two lines before ellipsing. This will make the rest of the description readable if you hover over the description.
2022-10-18 18:38:00 -05:00
Eric Eastwood f9e16964e1
Fix off-by-one calendar months with time zones that are greater than UTC+0 (#86)
Fix off-by-one calendar months with time zones that are greater than UTC+0 (GMT+0).


Previously, we would calculate `lastDayOfTheMonthDate` in the local timezone because we were using the vanilla `new Date(year, month, 0)` constructor. For any timezone greater than `UTC+0` (like London UTC+1 or Korea UTC +9), this means that the date is a day-behind when we go back to UTC+0.


inputDate Fri, 29 Jul 2022 00:00:00 GMT 1659052800000
lastDayOfTheMonthDate Sat, 30 Jul 2022 23:00:00 GMT 1659222000000
lastDayOfTheMonth 30


inputDate Fri, 29 Jul 2022 00:00:00 GMT 1659052800000
lastDayOfTheMonthDate Sun, 31 Jul 2022 00:00:00 GMT 1659225600000
lastDayOfTheMonth 31
2022-10-18 18:36:13 -05:00
Eric Eastwood b39d7caf31
Add linting to CI (#74)
- Prettier
 - ESLint
2022-09-27 22:21:00 -05:00
Eric Eastwood be837515fe
Show surrounding messages for a full screen of content (#71)
1. Add surrounding messages to the given messages so we have a full screen of content to make it feel lively even in quiet rooms
    - As you scroll around the timeline across different days, the date changes in the URL, calendar, etc
 2. Add summary item to the bottom of the timeline that explains if we couldn't find any messages in the specific day requested 
    - Also allows you to the jump to the next activity in the room. Adds `/:roomId/jump?ts=xxx&dir=[f|b]` to facilitate this.
    - Part of
 3. Add developer options modal which is linked from the bottom of the right-panel
    - Adds an option so you can debug the `IntersectionObserver` and how it's selecting the active day from the top-edge of the scroll viewport.
    - In the future, this will also include a nice little visualization of the backend timing traces
2022-09-20 16:02:09 -05:00