├── .babelrc
├── .env
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── CODETOUR.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── config
├── env.js
├── paths.js
└── webpack
│ ├── loaders.js
│ ├── plugins.js
│ ├── static-files.js
│ ├── webpack.config.js
│ └── webpackDevServer.config.js
├── development.md
├── package-lock.json
├── package.json
├── screenshots
├── apply.png
├── recording.gif
└── search.png
├── scripts
├── build.js
├── chrome-launch.js
├── compress.js
├── dev.js
└── start.js
└── src
├── background
└── index.js
├── content_scripts
└── index.js
├── fonts
└── googlefonts
│ ├── noto-sans.css
│ └── roboto-mono.css
├── img
├── background.png
└── posterizer-icon.png
├── lib
└── js
│ └── plex.js
├── manifest.json
└── popup
├── App.css
├── App.js
├── components
├── plexLogin.js
├── searchItem.js
├── searchPage.js
├── settingsPage.js
└── topBar.js
├── dataStore.js
├── index.css
└── index.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "@babel/preset-env",
4 | "@babel/preset-react"
5 | ],
6 | "plugins": [
7 | "@babel/plugin-proposal-class-properties"
8 | ]
9 | }
--------------------------------------------------------------------------------
/.env:
--------------------------------------------------------------------------------
1 | GENERATE_SOURCEMAP=false
2 | INLINE_RUNTIME_CHUNK=false
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | /dist
2 | /node_modules
3 | /dev
4 | /extension
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | commonjs: true,
5 | es6: true,
6 | node: true,
7 | jest: true
8 | },
9 | extends: 'eslint:recommended',
10 | parser: 'babel-eslint',
11 | parserOptions: {
12 | sourceType: 'module',
13 | ecmaVersion: 2018,
14 | ecmaFeatures: {
15 | jsx: true,
16 | },
17 | },
18 | plugins: ['react'],
19 | rules: {
20 | "no-console": "off",
21 | "no-underscore-dangle": "off",
22 | "no-plusplus": "off",
23 | "no-continue": "off",
24 | "camelcase": "off",
25 | "no-empty": "off",
26 | "no-param-reassign": "off",
27 | "func-names": [
28 | "error",
29 | "never"
30 | ],
31 | "prefer-destructuring": [
32 | "error",
33 | {
34 | "object": false,
35 | "array": false
36 | }
37 | ],
38 | indent: ['error', 2, { SwitchCase: 1 }],
39 | quotes: ['error', 'single', { allowTemplateLiterals: true }],
40 | semi: ['error', 'always'],
41 | 'react/jsx-uses-vars': 1,
42 | 'react/jsx-uses-react': 1,
43 | 'spaced-comment': ['error', 'always', { exceptions: ['-', '+'] }],
44 | },
45 | };
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | try.js
3 | old-extension
4 | dist
5 | extension
6 | dev
7 | .vscode
--------------------------------------------------------------------------------
/CODETOUR.md:
--------------------------------------------------------------------------------
1 | # Code Tour
2 |
3 | A quick introduction to the folders and files in this repo.
4 |
5 | ## Project anatomy
6 |
7 | The **source** files which you will need to build the extension are present inside the [`src`](src) folder. Run `npm run chrome-launch` or `npm run firefox-launch` to see the changes that you make inside your `src` folder live in the browser.
8 |
9 | The project uses **Webpack** to bundle the project into a folder like `extension` in case of *production* build and `dev` in case of *development* build. A lot of different webpack plugins are used for the webpack bundling process which can be seen inside the [`config/webpack/plugins.js`](config/webpack/plugins.js) file.
10 | A big thanks to the [`Memex`](https://github.com/WorldBrain/Memex) project for helping in setting up the boilerplate code and to Facebook's [`create-react-app`](https://github.com/facebook/create-react-app) for helping in setup the webpack config.
11 |
12 | ## Source Organisation: [`src/`](src)
13 |
14 | To keep things modular, the resources are divided into folders namely `/background`, `/content_scripts`, `/options`, `/popup` and `/sidebar` and `manifest.json`. We can obviously introduce more as required.
15 |
16 | - ### [`/lib`](src/lib): Contains JS and CSS libraries which are not to be compiled and minified by webpack.
17 |
18 | The `/lib` folder is copied as it is to the build folder which is `extension` during production build and `dev` during development build. If you have vendor libraries like bootstrap.css, you can put it inside the lib folder. This comes handy when you have to used `chrome.tabs.executeScript()`, the script to be injected can be placed here.
19 |
20 | - [/lib/css](src/lib/css): Contains CSS files
21 | - [/lib/js](src/lib/js): Contains JS files
22 |
23 | - ### [`background`](src/background/): Contains scripts relating to the extension background page.
24 |
25 | - [**`index.js`**](src/background/index.js): All the contents of the background page goes inside the [index.js](src/background/index.js) file.
26 | Webpack bundles the `index.js` into `background.js` in the build folder. This allows the use of `import` and `require` statements inside the background page. All others scripts for background are refreneced here.
27 |
28 | - ### [`content_scripts`](src/content_scripts/): Contains scripts relating to the extension content_scripts page.
29 |
30 | Webpack bundles the `index.js` into `content_scripts.js` in the build folder.
31 |
32 | - [`index.js`](src/content_scripts/index.js): All the contents of the background page goes inside the [index.js](src/content_scripts/index.js) file.
33 | Webpack bundles the `index.js` into `content.js` in the build folder. This allows the use of `import` and `require` statements inside the background page.All others scripts for content_scripts are refreneced here.
34 |
35 | - ### [`popup`](src/popup/): Contains scripts relating to the extension popup page.
36 |
37 | Webpack bundles the `index.js` into `popup.js` in the build folder which is referenced inside the `popup.html`.
38 |
39 | - [`index.js`](src/popup/index.js): Main file which webpack looks for while bundling. All others scripts for popup are refreneced here.
40 | - [`template.html`](src/popup/template.html) - Provides the base for popup.html. All scripts and CSS file tags are added dynamically using Webpack at compile time.
41 |
42 | - ### [`options`](src/options/): Contains scripts relating to the extension options page.
43 |
44 | Webpack bundles the `index.js` into `options.js` in the build folder which is referenced inside the `options.html`.
45 |
46 | - [`index.js`](src/options/index.js): Main file which webpack looks for while bundling. All others scripts for options are refreneced here.
47 | - [`template.html`](src/options/template.html) - Provides the base for options.html. All scripts and CSS file tags are added dynamically using Webpack at compile time.
48 |
49 | - ### [`fonts`](src/fonts/): Contains CSS files for fonts used in the extension.
50 |
51 | - ### [`images`](src/img/): Contains images used in the extension
52 |
53 | ## [`Config folder`](config) :
54 |
55 | - [`webpack/`](config/webpack): Contains the webpack config file and all the files necessary for setting up the webpack config.
56 | - [`env.js`](config/env.js): Loads environment variables from `.env` . Reference taken from https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/env.js
57 | - [`paths.js`](config/paths.js): Returns an API that provides absolute paths for different files inside this project . Reference taken from https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/paths.js
58 |
59 | ## Other Config files
60 |
61 | - [`package.json`](package.json) - Contains project dependencies, info about project and run commands.
62 |
63 | - [`package-lock.json`](package-lock.json): npm config file (genertaed alongwith package.json). This shouldn't be modified unless you're adding new dependencies or updating them.
64 | - [`.eslintrc.js`](.eslintrc.js): ESLint config file
65 | - [`.eslintignore`](.eslintrc.js): Files to be ignored by ESLint.
66 | - [`.babelrc`](.babelrc): Babel config file.
67 | - [`.storybook`](.storybook): Config to setup storybook.
68 | ## Others
69 |
70 | - [`.gitignore`](.gitignore): Contains a list of files and folders to be ignored by git. [More about gitignore..](https://medium.com/@haydar_ai/learning-how-to-git-ignoring-files-and-folders-using-gitignore-177556afdbe3)
71 | - [`LICENSE`](LICENSE): license file. A software license tells others what they can and can't do with your source code. The most common licenses for open source projects are MIT, Apache, GNU... licenses. The license used in this project is the MIT license.
72 |
73 | ### MARKDOWNS
74 |
75 | - [`README.md`](CONTRIBUTING.md): Introduction to this project along with instructions to build and contribute to this project.
76 |
77 | - [`CONTRIBUTING.md`](CONTRIBUTING.md): Deatiled instructions on contributing to this project.
78 |
79 | - [`CODETOUR.md`](CODETOUR.md): A tour through all the files and folders of this project.
80 |
81 | Please feel free to make changes to the above documentation :)
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Thank You
2 |
3 | We are grateful that you considered contributing to React Extension Boilerplate. Please follow the below guidelines for contribution.
4 |
5 | Follow the golden rule
6 |
7 | > Code, Document, Raise Issues and Review like you have to explain everything to a new developer without saying a word.
8 |
9 | ## First Time
10 |
11 | The first thing to do always is to run the program and note how it works. One of the best ways to do this is to launch the application and go through the files that it launches in the sequential manner.
12 |
13 | Also take a note of the coding style and dependencies that the project follows.
14 |
15 | ## Choosing issues
16 |
17 | It is recommended to go through the issues tab once you have ran the program once and look for easy issues.
18 |
19 | If an issue is not assigned; follow through the comments, ask queries about it and then start working on it.
20 |
21 | ## Creating issues
22 |
23 | If you face any reproducable problem while launching the boilerplate or any feature you think should be there, file an issue in the github repository.
24 |
25 | It is expected that you will follow the below guidelines while creating issues:
26 |
27 | https://wiredcraft.com/blog/how-we-write-our-github-issues
28 |
29 | ## Sending a PR
30 |
31 | While sending a PR, always remember not to send one from your master branch; it'll lead to commit issues and mismatch.
32 |
33 | It is highly recommended to follow the below guidelines while writing commits and sending PRs:
34 |
35 | - https://blog.github.com/2015-01-21-how-to-write-the-perfect-pull-request/
36 | - https://code.likeagirl.io/useful-tips-for-writing-better-git-commit-messages-808770609503
37 |
38 | ## Communication
39 |
40 | Please join the [gitter channel](https://gitter.im/react-boilerplate-extension/community) for communication regarding the project. No personal communication will be entertained :)
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | MIT License
3 |
4 | Copyright (c) 2019 Minanshu Singh
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Posterizer browser extension for PosterDB and Plex
2 |
3 | Posterizer is made to quickly POST image URLs to Plex Media Server directly from the web while browsing poster sets on [ThePosterDB.com](https://theposterdb.com/)
4 |
5 | When looking at a TV show poster set while logged into ThePosterDB, the extension can be used to search for a show in your Plex library. Once a show is selected, the extension parses the HTML to find download URLs of each season poster and matches it up to the corresponding season in Plex which results in a list of POST URLs that can be used to update plex images. This means you don't need to right click on each image's download button, copy the url, then walk through the Plex edit menus and paste the URL - saving a crazy amount of time with no additional requests to either Plex or the PosterDB!
6 |
7 | #### Screenshots
8 | Search | Apply | Recording |
9 | :-------------------------:|:-------------------------:|:-------------------------:
10 |
|
|
11 |
12 | ### ToDo before it would be ready for public use:
13 |
14 |
15 | :white_check_mark: Plex oAUTH instead of simple form/API combo
16 | :white_check_mark: Ability to clear auth and cache
17 | :white_check_mark: Replace hard coded IP address calls to Plex API
18 | :white_check_mark: Fix matching for 'Specials' posters
19 | :large_orange_diamond: Detect API failure and respond appropriately
20 | :x: Movie/Collection compatability?
21 | :x: **PosterDB API instead of pulling from HTML**
22 |
23 |
24 |
25 | ## License
26 |
27 | The code is available under the [MIT license](LICENSE).
28 |
--------------------------------------------------------------------------------
/config/env.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const fs = require('fs');
4 | const path = require('path');
5 | const paths = require('./paths');
6 |
7 | // Make sure that including paths.js after env.js will read .env variables.
8 | delete require.cache[require.resolve('./paths')];
9 |
10 | const NODE_ENV = process.env.NODE_ENV;
11 | if (!NODE_ENV) {
12 | throw new Error(
13 | 'The NODE_ENV environment variable is required but was not specified.'
14 | );
15 | }
16 |
17 | // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
18 | var dotenvFiles = [
19 | `${paths.dotenv}.${NODE_ENV}.local`,
20 | `${paths.dotenv}.${NODE_ENV}`,
21 | // Don't include `.env.local` for `test` environment
22 | // since normally you expect tests to produce the same
23 | // results for everyone
24 | NODE_ENV !== 'test' && `${paths.dotenv}.local`,
25 | paths.dotenv,
26 | ].filter(Boolean);
27 |
28 | // Load environment variables from .env* files. Suppress warnings using silent
29 | // if this file is missing. dotenv will never modify any environment variables
30 | // that have already been set. Variable expansion is supported in .env files.
31 | // https://github.com/motdotla/dotenv
32 | // https://github.com/motdotla/dotenv-expand
33 | dotenvFiles.forEach(dotenvFile => {
34 | if (fs.existsSync(dotenvFile)) {
35 | require('dotenv-expand')(
36 | require('dotenv').config({
37 | path: dotenvFile,
38 | })
39 | );
40 | }
41 | });
42 |
43 | // We support resolving modules according to `NODE_PATH`.
44 | // This lets you use absolute paths in imports inside large monorepos:
45 | // https://github.com/facebook/create-react-app/issues/253.
46 | // It works similar to `NODE_PATH` in Node itself:
47 | // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
48 | // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
49 | // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
50 | // https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
51 | // We also resolve them to make sure all tools using them work consistently.
52 | const appDirectory = fs.realpathSync(process.cwd());
53 | process.env.NODE_PATH = (process.env.NODE_PATH || '')
54 | .split(path.delimiter)
55 | .filter(folder => folder && !path.isAbsolute(folder))
56 | .map(folder => path.resolve(appDirectory, folder))
57 | .join(path.delimiter);
58 |
--------------------------------------------------------------------------------
/config/paths.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const fs = require('fs');
3 | const url = require('url');
4 |
5 | require('colors');
6 |
7 | const appDirectory = fs.realpathSync(process.cwd());
8 | console.log(`appDirectory: ${appDirectory}`.yellow);
9 | const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
10 | console.log(resolveApp('.env').yellow);
11 |
12 | const envPublicUrl = process.env.PUBLIC_URL;
13 |
14 | function ensureSlash(inputPath, needsSlash) {
15 | const hasSlash = inputPath.endsWith('/');
16 | if (hasSlash && !needsSlash) {
17 | return inputPath.substr(0, inputPath.length - 1);
18 | } else if (!hasSlash && needsSlash) {
19 | return `${inputPath}/`;
20 | } else {
21 | return inputPath;
22 | }
23 | }
24 |
25 | const getPublicUrl = appPackageJson =>
26 | envPublicUrl || require(appPackageJson).homepage;
27 |
28 | // We use `PUBLIC_URL` environment variable or "homepage" field to infer
29 | // "public path" at which the app is served.
30 | // Webpack needs to know it to put the right