Giter Site home page Giter Site logo

matrix-org / matrix-static Goto Github PK

View Code? Open in Web Editor NEW
87.0 29.0 25.0 6.63 MB

A static golang generated preview of public world readable Matrix rooms.

Home Page: http://view.matrix.org/

License: Apache License 2.0

Go 96.92% CSS 2.41% Dockerfile 0.64% Procfile 0.03%
static-site

matrix-static's Introduction

Matrix Static

No longer maintained

In favour of https://github.com/matrix-org/matrix-public-archive

Installation

git clone or download this repository as an archive and extract then follow below instructions.

go get github.com/valyala/quicktemplate/qtc
qtc
mkdir bin && go build -o bin/ ./cmd/...

Docker

docker build -t matrix-static .
docker run -v $(pwd)/config.json:/opt/matrix-static/config.json -p 8000:8000 -it matrix-static

or for windows:

docker run -v %cd%/config.json:/opt/matrix-static/config.json -p 8000:8000 -it matrix-static

and pass any command line arguments to the end of the command.

Usage

First you must create a config, there is a sample json file provided or you can use the helper binary register-guest to register a guest on a given homeserver and write an appropriate config file.

register-guest takes the following options:

--config-file= to specify the config file, defaulting to ./config.json.

--homeserver-url= to specify the Homeserver URL to use, defaulting to https://matrix.org.

The main binary, matrix-static exhibits the following controls:

Accepts PORT= env variable to determine what port to use, defaulting to port 8000 if one is not specified. Will panic if port is in use.

Accepts the following command line arguments:

--config-file= to specify the config file, defaulting to ./config.json.

--enable-pprof if set, enables the /debug/pprof endpoints for debugging.

--enable-prometheus-metrics if set, enables the /metrics endpoint for metrics.

--num-workers= to specify the number of worker goroutines to start, defaults to 32.

--public-serve-prefix= to specify the router prefix to use for the user-facing html-serving routes, defaults to /.

--logger-directory to specify where the output logs should go.

--cache-ttl to specify how long since last access to keep a room in memory and up to date for, defaults to 30 minutes.

--cache-min-rooms to specify the minimum number of rooms to always keep in memory, defaults to 10.

Support

Currently hosted at https://view.matrix.org

Discussion Matrix Room is #matrix-static:matrix.org

matrix-static's People

Contributors

aaronraimist avatar ara4n avatar erikjohnston avatar gary-kim avatar progval avatar rreuvekamp avatar t3chguy avatar turt2live avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matrix-static's Issues

workaround federation inpeekability

I feel like the horrific hack to work around the federation peeking issue is to have static try and register a guest account on whatever HS it's trying to look at (probably (and horrifically) based on room id) - Cadair

Room name first in the title

Nit: with the name last, and more than one room open, there's no at-a-glance distinction between rooms:

image

Consider naming the room first.

For example, instead of the current arrangement:

Matrix Static - Public Room Timeline - Manjaro

– this:

Manjaro – public timeline – Matrix Static

Todo List

  • Historical Member Info
  • make Peeking more useful (pagination etc)
  • investigate additional meta useful for spidering
  • make cache invalidate after N requests or M minutes
  • sort memberlist
  • paginate memberlist
  • linkify-js style thing
  • handle redactions
  • sanitize unbalanced closing tags
  • don't backpaginate if has reached m.room.create / smart about m.room.history_visibility

Renderers for common events:

  • m.text
  • m.emote
  • m.notice
  • html formatted m.text/m.emote/m.notice
  • m.image
  • m.file
  • m.location
  • m.video
  • m.audio

Renderers for room state changes:

  • m.room.member
  • m.room.name
  • m.room.topic
  • m.room.avatar
  • m.room.third_party_invite
  • m.room.power_levels
  • m.room.history_visibility -ish?
  • m.room.join_rules

Make it obvious how to join a room

I only found out about /aliases by accident, and was otherwise left quite confused trying to join a room I found on view.matrix.org. A fat button in the top right taking me to matrix.to might make sense. Thanks for your consideration.

matrix-static does not start if initial request to client/r0/publicRooms times out

When starting, matrix-static can panic mid-startup when it's doing it's initial sync of publicRooms:

panic: Get <<REDACTED - client/r0/publicRooms url with access token>>: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

goroutine 1 [running]:
github.com/t3chguy/matrix-static/mxclient.(*Client).NewWorldReadableRooms(0xc4202d90a0, 0xd)
        /home/matrixstatic/matrix-static/src/github.com/t3chguy/matrix-static/mxclient/public-rooms.go:53 +0x8d
main.main()
        /home/matrixstatic/matrix-static/src/github.com/t3chguy/matrix-static/matrix-static.go:93 +0x368
error: Forever detected script exited with code: 2

This isn't particularly fatal, we can just restart matrix-static until it completes, but adding a longer timeout may be useful here.

Provide stylesheet file

Hi, @t3chguy!

I've read about your work at Matrix.org status update

After visiting your Heroku app I would like to ask you, whether you could add a CSS file instead of styling inline? This way, web designers could use Stylish/edit the stylesheet using browser developer tools and send a PR with an updated stylesheet without needing to know, how to build a local version of the website.

Do you have any mockups on how you would like to see the app look like?

Display link for files

Zip, Image, Audio, Video files are shown as m.file.Event, instead there should be a link to download that file.

Sanity check API parameters

We don't validate that page is >= 0, so we can panic when we attempt to access negative indices in an array.

panic: runtime error: slice bounds out of range

goroutine 61 [running]:
main.RoomMembersJob.Work(0xc4203ae0fe, 0x1e, 0xfffffffffffffffe, 0x14, 0xc420de00c0)
/home/matrixstatic/matrix-static/src/github.com/t3chguy/matrix-static/job-room-members.go:41 +0x687
main.(*RoomMembersJob).Work(0xc421ae0420, 0xc420de00c0)
:7 +0x72
main.(*Worker).Start(0xc420de00c0)
/home/matrixstatic/matrix-static/src/github.com/t3chguy/matrix-static/workers.go:38 +0x75
created by main.NewWorker
/home/matrixstatic/matrix-static/src/github.com/t3chguy/matrix-static/workers.go:88 +0x141

Room list – Public Rooms, view.matrix.org/?page=0 – relatively slow, heavyweight

https://view.matrix.org/?page=0

2019-12-30 15:45:11

Around fifty seconds to load finish when e.g. the network console is open, in Firefox 71.0, before loading the page.

Then a waiting period before the application becomes responsive, but this is probably an issue with Firefox. Screen recording:

2019-12-30 15:45 Firefox 71.0.zip

Not so long when web developer tools are in use but still, it's remarkably slow to load in some browsers.

panic

[GIN] 2019/02/09 - 11:35:10 | 200 ESC[0m|  985.490869ms | 54.36.148.31 |  ESC[0m GET     /api/room/!byVSIeqgYCNgmluYKv:outcasts.win/
time="2019-02-09T11:35:36Z" level=info msg="Started Initial Syncing Room" roomID="!AEhkQDKeSJvwkKyIHq:matrix.org" worker=14
time="2019-02-09T11:35:38Z" level=info msg="Finished Initial Syncing Room" roomID="!AEhkQDKeSJvwkKyIHq:matrix.org" worker=14
panic: runtime error: slice bounds out of range

goroutine 41 [running]:
main.RoomMembersJob.Work(0xc4331f01ee, 0x1e, 0x0, 0x14, 0xc420ed7ce0)
        /home/matrixstatic/matrix-static/src/github.com/t3chguy/matrix-static/job-room-members.go:41 +0x687
main.(*RoomMembersJob).Work(0xc420dd9540, 0xc420ed7ce0)
        <autogenerated>:7 +0x72
main.(*Worker).Start(0xc420ed7ce0)
        /home/matrixstatic/matrix-static/src/github.com/t3chguy/matrix-static/workers.go:38 +0x75
created by main.NewWorker
        /home/matrixstatic/matrix-static/src/github.com/t3chguy/matrix-static/workers.go:88 +0x141

Older direct links stop working

I opened this message direct link from Jul 5

https://view.matrix.org/room/!wSdymYrEpBhsWlDJuk:decred.org/?anchor=$153090455433548QNlFj:decred.org

and it showed "Some error has occurred". Then I removed the anchor part from the URL to open latest messages in the room and pressed "Load older messages" until I reached Jul 5 and it showed the message I was after. Then I visited initial direct link again and it opened.

Example of direct link that doesn't work (until someone visits it via "Load older messages"):

https://view.matrix.org/room/!OfChXgczrIlpEZSFAv:decred.org/?anchor=$153125687135698lmQRO:decred.org

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.