Set indent size

This commit is contained in:
Damien Broqua 2022-02-13 18:07:53 +01:00
parent 33c87b434c
commit 3ebdc9c06a
9 changed files with 143 additions and 155 deletions

View file

@ -46,6 +46,7 @@
"connect-flash": "^0.1.1",
"connect-mongo": "^4.6.0",
"cookie-parser": "^1.4.6",
"debug": "^4.3.3",
"ejs": "^3.1.6",
"express": "^4.17.2",
"express-session": "^1.17.2",

View file

@ -50,10 +50,8 @@ if (["production"].indexOf(env) !== -1) {
/* eslint-disable func-names */
app.use((req, res, next) => {
if (req.secure) {
// request was via https, so do no special handling
next();
} else {
// request was via http, so redirect to https
res.redirect(`https://${req.headers.host}${req.url}`);
}
});

View file

@ -4,54 +4,49 @@
* Module dependencies.
*/
import app from '../app';
import debugLib from 'debug';
import http from 'http';
import {port} from '../config';
import debugLib from "debug";
import http from "http";
import app from "../app";
import { port } from "../config";
const debug = debugLib('nodecdtheque:server');
const debug = debugLib("nodecdtheque:server");
const server = http.createServer(app);
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Event listener for HTTP server "error" event.
* @param {*} error
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
if (error.syscall !== "listen") {
throw error;
}
const bind = typeof port === 'string' ?
'Pipe ' + port :
'Port ' + port;
const bind = typeof port === "string" ? `Pipe ${port}` : `Port ${port}`;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
switch (error.code) {
case "EACCES":
console.error(`${bind} requires elevated privileges`);
process.exit(1);
break;
case "EADDRINUSE":
console.error(`${bind} is already in use`);
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
const addr = server.address();
const bind = typeof addr === 'string' ?
'pipe ' + addr :
'port ' + addr.port;
debug('Listening on ' + bind);
const addr = server.address();
const bind =
typeof addr === "string" ? `pipe ${addr}` : `port ${addr.port}`;
debug(`Listening on ${bind}`);
}
server.listen(port);
server.on("error", onError);
server.on("listening", onListening);

View file

@ -1,23 +1,22 @@
<!DOCTYPE html>
<html lang="fr">
<%- include('partials/head', {page: page, user: user}); %>
<body class="error">
<%- include('partials/header'); %>
<main class="mt-4">
<div class="container">
<section class="px-md-5 mx-md-5 dark-grey-text mb-4">
<h1><%= page.title %></h1>
<% if ( errorCode && errorCode === 404 ) { %>
<img src="/img/404.svg" alt="Erreur 404" style="max-height: 400px;" />
<% } %>
<p class="lead">
<%= page.error %>
</p>
</section>
</div>
</main>
<%- include('partials/footer', {page: page, user: user, blog: null}); %>
</body>
<%- include('partials/head', {page: page, user: user}); %>
<body class="error">
<%- include('partials/header'); %>
<main class="mt-4">
<div class="container">
<section class="px-md-5 mx-md-5 dark-grey-text mb-4">
<h1><%= page.title %></h1>
<% if ( errorCode && errorCode === 404 ) { %>
<img src="/img/404.svg" alt="Erreur 404" style="max-height: 400px;" />
<% } %>
<p class="lead">
<%= page.error %>
</p>
</section>
</div>
</main>
<%- include('partials/footer', {page: page, user: user, blog: null}); %>
</body>
</html>

View file

@ -1,26 +1,27 @@
<!doctype html>
<html lang="fr">
<%- include('partials/head'); %>
<body>
<%- include('partials/header'); %>
<%- include('partials/head'); %>
<body>
<%- include('partials/header'); %>
<% if ( page.failureFlash ) {%>
<div class="alert alert-danger" role="alert">
<%= page.failureFlash %>
</div>
<% } %>
<%
if (error && error.length > 0) {
for( let i = 0 ; i < error.length ; i += 1 ) {
%>
<div class="alert alert-danger" role="alert">
<%= error %>
</div>
<%
}
}
%>
<%- include(viewname) %>
<%- include('partials/footer'); %>
</body>
<% if ( page.failureFlash ) {%>
<div class="alert alert-danger" role="alert">
<%= page.failureFlash %>
</div>
<% } %>
<%
if (error && error.length > 0) {
for( let i = 0 ; i < error.length ; i += 1 ) {
%>
<div class="alert alert-danger" role="alert">
<%= error %>
</div>
<%
}
}
%>
<%- include(viewname) %>
<%- include('partials/footer'); %>
</body>
</html>

View file

@ -1,26 +1,24 @@
<div class="container">
<div class="d-flex justify-content-center">
<div class="p-2">
<form class="text-center border border-light p-5" method="POST">
<img class="mb-4" src="/img/logo.png" alt="DarKou">
<p class="h4 mb-4">Connexion</p>
<div class="d-flex justify-content-center">
<div class="p-2">
<form class="text-center border border-light p-5" method="POST">
<img class="mb-4" src="/img/logo.png" alt="DarKou">
<p class="h4 mb-4">Connexion</p>
<div class="md-form">
<input type="email" id="email" name="email" class="form-control" required>
<label for="email">Adresse e-mail</label>
<div class="md-form">
<input type="email" id="email" name="email" class="form-control" required>
<label for="email">Adresse e-mail</label>
</div>
<div class="md-form">
<input type="password" id="password" name="password" class="form-control" required>
<label for="password">Mot de passe</label>
</div>
<button class="btn btn-primary btn-block my-4" type="submit">Connexion</button>
<p>Pas encore inscrit ? <a href="/inscription">Inscrivez-vous</a></p>
</form>
</div>
<div class="md-form">
<input type="password" id="password" name="password" class="form-control" required>
<label for="password">Mot de passe</label>
</div>
<button class="btn btn-primary btn-block my-4" type="submit">Connexion</button>
<p>Pas encore inscrit ?
<a href="/inscription">Inscrivez-vous</a>
</p>
</form>
</div>
</div>
</div>

View file

@ -1,31 +1,29 @@
<div class="container">
<div class="d-flex justify-content-center">
<div class="p-2">
<form class="text-center border border-light p-5" method="POST">
<img class="mb-4" src="/img/logo.png" alt="DarKou">
<p class="h4 mb-4">Inscription</p>
<div class="d-flex justify-content-center">
<div class="p-2">
<form class="text-center border border-light p-5" method="POST">
<img class="mb-4" src="/img/logo.png" alt="DarKou">
<p class="h4 mb-4">Inscription</p>
<div class="md-form">
<input type="text" id="username" name="username" class="form-control" required>
<label for="username">Nom d'utilisateur</label>
<div class="md-form">
<input type="text" id="username" name="username" class="form-control" required>
<label for="username">Nom d'utilisateur</label>
</div>
<div class="md-form">
<input type="email" id="email" name="email" class="form-control" required>
<label for="email">Adresse e-mail</label>
</div>
<div class="md-form">
<input type="password" id="password" name="password" class="form-control" required>
<label for="password">Mot de passe</label>
</div>
<button class="btn btn-primary btn-block my-4" type="submit">Inscription</button>
<p>Déjà inscrit ? <a href="/connexion">Connectez-vous</a></p>
</form>
</div>
<div class="md-form">
<input type="email" id="email" name="email" class="form-control" required>
<label for="email">Adresse e-mail</label>
</div>
<div class="md-form">
<input type="password" id="password" name="password" class="form-control" required>
<label for="password">Mot de passe</label>
</div>
<button class="btn btn-primary btn-block my-4" type="submit">Inscription</button>
<p>Déjà inscrit ?
<a href="/connexion">Connectez-vous</a>
</p>
</form>
</div>
</div>
</div>

View file

@ -1,18 +1,17 @@
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><% if (page.title) { %><%= page.title %> <% } else { %> DarKou - Ma CDThèque <% } %></title>
<link rel="icon" type="image/png" href="/favicon.png" />
<title><% if (page.title) { %><%= page.title %> <% } else { %> DarKou - Ma CDThèque <% } %></title>
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap">
<link rel="stylesheet" href="/libs/mdbootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/libs/mdbootstrap/css/mdb.min.css">
<link rel="stylesheet" href="/libs/mdbootstrap/css/style.css">
<link rel="stylesheet" href="/libs/mdbootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/libs/mdbootstrap/css/mdb.min.css">
<link rel="stylesheet" href="/libs/mdbootstrap/css/style.css">
<link rel="stylesheet" href="/css/main.css" />
<link rel="stylesheet" href="/css/main.css" />
</head>

View file

@ -1,25 +1,24 @@
<nav class="navbar navbar-expand-md navbar-dark primary-color sticky-top">
<a class="navbar-brand" href="/">CDThèque</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<a class="navbar-brand" href="/">CDThèque</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</button>
<% if ( user ) { %>
<div class="navbar-collapse collapse w-100 order-1 dual-collapse2">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="/upload">Ajouter une image</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
aria-expanded="false">Mon compte</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="/gallery">Mes images</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/se-deconnecter">Déconnexion</a>
</div>
</li>
</ul>
</div>
<% } %>
<% if ( user ) { %>
<div class="navbar-collapse collapse w-100 order-1 dual-collapse2">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="/upload">Ajouter une image</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Mon compte</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="/gallery">Mes images</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/se-deconnecter">Déconnexion</a>
</div>
</li>
</ul>
</div>
<% } %>
</nav>