Giter VIP home page Giter VIP logo

Comments (16)

lokenx avatar lokenx commented on July 30, 2024

Yeah I do agree with you, and I am leaning towards it. I've only used Meteor accounts on a sign up as you want so will have to see how it works with accept/deny. I have heard in passing there is a way to require the user to have like a sign-up token or code or something would could work too.

from plexrequests-meteor.

curlz620 avatar curlz620 commented on July 30, 2024

Giving out a token or pin of sorts is not a bad idea either. You can just send out emails to new users so that could work.

from plexrequests-meteor.

Jeradin avatar Jeradin commented on July 30, 2024

I came up with a little different solution to handle this.

Accessing the plex.tv API to find out the admins "friends" (PMS server shares) and allowing the user to authenticate with their Plex username.

The user is presented with a "Enter Your Plex Username" screen if there is no Plex authentication session set or the admin is not logged in. I had to add 2 packages, one is u2622:persistent-session to allow sessions to be saved in localStorage and work across tabs and closing the window, also peerlibrary:xml2js to make it easy to convert the Plex XML api into json.

I will be honest my code is pretty messy and can be cleaned up a ton! I am also not sure how I feel about saving my Plex password in the mongoDB, but I could not figure out how else to do it.

The reason I like this direction more than user accounts is:

  1. Only people you have shared your server with can request movies from you.
  2. Your friends who hate creating accounts only need to remember their Plex username (which is hard enough for most of them!)

I am storing a session for the username of the person, and hopefully can build that into the Movie collection so you know who requested what movie.

I did not add a pull request because I think the code needs to be cleaned up before it can be put in production: https://github.com/Jeradin/plexrequests-meteor

from plexrequests-meteor.

Jeradin avatar Jeradin commented on July 30, 2024

Obvious things to be added (outside of code cleanup):

  1. Only show "Sign In with Username form" if Plex authentication is set to true.
  2. Add admin Plex username to plexuser session.
  3. Add plexuser column to Movies.collections for storing the below info.
  4. Add Session.get("plexuser") to movie results (maybe only show this for admin account?)
  5. Add an option for a user to not set a persistent login / remove a auth session.

from plexrequests-meteor.

Jeradin avatar Jeradin commented on July 30, 2024

I rebuilt the Plex auth check to not save the plex.tv login and password in a collection. now there is a login form which gets the admins Plex token and saves that to the settings DB so users can login with their username.

The Plex login page helpers need to be fixed, to check for the Plex settings being active and also some other cleanup on that code chunk.
To Login and get token from Plex, use this page: http://localhost:3000/plex

from plexrequests-meteor.

lokenx avatar lokenx commented on July 30, 2024

Quickly scanned it this morning before work and it looks good. You haven't setup the login page for the admin user yet correct or did I just miss that template? We'd also need to restrict that page access to the admin user (or in this case the only Meteor.user) account like the CP test page. I'm hoping to finish TV show searches tonight and then SickBeard/Rage integration maybe tomorrow (or tonight we'll see) and then I can test out your auth stuff and merge it in after that, this weekend maybe?

Don't worry too much about messy account right now. 1. I'm new to Meteor and the web side of coding myself so I'm not one to say anything about messy code 2. Once TV shows are working and your Auth stuff get's pulled in I'm putting features on hold while I clean up code, document/comment more thoroughly, and write some tests in (not sure how they work with Meteor)

from plexrequests-meteor.

hthighway avatar hthighway commented on July 30, 2024

@Jeradin
Nice work on the plex API, I noticed though that if you have "Plex Home" enabled none of the users that are in your "Plex Home" can log in. Only users that you have shared with but not also added them to Plex Home.

Note: these are user that have free plex accounts not managed users

from plexrequests-meteor.

Jeradin avatar Jeradin commented on July 30, 2024

Good catch @hthighway I didn't have any managed users, but ran a test. The feed for managed users only has a title, not a username, I switched that in the API call and they should work now.

from plexrequests-meteor.

Jeradin avatar Jeradin commented on July 30, 2024

You haven't setup the login page for the admin user yet correct or did I just miss that template?
@lokenx

It is the plex.html template file in the client directory, I kind of followed suit with your couchpotato file. I used a helper to check if( Session.get("plexauthuser") || Meteor.userId() ). The page needs error handling and some tweaks for sure.

from plexrequests-meteor.

lokenx avatar lokenx commented on July 30, 2024

Ah OK must have missed it! I just pushed TV Search results to Dev with the idea of doing the sickbeard tonight but just realized that sick beard uses The TVDB for ID numbers instead of IMDB's (which to be fair makes sense)...so that work was all for nothing!

Relating back to this Issue though because of that I'm going to put your Auth stuff ahead of TV (as TV now requires XML which I know little about and yours will be adding an XML to JSON package anyway) so I'll be cloning your repo and giving it a test and such so we can merge.

I'll also probably do code cleanup and file re-organization before TV to make it easier as it was hellish in the current state.

from plexrequests-meteor.

Jeradin avatar Jeradin commented on July 30, 2024

Cool man! I commented some of my code to maybe help a bit on some issues/thoughts of how to change things.. So glad you started this, its made me want to develop in Meteor.js more, super cool.

Sorry you went down the wrong road on the TV thing, part of the joys of coding, right? =)

from plexrequests-meteor.

lokenx avatar lokenx commented on July 30, 2024

Gone through most of it and all seems good! Main functionality seems to work great! Made some small changes:

I’ve made it so the admin user doesn’t need to be logged in, and being logged in isn’t enough, they have to have the token set (which gets set when they setup Plex Auth), added new setting variable which is the admin’s Plex username to allow the above. Also once we tagged movies with the requesting user the admin user gets tagged as well.

Cleaned up the home.html for when the user doesn’t have a token so it fits more in style with the rest of the application and to give them some info as to what they’re entering their username for. Will do the same for the Plex page, will make it similar to the Couch Potato page.

Added alert dialogs for when the user isn't on the friends list and for when admin user doesn't authenticate against Plex.tv (the Plex.tv one is rudimentary and doesn't check if it's a 401 or anything, just takes anything that isn't a 201 and complains).

Moved some code around and cleaned up in a few small places, nothing major just so I could read it easier.

Now do you want me to merge into your branch and them into mine? Or merge yours as is into mine and then make changes that way? The only thing I'd want to change before pushing it really is making the /plex more informative as I mentioned above, after that I'm happy with it being pushed into my Dev and letting people test it out

from plexrequests-meteor.

Jeradin avatar Jeradin commented on July 30, 2024

Good thinking related to just checking the token instead of being logged in!

Ya the Plex API needs to be updated with better error reporting, that caused me some trouble.

I added a pull request for the code. *but do what ever is easier, I am still semi new to pulls, merges and git.

from plexrequests-meteor.

Jeradin avatar Jeradin commented on July 30, 2024

As a side note, it might be worth it to look at this repo as its built on node.js for the Plex API: https://github.com/phillipj/node-plex-api

might be overkill for just querying the friends list though.

from plexrequests-meteor.

lokenx avatar lokenx commented on July 30, 2024

Ah cool, and yeah, plus it's querying the server directly which means the users would have to both inserting another IP instead of just using Plex.tv--easier I'd say!

And OK thanks, I'm new too so I'm defs no authority on what's better. Just seems simpler, only need one pull/merge instead of two!

from plexrequests-meteor.

lokenx avatar lokenx commented on July 30, 2024

Merged and updated on Dev with my few changes (think I botched the pull requests but oh well, it got in).

from plexrequests-meteor.

Related Issues (20)

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.