diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..cedf24f1 --- /dev/null +++ b/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + "@babel/preset-env" + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 48880af2..6478c06f 100755 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,5 @@ GapsAsJar/* !GapsAsJar/start.bat !GapsAsJar/gaps.nsi .DS_Store + +coverage/ diff --git a/Core/pom.xml b/Core/pom.xml index 67064e7c..f8e2c84c 100755 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.9.5 + 0.9.6 4.0.0 diff --git a/Dockerfile b/Dockerfile index fa5956b9..000d9464 100755 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.6.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index 4f7aaaa9..8aa27745 100755 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -36,7 +36,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.6.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.ppc64le b/Dockerfile.ppc64le index 467f9253..b5eb4753 100755 --- a/Dockerfile.ppc64le +++ b/Dockerfile.ppc64le @@ -32,7 +32,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.6.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.raspbian b/Dockerfile.raspbian index 6b3d69c6..3456ca4b 100755 --- a/Dockerfile.raspbian +++ b/Dockerfile.raspbian @@ -32,7 +32,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.6.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/Dockerfile.riscv64 b/Dockerfile.riscv64 index 8b9f48fb..1d9496aa 100755 --- a/Dockerfile.riscv64 +++ b/Dockerfile.riscv64 @@ -36,7 +36,7 @@ RUN mkdir -p /usr/app && chmod 777 /usr/data WORKDIR /usr/app -COPY GapsWeb/target/GapsWeb-0.9.5.jar /usr/app/gaps.jar +COPY GapsWeb/target/GapsWeb-0.9.6.jar /usr/app/gaps.jar COPY start.sh /usr/app/ diff --git a/GapsAsJar/gaps.nsi b/GapsAsJar/gaps.nsi index da27367d..0327893d 100644 --- a/GapsAsJar/gaps.nsi +++ b/GapsAsJar/gaps.nsi @@ -48,4 +48,4 @@ RMDIR /r $INSTDIR SectionEnd # name the installer -OutFile "gaps-0.9.5-installer.exe" \ No newline at end of file +OutFile "gaps-0.9.6-installer.exe" \ No newline at end of file diff --git a/GapsWeb/pom.xml b/GapsWeb/pom.xml index 5d4d9b62..49b5c5d4 100755 --- a/GapsWeb/pom.xml +++ b/GapsWeb/pom.xml @@ -5,7 +5,7 @@ Gaps com.jasonhhouse - 0.9.5 + 0.9.6 4.0.0 diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/WebSecurityConfig.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/WebSecurityConfig.java index fd983d0b..042c4ab8 100644 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/WebSecurityConfig.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/WebSecurityConfig.java @@ -53,40 +53,27 @@ protected void configure(HttpSecurity http) throws Exception { if (gapsConfiguration.getLoginEnabled() && gapsConfiguration.getSslEnabled()) { LOGGER.info("Login Enabled. Configuring site security with ssl."); - http.cors().and().csrf().disable() - .authorizeRequests().antMatchers("/images/gaps.ico", - "/css/bootstrap.min.css", - "/css/input.min.css", - "/js/jquery-3.4.1.min.js", - "/js/bootstrap.bundle.min.js", - "/js/index.min.js", - "/images/final-2.svg", - "/images/final-gaps.svg").permitAll() - .anyRequest().fullyAuthenticated() - .and() - .formLogin() - .loginPage("/login") - .permitAll() + http.cors().and().csrf().disable() + .authorizeRequests() + .antMatchers("/rss/**").permitAll() + .anyRequest() + .authenticated() .and() - .logout() - .permitAll(); + .httpBasic(); } else if (Boolean.TRUE.equals(gapsConfiguration.getLoginEnabled()) && Boolean.FALSE.equals(gapsConfiguration.getSslEnabled())) { LOGGER.info("Login Enabled. Configuring site security without ssl."); http.cors().and().csrf().disable() .authorizeRequests() - .anyRequest().fullyAuthenticated() - .and() - .formLogin() - .loginPage("/login") - .defaultSuccessUrl("/home") - .permitAll() + .antMatchers("/rss/**").permitAll() + .anyRequest() + .authenticated() .and() - .logout() - .permitAll(); - + .httpBasic(); } else { + //TODO + //Test needing cors and csrf disabled http.cors().and().csrf().disable(); } } diff --git a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/GapsController.java b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/GapsController.java index fb7b0b58..b944840d 100755 --- a/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/GapsController.java +++ b/GapsWeb/src/main/java/com/jasonhhouse/gaps/controller/GapsController.java @@ -94,13 +94,6 @@ public ModelAndView getAbout() { return modelAndView; } - @GetMapping(value = "/login", - produces = MediaType.TEXT_HTML_VALUE) - public ModelAndView getLogin() { - LOGGER.info("getLogin()"); - return new ModelAndView("login"); - } - @GetMapping(value = "/updates", produces = MediaType.TEXT_HTML_VALUE) public ModelAndView getUpdates() { diff --git a/GapsWeb/src/main/resources/application.yaml b/GapsWeb/src/main/resources/application.yaml index 68a0d70b..e35a9949 100755 --- a/GapsWeb/src/main/resources/application.yaml +++ b/GapsWeb/src/main/resources/application.yaml @@ -50,7 +50,7 @@ info: app: name: Gaps description: Gaps searches through your Plex Server or local folders for all movies, then queries for known movies in the same collection. If those movies don't exist in your library, Gaps will recommend getting those movies, legally of course. - version: 0.9.5 + version: 0.9.6 storageFolder: /usr/data properties: rssFeed: rssFeed.json diff --git a/GapsWeb/src/main/resources/static/js/modules/common.js b/GapsWeb/src/main/resources/static/js/modules/common.js index a6b400f9..6af28847 100755 --- a/GapsWeb/src/main/resources/static/js/modules/common.js +++ b/GapsWeb/src/main/resources/static/js/modules/common.js @@ -18,6 +18,21 @@ export function getContextPath(url) { return url; } +export function getYear(year) { + if ((year && year !== -1) && (year && year !== 0)) { + return ` (${year})`; + } + return ''; +} + +export function isEqual(a, b) { + return a === b; +} + +export function isNotOwned(value) { + return !value; +} + export async function getOwnedMoviesForTable(url, movieContainer, noMovieContainer, moviesTable) { const response = await fetch(getContextPath(url), { method: 'get', diff --git a/GapsWeb/src/main/resources/static/js/page/recommended.js b/GapsWeb/src/main/resources/static/js/page/recommended.js index 33621db3..0b8f538d 100755 --- a/GapsWeb/src/main/resources/static/js/page/recommended.js +++ b/GapsWeb/src/main/resources/static/js/page/recommended.js @@ -12,7 +12,9 @@ /* global Handlebars, SockJS, Stomp */ /* eslint no-undef: "error" */ -import { getContextPath, getRecommendedMoviesForTable } from '../modules/common.min.js'; +import { + getContextPath, getRecommendedMoviesForTable, getYear, isEqual, isNotOwned, +} from '../modules/common.min.js'; import Payload from '../modules/payload.min.js'; let libraryTitle; @@ -118,18 +120,9 @@ function copyToClipboard() { jQuery(($) => { Handlebars.registerHelper({ - isNotOwned(value) { - return !value; - }, - isEqual(a, b) { - return a === b; - }, - getYear(year) { - if (year && (year !== -1 || year !== 0)) { - return ` (${year})`; - } - return ''; - }, + isNotOwned, + isEqual, + getYear, }); libraryTitle = $('#libraryTitle'); @@ -227,7 +220,4 @@ jQuery(($) => { window.copyToClipboard = copyToClipboard; }); -window.onbeforeunload = function () { - disconnect(); - // return false; -}; +window.onbeforeunload = disconnect; diff --git a/GapsWeb/src/main/resources/templates/about.html b/GapsWeb/src/main/resources/templates/about.html index d4ab068b..4d48432f 100755 --- a/GapsWeb/src/main/resources/templates/about.html +++ b/GapsWeb/src/main/resources/templates/about.html @@ -29,7 +29,7 @@ Gaps Logo

About

-

v0.9.5

+

v0.9.6

Gaps searches through your Plex Server. It then queries for known diff --git a/GapsWeb/src/main/resources/templates/index.html b/GapsWeb/src/main/resources/templates/index.html index 2d269444..61106eb6 100755 --- a/GapsWeb/src/main/resources/templates/index.html +++ b/GapsWeb/src/main/resources/templates/index.html @@ -27,7 +27,7 @@

Gaps Logo -

v0.9.5

+

v0.9.6

Gaps searches through your Plex Server. It then queries for known diff --git a/GapsWeb/src/main/resources/templates/login.html b/GapsWeb/src/main/resources/templates/login.html deleted file mode 100644 index 23636ece..00000000 --- a/GapsWeb/src/main/resources/templates/login.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - Gaps - - - - - - - - - - -

-
- Gaps Logo - -
- Invalid username and password. -
-
- You have been logged out. -
-
-
- - -
-
- - -
- -
-
- - - - - - \ No newline at end of file diff --git a/GapsWeb/src/main/resources/templates/updates.html b/GapsWeb/src/main/resources/templates/updates.html index 090e46f4..40d22dc2 100755 --- a/GapsWeb/src/main/resources/templates/updates.html +++ b/GapsWeb/src/main/resources/templates/updates.html @@ -28,6 +28,13 @@ Gaps Logo

Updates

+

v0.9.6

+ +

v0.9.5