I'm not sure what exactly is causing the behavior change now besides that I am running on Linux.
The quote fix around the path is from https://stackoverflow.com/questions/51021751/express-js-lint-gives-mistake
`node_modules/` is already part of our `.eslintignore`.
Previously:
```sh
$ npm run lint
> matrix-public-archive@0.1.0 lint
> eslint **/*.js
Oops! Something went wrong! :(
ESLint: 8.37.0
You are linting "node_modules/ipaddr.js", but all of the files matching the glob pattern "node_modules/ipaddr.js" are ignored.
If you don't want to lint these files, remove the pattern "node_modules/ipaddr.js" from the list of arguments passed to ESLint.
If you do want to lint these files, try the following solutions:
* Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored.
* Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument.
```
Only `world_readable` can be considered as opting into having history publicly on the web. Anything else must not be archived until there's a dedicated state event for opting into archiving.
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.
Room cards will now sort by room members descending (highest to lowest) as expected.
Fix https://github.com/matrix-org/matrix-public-archive/issues/218
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 https://stackoverflow.com/questions/55039157/array-sort-behaves-differently-in-firefox-and-chrome-edge)
- 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]` ❌
Useful in moderation scenarios where you want to quarantine media and can quickly/easily look at the data attribute on the media (image/videos). Or simply write a little script to extract all of the `data-mxc-url` and `data-thumbnail-mxc-url` attributes.
ex.
```
<img src="http://localhost:8008/_matrix/media/r0/thumbnail/my.synapse.server/TEyTVUNgvUQZcXlrLwgGfbcp?width=400&height=266&method=scale" alt="Stormclouds.jpg" title="Stormclouds.jpg" data-mxc-url="mxc://my.synapse.server/kxibKhxRfTvFWyuWwWvFuBtE" data-thumbnail-mxc-url="mxc://my.synapse.server/TEyTVUNgvUQZcXlrLwgGfbcp" style="max-width: 400px; max-height: 266px;">
```
- Default to a nice `[matrix]` banner
- There is room for improvement here when the Matrix Public Archive gets it's own logo (https://github.com/matrix-org/matrix-public-archive/issues/94) 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 https://github.com/matrix-org/matrix-public-archive/issues/202
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%
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.
Before:
```
<input id="debugActiveDateIntersectionObserver" type="checkbox" checked="null">
```
After:
```
<input id="debugActiveDateIntersectionObserver" type="checkbox">
```
Set `X-Date-Temporal-Context: [past|present|future]` header for easy cache rules:
- Cache `past` things heavily
- Cache `present`/`future` things for 5 minutes
This accomplishes the goal we set out for:
> - We can cache all responses except for the latest UTC day (and anything in the future). ex. `/!aMzLHLvScQCGKDNqCB:gitter.im/date/2022/10/13`
> - For the latest day, we could set the cache expire after 5 minutes or so
>
> *-- [Matrix Public Archive deployment issue](https://github.com/vector-im/sre-internal/issues/2079)*
And this way we don't have to do any fancy date parsing and comparison from the URL which is probably not even possible Cloudflare cache rules.
Who knows why we can't capture these errors via the more conventional `child.on('error', (err) => { })` listener 🤷
### Before
```
RethrownError: Failed to render Hydrogen to string. In order to reproduce, feed in these arguments into `renderHydrogenToString(...)`:
renderHydrogenToString arguments: { ... }
at renderHydrogenToString (server/hydrogen-render/render-hydrogen-to-string.js:58:11)
--- Original Error ---
RethrownError: Child process exited with code 1
at assembleErrorAfterChildExitsWithErrors (server/child-process-runner/run-in-child-process.js:60:29)
--- Original Error ---
No child errors
```
### After
```
RethrownError: Failed to render Hydrogen to string. In order to reproduce, feed in these arguments into `renderHydrogenToString(...)`:
renderHydrogenToString arguments: { ... }
at renderHydrogenToString (server/hydrogen-render/render-hydrogen-to-string.js:58:11)
--- Original Error ---
RethrownError: Child process exited with code 1
at assembleErrorAfterChildExitsWithErrors (server/child-process-runner/run-in-child-process.js:60:29)
--- Original Error ---
No child errors but there might be something in stderr=node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '../lib/rethrown-error'
Require stack:
- server/child-process-runner/child-fork-script.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (server/child-process-runner/child-fork-script.js:8:23)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'server//child-process-runner//child-fork-script.js'
]
}
```