From 5942c95bc3786a06f3a5a7fb8922ddec13883236 Mon Sep 17 00:00:00 2001 From: luke-hagar-sp <98849695+luke-hagar-sp@users.noreply.github.com> Date: Fri, 22 Jul 2022 20:40:11 -0500 Subject: [PATCH] stopping --- index.js | 24 +++++++++++++++++------- package.json | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 3a8b514..0aa2331 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,9 @@ import { PlexOauth, IPlexClientDetails } from "plex-oauth"; import v4 from "uuid/dist/v4"; import axios from "axios"; import qs from "qs"; -var PlexAPIOauth = /** @class */ function ( +class PlexAPIOauth { + + constructor( clientId, product = "Plex-API-OAuth", device = "Web Client", @@ -10,6 +12,13 @@ var PlexAPIOauth = /** @class */ function ( forwardUrl = "", platform = "Web" ) { + this.clientId = clientId; + this.product = product + this.device = device + this.version = version + this.forwardUrl = forwardUrl + this.platform = platform + if (clientId === null) { var clientId = localStorage.getItem("plex-client-id"); //Defaults to last used ClientId from any previous runs } @@ -39,12 +48,15 @@ var PlexAPIOauth = /** @class */ function ( console.log("Plex DataBase:"); console.log(plexData); - function openInNewTab(url) { +} + + + openInNewTab(url) { var separateWindow = window.open(url, "_blank"); separateWindow?.focus; } - var clientInformation = { + plexClientInformation = { clientIdentifier: clientId, // This is a unique identifier used to identify your app with Plex. - If none is provided a new one is generated and saved locally product: product, // Name of your application - Defaults to Plex-API-OAuth device: device, // The type of device your application is running on - Defaults to "Web Client" @@ -53,7 +65,7 @@ var PlexAPIOauth = /** @class */ function ( platform: platform, // Platform your application runs on - Defaults to 'Web' }; - var plexOauth = new PlexOauth(clientInformation); + plexOauth = new PlexOauth(plexClientInformation); // Get hosted UI URL and Pin Id async function plexLogin() { @@ -159,6 +171,4 @@ var PlexAPIOauth = /** @class */ function ( return plexData.plexLibraries; } }; -module.exports = { - PlexAPIOauth: PlexAPIOauth, -}; +export { PlexAPIOauth }; diff --git a/package.json b/package.json index 8d15004..92d95ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plex-api-oauth", - "version": "1.0.2", + "version": "1.0.3", "description": "An NPM Module designed to make Plex Media Server and plex.tv API calls easier to implement in JavaScript and React projects", "main": "index.js", "scripts": {