Giter Club home page Giter Club logo

matrix-media-logging-widget's Introduction

matrix-media-logging-widget

Log your your tv show viewings directly to a matrix room to share what you've been watching.

Uses TheMovieDatabase API to look up TvShows/Seasons.

Widget pages require matrix authentication (seemlessly thru the widget-api, if the matrix client supports it), so your TMDB proxy endpoints aren't public to the world

โš ๏ธ Use allowlistHomeserver setting to restrict access. Restrict access by room is on roadmap

Example

Imagine a search input for tv shows, a dropdown to select a season and a submit button. When you submit, it sends a matrix message like "I watched Season 6 of Game of Thrones". That message will also embed an external tv show id so it can be cross referenced by any other future matrix application with access to the chat room.

Demo

Develop

This project uses Sveltekit

yarn install

# create & configure .env

yarn dev

# if debug=true, open http://localhost:5173/auth in browser, else see Run step 2 below

Run

1. Bootstrap server & widget webapp

Use node 16.9+

# clone repo
yarn install

yarn build

# create & configure .env

# optionally configure port in pm2.config.js

yarn global add pm2
pm2 start pm2.config.js

1.5. Optional, but recommended: Setup reverse-proxy for https

The widget server uses http, so you'll need to put it behind a reverse-proxy (like Caddy, Traefik, or Nginx) to access the widget securely with https.

2. Add Widget to your matrix room

Element-Web command: /addwidget https://your-homeserver.tld:3047/auth?widgetId=$matrix_widget_id&userId=$matrix_user_id

Config

Configured via .env file in the root of this project.

See ./src/lib/settings.ts for descriptions of each setting

Restricted config example

tmdbApiKey=topsecret1234
allowlistHomeserver=your-homeserver.tld

Restricts use of the widget ui and the api's they communicate with, to matrix user id's that use the your-homeserver.tld homeserver, eg @nik0kin:your-homeserver.tld

Open config example

tmdbApiKey=topsecret1234
debug=true

Debug mode turns authentication off, opening up the widget server & ui to be used by anyone to request tv show info.

Importantly, this still does not allow anyone to post on anyone's behalf via the widget.

Matrix requirements

MSC1690 - Widget Authenticiation (Client & Server)

MSC2762 - Widget sending messages on user's behalf (Client only)

Known Issues

Widget server authentication does not work in Element-Desktop (userid cookie is missing for subsequent api requests - ./src/hooks.ts might need to be rewritten/rethought)

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.