manifestinteractive / teleprompter

Browser-based TelePrompter with Remote Control
https://promptr.tv
Other
316 stars 113 forks source link

QRcode generation #30

Closed pranjalisnow closed 3 years ago

pranjalisnow commented 3 years ago

This is not actually an issue.

Wanted help on setting up for generating QRcode on a LAN-based website Currently, the QRcode is generated using this URL: https://promptr.tv/remote/socket.io/socket.io.js Tried downloading this JS and using, but didn't work.

Request for the steps to enable generating QRcode locally without internet access.

Regards.

LaughterOnWater commented 3 years ago

This package is tied in several of the documents to promptr.tv. Like you, I would rather serve the code locally. While it may technically be secure, it's my data in someone else's hands for reasons I don't know about. Cursorily, it looks like plugins.js has several functions, one of which probably has hidden the variable for the promptr.tv remote link used to create the canvas QR Code. From the point of view of a neophyte, it looks like Peter is hiding something for unknown reasons. Perhaps he'll explain why we can't simply host this locally for logical reasons. Peter?

manifestinteractive commented 3 years ago

@pranjalisnow The reason this did not work is because you cannot just download a socket. This needs to be run on a node server ( and not just that one file, you need to run the app that hosts that socket instance ).

All of the code you need to run this is already in the repo. You simply need to run the server.js file on a server using node.

You'll obviously also need to change all the https://promptr.tv/remote/socket.io/socket.io.js URL's to wherever you are running this server.

To be 100% clear, this repo and all of its code is for what is running on https://promptr.tv

You can certainly clone / fork this repo and use as you wish. There is nothing "hidden" in this code. If you are familiar with NPM, you can simply do the following to get your own version of the code running locally:

git clone https://github.com/manifestinteractive/teleprompter.git
cd teleprompter
npm install
npm start

But you will need to replace all instances of https://promptr.tv with your own server.

manifestinteractive commented 3 years ago

If it's helpful, this is the Nginx Config I use for my actual server. You will notice I made a custom route for /remote what is a proxy for port 3000. So if you just want to use the port as is, you will want to change https://promptr.tv/remote/socket.io/socket.io.js in the source code to wherever that actual server is running, e.g. http://localhost:3000/socket.io/socket.io.js

server {
  listen 80;
  listen [::]:80;
  server_name promptr.tv www.promptr.tv;
  return 301 https://$server_name$request_uri;
}

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  include snippets/ssl-promptr.tv.conf;
  include snippets/ssl-params.conf;
  include snippets/basic.conf;
  include snippets/error-pages.conf;

  add_header X-Frame-Options DENY;

  root /var/www/promptr.tv/html;
  index index.php index.html index.htm index.nginx-debian.html;

  server_name promptr.tv www.promptr.tv;

  location / {
    try_files $uri $uri/ =404;
  }

  location ^~ /remote/ {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_http_version 1.1;
    proxy_pass http://localhost:3000/;
  }
}
LaughterOnWater commented 3 years ago

These are all fantastic answers! This is a lovely piece of craftsmanship. I greatly appreciate your consideration for making it secure for each instance, and now understand that as a proof of concept it's the safest way to go! I'll see if I can set up a server on node and try it out! Thank you so much for making all of this clear.

pranjalisnow commented 3 years ago

Thank you, Peter.