Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
f921d1fe75 | |||
46bc7f0013 | |||
21dc689c9a | |||
98d62e6883 | |||
e3a1db5200 | |||
4243d6e651 | |||
f056db13d8 | |||
43bf4c0baa | |||
ee51c4fe8a | |||
eafa16e46d | |||
12b340e0f1 | |||
353746b3d4 | |||
9982f1f1bf | |||
88ce85c422 | |||
74c5342633 | |||
7daccf6690 | |||
493b6973c5 | |||
7877729100 | |||
c9f45ef82f | |||
3bee5b2aed | |||
bf3c216ee0 | |||
be3107b7a8 | |||
77946ad1eb | |||
bbd50f6f4a | |||
2f7c9abdc8 | |||
f27c7a03f3 | |||
6e0958d45b | |||
7e5753900c | |||
d6d6332da2 | |||
e48e9ae2fc | |||
428963b352 | |||
1aba9a71d7 | |||
80a7ce8f19 | |||
2d285f47fd | |||
6169272093 | |||
cb1e881450 |
40
Jenkinsfile
vendored
40
Jenkinsfile
vendored
@ -2,36 +2,9 @@ pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('[Neutral] - Check Version') {
|
||||
steps {
|
||||
script {
|
||||
def commit_name = env.TAG_NAME
|
||||
if(commit_name) {
|
||||
echo "[Neutral] - Deployement version reconnu"
|
||||
|
||||
} else {
|
||||
currentBuild.result = 'ABORTED'
|
||||
echo "[Neutral] - Deployement version non reconnu"
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('[Neutral] - Test') {
|
||||
steps {
|
||||
script {
|
||||
def commit_name = env.TAG_NAME
|
||||
if(commit_name) {
|
||||
echo "[Neutral] - Deployement version reconnu"
|
||||
|
||||
} else {
|
||||
currentBuild.result = 'ABORTED'
|
||||
echo "[Neutral] - Deployement version non reconnu"
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
echo "[Neutral-Deploy] - Test Stage"
|
||||
sh "rm -rf neutral"
|
||||
sh "git clone https://git.raphix.fr/infrastructure/neutral.git"
|
||||
@ -40,25 +13,12 @@ pipeline {
|
||||
sh "ENV='TEST' node bin/www"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
stage('[Neutral] - Déploiement') {
|
||||
steps {
|
||||
script {
|
||||
|
||||
def commit_name = env.TAG_NAME
|
||||
if(commit_name) {
|
||||
echo "[Neutral] - Deployement version reconnu"
|
||||
|
||||
} else {
|
||||
currentBuild.result = 'ABORTED'
|
||||
echo "[Neutral] - Deployement version non reconnu"
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
def doesJavaRock = input(message: 'Confirmation de Déploiement', ok: 'Déployer')
|
||||
echo "[Neutral-Deploy] - Deploy Stage"
|
||||
sh "ssh raphix@raphix.fr sudo apt update -y"
|
||||
sh "ssh raphix@raphix.fr sudo apt upgrade -y"
|
||||
|
5
app.js
5
app.js
@ -20,6 +20,9 @@ var uploadRouter = require('./routes/upload');
|
||||
var userManagerRouter = require('./routes/usermanager');
|
||||
var linkRouter = require('./routes/link');
|
||||
var fileRouter = require("./routes/filemanager")
|
||||
var downloadRouter = require("./routes/download")
|
||||
var cvRouter = require("./routes/cv")
|
||||
|
||||
|
||||
|
||||
var app = express();
|
||||
@ -47,6 +50,8 @@ app.use('/upload', uploadRouter)
|
||||
app.use('/usermanager', userManagerRouter)
|
||||
app.use('/link', linkRouter)
|
||||
app.use("/filemanager", fileRouter)
|
||||
app.use("/download", downloadRouter)
|
||||
app.use("/cv", cvRouter)
|
||||
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
|
@ -31,10 +31,7 @@ module.exports.createUser = (name, password, level, fullname) => {
|
||||
"uuid": userUUID,
|
||||
"fullname": fullname,
|
||||
"permissionLevel":level,
|
||||
"token":{
|
||||
|
||||
|
||||
},
|
||||
"tokens":{},
|
||||
"lastconnexion":0
|
||||
|
||||
}
|
||||
@ -88,7 +85,7 @@ module.exports.deleteToken = (username) => {
|
||||
|
||||
const userData = JSON.parse(fs.readFileSync(__dirname + path.sep + "users" + path.sep + this.getUUID(username) + ".json", 'utf-8'))
|
||||
|
||||
userData.token = {}
|
||||
userData.tokens = {}
|
||||
|
||||
fs.writeFileSync(__dirname + path.sep + "users" + path.sep + this.getUUID(username) + ".json", JSON.stringify(userData, null, 2))
|
||||
|
||||
@ -111,13 +108,13 @@ module.exports.checkToken = (req, res) => {
|
||||
|
||||
fs.writeFileSync(__dirname + path.sep + "users" + path.sep + userData.uuid + ".json", JSON.stringify(userData, null, 2))
|
||||
|
||||
if(userData.token.livableToken == true) {
|
||||
if(userData.tokens[req.cookies.tokenID].livableToken == true) {
|
||||
|
||||
const checkTokenData = {"name":user, "permLevel": userData.permissionLevel, "fullname":userData.fullname, "lastconnexion":userData.lastconnexion};
|
||||
return checkTokenData;
|
||||
|
||||
} else {
|
||||
const tokenDate = new Date(userData.token.createdAt)
|
||||
const tokenDate = new Date(userData.tokens[req.cookies.tokenID].createdAt)
|
||||
const nowDate = new Date(Date.now())
|
||||
|
||||
if(tokenDate.getDay() == nowDate.getDay() && tokenDate.getMonth() == nowDate.getMonth()) {
|
||||
@ -126,7 +123,10 @@ module.exports.checkToken = (req, res) => {
|
||||
return checkTokenData;
|
||||
} else {
|
||||
|
||||
|
||||
this.clearSpecificCookie(req.cookies.tokenID);
|
||||
res.clearCookie('tokenID');
|
||||
|
||||
const checkTokenData = {"name":false}
|
||||
return checkTokenData;
|
||||
|
||||
@ -143,6 +143,43 @@ module.exports.checkToken = (req, res) => {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports.clearSpecificCookie = (token) => {
|
||||
|
||||
|
||||
const tokens = this.getAllToken()
|
||||
const user = tokens.get(token)
|
||||
const users = this.getUsers()
|
||||
|
||||
const userData = JSON.parse(fs.readFileSync(__dirname + path.sep + "users" + path.sep + users.get(user) + ".json", 'utf-8'))
|
||||
|
||||
userData["tokens"].token = null;
|
||||
|
||||
fs.writeFileSync(__dirname + path.sep + "users" + path.sep + userData.uuid + ".json", JSON.stringify(userData, null, 2))
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
module.exports.clearCookies = (token) => {
|
||||
|
||||
|
||||
const tokens = this.getAllToken()
|
||||
const user = tokens.get(token)
|
||||
const users = this.getUsers()
|
||||
|
||||
const userData = JSON.parse(fs.readFileSync(__dirname + path.sep + "users" + path.sep + users.get(user) + ".json", 'utf-8'))
|
||||
|
||||
userData["tokens"] = {};
|
||||
|
||||
fs.writeFileSync(__dirname + path.sep + "users" + path.sep + userData.uuid + ".json", JSON.stringify(userData, null, 2))
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports.getFullName = (username) => {
|
||||
@ -166,18 +203,12 @@ module.exports.generateTokenID = (username, userData, req, users) => {
|
||||
livable = true;
|
||||
}
|
||||
|
||||
Object.defineProperties(newUserData, {
|
||||
token: {
|
||||
value: {
|
||||
"tokenID":tokenID,
|
||||
"livableToken": livable,
|
||||
"createdAt": date
|
||||
},
|
||||
writable: true
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
newUserData.tokens[tokenID] = {
|
||||
"tokenID":tokenID,
|
||||
"livableToken": livable,
|
||||
"createdAt": date
|
||||
}
|
||||
|
||||
fs.writeFileSync(__dirname + path.sep + "users" + path.sep + users.get(username) + ".json", JSON.stringify(newUserData, null, 2))
|
||||
|
||||
@ -204,7 +235,13 @@ module.exports.getAllToken = () => {
|
||||
|
||||
fs.readdirSync(__dirname + path.sep + "users").forEach(file => {
|
||||
const fileData = JSON.parse(fs.readFileSync(__dirname + path.sep + "users" + path.sep + file, 'utf-8'))
|
||||
token.set(fileData.token.tokenID, fileData.username)
|
||||
|
||||
for(var tokenIDs of Object.keys(fileData.tokens)) {
|
||||
|
||||
token.set(fileData.tokens[tokenIDs].tokenID, fileData.username)
|
||||
console.log(token)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "neutral",
|
||||
"version": "DEV_3.0",
|
||||
"version": "DEV_5.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "neutral",
|
||||
"version": "DEV_3.0",
|
||||
"version": "DEV_5.0",
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.6",
|
||||
"bootstrap": "^5.2.2",
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "neutral",
|
||||
"version": "DEV_5.0",
|
||||
"version": "DEV_6",
|
||||
"private": true,
|
||||
"nodemonConfig": {
|
||||
"ext": "js",
|
||||
"ext": "js, html",
|
||||
"ignore": [
|
||||
"*.json"
|
||||
],
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
const account = document.getElementById("account")
|
||||
const menu = document.getElementById("accmenu")
|
||||
const sidebar = document.getElementById("sidebar")
|
||||
@ -145,6 +143,7 @@ const b4 = document.getElementById("s-moni")
|
||||
const b5 = document.getElementById("s-device")
|
||||
const b6 = document.getElementById("s-cv")
|
||||
const b7 = document.getElementById("s-link")
|
||||
const b8 = document.getElementById("s-admin")
|
||||
const settings = document.getElementById("settingsBtn")
|
||||
|
||||
b1.addEventListener("click", () => {
|
||||
@ -183,6 +182,11 @@ b7.addEventListener("click", () => {
|
||||
|
||||
})
|
||||
|
||||
b8.addEventListener("click", () => {
|
||||
getPage("panel.html")
|
||||
|
||||
})
|
||||
|
||||
settings.addEventListener("click", () => {
|
||||
getPage("settings.html")
|
||||
|
||||
|
@ -153,10 +153,6 @@ body {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.viewbar {
|
||||
|
||||
display: block !important;
|
||||
@ -216,7 +212,7 @@ body {
|
||||
|
||||
}
|
||||
.edropdown-content {
|
||||
text-align: center;
|
||||
|
||||
display: none;
|
||||
background-color: rgb(80, 80, 80);
|
||||
position: absolute;
|
||||
@ -277,6 +273,12 @@ body {
|
||||
overflow:scroll;
|
||||
overflow-x:hidden;
|
||||
|
||||
}
|
||||
|
||||
.sidebar:hover .d-content {
|
||||
|
||||
margin-left: 15%;
|
||||
|
||||
}
|
||||
|
||||
.sidecontent{
|
||||
@ -289,10 +291,29 @@ body {
|
||||
|
||||
.sidebar-content {
|
||||
|
||||
text-align: center;
|
||||
|
||||
height: 83%;
|
||||
padding-top: 50%;
|
||||
padding-bottom: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
|
||||
}
|
||||
|
||||
.middle {
|
||||
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
flex-direction: column;
|
||||
gap: 1vw;
|
||||
}
|
||||
|
||||
.sidebar:hover .middle{
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.sidebar:hover .middle {
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
@ -305,7 +326,7 @@ body {
|
||||
|
||||
text-align: unset;
|
||||
padding-top: 5%;
|
||||
padding-left: 30%;
|
||||
padding-left: 10%;
|
||||
}
|
||||
|
||||
.sidebar-footer {
|
||||
@ -347,6 +368,8 @@ body {
|
||||
-webkit-user-select: none; /* Chrome, Safari, Opéra depuis la version 15 */
|
||||
-ms-user-select: none; /* Internet explorer depuis la version 10 et Edge */
|
||||
user-select: none; /* Propriété standard */
|
||||
margin-left: 2%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.username {
|
||||
@ -387,9 +410,9 @@ body {
|
||||
.sidebar-item {
|
||||
|
||||
transition: all 0.2s ease 0s;
|
||||
padding: 5%;
|
||||
margin-top: 5%;
|
||||
margin-bottom: 5%;
|
||||
padding: 10%;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
.sidebar-item:hover {
|
||||
@ -418,7 +441,6 @@ body {
|
||||
|
||||
}
|
||||
.edropdown-content {
|
||||
text-align: center;
|
||||
display: none;
|
||||
background-color: rgb(80, 80, 80);
|
||||
position: absolute;
|
||||
|
852
public/templates/cv.html
Normal file
852
public/templates/cv.html
Normal file
@ -0,0 +1,852 @@
|
||||
<div class="home">
|
||||
<h1>Mon CV</h1>
|
||||
|
||||
</br>
|
||||
<div class="homepanel">
|
||||
<div class="row w-100">
|
||||
<div class="hbox col-lg">
|
||||
<h1><i class="fas fa-puzzle-piece"></i> Sections</h1>
|
||||
<div class="cv-sections">
|
||||
|
||||
<div class="row w-100">
|
||||
<select id="cv-section-selector" class="cv-selector">
|
||||
<option>Qui suis-je ?</option>
|
||||
<option>Contact</option>
|
||||
<option>Formations</option>
|
||||
<option>Diplomes & Certifications</option>
|
||||
<option>Passions et activités</option>
|
||||
<option>Ma recherche de stage</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row w-100">
|
||||
<textarea id="cv-section-textarea" class="cv-textarea">
|
||||
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<div class="row w-100">
|
||||
<button id="cv-section-save" class="cv-save col-lg-2"><i class="fa fa-save"></i> Sauvegarder</button>
|
||||
</div>
|
||||
<div class="row w-100">
|
||||
|
||||
<p id="cv-section-info" class="cv-info" style="color:rgb(255, 48, 48)"></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="hbox col-lg">
|
||||
|
||||
|
||||
<h1><i class="fa fa-gear"></i> Projets</h1>
|
||||
<div class="cv-sections">
|
||||
|
||||
<div class="row w-100">
|
||||
<select id="cv-project-selector" class="col-lg-10 cv-selector">
|
||||
</select>
|
||||
<button id="cv-project-add" class="col-lg-1 cv-plus"><i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
|
||||
<div class="row w-100">
|
||||
<textarea id="cv-project-textarea" class="cv-textarea">
|
||||
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="row cv-upload-section">
|
||||
<p class="col-lg-8" style="font-size: 14px;">Image : <span id="cv-m-upload-name">Aucune image !</span></p>
|
||||
<button id="cv-m-upload-btn" style="margin-left: 10%;" class="col-lg-2 cv-upload"><i class="fa fa-upload"></i> Upload</button>
|
||||
<input id='cv-m-upload-file' type='file' hidden/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row w-100">
|
||||
<button id="cv-project-save" class="cv-save col-lg-2"><i class="fa fa-save"></i> Sauvegarder</button>
|
||||
<button id="cv-project-del" class="cv-del col-lg-2"><i class="fa fa-trash"></i> Effacer</button>
|
||||
</div>
|
||||
<div class="row w-100">
|
||||
|
||||
<p id="cv-project-info" class="cv-info" style="color:rgb(255, 48, 48)"></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row w-100">
|
||||
<div class="hbox col-lg">
|
||||
|
||||
|
||||
<h1><i class="fa fa-signal"></i> Statistiques</h1>
|
||||
<p>Coming soon ...</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<dialog class="cv_addproject" id="cv-project-dialog">
|
||||
<h1><i class="fa fa-project-diagram"></i> Créer un projet</h1>
|
||||
<p>Nom du projet :</p>
|
||||
<input class="inp" id="cv-project-add-input" type="text">
|
||||
<div style="color: rgb(255, 76, 76);" id="cv-project-add-info"></div>
|
||||
</div>
|
||||
<div class="cv-upload-section">
|
||||
<p style="font-size: 14px;">Image : <span id="cv-upload-name">NULL_NAME</span> <button id="cv-upload-btn" style="margin-left: 10%;" class="cv-upload"><i class="fa fa-upload"></i> Upload</button></p>
|
||||
<input id='cv-upload-file' type='file' hidden/>
|
||||
|
||||
</div>
|
||||
<button onclick="getPage('cv.html')" id="cv-project-add-close" class="cv_add_close">Annuler</button>
|
||||
<button id="cv-project-add-confirm" class="cv_add_confirm">Ajouter</button>
|
||||
|
||||
</dialog>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
if(typeof checkDelare == "undefined") {
|
||||
const checkDelare = true;
|
||||
|
||||
const sectionTextArea = document.getElementById("cv-section-textarea")
|
||||
const sectionSelector = document.getElementById("cv-section-selector")
|
||||
const sectionSave = document.getElementById("cv-section-save")
|
||||
const sectionInfo = document.getElementById("cv-section-info")
|
||||
|
||||
const projectTextArea = document.getElementById("cv-project-textarea")
|
||||
const projectSelector = document.getElementById("cv-project-selector")
|
||||
const projectSave = document.getElementById("cv-project-save")
|
||||
const projectInfo = document.getElementById("cv-project-info")
|
||||
const projectDelete = document.getElementById("cv-project-del")
|
||||
const projectAdd = document.getElementById("cv-project-add")
|
||||
const projectDialog = document.getElementById("cv-project-dialog")
|
||||
const projectAddInput = document.getElementById("cv-project-add-input")
|
||||
const projectAddConfirm = document.getElementById("cv-project-add-confirm")
|
||||
const projectAddInfo = document.getElementById("cv-project-add-info")
|
||||
|
||||
const projectUploadFile = document.getElementById("cv-upload-file")
|
||||
const projectUploadBtn = document.getElementById("cv-upload-btn")
|
||||
const projectUploadName = document.getElementById("cv-upload-name")
|
||||
|
||||
const eprojectUploadFile = document.getElementById("cv-m-upload-file")
|
||||
const eprojectUploadBtn = document.getElementById("cv-m-upload-btn")
|
||||
const eprojectUploadName = document.getElementById("cv-m-upload-name")
|
||||
|
||||
var sectionSelectedMD = null;
|
||||
var projectSelectedMD = null;
|
||||
|
||||
loadText(sectionTextArea, "WHOAMI")
|
||||
getProjects(projectSelector)
|
||||
|
||||
projectAddConfirm.addEventListener("click", () => {
|
||||
|
||||
projectAddInfo.innerHTML = ""
|
||||
|
||||
|
||||
|
||||
const refusedChar = ['\\','/' ,':' ,'*','?' ,'"','<','>','|']
|
||||
var wrongName = true;
|
||||
|
||||
for(var char of refusedChar) {
|
||||
|
||||
console.log(wrongName)
|
||||
|
||||
if(projectAddInput.value.includes(char)) {
|
||||
wrongName = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(wrongName == true && projectAddInput.value != "" && projectAddInput.value != "WHOAMI" && projectAddInput.value != "CONTACT" && projectAddInput.value != "FORMATION" && projectAddInput.value != "DIPLOME" && projectAddInput.value != "LOBBIES" && projectAddInput.value != "FIND") {
|
||||
|
||||
fetch('/cv', {
|
||||
method: 'POST',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({"request":"add", "value": projectAddInput.value})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => res(response))
|
||||
|
||||
function res(response) {
|
||||
if(response.result == "failed") {
|
||||
content.innerHTML = ' <h1 style="color:red;"><i style="color:yellow; font-size: 2vw;" class="fa fa-warning"></i> Erreur de chargement des données - Erreur : ' + response.content + '</h1>'
|
||||
console.log("FAILED")
|
||||
|
||||
} else if(response.result == "success") {
|
||||
|
||||
if(response.content == "ERROR_NOT_PERMITTED") {
|
||||
projectAddInfo.innerHTML = "Erreur, le fichier n'a pas été ajouté correctement !"
|
||||
|
||||
} else {
|
||||
projectDialog.close()
|
||||
getProjects(projectSelector)
|
||||
loadText(projectTextArea, projectAddInput.value)
|
||||
projectSelector.value = projectAddInput.value
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(projectUploadFile.files.length > 0) {
|
||||
|
||||
const file_acc = new FormData();
|
||||
file_acc.append("apic", projectUploadFile.files[0])
|
||||
|
||||
fetch('/upload', {
|
||||
method: 'POST',
|
||||
mode:"cors",
|
||||
cache:"no-cache",
|
||||
credentials:"same-origin",
|
||||
headers: {
|
||||
"uploadforproject": projectAddInput.value
|
||||
|
||||
},
|
||||
referrerPolicy:"no-referrer",
|
||||
redirect: 'follow',
|
||||
body: file_acc
|
||||
}).then(response => response.json())
|
||||
.then(response => resupload(response))
|
||||
|
||||
function resupload(response) {
|
||||
|
||||
|
||||
if(response.result == "ERROR") {
|
||||
projectInfo.innerHTML = "L'image n'a pas été upload !"
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
projectAddInfo.innerHTML = "Ce nom n'est pas autorisé !"
|
||||
}
|
||||
})
|
||||
|
||||
projectAdd.addEventListener("click", () => {
|
||||
|
||||
projectDialog.showModal()
|
||||
|
||||
projectAddInput.value = ""
|
||||
projectUploadName.innerHTML = "Aucune image."
|
||||
projectUploadFile.value = null;
|
||||
|
||||
|
||||
})
|
||||
|
||||
projectUploadFile.addEventListener("change", () => {
|
||||
|
||||
projectUploadName.innerHTML = projectUploadFile.files[0].name
|
||||
|
||||
})
|
||||
|
||||
|
||||
projectUploadBtn.addEventListener("click", () => {
|
||||
|
||||
projectUploadFile.click()
|
||||
})
|
||||
|
||||
eprojectUploadBtn.addEventListener("click", () => {
|
||||
|
||||
eprojectUploadFile.click()
|
||||
})
|
||||
|
||||
eprojectUploadFile.addEventListener("change", () => {
|
||||
|
||||
eprojectUploadName.innerHTML = eprojectUploadFile.files[0].name
|
||||
|
||||
if(eprojectUploadFile.files.length > 0) {
|
||||
|
||||
const file_acc = new FormData();
|
||||
file_acc.append("apic", eprojectUploadFile.files[0])
|
||||
|
||||
fetch('/upload', {
|
||||
method: 'POST',
|
||||
mode:"cors",
|
||||
cache:"no-cache",
|
||||
credentials:"same-origin",
|
||||
headers: {
|
||||
"uploadforproject": projectSelector.value
|
||||
|
||||
},
|
||||
referrerPolicy:"no-referrer",
|
||||
redirect: 'follow',
|
||||
body: file_acc
|
||||
}).then(response => response.json())
|
||||
.then(response => resupload(response))
|
||||
|
||||
function resupload(response) {
|
||||
|
||||
|
||||
if(response.result == "ERROR") {
|
||||
projectInfo.innerHTML = "L'image n'a pas été upload !"
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
projectInfo.innerHTML = "<span style='color:rgb(130, 255, 163); '>L'image a été correctement upload !</span>"
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
projectDelete.addEventListener("click", () => {
|
||||
|
||||
const opt = projectSelector.value
|
||||
|
||||
deleteProject(opt)
|
||||
|
||||
})
|
||||
|
||||
sectionSelector.addEventListener("change", () => {
|
||||
const opt = sectionSelector.value
|
||||
|
||||
if(opt == "Qui suis-je ?") {
|
||||
loadText(sectionTextArea, "WHOAMI")
|
||||
|
||||
} else if(opt == "Contact") {
|
||||
loadText(sectionTextArea, "CONTACT")
|
||||
|
||||
} else if(opt == "Formations") {
|
||||
loadText(sectionTextArea, "FORMATION")
|
||||
|
||||
} else if(opt == "Diplomes & Certifications") {
|
||||
loadText(sectionTextArea, "DIPLOME")
|
||||
|
||||
} else if(opt == "Passions et activités") {
|
||||
loadText(sectionTextArea, "LOBBIES")
|
||||
|
||||
} else if(opt == "Ma recherche de stage") {
|
||||
loadText(sectionTextArea, "FIND")
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
projectSelector.addEventListener("change", () => {
|
||||
const opt = projectSelector.value
|
||||
|
||||
loadText(projectTextArea, opt)
|
||||
|
||||
})
|
||||
|
||||
sectionSave.addEventListener("click", () => {
|
||||
|
||||
sectionInfo.innerHTML = ""
|
||||
|
||||
|
||||
|
||||
fetch('/cv', {
|
||||
method: 'POST',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({"request":"set", "value": sectionTextArea.value, "type": sectionSelectedMD})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => res(response))
|
||||
|
||||
function res(response) {
|
||||
if(response.result == "failed") {
|
||||
content.innerHTML = ' <h1 style="color:red;"><i style="color:yellow; font-size: 2vw;" class="fa fa-warning"></i> Erreur de chargement des données - Erreur : ' + response.content + '</h1>'
|
||||
console.log("FAILED")
|
||||
|
||||
} else if(response.result == "success") {
|
||||
|
||||
if(response.content == "ERROR_NOT_PERMITTED") {
|
||||
sectionInfo.innerHTML = "Erreur, le fichier n'a pas été sauvegardé correctement !"
|
||||
|
||||
} else {
|
||||
sectionInfo.innerHTML = "<span style='color:rgb(130, 255, 163); '>Le fichier a été sauvegardé avec succès !</span>"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
projectSave.addEventListener("click", () => {
|
||||
|
||||
projectInfo.innerHTML = ""
|
||||
|
||||
|
||||
|
||||
fetch('/cv', {
|
||||
method: 'POST',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({"request":"set", "value": projectTextArea.value, "type": projectSelectedMD})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => res(response))
|
||||
|
||||
function res(response) {
|
||||
if(response.result == "failed") {
|
||||
content.innerHTML = ' <h1 style="color:red;"><i style="color:yellow; font-size: 2vw;" class="fa fa-warning"></i> Erreur de chargement des données - Erreur : ' + response.content + '</h1>'
|
||||
console.log("FAILED")
|
||||
|
||||
} else if(response.result == "success") {
|
||||
|
||||
if(response.content == "ERROR_NOT_PERMITTED") {
|
||||
projectInfo.innerHTML = "Erreur, le fichier n'a pas été sauvegardé correctement !"
|
||||
|
||||
} else {
|
||||
projectInfo.innerHTML = "<span style='color:rgb(130, 255, 163); '>Le fichier a été sauvegardé avec succès !</span>"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
loadText(sectionTextArea, "WHOAMI")
|
||||
|
||||
function loadText(textArea, requestElement) {
|
||||
|
||||
sectionSelectedMD = requestElement
|
||||
projectSelectedMD = projectSelector.value
|
||||
|
||||
|
||||
fetch('/cv', {
|
||||
method: 'POST',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({"request":"get", "value": requestElement})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => res(response))
|
||||
|
||||
function res(response) {
|
||||
if(response.result == "failed") {
|
||||
content.innerHTML = ' <h1 style="color:red;"><i style="color:yellow; font-size: 2vw;" class="fa fa-warning"></i> Erreur de chargement des données - Erreur : ' + response.content + '</h1>'
|
||||
console.log("FAILED")
|
||||
|
||||
} else if(response.result == "success") {
|
||||
|
||||
textArea.value = response.content
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getProjects(selector) {
|
||||
|
||||
fetch('/cv', {
|
||||
method: 'POST',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({"request":"get-projects"})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => res(response))
|
||||
|
||||
function res(response) {
|
||||
if(response.result == "failed") {
|
||||
content.innerHTML = ' <h1 style="color:red;"><i style="color:yellow; font-size: 2vw;" class="fa fa-warning"></i> Erreur de chargement des données - Erreur : ' + response.content + '</h1>'
|
||||
console.log("FAILED")
|
||||
|
||||
} else if(response.result == "success") {
|
||||
|
||||
const projectList = response.content
|
||||
var projectSelectorInner = new Array();
|
||||
|
||||
for(var projet of projectList) {
|
||||
|
||||
projectSelectorInner.push("<option>" + projet + "</option>")
|
||||
|
||||
}
|
||||
|
||||
if(projectList.length == 0) {
|
||||
|
||||
projectInfo.innerHTML = "<span style='color: white;'>Aucun projet</span>"
|
||||
projectTextArea.innerHTML = 'Aucun projet n\'est disponible'
|
||||
}
|
||||
|
||||
|
||||
selector.innerHTML = projectSelectorInner.join("")
|
||||
loadText(projectTextArea, selector.value)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function deleteProject(opt) {
|
||||
|
||||
fetch('/cv', {
|
||||
method: 'POST',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({"request":"del", "value": opt})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => res(response))
|
||||
|
||||
function res(response) {
|
||||
if(response.result == "failed") {
|
||||
content.innerHTML = ' <h1 style="color:red;"><i style="color:yellow; font-size: 2vw;" class="fa fa-warning"></i> Erreur de chargement des données - Erreur : ' + response.content + '</h1>'
|
||||
console.log("FAILED")
|
||||
|
||||
} else if(response.result == "success") {
|
||||
|
||||
if(response.content == "ERROR_NOT_PERMITTED") {
|
||||
projectInfo.innerHTML = "Erreur, le fichier n'a pas été supprimé correctement !"
|
||||
|
||||
} else {
|
||||
projectInfo.innerHTML = "<span style='color:rgb(130, 255, 163); '>Le fichier a été supprimé avec succès !</span>"
|
||||
|
||||
}
|
||||
|
||||
getProjects(projectSelector)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Style-->
|
||||
<style>
|
||||
|
||||
.cv_addproject {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: transparent;
|
||||
background-color: rgb(80, 80, 80);
|
||||
color: white;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
.cv_add_close {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: rgb(255, 48, 48);
|
||||
border-width: 1%;
|
||||
border-style: solid;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s ease 0s;
|
||||
margin: 0.5vw;
|
||||
padding: 0.5vw;
|
||||
font-size: 1vw;
|
||||
}
|
||||
|
||||
.cv_add_close:hover {
|
||||
box-shadow: 1px 1px 10px rgb(255, 48, 48);
|
||||
background-color: rgb(255, 48, 48);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.cv_add_close:active {
|
||||
box-shadow: none;
|
||||
|
||||
}
|
||||
|
||||
.cv_add_confirm {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: rgb(0, 174, 255);
|
||||
border-width: 1%;
|
||||
border-style: solid;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s ease 0s;
|
||||
margin: 0.5vw;
|
||||
padding: 0.5vw;
|
||||
font-size: 1vw;
|
||||
|
||||
}
|
||||
|
||||
.cv_add_confirm:hover {
|
||||
box-shadow: 1px 1px 10px rgb(0, 174, 255);
|
||||
background-color: rgb(0, 174, 255);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.cv_add_confirm:active {
|
||||
box-shadow: none;
|
||||
|
||||
}
|
||||
|
||||
.inp {
|
||||
|
||||
border-style: hidden;
|
||||
border-radius: 1vw;
|
||||
padding: 0.2vw;
|
||||
padding-left: 1vw;
|
||||
transition: all 0.2s ease 0s;
|
||||
margin-bottom: 0.5vw;
|
||||
width: 100%;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.inp:hover {
|
||||
|
||||
box-shadow: 2px 2px 5px rgba(255, 255, 255, 0.477) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.inp:focus {
|
||||
|
||||
box-shadow: 5px 5px 5px rgba(0, 174, 255, 0.477) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.cv-info {
|
||||
|
||||
margin-top: 5%;
|
||||
}
|
||||
|
||||
.cv-upload-section {
|
||||
|
||||
align-items: center;
|
||||
margin-top: 3%;
|
||||
|
||||
}
|
||||
|
||||
.cv-selector {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: rgb(0, 174, 255);
|
||||
border-width: 1%;
|
||||
border-style: solid;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s ease 0s;
|
||||
font-size: 0.7vw;
|
||||
padding: 0.5vw;
|
||||
margin-bottom: 3%;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.cv-selector:hover {
|
||||
box-shadow: 1px 1px 10px rgb(0, 174, 255);
|
||||
background-color: rgb(0, 174, 255);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.cv-selector:active {
|
||||
box-shadow: none;
|
||||
|
||||
}
|
||||
|
||||
.cv-selector option {
|
||||
|
||||
background-color: rgb(80, 80, 80);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.cv-upload {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: rgb(0, 174, 255);
|
||||
border-width: 1%;
|
||||
border-style: solid;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s ease 0s;
|
||||
font-size: 0.7vw;
|
||||
padding: 0.5vw;
|
||||
|
||||
}
|
||||
|
||||
.cv-upload:hover {
|
||||
box-shadow: 1px 1px 10px rgb(0, 174, 255);
|
||||
background-color: rgb(0, 174, 255);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.cv-upload:active {
|
||||
box-shadow: none;
|
||||
|
||||
}
|
||||
|
||||
.cv-save{
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: rgb(0, 174, 255);
|
||||
border-width: 1%;
|
||||
border-style: solid;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s ease 0s;
|
||||
font-size: 0.7vw;
|
||||
padding: 0.5vw;
|
||||
margin-top: 3%;
|
||||
margin-right: 3%;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.cv-save:hover {
|
||||
box-shadow: 1px 1px 10px rgb(0, 174, 255);
|
||||
background-color: rgb(0, 174, 255);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.cv-save:active {
|
||||
box-shadow: none;
|
||||
|
||||
}
|
||||
|
||||
.cv-plus {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: rgb(0, 174, 255);
|
||||
border-width: 1%;
|
||||
border-style: solid;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s ease 0s;
|
||||
font-size: 0.7vw;
|
||||
padding: 0.5vw;
|
||||
margin-bottom: 3%;
|
||||
margin-left: 2%;
|
||||
|
||||
}
|
||||
|
||||
.cv-plus:hover {
|
||||
box-shadow: 1px 1px 10px rgb(0, 174, 255);
|
||||
background-color: rgb(0, 174, 255);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.cv-plus:active {
|
||||
box-shadow: none;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.cv-del {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: rgb(255, 48, 48);
|
||||
border-width: 1%;
|
||||
border-style: solid;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s ease 0s;
|
||||
font-size: 0.7vw;
|
||||
padding: 0.5vw;
|
||||
margin-top: 3%;
|
||||
margin-right: 3%;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.cv-del:hover {
|
||||
box-shadow: 1px 1px 10px rgb(255, 48, 48);
|
||||
background-color: rgb(255, 48, 48);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.cv-del:active {
|
||||
box-shadow: none;
|
||||
|
||||
}
|
||||
|
||||
.cv-textarea {
|
||||
|
||||
border-radius: 1vw;
|
||||
padding: 3%;
|
||||
color: black;
|
||||
height: 15vw;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.cv-sections {
|
||||
|
||||
padding: 2% !important;
|
||||
}
|
||||
|
||||
|
||||
.hbox h1 {
|
||||
|
||||
font-size: large;
|
||||
|
||||
}
|
||||
|
||||
table {
|
||||
color: white;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hbox {
|
||||
|
||||
margin: 1%;
|
||||
padding: 1%;
|
||||
background-color: rgb(80, 80, 80);
|
||||
border-radius: 1vw;
|
||||
box-shadow: 5px 5px 5px rgba(80, 80, 80, 0.477) ;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
@ -1,19 +1,23 @@
|
||||
<div class="files">
|
||||
<h1>Gestionnnaire de fichiers</h1>
|
||||
<h1>Gestionnaire de fichiers</h1>
|
||||
|
||||
</br>
|
||||
<div class="homepanel">
|
||||
<div class="row w-100">
|
||||
<div class="hbox col-lg">
|
||||
<div class="fi_act">
|
||||
<h1><i class="fa fa-folder"></i> Fichiers</h1>
|
||||
<hr>
|
||||
<div>
|
||||
<button class="fi_act_btn"><i class="fa fa-folder"></i> Nouveau dossier</button>
|
||||
<button class="fi_act_btn"><i class="fa fa-upload"></i> Upload</button>
|
||||
<button id="fi_new_folder" class="fi_act_btn"><i class="fa fa-folder"></i> Nouveau dossier</button>
|
||||
<input id='fi_upload_file' type='file' hidden multiple />
|
||||
<button id="fi_upload" class="fi_act_btn"><i class="fa fa-upload"></i> Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fi_current_directory">
|
||||
<input id="fi_current_directory" class="fi_current_p" value="C:\Users\picot\OneDrive\Bureau\Developement\Neutral\neutral" type="text">
|
||||
<input id="fi_current_directory" class="fi_current_p" value="/" type="text">
|
||||
</div>
|
||||
<p id="fi_info" style="text-align: start; color: rgb(255, 48, 48);"></p>
|
||||
<div id="fileExplorer" class="fi_container">
|
||||
<p style="text-align: start; color: rgb(255, 48, 48);">Le répertoire n'existe pas ou est vide.</p>
|
||||
</div>
|
||||
@ -22,6 +26,21 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="fi_dialog_input">
|
||||
|
||||
</div>
|
||||
|
||||
<dialog class="fi_addfolder" id="fi_new_folder_dialog">
|
||||
<h1><i class="fa fa-folder"></i> Créer un dossier</h1>
|
||||
<p>Nom du dossier :</p>
|
||||
<input class="inp" id="fi_add_name" type="text">
|
||||
<div style="color: rgb(255, 76, 76);" id="fi_folder_info"></div>
|
||||
</div>
|
||||
<button id="fi_add_close" class="fi_add_close">Annuler</button>
|
||||
<button id="fi_add_confirm" class="fi_add_confirm">Ajouter</button>
|
||||
</dialog>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
if(typeof currentDir == "undefined") {
|
||||
@ -29,9 +48,183 @@
|
||||
const currentDir = document.getElementById("fi_current_directory")
|
||||
const fileExplorer = document.getElementById("fileExplorer")
|
||||
const fileExplorerError = '<div id="last_directory" class="fi_file"><p style="margin-left: 1vw;text-align:start;margin-bottom: 1vw !important;"><i class="fa fa-arrow-left"></i> Revenir au dossier parent</p></div>' + fileExplorer.outerHTML
|
||||
const fiInfo = document.getElementById("fi_info")
|
||||
|
||||
getDirectory(currentDir.value)
|
||||
|
||||
const newFolderBtn = document.getElementById("fi_new_folder")
|
||||
const newFolderDialog = document.getElementById("fi_new_folder_dialog")
|
||||
const newFolderConfirm = document.getElementById("fi_add_confirm")
|
||||
const newFolderName = document.getElementById("fi_add_name")
|
||||
const newFolderInfo = document.getElementById("fi_folder_info")
|
||||
const dialogInput = document.getElementById("fi_dialog_input")
|
||||
|
||||
|
||||
const newFolderClose = document.getElementById("fi_add_close")
|
||||
|
||||
newFolderClose.addEventListener("click", () => {
|
||||
|
||||
newFolderDialog.close()
|
||||
getDirectory(currentDir.value)
|
||||
})
|
||||
|
||||
|
||||
|
||||
newFolderBtn.addEventListener("click", () => {
|
||||
|
||||
newFolderDialog.showModal()
|
||||
newFolderName.value = ""
|
||||
newFolderInfo.value = ""
|
||||
|
||||
})
|
||||
|
||||
newFolderConfirm.addEventListener("click", () => {
|
||||
|
||||
const folderDir = currentDir + newFolderName.value
|
||||
newFolderInfo.value = ""
|
||||
var wrongName = true
|
||||
var justspace = false
|
||||
|
||||
const refusedChar = ['\\','/' ,':' ,'*','?' ,'"','<','>','|']
|
||||
|
||||
for(var char of refusedChar) {
|
||||
|
||||
if(newFolderName.value.includes(char)) {
|
||||
wrongName = false
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < newFolderName.value.length; i++) {
|
||||
var char = newFolderName.value.charAt(i)
|
||||
|
||||
if(char != " ") {
|
||||
|
||||
justspace = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(wrongName == false) {
|
||||
|
||||
newFolderInfo.innerHTML = "<p>Le nom du dossier est invalide car il contient des caractères interdits !</p>"
|
||||
|
||||
} else if(justspace == false) {
|
||||
|
||||
newFolderInfo.innerHTML = "<p>Le nom du dossier ne peut être vide !</p>"
|
||||
|
||||
} else {
|
||||
|
||||
fetch('/filemanager', {
|
||||
method: 'POST',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({"request":"addfolder", "value": newFolderName.value, "currentDir" : currentDir.value})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => res(response))
|
||||
|
||||
function res(response) {
|
||||
if(response.result == "failed") {
|
||||
content.innerHTML = ' <h1 style="color:red;"><i style="color:yellow; font-size: 2vw;" class="fa fa-warning"></i> Erreur de chargement des données - Erreur : ' + response.content + '</h1>'
|
||||
console.log("FAILED")
|
||||
|
||||
} else if(response.result == "success") {
|
||||
|
||||
if(response.content == "ERROR_ALREADY_EXIST") {
|
||||
newFolderInfo.innerHTML = "<p>Le nom du dossier est déjà existant !</p>"
|
||||
|
||||
|
||||
} else if(response.content == "ERROR_NOT_MAKEABLE") {
|
||||
newFolderInfo.innerHTML = "<p>Vous n'avez pas la permission !</p>"
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
newFolderDialog.close()
|
||||
getDirectory(currentDir.value)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
const uploadBtn = document.getElementById("fi_upload")
|
||||
const uploadFiles = document.getElementById("fi_upload_file")
|
||||
|
||||
|
||||
uploadBtn.addEventListener("click", () => {
|
||||
|
||||
uploadFiles.click()
|
||||
|
||||
})
|
||||
|
||||
uploadFiles.addEventListener("change", () => {
|
||||
|
||||
var stopSend = false
|
||||
fiInfo.innerHTML = ""
|
||||
|
||||
for(var file of uploadFiles.files) {
|
||||
|
||||
|
||||
|
||||
if(stopSend == false) {
|
||||
const file_acc = new FormData();
|
||||
file_acc.append("apic", file)
|
||||
|
||||
fetch('/upload', {
|
||||
method: 'POST',
|
||||
mode:"cors",
|
||||
cache:"no-cache",
|
||||
credentials:"same-origin",
|
||||
headers: {
|
||||
"uploadfiledirectory": currentDir.value
|
||||
|
||||
},
|
||||
referrerPolicy:"no-referrer",
|
||||
redirect: 'follow',
|
||||
body: file_acc
|
||||
}).then(response => response.json())
|
||||
.then(response => resupload(response))
|
||||
|
||||
function resupload(response) {
|
||||
|
||||
|
||||
if(response.result == "ERROR") {
|
||||
fiInfo.innerHTML = "Les fichiers n'ont pas pu être uploadés !"
|
||||
stopSend = true
|
||||
|
||||
} else {
|
||||
|
||||
getDirectory(currentDir.value)
|
||||
fiInfo.innerHTML = "<span style='color: rgb(130, 255, 163);'>Le fichier <strong>" + file.name + "</strong> a été upload !</span>"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
uploadFiles.value = null
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
currentDir.addEventListener("change", () => {
|
||||
|
||||
@ -41,7 +234,10 @@
|
||||
|
||||
function getDirectory(directory) {
|
||||
|
||||
fiInfo.innerHTML = ""
|
||||
|
||||
var fileExplorerList = new Array()
|
||||
var dialogExlorerList = new Array()
|
||||
|
||||
fetch('/filemanager', {
|
||||
method: 'POST',
|
||||
@ -74,11 +270,68 @@
|
||||
if(response.content == "ERROR_NOT_EXIST") {
|
||||
|
||||
fileExplorer.innerHTML = fileExplorerError
|
||||
const last_dir = document.getElementById("last_directory")
|
||||
|
||||
last_dir.addEventListener("click", () => {
|
||||
|
||||
var cdSplit = currentDir.value.split("/")
|
||||
|
||||
if(cdSplit.slice(-1) == "") {
|
||||
|
||||
cdSplit.pop()
|
||||
cdSplit.pop()
|
||||
|
||||
} else {
|
||||
cdSplit.pop()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
currentDir.value = cdSplit.join("/")
|
||||
|
||||
if(currentDir.value == "") {
|
||||
currentDir.value = "/"
|
||||
}
|
||||
|
||||
getDirectory(currentDir.value)
|
||||
|
||||
|
||||
})
|
||||
console.log("DENY")
|
||||
|
||||
} else if(response.content == "ERROR_NOT_PERMITTED") {
|
||||
|
||||
fileExplorer.innerHTML = '<p style="text-align: start; padding: 1vw; color: rgb(255, 48, 48);">Vous n\'avez pas la permission de regarder ce dossier.</p>'
|
||||
fileExplorer.innerHTML = '<div id="last_directory" class="fi_file"><p style="margin-left: 1vw;text-align:start;margin-bottom: 1vw !important;"><i class="fa fa-arrow-left"></i> Revenir au dossier parent</p></div>' +'<p style="text-align: start; padding: 1vw; color: rgb(255, 48, 48);">Vous n\'avez pas la permission de regarder ce dossier.</p>'
|
||||
const last_dir = document.getElementById("last_directory")
|
||||
|
||||
last_dir.addEventListener("click", () => {
|
||||
|
||||
var cdSplit = currentDir.value.split("/")
|
||||
|
||||
if(cdSplit.slice(-1) == "") {
|
||||
|
||||
cdSplit.pop()
|
||||
cdSplit.pop()
|
||||
|
||||
} else {
|
||||
cdSplit.pop()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
currentDir.value = cdSplit.join("/")
|
||||
|
||||
if(currentDir.value == "") {
|
||||
currentDir.value = "/"
|
||||
}
|
||||
|
||||
getDirectory(currentDir.value)
|
||||
|
||||
|
||||
})
|
||||
|
||||
console.log("DENY")
|
||||
|
||||
} else {
|
||||
@ -119,8 +372,8 @@
|
||||
|
||||
if(file.directory == true) {
|
||||
|
||||
fileExplorerList.push('<div id="' + file.name + '_directory" class="fi_file row"> <p class="col-lg"><i style="color:yellow;" class="fa fa-folder"></i> ' + file.name + '</p> <p class="col-lg"><i class="fa fa-calendar"></i> Dernière édition : ' + lastedition + '</p> <p class="col-lg"><i class="fas fa-weight-hanging"></i> Taille : ' + file.size + ' octet(s)</p> <div class="col-lg fi_file_btn"> <button id="' + file.name + '_rename" class="fi_rename"><i class="fas fa-terminal"></i></button> <button id="' + file.name + '_delete" class="fi_delete"><i class="fa fa-trash"></i></button> </div> </div>')
|
||||
|
||||
fileExplorerList.push('<div id="' + file.name + '_directory" class="fi_file row"> <p class="col-lg"><i style="color:yellow;" class="fa fa-folder"></i> ' + file.name + '</p> <p class="col-lg"><i class="fa fa-calendar"></i> Dernière édition : ' + lastedition + '</p> <p class="col-lg"><i class="fas fa-weight-hanging"></i> Taille : ' + file.size + ' octet(s)</p> <div class="col-lg fi_file_btn"> <button id="' + file.name + '_rename" class="fi_rename"><i id="' + file.name + '_trename" class="fas fa-terminal"></i></button> <button id="' + file.name + '_delete" class="fi_delete"><i id="' + file.name + '_tdelete" class="fa fa-trash"></i></button> </div> </div>')
|
||||
dialogExlorerList.push(' <dialog class="fi_addfolder" id="' + file.name + '_rename_dialog"> <h1><i class="fa fa-terminal"></i> Renommer un dossier</h1> <p><span id="' + file.name + '_old_name"></span></p> <p>Nouveau lien :</p> <input class="inp" id="' + file.name + '_rename_name" type="text"> </div><p id="' + file.name +'_rename_info" style="text-align: start; color: rgb(255, 48, 48);"></p> <button id="' + file.name + '_rename_close" class="fi_add_close">Annuler</button> <button id="' + file.name + '_rename_confirm" class="fi_add_confirm">Editer</button> </dialog>')
|
||||
|
||||
}
|
||||
|
||||
@ -228,13 +481,14 @@
|
||||
|
||||
|
||||
|
||||
fileExplorerList.push('<div id="' + file.name + '_directory" class="fi_file row"> <p class="col-lg">' + icon+ '</i> ' + file.name + '</p> <p class="col-lg"><i class="fa fa-calendar"></i> Dernière édition : ' + lastedition + '</p> <p class="col-lg"><i class="fas fa-weight-hanging"></i> Taille : ' + file.size + ' octet(s)</p> <div class="col-lg fi_file_btn"> <button id="' + file.name + '_rename" class="fi_rename"><i class="fas fa-terminal"></i></button> <button id="' + file + '_download" class="fi_rename"><i class="fas fa-download"></i></button><button id="' + file.name + '_delete" class="fi_delete"><i class="fa fa-trash"></i></button> </div> </div>')
|
||||
|
||||
fileExplorerList.push('<div id="' + file.name + '_directory" class="fi_file row"> <p class="col-lg">' + icon+ '</i> ' + file.name + '</p> <p class="col-lg"><i class="fa fa-calendar"></i> Dernière édition : ' + lastedition + '</p> <p class="col-lg"><i class="fas fa-weight-hanging"></i> Taille : ' + file.size + ' octet(s)</p> <div class="col-lg fi_file_btn"> <button id="' + file.name + '_rename" class="fi_rename"><i id="' + file.name + '_trename" class="fas fa-terminal"></i></button> <button id="' + file.name + '_download" class="fi_rename"><i id="' + file.name + '_tdownload" class="fas fa-download"></i></button><button id="' + file.name + '_delete" class="fi_delete"><i id="' + file.name + '_tdelete" class="fa fa-trash"></i></button> </div> </div>')
|
||||
dialogExlorerList.push(' <dialog class="fi_addfolder" id="' + file.name + '_rename_dialog"> <h1><i class="fa fa-terminal"></i> Renommer un fichier</h1> <p><span id="' + file.name + '_old_name"></span></p> <p>Nouveau lien :</p> <input class="inp" id="' + file.name + '_rename_name" type="text"> </div> <p id="' + file.name +'_rename_info" style="text-align: start; color: rgb(255, 48, 48);"></p><button id="' + file.name + '_rename_close" class="fi_add_close">Annuler</button> <button id="' + file.name + '_rename_confirm" class="fi_add_confirm">Editer</button> </dialog>')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fileExplorer.innerHTML = fileExplorerList.join('')
|
||||
dialogInput.innerHTML = dialogExlorerList.join('')
|
||||
|
||||
const last_dir = document.getElementById("last_directory")
|
||||
|
||||
@ -275,17 +529,14 @@
|
||||
|
||||
const deleteBtn = document.getElementById(file.name + "_delete")
|
||||
const renameBtn = document.getElementById(file.name + "_rename")
|
||||
const renameDialog = document.getElementById(file.name + "_rename_dialog")
|
||||
const renameOldName = document.getElementById(file.name + "_old_name")
|
||||
const renameName = document.getElementById(file.name + "_rename_name")
|
||||
const renameClose = document.getElementById(file.name + "_rename_close")
|
||||
const renameConfirm = document.getElementById(file.name + "_rename_confirm")
|
||||
const renameInfo = document.getElementById(file.name + "_rename_info")
|
||||
|
||||
|
||||
deleteBtn.addEventListener("click", () => {
|
||||
|
||||
console.log(file.name)
|
||||
})
|
||||
|
||||
renameBtn.addEventListener("click", () => {
|
||||
|
||||
console.log(file.name)
|
||||
})
|
||||
|
||||
if(file.directory == true) {
|
||||
|
||||
@ -293,9 +544,9 @@
|
||||
|
||||
dir.addEventListener("click", (event) => {
|
||||
|
||||
console.log(event.target.id != file.name + "_delete" && event.target.id != file.name + "_rename")
|
||||
console.log(event.target)
|
||||
|
||||
if((event.target.id != file.name + "_delete" & event.target.id != file.name + "_rename") == true) {
|
||||
if(event.target.id != file.name + "_delete" && event.target.id != file.name + "_rename" && event.target.id != file.name + "_trename" && event.target.id != file.name + "_tdelete") {
|
||||
|
||||
if(currentDir.value.slice(-1) != "\\" && currentDir.value.slice(-1) != "/") {
|
||||
|
||||
@ -320,7 +571,170 @@
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
const downloadBtn = document.getElementById(file.name + "_download")
|
||||
|
||||
downloadBtn.addEventListener("click", () => {
|
||||
|
||||
fiInfo.innerHTML = ""
|
||||
|
||||
fetch('/download', {
|
||||
method: 'GET',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'FileRequest': file.fileDirectory
|
||||
}
|
||||
}).then(resp => resp.blob())
|
||||
.then(blob => {
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.style.display = "none";
|
||||
a.href = url;
|
||||
a.download = file.name;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
|
||||
})
|
||||
.catch(() => fiInfo.innerHTML = "Une erreur est survenue lors du téléchargement");
|
||||
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
deleteBtn.addEventListener("click", () => {
|
||||
|
||||
fiInfo.innerHTML = ""
|
||||
|
||||
fetch('/filemanager', {
|
||||
method: 'POST',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({"request":"del", "value": file})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => res(response, file))
|
||||
|
||||
|
||||
|
||||
function res(response, file) {
|
||||
|
||||
console.log(file)
|
||||
|
||||
if(response.result == "failed") {
|
||||
|
||||
content.innerHTML = ' <h1 style="color:red;"><i style="color:yellow; font-size: 2vw;" class="fa fa-warning"></i> Erreur de chargement des données - Erreur : ' + response.content + '</h1>'
|
||||
console.log("FAILED")
|
||||
|
||||
} else if(response.result == "success") {
|
||||
|
||||
if(response.content == "ERROR_NOT_MAKEABLE") {
|
||||
fiInfo.innerHTML = "<p>Vous n'avez pas la permission !</p>"
|
||||
|
||||
|
||||
} else if(response.content == "ERROR_NOT_EXIST") {
|
||||
console.log("ERROR NOT EXIST")
|
||||
getDirectory(currentDir.value)
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
newFolderDialog.close()
|
||||
getDirectory(currentDir.value)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
renameBtn.addEventListener("click", () => {
|
||||
|
||||
renameDialog.showModal()
|
||||
renameOldName.innerHTML = file.fileDirectory
|
||||
renameName.value = file.fileDirectory
|
||||
|
||||
|
||||
})
|
||||
|
||||
renameClose.addEventListener("click" ,() => {
|
||||
renameDialog.close()
|
||||
getDirectory(currentDir.value)
|
||||
|
||||
})
|
||||
|
||||
renameConfirm.addEventListener("click" ,() => {
|
||||
var rnjustspace = false
|
||||
renameInfo.innerHTML = ""
|
||||
|
||||
for (var i = 0; i < renameName.value.length; i++) {
|
||||
var char = renameName.value.charAt(i)
|
||||
|
||||
if(char != " ") {
|
||||
|
||||
rnjustspace = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(rnjustspace == false) {
|
||||
|
||||
renameInfo.innerHTML = "Le nom du dossier ne peut être vide !"
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
fetch('/filemanager', {
|
||||
method: 'POST',
|
||||
redirect: 'follow',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({"request":"rename", "value": renameName.value, "currentDir" : renameOldName.outerText})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => res(response))
|
||||
|
||||
function res(response) {
|
||||
if(response.result == "failed") {
|
||||
content.innerHTML = ' <h1 style="color:red;"><i style="color:yellow; font-size: 2vw;" class="fa fa-warning"></i> Erreur de chargement des données - Erreur : ' + response.content + '</h1>'
|
||||
console.log("FAILED")
|
||||
|
||||
} else if(response.result == "success") {
|
||||
|
||||
if(response.content == "ERROR_ALREADY_EXIST") {
|
||||
renameInfo.innerHTML = "<p>Le nom du dossier est déjà existant !</p>"
|
||||
|
||||
|
||||
} else if(response.content == "ERROR_NOT_MAKEABLE") {
|
||||
renameInfo.innerHTML = "<p>Vous n'avez pas la permission !</p>"
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
renameDialog.close()
|
||||
getDirectory(currentDir.value)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -428,7 +842,6 @@
|
||||
background-color: rgb(32, 32, 32) ;
|
||||
border-radius: 1vw;
|
||||
padding: 1vw;
|
||||
text-align: center;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
|
||||
@ -554,6 +967,93 @@ table {
|
||||
margin-bottom: 0.5vw !important;
|
||||
}
|
||||
|
||||
.fi_addfolder {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: transparent;
|
||||
background-color: rgb(80, 80, 80);
|
||||
color: white;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
.fi_add_close {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: rgb(255, 48, 48);
|
||||
border-width: 1%;
|
||||
border-style: solid;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s ease 0s;
|
||||
margin: 0.5vw;
|
||||
padding: 0.5vw;
|
||||
font-size: 1vw;
|
||||
}
|
||||
|
||||
.fi_add_close:hover {
|
||||
box-shadow: 1px 1px 10px rgb(255, 48, 48);
|
||||
background-color: rgb(255, 48, 48);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.fi_add_close:active {
|
||||
box-shadow: none;
|
||||
|
||||
}
|
||||
|
||||
.fi_add_confirm {
|
||||
|
||||
border-radius: 1vw;
|
||||
border-color: rgb(0, 174, 255);
|
||||
border-width: 1%;
|
||||
border-style: solid;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
transition: all 0.2s ease 0s;
|
||||
margin: 0.5vw;
|
||||
padding: 0.5vw;
|
||||
font-size: 1vw;
|
||||
|
||||
}
|
||||
|
||||
.fi_add_confirm:hover {
|
||||
box-shadow: 1px 1px 10px rgb(0, 174, 255);
|
||||
background-color: rgb(0, 174, 255);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.fi_add_confirm:active {
|
||||
box-shadow: none;
|
||||
|
||||
}
|
||||
|
||||
.inp {
|
||||
|
||||
border-style: hidden;
|
||||
border-radius: 1vw;
|
||||
padding: 0.2vw;
|
||||
padding-left: 1vw;
|
||||
transition: all 0.2s ease 0s;
|
||||
margin-bottom: 0.5vw;
|
||||
width: 100%;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.inp:hover {
|
||||
|
||||
box-shadow: 2px 2px 5px rgba(255, 255, 255, 0.477) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.inp:focus {
|
||||
|
||||
box-shadow: 5px 5px 5px rgba(0, 174, 255, 0.477) ;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
<h1><i class="fa fa-bell"></i> Notifications</h1>
|
||||
<hr>
|
||||
|
||||
<table class="table">
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
<div class="row w-100">
|
||||
<div class="hbox col-lg">
|
||||
<h1><i class="fa fa-link"></i> Liens raccourcis</h1>
|
||||
<hr>
|
||||
</br>
|
||||
<div id="lkcontent">
|
||||
|
||||
@ -78,7 +79,7 @@
|
||||
|
||||
for(var link of links) {
|
||||
|
||||
linksContent.push('<div class="row lk_line"> <p class="col-lg"><i class="fas fa-sticky-note"></i> Nom du raccourci : ' + link.name + '</p> <p class="col-lg"><i class="fa-sharp fa-solid fa-link"></i> Lien raccourci : <a href="http://localhost/link/' + link.dest + '">http://localhost/link/' + link.dest + '</a></p> <p class="col-lg"><i class="fa-solid fa-up-right-from-square"></i> Lien réel : <a href="' + link.src + '"><strong>Vers le lien</strong></a></p> <div class="col-lg "> <button id="' + link.name + '_edit_btn" class="lk_edit"><i class="fa fa-pen"></i></button> <button id="' + link.name + '_delete" class="lk_delete"><i class="fa fa-trash"></i></button> </div> </div>')
|
||||
linksContent.push('<div class="row lk_line"> <p class="col-lg"><i class="fas fa-sticky-note"></i> Nom du raccourci : ' + link.name + '</p> <p class="col-lg"><i class="fa-sharp fa-solid fa-link"></i> Lien raccourci : <a href="https://neutral.raphix.fr/link/' + link.dest + '">https://neutral.raphix.fr/link/' + link.dest + '</a></p> <p class="col-lg"><i class="fa-solid fa-up-right-from-square"></i> Lien réel : <a href="' + link.src + '"><strong>Vers le lien</strong></a></p> <div class="col-lg "> <button id="' + link.name + '_edit_btn" class="lk_edit"><i class="fa fa-pen"></i></button> <button id="' + link.name + '_delete" class="lk_delete"><i class="fa fa-trash"></i></button> </div> </div>')
|
||||
dialogContent.push('<dialog class="lk_adduser" id="' + link.name + '_dialog"> <h1><i class="fa fa-pen"></i> Editer un lien raccourci</h1> <p>Nom du raccourci :</p> <input class="inp" id="' + link.name + '_edit_name" type="text"> <p>Lien à raccourcir :</p> <input class="inp" id="' + link.name + '_edit_src" type="text"> <p>Nouveau lien (neutral.raphix.fr/link/<i>votrelien</i>):</p> <input class="inp" id="' + link.name + '_edit_dest" type="text"> <div style="color: rgb(255, 76, 76);" id="' + link.name + '_edit_info"></div> </div> <button onclick="getPage(\'link.html\')" id="lk_add_close" class="lk_add_close">Annuler</button> <button id="' + link.name + '_edit_confirm" class="lk_add_confirm">Editer</button> </dialog>')
|
||||
|
||||
lkcontent.innerHTML = linksContent.join("")
|
||||
|
70
public/templates/panel.html
Normal file
70
public/templates/panel.html
Normal file
@ -0,0 +1,70 @@
|
||||
<div class="home">
|
||||
<h1>Administration <button onclick="getPage('panel.html')">RELOAD</button></h1>
|
||||
</br>
|
||||
<div class="homepanel">
|
||||
<div class="row w-100">
|
||||
<div class="hbox col-lg">
|
||||
|
||||
|
||||
<h1><i class="fa fa-gear"></i> Actions et informations</h1>
|
||||
|
||||
<hr>
|
||||
|
||||
<button>Redémarrer</button>
|
||||
<button>Update</button>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="hbox col-lg">
|
||||
|
||||
|
||||
<h1><i class="fa fa-file"></i> Chemin d'accès et paramètres</h1>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Style-->
|
||||
<style>
|
||||
|
||||
.home {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hbox h1 {
|
||||
|
||||
font-size: large;
|
||||
|
||||
}
|
||||
|
||||
table {
|
||||
color: white;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hbox {
|
||||
|
||||
margin: 1%;
|
||||
padding: 1%;
|
||||
background-color: rgb(80, 80, 80);
|
||||
border-radius: 1vw;
|
||||
box-shadow: 5px 5px 5px rgba(80, 80, 80, 0.477) ;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
@ -6,6 +6,7 @@
|
||||
|
||||
<div class="hbox col">
|
||||
<p class="title"><i class="fa fa-id-card"></i> Mes informations</p>
|
||||
<hr>
|
||||
<div class="settings-content">
|
||||
<p>Photo de profil :</p>
|
||||
<div id="*accountpicture"></div>
|
||||
@ -183,6 +184,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
} else if(user_fullname.value != "") {
|
||||
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
<div class="users">
|
||||
<h1>Gestionnnaire des utilisateurs</h1>
|
||||
<h1>Gestionnaire des utilisateurs</h1>
|
||||
</br>
|
||||
<div class="homepanel">
|
||||
<div class="row w-100">
|
||||
<div class="hbox col">
|
||||
<h1><i class="fa fa-users"></i> Utilisateurs</h1>
|
||||
<hr>
|
||||
<div id="gus_panel" class="gus_users">
|
||||
|
||||
</div>
|
||||
|
554
routes/cv.js
Normal file
554
routes/cv.js
Normal file
@ -0,0 +1,554 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
var ntr = require("../neutral-functions.js")
|
||||
var fs = require("fs")
|
||||
var path = require("path")
|
||||
var mime = require('mime-types');
|
||||
const { compileString } = require('sass');
|
||||
const { response } = require('../app.js');
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
|
||||
|
||||
var check = ntr.checkToken(req, res)
|
||||
|
||||
if(check.name != false) {
|
||||
|
||||
res.redirect(302, "/")
|
||||
|
||||
} else {
|
||||
|
||||
res.render('login', {error: ""});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
router.post("/", function(req, res, next) {
|
||||
|
||||
var check = ntr.checkToken(req, res)
|
||||
|
||||
if(check.name == false) {
|
||||
|
||||
res.send({"result":"failed", "content":"ERROR_TOKEN_NOT_VALID"})
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if(check.permLevel >= 2) {
|
||||
|
||||
const bod = req.body
|
||||
|
||||
if(bod.request == "get") {
|
||||
|
||||
const markdownFolder = "/home/gitlab-ci/cv/dashboard-raphael/markdown/"
|
||||
|
||||
if(bod.value == "WHOAMI") {
|
||||
|
||||
var fileData = null;
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fileData = fs.readFileSync(markdownFolder + "whoami.md")
|
||||
|
||||
} else {
|
||||
fileData = fs.readFileSync("../MD_TEST/whoami.md")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
res.send({"result":"success", "content":fileData.toString()})
|
||||
} else if(bod.value == "CONTACT") {
|
||||
|
||||
var fileData = null;
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fileData = fs.readFileSync(markdownFolder + "info.md")
|
||||
|
||||
} else {
|
||||
fileData = fs.readFileSync("../MD_TEST/info.md")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
res.send({"result":"success", "content":fileData.toString()})
|
||||
} else if(bod.value == "FORMATION") {
|
||||
|
||||
var fileData = null;
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fileData = fs.readFileSync(markdownFolder + "formation.md")
|
||||
|
||||
} else {
|
||||
fileData = fs.readFileSync("../MD_TEST/formation.md")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
res.send({"result":"success", "content":fileData.toString()})
|
||||
} else if(bod.value == "DIPLOME") {
|
||||
|
||||
var fileData = null;
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fileData = fs.readFileSync(markdownFolder + "certif.md")
|
||||
|
||||
} else {
|
||||
fileData = fs.readFileSync("../MD_TEST/certif.md")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
res.send({"result":"success", "content":fileData.toString()})
|
||||
} else if(bod.value == "LOBBIES") {
|
||||
|
||||
var fileData = null;
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fileData = fs.readFileSync(markdownFolder + "passions.md")
|
||||
|
||||
} else {
|
||||
fileData = fs.readFileSync("../MD_TEST/passions.md")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
res.send({"result":"success", "content":fileData.toString()})
|
||||
} else if(bod.value == "FIND") {
|
||||
|
||||
var fileData = null;
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fileData = fs.readFileSync(markdownFolder + "find.md")
|
||||
|
||||
} else {
|
||||
fileData = fs.readFileSync("../MD_TEST/find.md")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
res.send({"result":"success", "content":fileData.toString()})
|
||||
} else {
|
||||
|
||||
|
||||
var fileData = null;
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fileData = fs.readFileSync(markdownFolder + "project/" + bod.value + ".md")
|
||||
|
||||
} else {
|
||||
fileData = fs.readFileSync("../MD_TEST/project/" + bod.value + ".md")
|
||||
|
||||
}
|
||||
|
||||
res.send({"result":"success", "content":fileData.toString()})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if(bod.request == "set") {
|
||||
|
||||
const markdownFolder = "/home/gitlab-ci/cv/dashboard-raphael/markdown/"
|
||||
|
||||
if(bod.type == "WHOAMI") {
|
||||
|
||||
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fs.writeFile(markdownFolder + "whoami.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
fs.writeFile("../MD_TEST/whoami.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
} else if(bod.type == "CONTACT") {
|
||||
|
||||
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fs.writeFile(markdownFolder + "info.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
fs.writeFile("../MD_TEST/info.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
res.send({"result":"success", "content":fileData.toString()})
|
||||
} else if(bod.type == "FORMATION") {
|
||||
|
||||
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fs.writeFile(markdownFolder + "formation.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
fs.writeFile("../MD_TEST/formation.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} else if(bod.type == "DIPLOME") {
|
||||
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fs.writeFile(markdownFolder + "certif.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
fs.writeFile("../MD_TEST/certif.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} else if(bod.type == "LOBBIES") {
|
||||
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fs.writeFile(markdownFolder + "passions.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
fs.writeFile("../MD_TEST/passions.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if(bod.type == "FIND") {
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fs.writeFile(markdownFolder + "find.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
fs.writeFile("../MD_TEST/find.md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if(fs.existsSync(markdownFolder)) {
|
||||
fs.writeFile(markdownFolder + "/project/" + bod.type + ".md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
fs.writeFile("../MD_TEST/project/" + bod.type + ".md", bod.value, (err) => {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else if(bod.request == "get-projects") {
|
||||
|
||||
const projectFolder = "/home/gitlab-ci/cv/dashboard-raphael/markdown/project/"
|
||||
|
||||
if(fs.existsSync(projectFolder)) {
|
||||
|
||||
var allProject = new Array()
|
||||
|
||||
fs.readdirSync(projectFolder).forEach((file) => {
|
||||
|
||||
allProject.push((file).replace(".md", ""))
|
||||
|
||||
})
|
||||
|
||||
|
||||
res.send({"result":"success", "content":allProject})
|
||||
|
||||
} else {
|
||||
|
||||
var allProject = new Array()
|
||||
|
||||
fs.readdirSync("../MD_TEST/project/").forEach((file) => {
|
||||
|
||||
|
||||
if(fs.statSync("../MD_TEST/project/" + file).isDirectory()) {
|
||||
console.log(file)
|
||||
|
||||
} else {
|
||||
allProject.push((file).replace(".md", ""))
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
res.send({"result":"success", "content":allProject})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if(bod.request == "del") {
|
||||
|
||||
|
||||
const projectFolder = "/home/gitlab-ci/cv/dashboard-raphael/markdown/project/"
|
||||
|
||||
if(fs.existsSync(projectFolder + bod.value + ".md")) {
|
||||
|
||||
fs.rm(projectFolder + bod.value + ".md", (err) => {
|
||||
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
} else if(fs.existsSync("../MD_TEST/project/" + bod.value + ".md")) {
|
||||
|
||||
|
||||
|
||||
fs.rm("../MD_TEST/project/" + bod.value + ".md", (err) => {
|
||||
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"failed", "content":"FILE_NO_EXIST"})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} else if(bod.request == "add") {
|
||||
|
||||
const projectFolder = "/home/gitlab-ci/cv/dashboard-raphael/markdown/project/"
|
||||
|
||||
if(fs.existsSync(projectFolder)) {
|
||||
|
||||
fs.writeFile(projectFolder + bod.value + ".md", "**" + bod.value + "**" ,(err) => {
|
||||
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
fs.writeFile("../MD_TEST/project/" + bod.value + ".md", "**" + bod.value + "**" ,(err) => {
|
||||
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
console.log(err)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"success", "content":"NO_PROBLEM"})
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"failed", "content":"ERROR_USER_PERMISSION_TOO_LOW"})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
module.exports = router;
|
48
routes/download.js
Normal file
48
routes/download.js
Normal file
@ -0,0 +1,48 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
var ntr = require("../neutral-functions.js");
|
||||
var fs = require("fs")
|
||||
var path = require("path")
|
||||
|
||||
router.get("/", function(req,res,next) {
|
||||
|
||||
var check = ntr.checkToken(req, res)
|
||||
|
||||
if(check.name != false) {
|
||||
|
||||
|
||||
|
||||
if(req.headers.filerequest != null && check.permLevel >= 3) {
|
||||
if(fs.existsSync(req.headers.filerequest)) {
|
||||
|
||||
res.download(req.headers.filerequest, (error) => {
|
||||
|
||||
if(error) {
|
||||
|
||||
res.send({"result":"ERROR"})
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"ERROR"})
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
res.redirect("/")
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
res.render('login', {error: ""});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
module.exports = router;
|
||||
|
@ -3,7 +3,8 @@ var router = express.Router();
|
||||
var ntr = require("../neutral-functions.js")
|
||||
var fs = require("fs")
|
||||
var path = require("path")
|
||||
var mime = require('mime-types')
|
||||
var mime = require('mime-types');
|
||||
const { compileString } = require('sass');
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
@ -59,7 +60,7 @@ router.post("/", function(req, res, next) {
|
||||
|
||||
const stat = fs.statSync(directory.replace("/", path.sep.replace("\\", path.sep)) + path.sep + file)
|
||||
|
||||
files.push({"name":file, "type":mime.lookup(file), "size":stat.size, "lastedition":stat.mtimeMs, "directory":stat.isDirectory()})
|
||||
files.push({"name":file, "fileDirectory" :directory.replace("/", path.sep.replace("\\", path.sep)) + path.sep + file , "type":mime.lookup(file), "size":stat.size, "lastedition":stat.mtimeMs, "directory":stat.isDirectory()})
|
||||
|
||||
|
||||
}
|
||||
@ -83,11 +84,80 @@ router.post("/", function(req, res, next) {
|
||||
|
||||
} else if(bod.request == "del") {
|
||||
|
||||
res.send({"result":"failed", "content":"ERROR_NOT_MAKE"})
|
||||
const file = bod.value
|
||||
|
||||
if(fs.existsSync(bod.value.fileDirectory) == false) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_EXIST"})
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
||||
if(file.directory == true) {
|
||||
fs.rmdirSync(file.fileDirectory , { recursive: true, force: true })
|
||||
|
||||
} else {
|
||||
fs.rmSync(file.fileDirectory)
|
||||
|
||||
|
||||
}
|
||||
console.log("DELETED")
|
||||
res.send({"result":"success", "content":"DELETED"})
|
||||
|
||||
} catch(error) {
|
||||
|
||||
console.log(error)
|
||||
console.log("NOT DELETED")
|
||||
res.send({"result":"success", "content":"ERROR_NOT_MAKEABLE"})
|
||||
}
|
||||
|
||||
console.log("NOT DELETED")
|
||||
|
||||
}
|
||||
|
||||
} else if(bod.request == "rename") {
|
||||
|
||||
res.send({"result":"failed", "content":"ERROR_NOT_MAKE"})
|
||||
if(fs.existsSync(bod.value) == true) {
|
||||
res.send({"result":"success", "content":"ERROR_ALREADY_EXIST"})
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
||||
fs.renameSync(bod.currentDir, bod.value)
|
||||
res.send({"result":"success", "content":"RENAMED"})
|
||||
|
||||
} catch(error) {
|
||||
console.log(error)
|
||||
res.send({"result":"success", "content":"ERROR_NOT_MAKEABLE"})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else if(bod.request == "addfolder") {
|
||||
|
||||
|
||||
if(fs.existsSync(bod.currentDir + path.sep + bod.value) == true) {
|
||||
res.send({"result":"success", "content":"ERROR_ALREADY_EXIST"})
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
fs.mkdirSync(bod.currentDir + path.sep + bod.value)
|
||||
res.send({"result":"success", "content":"CREATED"})
|
||||
|
||||
} catch(error) {
|
||||
console.log(error)
|
||||
res.send({"result":"success", "content":"ERROR_NOT_MAKEABLE"})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
res.send({"result":"failed", "content":"ERROR_REQUEST_MISSING_FIELDS", "additional": "REQUEST_MISSING"})
|
||||
|
@ -19,6 +19,7 @@ router.get('/', function(req, res, next) {
|
||||
|
||||
} else {
|
||||
|
||||
ntr.clearCookies(req.cookies.tokenID)
|
||||
res.clearCookie('tokenID')
|
||||
res.redirect(302, "/login")
|
||||
|
||||
|
@ -6,6 +6,8 @@ var CryptoJS = require("crypto-js");
|
||||
var uuid = require("uuid")
|
||||
var ntr = require("../neutral-functions.js");
|
||||
const Jimp = require("jimp");
|
||||
const { compileString } = require('sass');
|
||||
const { exec } = require('child_process');
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
@ -46,6 +48,7 @@ router.post("/", function(req, res, next) {
|
||||
var uploadPath = "";
|
||||
var uploadDir = __dirname.replace("routes","public" + path.sep + "images" + path.sep + "userspics" + path.sep)
|
||||
|
||||
|
||||
if(req.files.apic.mimetype == "image/png") {
|
||||
|
||||
uploadPath = req.headers.uploadforuser + ".png"
|
||||
@ -56,7 +59,7 @@ router.post("/", function(req, res, next) {
|
||||
uploadPath = req.headers.uploadforuser+ ".jpg"
|
||||
}
|
||||
|
||||
image.mv(uploadPath, function(err) {
|
||||
image.mv(__dirname.replace("routes", "") + path.sep + uploadPath, function(err) {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."})
|
||||
console.log(err)
|
||||
@ -76,7 +79,10 @@ router.post("/", function(req, res, next) {
|
||||
if(req.files.apic.mimetype == "image/jpeg") {
|
||||
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
||||
image.resize(200,200, function(err){
|
||||
if (err) throw err;
|
||||
if (err) {
|
||||
|
||||
console.log(err)
|
||||
}
|
||||
}).write(uploadDir + uploadPath.replace("jpg", "png"))
|
||||
fs.rmSync(uploadDir + req.headers.uploadforuser + ".jpg")
|
||||
|
||||
@ -91,7 +97,10 @@ router.post("/", function(req, res, next) {
|
||||
} else if(req.files.apic.mimetype == "image/png") {
|
||||
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
||||
image.resize(200,200, function(err){
|
||||
if (err) throw err;
|
||||
if (err) {
|
||||
|
||||
console.log(err)
|
||||
}
|
||||
}).write(uploadDir + uploadPath)
|
||||
|
||||
res.send({"result":"success", "content": "<span style='color:rgb(130, 255, 163);'>La photo de profil a été changé avec succès.</span>",})
|
||||
@ -133,6 +142,65 @@ router.post("/", function(req, res, next) {
|
||||
}
|
||||
|
||||
|
||||
} else if(req.headers.uploadfiledirectory != null) {
|
||||
|
||||
if(fs.existsSync(req.headers.uploadfiledirectory)) {
|
||||
image.mv(req.headers.uploadfiledirectory + path.sep + req.files.apic.name, (error) => {
|
||||
|
||||
if(error) {
|
||||
res.send({"result":"ERROR"})
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"SUCCESS"})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"ERROR"})
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if(req.headers.uploadforproject != null) {
|
||||
|
||||
const projectFolder = "/home/gitlab-ci/cv/dashboard-raphael/public/images/"
|
||||
|
||||
if(fs.existsSync(projectFolder)) {
|
||||
|
||||
image.mv(projectFolder + req.headers.uploadforproject + ".jpg", (error) => {
|
||||
|
||||
if(error) {
|
||||
res.send({"result":"ERROR"})
|
||||
console.log(error)
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"SUCCESS"})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
const mdtestfolder = "../MD_TEST/project/image/"
|
||||
|
||||
image.mv(mdtestfolder + req.headers.uploadforproject + ".jpg", (error) => {
|
||||
|
||||
if(error) {
|
||||
res.send({"result":"ERROR"})
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"SUCCESS"})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@ -151,7 +219,7 @@ router.post("/", function(req, res, next) {
|
||||
uploadPath = ntr.checkToken(req, res).name + ".jpg"
|
||||
}
|
||||
|
||||
image.mv(uploadPath, function(err) {
|
||||
image.mv(__dirname.replace("routes", "") + path.sep + uploadPath, function(err) {
|
||||
if(err) {
|
||||
res.send({"result":"success", "content": "La photo de profil n'a pas pu être chargé."})
|
||||
console.log(err)
|
||||
@ -171,7 +239,10 @@ router.post("/", function(req, res, next) {
|
||||
if(req.files.apic.mimetype == "image/jpeg") {
|
||||
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
||||
image.resize(200,200, function(err){
|
||||
if (err) throw err;
|
||||
if (err) {
|
||||
|
||||
console.log(err)
|
||||
}
|
||||
}).write(uploadDir + uploadPath.replace("jpg", "png"))
|
||||
fs.rmSync(uploadDir + ntr.checkToken(req, res).name + ".jpg")
|
||||
|
||||
@ -186,7 +257,10 @@ router.post("/", function(req, res, next) {
|
||||
} else if(req.files.apic.mimetype == "image/png") {
|
||||
Jimp.read(uploadDir + uploadPath, function (err, image) {
|
||||
image.resize(200,200, function(err){
|
||||
if (err) throw err;
|
||||
if (err) {
|
||||
|
||||
console.log(err)
|
||||
}
|
||||
}).write(uploadDir + uploadPath)
|
||||
|
||||
res.send({"result":"success", "content": "<span style='color:rgb(130, 255, 163);'>La photo de profil a été changé avec succès.</span>",})
|
||||
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"username": "raphix",
|
||||
"password": "U2FsdGVkX19eUkHlyqAgwuLYtNjlqzUmVAD7tBEBtaY=",
|
||||
"uuid": "0cee5da6-6812-49d8-97f5-2df5c1d78191",
|
||||
"fullname": "Raphael PICOT",
|
||||
"permissionLevel": 4,
|
||||
"token": {
|
||||
"tokenID": "748eac04-7725-4da3-a5ce-e02655e9a320",
|
||||
"livableToken": true,
|
||||
"createdAt": 1677602543822
|
||||
},
|
||||
"lastconnexion": 1677602755015
|
||||
}
|
9
users/2022eab5-5fa6-44ba-9f47-725c11226e97.json
Normal file
9
users/2022eab5-5fa6-44ba-9f47-725c11226e97.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"username": "root",
|
||||
"password": "U2FsdGVkX18At+CXx+srQ5aCaTZafPTcYEUPIIIi0f0=",
|
||||
"uuid": "2022eab5-5fa6-44ba-9f47-725c11226e97",
|
||||
"fullname": "Administrateur",
|
||||
"permissionLevel": 4,
|
||||
"tokens": {},
|
||||
"lastconnexion": 0
|
||||
}
|
9
users/a03e5a1b-4aa4-4ed1-bbb5-f734ddf7158e.json
Normal file
9
users/a03e5a1b-4aa4-4ed1-bbb5-f734ddf7158e.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"username": "raphix",
|
||||
"password": "U2FsdGVkX19Aop5Pvbq6wM82PpHsE18indmcC+9ken8=",
|
||||
"uuid": "a03e5a1b-4aa4-4ed1-bbb5-f734ddf7158e",
|
||||
"fullname": "Raphaël PICOT",
|
||||
"permissionLevel": 4,
|
||||
"tokens": {},
|
||||
"lastconnexion": 0
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"username": "root",
|
||||
"password": "U2FsdGVkX19uiFCajX45dwmAqo3GpmAQho5U9g5RSww=",
|
||||
"uuid": "c8f353a4-d0df-4c10-bccc-d4f47daf0f51",
|
||||
"fullname": "Administrateur",
|
||||
"permissionLevel": 4,
|
||||
"token": {
|
||||
"tokenID": "c750c10a-f69d-4dd2-8a35-65d8a74897bb",
|
||||
"livableToken": false,
|
||||
"createdAt": 1677339320398
|
||||
},
|
||||
"lastconnexion": 1677339336836
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
<body>
|
||||
<div id="sidebar" class="sidebar">
|
||||
<img class=" logo img-fluid" src="images/logo.png"></img>
|
||||
<div class="sidebar-content align-items-center">
|
||||
<div class="sidebar-content">
|
||||
<div class="middle">
|
||||
<div class="sidebar-item" id="s-home">
|
||||
<i class="fa-solid fa-home"></i>
|
||||
@ -22,22 +22,28 @@
|
||||
<i class="fa fa-users"></i>
|
||||
<p class="sidebar-text">Gestionnaire des utilisateurs</p>
|
||||
</div>
|
||||
<div class="sidebar-item " id="s-moni">
|
||||
<i class="fa fa-computer"></i>
|
||||
<p class="sidebar-text">Monitoring</p>
|
||||
</div>
|
||||
<div class="sidebar-item" id="s-device">
|
||||
<i class="fa-solid fa-server"></i>
|
||||
<p class="sidebar-text">Appareils et serveurs</p>
|
||||
</div>
|
||||
<div class="sidebar-item" id="s-cv">
|
||||
<i class="fa-solid fa-file-lines"></i>
|
||||
<p class="sidebar-text">Mon CV</p>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-item" id="s-link">
|
||||
<i class="fa-solid fa-link"></i>
|
||||
<p class="sidebar-text">Générateur de lien</p>
|
||||
</div>
|
||||
<div style="display: none;" class="sidebar-item " id="s-moni">
|
||||
<i class="fa fa-computer"></i>
|
||||
<p class="sidebar-text">Monitoring</p>
|
||||
</div>
|
||||
<div style="display: none;" class="sidebar-item" id="s-device">
|
||||
<i class="fa-solid fa-server"></i>
|
||||
<p class="sidebar-text">Appareils et serveurs</p>
|
||||
</div>
|
||||
|
||||
<div style="display: none;" class="sidebar-item" id="s-admin">
|
||||
<i class="fa-solid fa-gear"></i>
|
||||
<p class="sidebar-text">Administration</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Neutron - Login</title>
|
||||
<title>Neutral - Login</title>
|
||||
<script src="neutron.bundle.js"></script>
|
||||
<link rel='stylesheet' href='/stylesheets/style.css'>
|
||||
<meta charset="utf-8">
|
||||
|
Loading…
Reference in New Issue
Block a user