Skip to content

Commit

Permalink
Merge pull request #237 from JasonHHouse/improvement/improved_logging
Browse files Browse the repository at this point in the history
Improvement/improved logging
  • Loading branch information
JasonHHouse authored Jun 5, 2021
2 parents 0da5677 + e9bff5a commit e4ff2ae
Show file tree
Hide file tree
Showing 32 changed files with 6,870 additions and 1,972 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-env"
]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ GapsAsJar/*
!GapsAsJar/start.bat
!GapsAsJar/gaps.nsi
.DS_Store

coverage/
2 changes: 1 addition & 1 deletion Core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>Gaps</artifactId>
<groupId>com.jasonhhouse</groupId>
<version>0.9.5</version>
<version>0.9.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ppc64le
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.raspbian
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.riscv64
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
2 changes: 1 addition & 1 deletion GapsAsJar/gaps.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ RMDIR /r $INSTDIR
SectionEnd

# name the installer
OutFile "gaps-0.9.5-installer.exe"
OutFile "gaps-0.9.6-installer.exe"
2 changes: 1 addition & 1 deletion GapsWeb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>Gaps</artifactId>
<groupId>com.jasonhhouse</groupId>
<version>0.9.5</version>
<version>0.9.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
37 changes: 12 additions & 25 deletions GapsWeb/src/main/java/com/jasonhhouse/gaps/WebSecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion GapsWeb/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions GapsWeb/src/main/resources/static/js/modules/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
24 changes: 7 additions & 17 deletions GapsWeb/src/main/resources/static/js/page/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -227,7 +220,4 @@ jQuery(($) => {
window.copyToClipboard = copyToClipboard;
});

window.onbeforeunload = function () {
disconnect();
// return false;
};
window.onbeforeunload = disconnect;
2 changes: 1 addition & 1 deletion GapsWeb/src/main/resources/templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<img loading="lazy" th:src="@{/images/final-2.svg}" alt="Gaps Logo" style="width:50%;height:50%;" class="center">

<h3 class="top-margin">About</h3>
<h4 class="top-margin text-primary">v0.9.5</h4>
<h4 class="top-margin text-primary">v0.9.6</h4>

<p class="text-muted">Gaps searches through your Plex Server. It then queries
for known
Expand Down
2 changes: 1 addition & 1 deletion GapsWeb/src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="container bottom-margin">
<img loading="lazy" th:src="@{/images/final-2.svg}" alt="Gaps Logo" style="width:50%;height:50%;" class="center">

<h3 class="top-margin">v0.9.5</h3>
<h3 class="top-margin">v0.9.6</h3>

<p class="text-muted">Gaps searches through your Plex Server. It then queries
for known
Expand Down
57 changes: 0 additions & 57 deletions GapsWeb/src/main/resources/templates/login.html

This file was deleted.

7 changes: 7 additions & 0 deletions GapsWeb/src/main/resources/templates/updates.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
<img loading="lazy" th:src="@{/images/final-2.svg}" alt="Gaps Logo" style="width:50%;height:50%;" class="center">

<h3 class="top-margin">Updates</h3>
<h4 class="top-margin text-primary">v0.9.6</h4>
<ul class="text-muted">
<li>Switching to Basic Login, removing login page</li>
<li>Adding Jest unit tests</li>
<li>Hibernate-Validator 6.1.5-Final</li>
</ul>

<h4 class="top-margin text-primary">v0.9.5</h4>
<ul class="text-muted">
<li>Adding years collection movies</li>
Expand Down
2 changes: 1 addition & 1 deletion Plex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>Gaps</artifactId>
<groupId>com.jasonhhouse</groupId>
<version>0.9.5</version>
<version>0.9.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion RadarrV3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>Gaps</artifactId>
<groupId>com.jasonhhouse</groupId>
<version>0.9.5</version>
<version>0.9.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Loading

0 comments on commit e4ff2ae

Please sign in to comment.