Skip to content

Commit

Permalink
Rename project from "Matrix Public Archive" to "Matrix Viewer" (#280)
Browse files Browse the repository at this point in the history
Mentioned in the recent blog post: https://matrix.org/blog/2023/07/what-happened-with-the-archive/#next-steps

The canonical `view.matrix.org` instance is not live yet but this is pre-requisite work for that to happen.
  • Loading branch information
MadLittleMods committed Jul 14, 2023
1 parent 1d1d7d2 commit 5d444d5
Show file tree
Hide file tree
Showing 60 changed files with 611 additions and 641 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/containerize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ on:

env:
REGISTRY: ghcr.io
GHCR_NAMESPACE: matrix-org/matrix-public-archive
IMAGE_NAME: matrix-public-archive
GHCR_NAMESPACE: matrix-org/matrix-viewer
IMAGE_NAME: matrix-viewer

jobs:
# Create and publish a Docker image for matrix-public-archive
# Create and publish a Docker image for matrix-viewer
#
# Based off of
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
runs-on: ubuntu-latest

services:
matrix-public-archive:
matrix-viewer:
image: ${{ needs.build-image.outputs.docker_image_name }}:sha-${{ github.sha }}
credentials:
username: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

env:
REGISTRY: ghcr.io
GHCR_NAMESPACE: matrix-org/matrix-public-archive
IMAGE_NAME: matrix-public-archive-test-homeserver
GHCR_NAMESPACE: matrix-org/matrix-viewer
IMAGE_NAME: matrix-viewer-test-homeserver

jobs:
# Create and publish a Docker image for a Synapse test instance that can
Expand Down
32 changes: 16 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# 0.2.0 - _upcoming_
# 0.2.0 - _upcoming_ - Matrix Viewer

- Prevent Cloudflare from overriding our own 504 timeout page, https://github.com/matrix-org/matrix-public-archive/pull/228
- Catch NSFW rooms with underscores, https://github.com/matrix-org/matrix-public-archive/pull/231
- Fix `18+` false positives with NSFW check, https://github.com/matrix-org/matrix-public-archive/pull/279
- Fix room cards sorting in the wrong direction on Firefox, https://github.com/matrix-org/matrix-public-archive/pull/261
- Remove `libera.chat` as a default since their rooms are not accessible in the archive, https://github.com/matrix-org/matrix-public-archive/pull/263
- Add reason why the archive bot is joining the room, https://github.com/matrix-org/matrix-public-archive/pull/262
- Add `/faq` redirect, https://github.com/matrix-org/matrix-public-archive/pull/265
- Use `rel=canonical` link to de-duplicate event permalinks, https://github.com/matrix-org/matrix-public-archive/pull/266, https://github.com/matrix-org/matrix-public-archive/pull/269
- Prevent join event spam with stable `reason`, https://github.com/matrix-org/matrix-public-archive/pull/268
- Don't allow previewing `shared` history rooms, https://github.com/matrix-org/matrix-public-archive/pull/239
- Prevent Cloudflare from overriding our own 504 timeout page, https://github.com/matrix-org/matrix-viewer/pull/228
- Catch NSFW rooms with underscores, https://github.com/matrix-org/matrix-viewer/pull/231
- Fix `18+` false positives with NSFW check, https://github.com/matrix-org/matrix-viewer/pull/279
- Fix room cards sorting in the wrong direction on Firefox, https://github.com/matrix-org/matrix-viewer/pull/261
- Remove `libera.chat` as a default since their rooms are not accessible, https://github.com/matrix-org/matrix-viewer/pull/263
- Add reason why the bot is joining the room, https://github.com/matrix-org/matrix-viewer/pull/262
- Add `/faq` redirect, https://github.com/matrix-org/matrix-viewer/pull/265
- Use `rel=canonical` link to de-duplicate event permalinks, https://github.com/matrix-org/matrix-viewer/pull/266, https://github.com/matrix-org/matrix-viewer/pull/269
- Prevent join event spam with stable `reason`, https://github.com/matrix-org/matrix-viewer/pull/268
- Don't allow previewing `shared` history rooms, https://github.com/matrix-org/matrix-viewer/pull/239
- Contributed by [@tulir](https://github.com/tulir)
- Update FAQ to explain `world_readable` only, https://github.com/matrix-org/matrix-public-archive/pull/277
- Indicate when the room was set to `world_readable` and by who, https://github.com/matrix-org/matrix-public-archive/pull/278
- Only show `world_readable` rooms in the room directory, https://github.com/matrix-org/matrix-public-archive/pull/276
- Update FAQ to explain `world_readable` only, https://github.com/matrix-org/matrix-viewer/pull/277
- Indicate when the room was set to `world_readable` and by who, https://github.com/matrix-org/matrix-viewer/pull/278
- Only show `world_readable` rooms in the room directory, https://github.com/matrix-org/matrix-viewer/pull/276

Developer facing:

- Fix eslint trying to look at `node_modules/`, https://github.com/matrix-org/matrix-public-archive/pull/275
- Fix eslint trying to look at `node_modules/`, https://github.com/matrix-org/matrix-viewer/pull/275

# 0.1.0 - 2023-05-11

- Initial public release with good enough functionality to be generally available including: room directory homepage, room archive view with calendar jump-to-date, drill-down with the time selector, following room upgrades (tombstone/predecessor), and more. Completed milestone: https://github.com/matrix-org/matrix-public-archive/milestone/1
- Initial public release with good enough functionality to be generally available including: room directory homepage, room archive view with calendar jump-to-date, drill-down with the time selector, following room upgrades (tombstone/predecessor), and more. Completed milestone: https://github.com/matrix-org/matrix-viewer/milestone/1
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
# Matrix Public Archive
# Matrix Viewer

<a href="https://matrix.to/#/#matrix-public-archive:matrix.org"><img src="https://img.shields.io/matrix/matrix-public-archive:matrix.org.svg?label=%23matrix-public-archive%3Amatrix.org&logo=matrix&server_fqdn=matrix.org" alt="Join the community and get support at #matrix-public-archive:matrix.org" /></a>
<a href="https://matrix.to/#/#matrix-viewer:matrix.org"><img src="https://img.shields.io/matrix/matrix-viewer:matrix.org.svg?label=%23matrix-viewer%3Amatrix.org&logo=matrix&server_fqdn=matrix.org" alt="Join the community and get support at #matrix-viewer:matrix.org" /></a>

> **Note**
> The Matrix Public Archive has been renamed to Matrix Viewer to better reflect what it
> actually does and doesn't do. It's a viewer for world-readable Matrix rooms and
> doesn't actually archive anything.
In the vein of [feature parity with
Gitter](https://github.com/vector-im/roadmap/issues/26), the goal is to make a
public archive site for `world_readable` Matrix rooms like Gitter's archives
Gitter](https://github.com/vector-im/roadmap/issues/26), the goal is to make an
accessible public site for `world_readable` Matrix rooms like Gitter's archives
which search engines can index and keep all of the content accessible/available.

#### Try it out: [archive.matrix.org](https://archive.matrix.org/) 🌌
#### Try it out: [view.matrix.org](https://view.matrix.org/) 🌌

<!-- prettier-ignore -->
Room directory homepage | Archive room view
Room directory homepage | Room view
--- | ---
<img alt="A reference for how the Matrix Public Archive homepage looks. Search bar where you can find thousands of rooms using Matrix and homeserver selector. Grid of room cards showing the results." src="https://user-images.githubusercontent.com/558581/236579462-fee0f9c0-29d2-4c3d-a695-c9eaf0f744ef.png" width="440"> | ![A reference for how the Matrix Public Archive looks. Showing off a day of messages in `#gitter:matrix.org` on 2021-08-06. There is a date picker calendar in the right sidebar and a traditional chat app layout on the left.](https://user-images.githubusercontent.com/558581/234765275-28c70c49-c27f-473a-88ba-f4392ddae871.png)
<img alt="A reference for how the Matrix Viewer homepage looks. Search bar where you can find thousands of rooms using Matrix and homeserver selector. Grid of room cards showing the results." src="https://user-images.githubusercontent.com/558581/236579462-fee0f9c0-29d2-4c3d-a695-c9eaf0f744ef.png" width="440"> | ![A reference for how the Matrix Viewer looks. Showing off a day of messages in `#gitter:matrix.org` on 2021-08-06. There is a date picker calendar in the right sidebar and a traditional chat app layout on the left.](https://user-images.githubusercontent.com/558581/234765275-28c70c49-c27f-473a-88ba-f4392ddae871.png)

## Demo videos

The demo's refer to this project as the "Matrix Public Archive" which has now been renamed to "Matrix Viewer".

- [![](https://user-images.githubusercontent.com/558581/206083768-d18456de-caa3-463f-a891-96eed8054686.png) May 2023](https://www.youtube.com/watch?v=4KlNILNItGQ&t=1046s): Introducing [archive.matrix.org](https://archive.matrix.org/), the shiny new public instance of the Matrix Public Archive that everyone can share and link to.
- [![](https://user-images.githubusercontent.com/558581/206083768-d18456de-caa3-463f-a891-96eed8054686.png) Aug 2022](https://www.youtube.com/watch?v=6KHQSeJTXm0&t=583s) ([blog post](https://matrix.org/blog/2022/08/05/this-week-in-matrix-2022-08-05#matrix-public-archive-website)): A quick intro of what the project looks like, the goals, what it accomplishes, and how it's a new portal into the Matrix ecosystem.
- [![](https://user-images.githubusercontent.com/558581/206083768-d18456de-caa3-463f-a891-96eed8054686.png) Oct 2022](https://www.youtube.com/watch?v=UT6KSEqDUf8&t=548s): Showing off the room directory landing page used to browse everything available in the archive.
Expand All @@ -25,7 +32,7 @@ Room directory homepage | Archive room view
We server-side render (SSR) the [Hydrogen](https://github.com/vector-im/hydrogen-web)
Matrix client on a Node.js server (since both use JavaScript) and serve pages on the fly
(with some Cloudflare caching on top) when someone requests
`/archives/r/matrixhq:matrix.org/${year}/${month}/${day}`. To fetch the events for a
`/r/matrixhq:matrix.org/${year}/${month}/${day}`. To fetch the events for a
given day/time, we use [MSC3030](https://github.com/matrix-org/matrix-doc/pull/3030)'s
`/timestamp_to_event` endpoint to jump to a given day in the timeline and fetch the
messages from a Matrix homeserver.
Expand Down Expand Up @@ -70,9 +77,9 @@ $ npm run start
## Development

```sh
# Clone and install the `matrix-public-archive` project
$ git clone [email protected]:matrix-org/matrix-public-archive.git
$ cd matrix-public-archive
# Clone and install the `matrix-viewer` project
$ git clone [email protected]:matrix-org/matrix-viewer.git
$ cd matrix-viewer
$ npm install

# Edit `config/config.user-overrides.json` so that `matrixServerUrl` points to
Expand All @@ -88,7 +95,7 @@ it into this project with the following instructions:

```sh
# We need to use a draft branch of Hydrogen to get the custom changes needed for
# `matrix-public-archive` to run. Hopefully soon, we can get all of the custom
# `matrix-viewer` to run. Hopefully soon, we can get all of the custom
# changes mainlined so this isn't necessary.
$ git clone [email protected]:vector-im/hydrogen-web.git
$ cd hydrogen-web
Expand All @@ -98,7 +105,7 @@ $ yarn build:sdk
$ cd target/ && npm link && cd ..
$ cd ..

$ cd matrix-public-archive
$ cd matrix-viewer
$ npm link hydrogen-view-sdk
```

Expand Down
4 changes: 2 additions & 2 deletions build-scripts/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ module.exports = defineConfig({
// This doesn't seem to be necessary for the this package to work (ref
// https://vitejs.dev/guide/dep-pre-bundling.html#monorepos-and-linked-dependencies)
//
//'matrix-public-archive-shared'
//'matrix-viewer-shared'
],
},
resolve: {
alias: {
// The `file:` packages don't seem resolve correctly so let's add an alias as well
// See https://css-tricks.com/adding-vite-to-your-existing-web-app/#aa-aliases
'matrix-public-archive-shared': path.resolve(__dirname, '../shared'),
'matrix-viewer-shared': path.resolve(__dirname, '../shared'),
},
// This will make sure Vite/Rollup matches the original file path (i.e. the path
// without following symlinks) instead of the real file path (i.e. the path after
Expand Down
16 changes: 8 additions & 8 deletions client/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ summary {
}

/* Based on .SessionView from Hydrogen */
.ArchiveRoomView {
.RoomView {
/* this takes into account whether or not the url bar is hidden on mobile
(have tested Firefox Android and Safari on iOS),
see https://developers.google.com/web/updates/2016/12/url-bar-resizing */
Expand All @@ -76,7 +76,7 @@ summary {
min-width: 0;
}

.ArchiveRoomView_mainArea {
.RoomView_mainArea {
grid-area: middle;
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -105,7 +105,7 @@ summary {
display: none;
}

.ArchiveRoomView_mainBody {
.RoomView_mainBody {
flex: 1 1;
display: flex;
flex-direction: column;
Expand All @@ -114,31 +114,31 @@ summary {
min-width: 0;
}

.ArchiveRoomView_mainBody > .Timeline {
.RoomView_mainBody > .Timeline {
flex: 1 0;
}

@media screen and (max-width: 800px) {
/* Only the middle needs to be visible mobile by default */
.ArchiveRoomView {
.RoomView {
grid-template:
'status' auto
'middle' 1fr /
1fr;
}
/* Which also means hiding the right-panel by default on mobile */
.ArchiveRoomView:not(.right-shown) .RightPanelView {
.RoomView:not(.right-shown) .RightPanelView {
display: none;
}

/* When the user opens the right-panel, show it */
.ArchiveRoomView.right-shown {
.RoomView.right-shown {
grid-template:
'status' auto
'right' 1fr /
1fr;
}
.ArchiveRoomView.right-shown .ArchiveRoomView_mainArea {
.RoomView.right-shown .RoomView_mainArea {
display: none;
}
/* And show the button to open the right-panel on mobile */
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion client/js/entry-client-hydrogen.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'matrix-public-archive-shared/hydrogen-vm-render-script.js';
import 'matrix-viewer-shared/hydrogen-vm-render-script.js';

// Assets
import 'hydrogen-view-sdk/assets/theme-element-light.css';
Expand Down
12 changes: 6 additions & 6 deletions client/js/entry-client-room-alias-hash-redirect.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import assert from 'matrix-public-archive-shared/lib/assert.js';
import MatrixPublicArchiveURLCreator from 'matrix-public-archive-shared/lib/url-creator.js';
import redirectIfRoomAliasInHash from 'matrix-public-archive-shared/lib/redirect-if-room-alias-in-hash.js';
import assert from 'matrix-viewer-shared/lib/assert.js';
import MatrixViewerURLCreator from 'matrix-viewer-shared/lib/url-creator.js';
import redirectIfRoomAliasInHash from 'matrix-viewer-shared/lib/redirect-if-room-alias-in-hash.js';

// Assets
import 'hydrogen-view-sdk/assets/theme-element-light.css';
import '../css/styles.css';

const config = window.matrixPublicArchiveContext.config;
const config = window.matrixViewerContext.config;
assert(config);
assert(config.basePath);

const matrixPublicArchiveURLCreator = new MatrixPublicArchiveURLCreator(config.basePath);
const matrixViewerURLCreator = new MatrixViewerURLCreator(config.basePath);

console.log(`Trying to redirect based on pageHash=${window.location.hash}`);
const isRedirecting = redirectIfRoomAliasInHash(matrixPublicArchiveURLCreator);
const isRedirecting = redirectIfRoomAliasInHash(matrixViewerURLCreator);

// Show the message while we're trying to redirect or if we found nothing, remove the
// message
Expand Down
4 changes: 2 additions & 2 deletions client/js/entry-client-room-directory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'matrix-public-archive-shared/room-directory-vm-render-script.js';
import 'matrix-viewer-shared/room-directory-vm-render-script.js';

// Assets
import 'hydrogen-view-sdk/assets/theme-element-light.css';
Expand All @@ -8,4 +8,4 @@ import '../css/room-directory.css';
// over for all
import '../img/favicon.ico';
import '../img/favicon.svg';
import '../img/matrix-public-archive-opengraph.png';
import '../img/opengraph.png';
2 changes: 1 addition & 1 deletion config/config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"matrixServerName": "localhost",
// Set this to 100 since that is the max that Synapse will backfill even if you do a
// `/messages?limit=1000` and we don't want to miss messages in between.
"archiveMessageLimit": 100,
"messageLimit": 100,
"requestTimeoutMs": 25000,
"logOutputFromChildProcesses": false,
//"stopSearchEngineIndexing": true,
Expand Down
2 changes: 1 addition & 1 deletion config/config.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"testMatrixServerUrl2": "http://localhost:12008/",

// Secrets
"matrixAccessToken": "as_token_8664700429a911bbbecf7d91b9e1a74716d669f40cf32259630e38439726e29d"
"matrixAccessToken": "as_token_matrix_viewer_foobarbaz"
}
Loading

0 comments on commit 5d444d5

Please sign in to comment.