Somme change for error page
This commit is contained in:
parent
a97e2b0fd1
commit
9702fa66bd
42
src/main/java/net/Broken/webView/MyErrorController.java
Normal file
42
src/main/java/net/Broken/webView/MyErrorController.java
Normal file
@ -0,0 +1,42 @@
|
||||
package net.Broken.webView;
|
||||
|
||||
import net.Broken.MainBot;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
|
||||
import org.springframework.boot.autoconfigure.web.ErrorController;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.CookieValue;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
|
||||
@Controller
|
||||
public class MyErrorController implements ErrorController {
|
||||
|
||||
@RequestMapping("/error")
|
||||
public String handleError(HttpServletRequest request, Model model, @CookieValue(value = "guild", defaultValue = "1") String guildId){
|
||||
Guild guild = MainBot.jda.getGuildById(guildId);
|
||||
if(guild != null)
|
||||
model.addAttribute("guild_name", guild.getName());
|
||||
else
|
||||
model.addAttribute("guild_name", "");
|
||||
model.addAttribute("redirect_url", System.getenv("OAUTH_URL"));
|
||||
Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
|
||||
if (status != null) {
|
||||
Integer statusCode = Integer.valueOf(status.toString());
|
||||
|
||||
if(statusCode == HttpStatus.NOT_FOUND.value()) {
|
||||
return "error/404";
|
||||
}
|
||||
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorPath() {
|
||||
return "/error";
|
||||
}
|
||||
}
|
@ -1,198 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html >
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
|
||||
<title>Claptrap Bot</title>
|
||||
<link rel="icon"
|
||||
type="image/x-icon"
|
||||
href="favicon.png"/>
|
||||
|
||||
<!-- CSS -->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
|
||||
<link href="/css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
|
||||
<link href="/css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
|
||||
</head>
|
||||
|
||||
<body class="blue-grey lighten-5" >
|
||||
|
||||
<nav class="blue-grey darken-4 z-depth-3" role="navigation" >
|
||||
<div class="nav-wrapper container">
|
||||
<a id="logo-container" href="/" class="brand-logo" style="white-space: nowrap">Claptrap Bot</a>
|
||||
<ul class="right hide-on-med-and-down">
|
||||
|
||||
<li class="" th:classappend="(${page} == 'home')? 'active' : ''">
|
||||
<a class="waves-effect waves-light" href="/">Home</a>
|
||||
</li>
|
||||
<li class="" th:classappend="(${page} == 'music')? 'active' : ''">
|
||||
<a class="waves-effect waves-light" href="/music">Music Control</a>
|
||||
</li>
|
||||
<li id="nav-bar-account">
|
||||
<a class="dropdown-account dropdown-trigger" data-target="dropdown_connected"><i class="material-icons">account_box</i></a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<a href="#" data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<ul id="nav-mobile" class="sidenav">
|
||||
<li class="center" th:classappend="(${page} == 'home')? 'active' : ''">
|
||||
<a class="waves-effect waves-light sidenav-trigger" href="/" data-target="slide-out">Home</a>
|
||||
</li>
|
||||
<li class="center" th:classappend="(${page} == 'music')? 'active' : ''">
|
||||
<a class="waves-effect waves-light" href="/music">Music Control</a>
|
||||
</li>
|
||||
|
||||
<li><div class="divider"></div></li>
|
||||
<li><a class="center nav-change-guild">Change Guild</a></li>
|
||||
<li>
|
||||
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Account</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Playlists</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
|
||||
<li><a class="center red-text nav-disconnect" style="font-weight: bold">Disconnect</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Dropdown connected -->
|
||||
<ul id="dropdown_connected" class="dropdown-content ">
|
||||
<li>
|
||||
<a class="center blue-grey-text text-darken-4 tooltipped" data-position="left" data-delay="50" data-tooltip="It's you !" id="nav-name" style="font-weight: bold"></a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li><a class="center nav-change-guild" >Change Guild</a></li>
|
||||
<li>
|
||||
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Account</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="center tooltipped" data-position="left" data-delay="50" data-tooltip="Under Development!">My Playlists</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
|
||||
<li><a class="center red-text nav-disconnect" style="font-weight: bold">Disconnect</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<!--________________________________________-->
|
||||
<!-- Connection modal -->
|
||||
<!--________________________________________-->
|
||||
<div id="modal_connection" class="modal">
|
||||
<div class="modal-content">
|
||||
<div class="row center">
|
||||
<div class="col s12">
|
||||
<h3 class="" style="font-weight: bold">Sign in</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row center" style="margin-bottom: 0px">
|
||||
<form name="login_form" id="login_form" action="javascript:void(0);" onsubmit="tryConnection()">
|
||||
<div class="row" style="margin-bottom: 0px">
|
||||
<div class="input-field col s6 offset-s3">
|
||||
<i class="material-icons prefix">account_box</i>
|
||||
<input name="username" id="user_input" type="text" class="validate"/>
|
||||
<label for="user_input" >User Name</label>
|
||||
<span class="helper-text" data-error="User not registered!"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="input-field col s6 offset-s3">
|
||||
<i class="material-icons prefix">security</i>
|
||||
<input name="password" id="password_input" type="password" class="validate"/>
|
||||
<label for="password_input">Password</label>
|
||||
<span class="helper-text" data-error="Wrong password!"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px">
|
||||
<button id="btn-submit-connect" class="btn waves-effect waves-light light-green darken-1 scale-transition scale-out" type="submit" name="action" >
|
||||
Submit<i class="material-icons right">send</i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<a class="btn waves-effect waves-light brown" href="/register">
|
||||
Create account<i class="material-icons right">person_add</i>
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--________________________________________-->
|
||||
<!-- Guild modal -->
|
||||
<!--________________________________________-->
|
||||
|
||||
<div id="modal_guild" class="modal">
|
||||
<div class="modal-content" style="padding-bottom: 0px">
|
||||
<div class="row" style="margin-bottom: 0px">
|
||||
<h3 class="col s12 center">Guild Selection</h3>
|
||||
<div class="col offset-s4 s4 center">
|
||||
<form id="guild_form" action="#" class="left-align">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" id="btn_ok_guild" class="modal-action modal-close waves-effect waves-green btn-flat disabled">Ok</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="radioTemplateGuild" class="" style="visibility: hidden; display: none ">
|
||||
<label>
|
||||
<input name="guildRadio" class="with-gap" type="radio" value="@id" id="@id"/>
|
||||
<span>@name</span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<!--__________________________________________________________-->
|
||||
<!-- -->
|
||||
<!-- END -->
|
||||
<!-- -->
|
||||
<!--__________________________________________________________-->
|
||||
|
||||
<div class="section no-pad-bot main" id="index-banner">
|
||||
|
||||
<div class="center row">
|
||||
<div class="row center">
|
||||
<div class="col l6 m12 s12">
|
||||
<h1 class="red-text text-darken-2 "><b>Oops!</b></h1>
|
||||
<h2 class=" blue-grey-text "><b>Page not found!</b></h2>
|
||||
<a class="btn btn-large light-green darken-3 waves-effect" href="/">
|
||||
<i class="large material-icons">home</i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col l6 m12 s12">
|
||||
<img class="" src="/img/404.gif" style="border:none;outline: none">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scripts-->
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.js"
|
||||
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
|
||||
crossorigin="anonymous"></script>
|
||||
|
||||
<script src="/js/materialize.js"></script>
|
||||
<script src="/js/navabar.js"></script>
|
||||
<script src="/js/js.cookie.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
70
src/main/resources/templates/error/404.html
Normal file
70
src/main/resources/templates/error/404.html
Normal file
@ -0,0 +1,70 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
|
||||
<title>Claptrap Bot</title>
|
||||
<link rel="icon"
|
||||
type="image/x-icon"
|
||||
href="/favicon.png"/>
|
||||
|
||||
<!-- CSS -->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
|
||||
<link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
|
||||
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
|
||||
<link rel="manifest" href="/manifest.json"/>
|
||||
<meta name="theme-color" content="#263238"/>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="blue-grey lighten-5" >
|
||||
|
||||
<div th:replace="header :: header ('home',${guild_name},${redirect_url})">...</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="section no-pad-bot main" id="index-banner">
|
||||
|
||||
<div class="center row">
|
||||
<div class="row center">
|
||||
<div class="col l6 m12 s12">
|
||||
<h1 class="red-text text-darken-2 "><b>Oops!</b></h1>
|
||||
<h2 class=" blue-grey-text "><b>Page not found!</b></h2>
|
||||
<a class="btn btn-large light-green darken-3 waves-effect" href="/">
|
||||
<i class="large material-icons">home</i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col l6 m12 s12">
|
||||
<img class="" src="/img/404.gif" style="border:none;outline: none"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var needLogin = true;
|
||||
</script>
|
||||
<!-- Scripts-->
|
||||
<script th:src="@{/js/jquery-3.3.1.min.js}"></script>
|
||||
<script th:src="@{/js/materialize.js}"></script>
|
||||
<script th:src="@{/js/navabar.js}"></script>
|
||||
<script th:src="@{/js/js.cookie.js}"></script>
|
||||
<script src="https://use.fontawesome.com/releases/v5.3.1/js/all.js" crossorigin="anonymous"></script>
|
||||
<script th:src="@{/js/workerRegister.js}"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user