Es-module requires file extension, updated all imports
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
"url": "https://www.opensource.org/licenses/mit-license.php"
|
||||
},
|
||||
"main": "webserver/server.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "SEASONED_CONFIG=configurations/production.json NODE_ENV=production node src/webserver/server.js",
|
||||
"dev": "SEASONED_CONFIG=configurations/development.json NODE_ENV=development node src/webserver/server.js",
|
||||
|
||||
11
src/cache/redis.js
vendored
11
src/cache/redis.js
vendored
@@ -1,5 +1,5 @@
|
||||
import redis from "redis";
|
||||
import Configuration from "../config/configuration";
|
||||
import Configuration from "../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
let client;
|
||||
@@ -38,7 +38,7 @@ try {
|
||||
});
|
||||
} catch (e) {}
|
||||
|
||||
export function set(key, value, TTL = 10800) {
|
||||
function set(key, value, TTL = 10800) {
|
||||
if (value == null || key == null) return null;
|
||||
|
||||
const json = JSON.stringify(value);
|
||||
@@ -61,7 +61,7 @@ export function set(key, value, TTL = 10800) {
|
||||
return value;
|
||||
}
|
||||
|
||||
export function get(key) {
|
||||
function get(key) {
|
||||
return new Promise((resolve, reject) => {
|
||||
client.get(key, (error, reply) => {
|
||||
if (reply === null) {
|
||||
@@ -72,3 +72,8 @@ export function get(key) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
set,
|
||||
get
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Filters from "./filters";
|
||||
import EnvironmentVariables from "./environmentVariables";
|
||||
import Filters from "./filters.js";
|
||||
import EnvironmentVariables from "./environmentVariables.js";
|
||||
|
||||
class Field {
|
||||
constructor(rawValue, environmentVariables) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import SqliteDatabase from "./sqliteDatabase";
|
||||
import Configuration from "../config/configuration";
|
||||
import SqliteDatabase from "./sqliteDatabase.js";
|
||||
import Configuration from "../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import Media from "./media";
|
||||
import Media from "./media.js";
|
||||
|
||||
class Plex extends Media {
|
||||
constructor(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable camelcase */
|
||||
import Media from "./media";
|
||||
import Media from "./media.js";
|
||||
|
||||
class TMDB extends Media {
|
||||
// constructor(...args) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Configuration from "../config/configuration";
|
||||
import Configuration from "../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import http from "http";
|
||||
import { URL } from "url";
|
||||
import PythonShell from "python-shell";
|
||||
|
||||
import establishedDatabase from "../database/database";
|
||||
import cache from "../cache/redis";
|
||||
import establishedDatabase from "../database/database.js";
|
||||
import cache from "../cache/redis.js";
|
||||
|
||||
function getMagnetFromURL(url) {
|
||||
return new Promise(resolve => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Episode from "./types/episode";
|
||||
import Episode from "./types/episode.js";
|
||||
|
||||
function convertPlexToEpisode(plexEpisode) {
|
||||
const episode = new Episode(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Movie from "./types/movie";
|
||||
import Movie from "./types/movie.js";
|
||||
|
||||
function convertPlexToMovie(plexMovie) {
|
||||
const movie = new Movie(plexMovie.title, plexMovie.year);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import Plex from "../media_classes/plex";
|
||||
import Plex from "../media_classes/plex.js";
|
||||
|
||||
function translateAdded(date_string) {
|
||||
return new Date(date_string * 1000);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Show from "./types/show";
|
||||
import Show from "./types/show.js";
|
||||
|
||||
function convertPlexToShow(plexShow) {
|
||||
const show = new Show(plexShow.title, plexShow.year);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import convertPlexToSeasoned from "./convertPlexToSeasoned";
|
||||
import convertStreamToMediaInfo from "./convertStreamToMediaInfo";
|
||||
import convertStreamToPlayer from "./stream/convertStreamToPlayer";
|
||||
import convertStreamToUser from "./stream/convertStreamToUser";
|
||||
import ConvertStreamToPlayback from "./stream/convertStreamToPlayback";
|
||||
import convertPlexToSeasoned from "./convertPlexToSeasoned.js";
|
||||
import convertStreamToMediaInfo from "./convertStreamToMediaInfo.js";
|
||||
import convertStreamToPlayer from "./stream/convertStreamToPlayer.js";
|
||||
import convertStreamToUser from "./stream/convertStreamToUser.js";
|
||||
import ConvertStreamToPlayback from "./stream/convertStreamToPlayback.js";
|
||||
|
||||
function convertPlexToStream(plexStream) {
|
||||
const stream = convertPlexToSeasoned(plexStream);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import MediaInfo from "../media_classes/mediaInfo";
|
||||
import MediaInfo from "../media_classes/mediaInfo.js";
|
||||
|
||||
function convertStreamToMediaInfo(plexStream) {
|
||||
const mediaInfo = new MediaInfo();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import convertPlexToMovie from "./convertPlexToMovie";
|
||||
import convertPlexToShow from "./convertPlexToShow";
|
||||
import convertPlexToEpisode from "./convertPlexToEpisode";
|
||||
import redisCache from "../cache/redis";
|
||||
import convertPlexToMovie from "./convertPlexToMovie.js";
|
||||
import convertPlexToShow from "./convertPlexToShow.js";
|
||||
import convertPlexToEpisode from "./convertPlexToEpisode.js";
|
||||
import redisCache from "../cache/redis.js";
|
||||
|
||||
class PlexRequestTimeoutError extends Error {
|
||||
constructor() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import convertPlexToSeasoned from "./convertPlexToSeasoned";
|
||||
import convertPlexToStream from "./convertPlexToStream";
|
||||
import convertPlexToSeasoned from "./convertPlexToSeasoned.js";
|
||||
import convertPlexToStream from "./convertPlexToStream.js";
|
||||
|
||||
// eslint-disable-next-line
|
||||
function addAttributeIfTmdbInPlex(_tmdb, plexResult) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import PlexRepository from "./plexRepository";
|
||||
import TMDB from "../tmdb/tmdb";
|
||||
import establishedDatabase from "../database/database";
|
||||
import Configuration from "../config/configuration";
|
||||
import PlexRepository from "./plexRepository.js";
|
||||
import TMDB from "../tmdb/tmdb.js";
|
||||
import establishedDatabase from "../database/database.js";
|
||||
import Configuration from "../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const plexRepository = new PlexRepository(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Player from "../../media_classes/player";
|
||||
import Player from "../../media_classes/player.js";
|
||||
|
||||
function convertStreamToPlayer(plexStream) {
|
||||
const player = new Player(plexStream.device, plexStream.address);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import User from "../../media_classes/user";
|
||||
import User from "../../media_classes/user.js";
|
||||
|
||||
function convertStreamToUser(plexStream) {
|
||||
return new User(plexStream.id, plexStream.title);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import assert from "assert";
|
||||
// const configuration = require("../config/configuration").getInstance();
|
||||
// const TMDB = require("../tmdb/tmdb");
|
||||
import establishedDatabase from "../database/database";
|
||||
import establishedDatabase from "../database/database.js";
|
||||
|
||||
// const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
|
||||
@@ -45,4 +45,4 @@ function validFilter(filterParam) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = { validSort, validFilter };
|
||||
export default { validSort, validFilter };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import establishedDatabase from "../database/database";
|
||||
import establishedDatabase from "../database/database.js";
|
||||
|
||||
class SearchHistoryCreateDatabaseError extends Error {
|
||||
constructor(message = "an unexpected error occured", errorResponse = null) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import assert from "assert";
|
||||
import pythonShell from "python-shell";
|
||||
import Stray from "./stray";
|
||||
import establishedDatabase from "../database/database";
|
||||
import Stray from "./stray.js";
|
||||
import establishedDatabase from "../database/database.js";
|
||||
|
||||
class StrayRepository {
|
||||
constructor(database) {
|
||||
|
||||
@@ -75,4 +75,4 @@ class Tautulli {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Tautulli;
|
||||
export default Tautulli;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import assert from "assert";
|
||||
import establishedDatabase from "../database/database";
|
||||
import establishedDatabase from "../database/database.js";
|
||||
|
||||
class Cache {
|
||||
constructor(database) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import moviedb from "km-moviedb";
|
||||
import redisCache from "../cache/redis";
|
||||
import redisCache from "../cache/redis.js";
|
||||
|
||||
const { Movie, Show, Person, Credits, ReleaseDates } = require("./types");
|
||||
import { Movie, Show, Person, Credits, ReleaseDates } from "./types.js";
|
||||
|
||||
class TMDBNotFoundError extends Error {
|
||||
constructor(message) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Movie from "./types/movie";
|
||||
import Show from "./types/show";
|
||||
import Person from "./types/person";
|
||||
import Credits from "./types/credits";
|
||||
import ReleaseDates from "./types/releaseDates";
|
||||
import Movie from "./types/movie.js";
|
||||
import Show from "./types/show.js";
|
||||
import Person from "./types/person.js";
|
||||
import Credits from "./types/credits.js";
|
||||
import ReleaseDates from "./types/releaseDates.js";
|
||||
|
||||
export default { Movie, Show, Person, Credits, ReleaseDates };
|
||||
export { Movie, Show, Person, Credits, ReleaseDates };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable camelcase */
|
||||
import Movie from "./movie";
|
||||
import Show from "./show";
|
||||
import Movie from "./movie.js";
|
||||
import Show from "./show.js";
|
||||
|
||||
class CreditedMovie extends Movie {}
|
||||
class CreditedShow extends Show {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import jwt from "jsonwebtoken";
|
||||
import User from "./user";
|
||||
import User from "./user.js";
|
||||
|
||||
class Token {
|
||||
constructor(user, admin = false, settings = null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import assert from "assert";
|
||||
import establishedDatabase from "../database/database";
|
||||
import establishedDatabase from "../database/database.js";
|
||||
|
||||
class LinkPlexUserError extends Error {
|
||||
constructor(errorMessage = null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import bcrypt from "bcrypt";
|
||||
import UserRepository from "./userRepository";
|
||||
import UserRepository from "./userRepository.js";
|
||||
|
||||
class UserSecurity {
|
||||
constructor(database) {
|
||||
|
||||
@@ -3,67 +3,69 @@ import Raven from "raven";
|
||||
import cookieParser from "cookie-parser";
|
||||
import bodyParser from "body-parser";
|
||||
|
||||
import Configuration from "../config/configuration";
|
||||
|
||||
import reqTokenToUser from "./middleware/reqTokenToUser";
|
||||
import mustBeAuthenticated from "./middleware/mustBeAuthenticated";
|
||||
import mustBeAdmin from "./middleware/mustBeAdmin";
|
||||
import mustHaveAccountLinkedToPlex from "./middleware/mustHaveAccountLinkedToPlex";
|
||||
|
||||
import listController from "./controllers/list/listController";
|
||||
import tautulli from "./controllers/user/viewHistory";
|
||||
import SettingsController from "./controllers/user/settings";
|
||||
import AuthenticatePlexAccountController from "./controllers/user/authenticatePlexAccount";
|
||||
|
||||
import Configuration from "../config/configuration.js";
|
||||
const configuration = Configuration.getInstance();
|
||||
|
||||
import UserRegisterController from "./controller/user/register";
|
||||
import UserLoginController from "./controller/user/login";
|
||||
import UserLogoutController from "./controller/user/logout";
|
||||
import UserSearchHistoryController from "./controllers/user/searchHistory";
|
||||
import UserRequestsController from "./controllers/user/requests";
|
||||
import reqTokenToUser from "./middleware/reqTokenToUser.js";
|
||||
import mustBeAuthenticated from "./middleware/mustBeAuthenticated.js";
|
||||
import mustBeAdmin from "./middleware/mustBeAdmin.js";
|
||||
import mustHaveAccountLinkedToPlex from "./middleware/mustHaveAccountLinkedToPlex.js";
|
||||
|
||||
import SearchMultiController from "./controllers/search/multiSearch";
|
||||
import SearchMovieController from "./controllers/search/movieSearch";
|
||||
import SearchShowController from "./controllers/search/showSearch";
|
||||
import SearchPersonController from "./controllers/search/personSearch";
|
||||
import tautulli from "./controllers/user/viewHistory.js";
|
||||
import {
|
||||
getSettingsController,
|
||||
updateSettingsController
|
||||
} from "./controllers/user/settings.js";
|
||||
import AuthenticatePlexAccountController from "./controllers/user/authenticatePlexAccount.js";
|
||||
|
||||
import MovieCreditsController from "./controllers/movie/credits";
|
||||
import MovieReleaseDatesController from "./controllers/movie/releaseDates";
|
||||
import MovieInfoController from "./controllers/movie/info";
|
||||
import UserRegisterController from "./controllers/user/register.js";
|
||||
import UserLoginController from "./controllers/user/login.js";
|
||||
import UserLogoutController from "./controllers/user/logout.js";
|
||||
import UserSearchHistoryController from "./controllers/user/searchHistory.js";
|
||||
import UserRequestsController from "./controllers/user/requests.js";
|
||||
|
||||
import ShowCreditsController from "./controllers/show/credits";
|
||||
import ShowInfoController from "./controllers/show/info";
|
||||
import SearchMultiController from "./controllers/search/multiSearch.js";
|
||||
import SearchMovieController from "./controllers/search/movieSearch.js";
|
||||
import SearchShowController from "./controllers/search/showSearch.js";
|
||||
import SearchPersonController from "./controllers/search/personSearch.js";
|
||||
|
||||
import PersonCreditsController from "./controllers/person/credits";
|
||||
import PersonInfoController from "./controllers/person/info";
|
||||
import listController from "./controllers/list/listController.js";
|
||||
|
||||
import SeasonedAllController from "./controllers/seasoned/readStrays";
|
||||
import SeasonedInfoController from "./controllers/seasoned/strayById";
|
||||
import SeasonedVerifyController from "./controllers/seasoned/verifyStray";
|
||||
import MovieCreditsController from "./controllers/movie/credits.js";
|
||||
import MovieReleaseDatesController from "./controllers/movie/releaseDates.js";
|
||||
import MovieInfoController from "./controllers/movie/info.js";
|
||||
|
||||
import PlexSearchController from "./controllers/plex/search";
|
||||
import PlexRequestsAllController from "./controllres/plex/requests/all";
|
||||
import PlexRequestsInfo from "./controllers/plex/updateRequested";
|
||||
import PlexWatchLinkController from "./controllers/plex/watchDirectLink";
|
||||
import PlexHookController from "./controllers/plex/hookDump";
|
||||
import PlexSubmitRequestController from "./controllers/plex/submitRequest";
|
||||
import PlexRequestInfo from "./controllers/plex/readRequest";
|
||||
import PlexSearchRequestController from "./controllers/plex/searchRequest";
|
||||
import PlexPlayingController from "./controllers/plex/plexPlaying";
|
||||
import PlexSearchMediaController from "./controllres/plex/searchMedia";
|
||||
import PlexUpdateRequestedController from "./controllers/plex/updateRequested";
|
||||
import ShowCreditsController from "./controllers/show/credits.js";
|
||||
import ShowInfoController from "./controllers/show/info.js";
|
||||
|
||||
import RequestFetchAllController from "./controllers/request/fetchAllRequests";
|
||||
import RequestAllController from "./controllers/plex/fetchRequested";
|
||||
import RequestInfoController from "./controllers/request/getRequest";
|
||||
import RequestSubmitController from "./controllers/request/requestTmdbId";
|
||||
import PersonCreditsController from "./controllers/person/credits.js";
|
||||
import PersonInfoController from "./controllers/person/info.js";
|
||||
|
||||
import PirateSearchController from "./controllers/pirate/search";
|
||||
import PirateAddController from "./controllers/pirate/addMagnet";
|
||||
import SeasonedAllController from "./controllers/seasoned/readStrays.js";
|
||||
import SeasonedInfoController from "./controllers/seasoned/strayById.js";
|
||||
import SeasonedVerifyController from "./controllers/seasoned/verifyStray.js";
|
||||
|
||||
import GitDumpController from "./controllres/git/dump";
|
||||
import EmojiController from "./controllers/misc/emoji";
|
||||
import PlexSearchController from "./controllers/plex/search.js";
|
||||
import PlexFetchRequestedController from "./controllers/plex/fetchRequested.js";
|
||||
import PlexRequestsInfo from "./controllers/plex/updateRequested.js";
|
||||
import PlexWatchLinkController from "./controllers/plex/watchDirectLink.js";
|
||||
import PlexHookController from "./controllers/plex/hookDump.js";
|
||||
import PlexSubmitRequestController from "./controllers/plex/submitRequest.js";
|
||||
import PlexRequestInfo from "./controllers/plex/readRequest.js";
|
||||
import PlexSearchRequestController from "./controllers/plex/searchRequest.js";
|
||||
import PlexPlayingController from "./controllers/plex/plexPlaying.js";
|
||||
import PlexSearchMediaController from "./controllers/plex/searchMedia.js";
|
||||
import PlexUpdateRequestedController from "./controllers/plex/updateRequested.js";
|
||||
|
||||
import RequestFetchAllController from "./controllers/request/fetchAllRequests.js";
|
||||
import RequestInfoController from "./controllers/request/getRequest.js";
|
||||
import RequestSubmitController from "./controllers/request/requestTmdbId.js";
|
||||
|
||||
import PirateSearchController from "./controllers/pirate/searchTheBay.js";
|
||||
import PirateAddController from "./controllers/pirate/addMagnet.js";
|
||||
|
||||
import GitDumpController from "./controllers/git/dumpHook.js";
|
||||
import EmojiController from "./controllers/misc/emoji.js";
|
||||
|
||||
// TODO: Have our raven router check if there is a value, if not don't enable raven.
|
||||
Raven.config(configuration.get("raven", "DSN")).install();
|
||||
@@ -119,16 +121,8 @@ router.post("/v1/user", UserRegisterController);
|
||||
router.post("/v1/user/login", UserLoginController);
|
||||
router.post("/v1/user/logout", UserLogoutController);
|
||||
|
||||
router.get(
|
||||
"/v1/user/settings",
|
||||
mustBeAuthenticated,
|
||||
SettingsController.getSettingsController
|
||||
);
|
||||
router.put(
|
||||
"/v1/user/settings",
|
||||
mustBeAuthenticated,
|
||||
SettingsController.updateSettingsController
|
||||
);
|
||||
router.get("/v1/user/settings", mustBeAuthenticated, getSettingsController);
|
||||
router.put("/v1/user/settings", mustBeAuthenticated, updateSettingsController);
|
||||
router.get(
|
||||
"/v1/user/search_history",
|
||||
mustBeAuthenticated,
|
||||
@@ -220,7 +214,7 @@ router.get("/v1/plex/watch-link", mustBeAuthenticated, PlexWatchLinkController);
|
||||
router.get("/v2/request", RequestFetchAllController);
|
||||
router.get("/v2/request/:id", RequestInfoController);
|
||||
router.post("/v2/request", RequestSubmitController);
|
||||
router.get("/v1/plex/requests/all", RequestAllController);
|
||||
router.get("/v1/plex/requests/all", PlexFetchRequestedController);
|
||||
router.put(
|
||||
"/v1/plex/request/:requestId",
|
||||
mustBeAuthenticated,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import GitRepository from "../../../git/gitRepository";
|
||||
import GitRepository from "../../../git/gitRepository.js";
|
||||
|
||||
const gitRepository = new GitRepository();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
@@ -51,17 +51,27 @@ function fetchTmdbList(req, res, listname, type) {
|
||||
);
|
||||
}
|
||||
|
||||
export const nowPlayingMovies = (req, res) =>
|
||||
const nowPlayingMovies = (req, res) =>
|
||||
fetchTmdbList(req, res, "miscNowPlayingMovies", "movie");
|
||||
export const popularMovies = (req, res) =>
|
||||
const popularMovies = (req, res) =>
|
||||
fetchTmdbList(req, res, "miscPopularMovies", "movie");
|
||||
export const topRatedMovies = (req, res) =>
|
||||
const topRatedMovies = (req, res) =>
|
||||
fetchTmdbList(req, res, "miscTopRatedMovies", "movie");
|
||||
export const upcomingMovies = (req, res) =>
|
||||
const upcomingMovies = (req, res) =>
|
||||
fetchTmdbList(req, res, "miscUpcomingMovies", "movie");
|
||||
export const nowPlayingShows = (req, res) =>
|
||||
const nowPlayingShows = (req, res) =>
|
||||
fetchTmdbList(req, res, "tvOnTheAir", "show");
|
||||
export const popularShows = (req, res) =>
|
||||
const popularShows = (req, res) =>
|
||||
fetchTmdbList(req, res, "miscPopularTvs", "show");
|
||||
export const topRatedShows = (req, res) =>
|
||||
const topRatedShows = (req, res) =>
|
||||
fetchTmdbList(req, res, "miscTopRatedTvs", "show");
|
||||
|
||||
export default {
|
||||
nowPlayingMovies,
|
||||
popularMovies,
|
||||
topRatedMovies,
|
||||
upcomingMovies,
|
||||
nowPlayingShows,
|
||||
popularShows,
|
||||
topRatedShows
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Plex from "../../../plex/plex";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import Plex from "../../../plex/plex.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(Configuration.get("tmdb", "apiKey"));
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
const personCreditsController = (req, res) => {
|
||||
const personId = req.params.id;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
* @Last Modified time: 2017-10-21 15:32:43
|
||||
*/
|
||||
|
||||
import PirateRepository from "../../../pirate/pirateRepository";
|
||||
import { AddMagnet } from "../../../pirate/pirateRepository.js";
|
||||
|
||||
function addMagnet(req, res) {
|
||||
const { magnet, name } = req.body;
|
||||
const tmdbId = req.body?.tmdb_id;
|
||||
|
||||
PirateRepository.AddMagnet(magnet, name, tmdbId)
|
||||
AddMagnet(magnet, name, tmdbId)
|
||||
.then(result => res.send(result))
|
||||
.catch(error => {
|
||||
res.status(500).send({ success: false, message: error.message });
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @Last Modified time: 2018-02-26 19:56:32
|
||||
*/
|
||||
|
||||
import PirateRepository from "../../../pirate/pirateRepository";
|
||||
import { SearchPiratebay } from "../../../pirate/pirateRepository.js";
|
||||
// const pirateRepository = new PirateRepository();
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ import PirateRepository from "../../../pirate/pirateRepository";
|
||||
function updateRequested(req, res) {
|
||||
const { query, page, type } = req.query;
|
||||
|
||||
PirateRepository.SearchPiratebay(query, page, type)
|
||||
SearchPiratebay(query, page, type)
|
||||
.then(result => {
|
||||
res.send({ success: true, results: result });
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import RequestRepository from "../../../plex/requestRepository";
|
||||
import RequestRepository from "../../../plex/requestRepository.js";
|
||||
|
||||
const requestRepository = new RequestRepository();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import PlexRepository from "../../../plex/plexRepository";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import PlexRepository from "../../../plex/plexRepository.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
|
||||
@@ -19,4 +19,4 @@ function playingController(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = playingController;
|
||||
export default playingController;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import RequestRepository from "../../../plex/requestRepository";
|
||||
import RequestRepository from "../../../plex/requestRepository.js";
|
||||
|
||||
const requestRepository = new RequestRepository();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Plex from "../../../plex/plex";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import Plex from "../../../plex/plex.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import PlexRepository from "../../../plex/plexRepository";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import PlexRepository from "../../../plex/plexRepository.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SearchHistory from "../../../searchHistory/searchHistory";
|
||||
import Cache from "../../../tmdb/cache";
|
||||
import RequestRepository from "../../../plex/requestRepository";
|
||||
import SearchHistory from "../../../searchHistory/searchHistory.js";
|
||||
import Cache from "../../../tmdb/cache.js";
|
||||
import RequestRepository from "../../../plex/requestRepository.js";
|
||||
|
||||
const cache = new Cache();
|
||||
const requestRepository = new RequestRepository(cache);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import RequestRepository from "../../../request/request";
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import RequestRepository from "../../../request/request.js";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import RequestRepository from "../../../plex/requestRepository";
|
||||
import RequestRepository from "../../../plex/requestRepository.js";
|
||||
|
||||
const requestRepository = new RequestRepository();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Plex from "../../../plex/plex";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import Plex from "../../../plex/plex.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const plex = new Plex(configuration.get("plex", "ip"));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import RequestRepository from "../../../request/request";
|
||||
import RequestRepository from "../../../request/request.js";
|
||||
|
||||
const request = new RequestRepository();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import RequestRepository from "../../../request/request";
|
||||
import RequestRepository from "../../../request/request.js";
|
||||
|
||||
const request = new RequestRepository();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import RequestRepository from "../../../request/request";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import RequestRepository from "../../../request/request.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import SearchHistory from "../../../searchHistory/searchHistory";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import SearchHistory from "../../../searchHistory/searchHistory.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import SearchHistory from "../../../searchHistory/searchHistory";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import SearchHistory from "../../../searchHistory/searchHistory.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import SearchHistory from "../../../searchHistory/searchHistory";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import SearchHistory from "../../../searchHistory/searchHistory.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SearchHistory from "../../../searchHistory/searchHistory";
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import SearchHistory from "../../../searchHistory/searchHistory.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import StrayRepository from "../../../seasoned/strayRepository";
|
||||
import StrayRepository from "../../../seasoned/strayRepository.js";
|
||||
|
||||
const strayRepository = new StrayRepository();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import StrayRepository from "../../../seasoned/strayRepository";
|
||||
import StrayRepository from "../../../seasoned/strayRepository.js";
|
||||
|
||||
const strayRepository = new StrayRepository();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import StrayRepository from "../../../seasoned/strayRepository";
|
||||
import StrayRepository from "../../../seasoned/strayRepository.js";
|
||||
|
||||
const strayRepository = new StrayRepository();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import TMDB from "../../../tmdb/tmdb";
|
||||
import Plex from "../../../plex/plex";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import TMDB from "../../../tmdb/tmdb.js";
|
||||
import Plex from "../../../plex/plex.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import FormData from "form-data";
|
||||
import UserRepository from "../../../user/userRepository";
|
||||
import UserRepository from "../../../user/userRepository.js";
|
||||
|
||||
const userRepository = new UserRepository();
|
||||
|
||||
@@ -61,7 +61,7 @@ function plexAuthenticate(username, password) {
|
||||
return fetch(url, options).then(resp => handleResponse(resp));
|
||||
}
|
||||
|
||||
export function link(req, res) {
|
||||
function link(req, res) {
|
||||
const user = req.loggedInUser;
|
||||
const { username, password } = req.body;
|
||||
|
||||
@@ -86,7 +86,7 @@ export function link(req, res) {
|
||||
);
|
||||
}
|
||||
|
||||
export function unlink(req, res) {
|
||||
function unlink(req, res) {
|
||||
const username = req.loggedInUser ? req.loggedInUser.username : null;
|
||||
|
||||
return userRepository
|
||||
@@ -108,3 +108,5 @@ export function unlink(req, res) {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export default { link, unlink };
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import User from "../../../user/user";
|
||||
import Token from "../../../user/token";
|
||||
import UserSecurity from "../../../user/userSecurity";
|
||||
import UserRepository from "../../../user/userRepository";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import User from "../../../user/user.js";
|
||||
import Token from "../../../user/token.js";
|
||||
import UserSecurity from "../../../user/userSecurity.js";
|
||||
import UserRepository from "../../../user/userRepository.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const secret = configuration.get("authentication", "secret");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import User from "../../../user/user";
|
||||
import Token from "../../../user/token";
|
||||
import UserSecurity from "../../../user/userSecurity";
|
||||
import Configuration from "../../../config/configuration";
|
||||
import User from "../../../user/user.js";
|
||||
import Token from "../../../user/token.js";
|
||||
import UserSecurity from "../../../user/userSecurity.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const secret = configuration.get("authentication", "secret");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import RequestRepository from "../../../plex/requestRepository";
|
||||
import RequestRepository from "../../../plex/requestRepository.js";
|
||||
|
||||
const requestRepository = new RequestRepository();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import SearchHistory from "../../../searchHistory/searchHistory";
|
||||
import SearchHistory from "../../../searchHistory/searchHistory.js";
|
||||
|
||||
const searchHistory = new SearchHistory();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import UserRepository from "../../../user/userRepository";
|
||||
import UserRepository from "../../../user/userRepository.js";
|
||||
|
||||
const userRepository = new UserRepository();
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import configuration from "../../../config/configuration";
|
||||
import Tautulli from "../../../tautulli/tautulli";
|
||||
import Tautulli from "../../../tautulli/tautulli.js";
|
||||
import Configuration from "../../../config/configuration.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const apiKey = configuration.get("tautulli", "apiKey");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import establishedDatabase from "../../database/database";
|
||||
import establishedDatabase from "../../database/database.js";
|
||||
|
||||
// eslint-disable-next-line consistent-return
|
||||
const mustBeAdmin = (req, res, next) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import establishedDatabase from "../../database/database";
|
||||
import establishedDatabase from "../../database/database.js";
|
||||
|
||||
/* eslint-disable consistent-return */
|
||||
const mustHaveAccountLinkedToPlex = (req, res, next) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import Configuration from "../../config/configuration";
|
||||
import Token from "../../user/token";
|
||||
import Configuration from "../../config/configuration.js";
|
||||
import Token from "../../user/token.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
const secret = configuration.get("authentication", "secret");
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import Configuration from "../config/configuration";
|
||||
import app from "./app";
|
||||
import Configuration from "../config/configuration.js";
|
||||
import app from "./app.js";
|
||||
|
||||
const configuration = Configuration.getInstance();
|
||||
|
||||
export default app.listen(config.get("webserver", "port"), () => {
|
||||
export default app.listen(configuration.get("webserver", "port"), () => {
|
||||
/* eslint-disable no-console */
|
||||
console.log("seasonedAPI");
|
||||
console.log(`Database is located at ${config.get("database", "host")}`);
|
||||
console.log(`Webserver is listening on ${config.get("webserver", "port")}`);
|
||||
console.log(
|
||||
`Database is located at ${configuration.get("database", "host")}`
|
||||
);
|
||||
console.log(
|
||||
`Webserver is listening on ${configuration.get("webserver", "port")}`
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user