From d102ec4cbc5ba59d4daf013c04f03496fdbbf0e5 Mon Sep 17 00:00:00 2001 From: sanny Date: Thu, 8 Oct 2020 09:53:51 +0200 Subject: [PATCH 1/2] resolve vulnerabitlities --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 074ca7c..0cb0d6a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -821,9 +821,9 @@ "integrity": "sha512-0L9FvHG3nfnnmaEQPjT9xhfN4ISk0A8/2j4M37Np4mcDesJjHgEUfgPhdCyZuFI954tjokaIj/A3NdpFNdEh4Q==" }, "node-forge": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.6.tgz", - "integrity": "sha512-sol30LUpz1jQFBjOKwbjxijiE3b6pjd74YwfD0fJOKPjF+fONKb2Yg8rYgS6+bK6VDl+/wfr4IYpC7jDzLUIfw==" + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" }, "object-assign": { "version": "4.1.1", @@ -1307,12 +1307,12 @@ } }, "xml-encryption": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/xml-encryption/-/xml-encryption-1.2.0.tgz", - "integrity": "sha512-J3NjGMY8jf6bTo15jURTYBLtsisbnyCeM+MuxtfiAkZEZBnSZpNKjUUORhiOScKvSi6tMOAaZ3r7bZOXOni+Ew==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/xml-encryption/-/xml-encryption-1.2.1.tgz", + "integrity": "sha512-hn5w3l5p2+nGjlmM0CAhMChDzVGhW+M37jH35Z+GJIipXbn9PUlAIRZ6I5Wm7ynlqZjFrMAr83d/CIp9VZJMTA==", "requires": { "escape-html": "^1.0.3", - "node-forge": "^0.7.0", + "node-forge": "^0.10.0", "xmldom": "~0.1.15", "xpath": "0.0.27" } -- GitLab From f6dc143c13e991851bbdf5d4b82cdabdc56adcc7 Mon Sep 17 00:00:00 2001 From: sanny Date: Thu, 8 Oct 2020 13:50:58 +0200 Subject: [PATCH 2/2] separating the project-repo list from the project-pages list --- routes/routes-project.js | 80 +++++++++++++++++++------- views/DE/project/pagesList.pug | 98 ++++++++++++++++++++++++++++++++ views/DE/project/projectList.pug | 33 +---------- 3 files changed, 160 insertions(+), 51 deletions(-) create mode 100644 views/DE/project/pagesList.pug diff --git a/routes/routes-project.js b/routes/routes-project.js index dc21915..65d942a 100644 --- a/routes/routes-project.js +++ b/routes/routes-project.js @@ -362,9 +362,9 @@ module.exports = function (app) { perPage+'&order_by=id&sort=asc&id_after='+idAfter) } - app.get('/projectlist', async function(req, res){ + // Projektdaten + app.get('/projektdaten', async function(req, res){ let projectArr = [] - let pagesArr = [] let isProject = true let firstId = 0 @@ -381,16 +381,66 @@ module.exports = function (app) { if (projectData[i].name == "template_gitlab_page") { continue } - // M4_LAB logo for all projects that do not have logo - if (projectData[i].avatar_url == null) { - projectData[i].avatar_url = "https://m4lab.hft-stuttgart.de/img/footer/M4_LAB_LOGO_Graustufen.png" + // only repo + if (!projectData[i].tag_list.includes('website')) { + // M4_LAB logo for all projects that do not have logo + if (projectData[i].avatar_url == null) { + projectData[i].avatar_url = "https://m4lab.hft-stuttgart.de/img/footer/M4_LAB_LOGO_Graustufen.png" + } + // for all projects that have no description + if (projectData[i].description == "") { + projectData[i].description = "- no description -" + } + + let project = { + logo: projectData[i].avatar_url, + name: projectData[i].name, + weburl: projectData[i].web_url, + desc: projectData[i].description, + keywords: projectData[i].tag_list + } + projectArr.push(project) } - // for all projects that have no description - if (projectData[i].description == "") { - projectData[i].description = "- no description -" + } + + firstId = projectData[projectData.length-1].id + } + } + + res.render(lang+'/project/projectList', { + project: projectArr + }) + }) + + // Projektinformationen + app.get('/projektinformationen', async function(req, res){ + let pagesArr = [] + let isProject = true + let firstId = 0 + + while (isProject == true) { + let projects = await getProjectsFromGitlab(10, firstId) + let projectData = projects.data + + if (projectData.length == 0) { + isProject = false + } + else { + for(let i = 0; i < projectData.length; i++){ + // skip template project + if (projectData[i].name == "template_gitlab_page") { + continue } // websites if (projectData[i].tag_list.includes('website')) { + // M4_LAB logo for all projects that do not have logo + if (projectData[i].avatar_url == null) { + projectData[i].avatar_url = "https://m4lab.hft-stuttgart.de/img/footer/M4_LAB_LOGO_Graustufen.png" + } + // for all projects that have no description + if (projectData[i].description == "") { + projectData[i].description = "- no description -" + } // customize website name if (projectData[i].name == "Visualization") { projectData[i].web_url = "https://transfer.hft-stuttgart.de/pages/visualization" @@ -421,27 +471,15 @@ module.exports = function (app) { pagesArr.push(pages) } - else { - let project = { - logo: projectData[i].avatar_url, - name: projectData[i].name, - weburl: projectData[i].web_url, - desc: projectData[i].description, - keywords: projectData[i].tag_list - } - projectArr.push(project) - } } firstId = projectData[projectData.length-1].id } } - res.render(lang+'/project/projectList', { - project: projectArr, + res.render(lang+'/project/pagesList', { pages: pagesArr }) }) - }; \ No newline at end of file diff --git a/views/DE/project/pagesList.pug b/views/DE/project/pagesList.pug new file mode 100644 index 0000000..d3c8a4b --- /dev/null +++ b/views/DE/project/pagesList.pug @@ -0,0 +1,98 @@ +doctype html +html(lang="de") + head + title= "Projektinformationen" + meta(charset="UTF-8") + meta(name="viewport", content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no") + link(rel="stylesheet", type="text/css", href="https://transfer.hft-stuttgart.de/css/bootstrap.min.css") + link(rel="stylesheet", type="text/css", href="https://transfer.hft-stuttgart.de/css/m4lab.css") + link(rel="stylesheet", href="https://use.fontawesome.com/releases/v5.8.2/css/all.css", integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay", crossorigin="anonymous") + style. + .title-container { + position: relative; + color: white; + } + .card-title-bottom-left { + position: absolute; + bottom: 0px; + width: 100%; + color: black; + font-weight: bold; + background: rgb(255, 255, 255, 0.5); + text-align: left; + padding: 5px + } + .card-img-top { + height: 15vw; + object-fit: cover; + } + body + div(class="container") + div(class="pt-4 pb-4 form-row") + div(class="form-group col-md-10") + input(id="searchInput", class="form-control", type="text", placeholder="Suchen Sie hier nach Themen und Projekten", onkeyup="searchFunction()") + div(class="form-group col-md-2") + select(class="form-control") + option uncategorized + h3(class="mb-3 font-weight-bold") Projektinformationen + p(class="font-italic") Hier finden Sie Informationen zu den bei uns gehosteten Projekten, wie z.B. Projektbeschreibungen, Projektwebseiten, Visualisierungen, Demonstrationen. + + div(class="container") + p#pagesCounter #{pages.length} Projektinformationen werden angezeigt + |
+ for item in pages + div(class="py-4 col-sm") + div(class="card", style="width: 18rem;") + div(class="title-container") + h5(class="card-title-bottom-left") #{item.name} + img(class="card-img-top", src=item.logo) + div(class="card-body") + div(class="row") + each key in item.keywords + h6 + span(class="badge badge-pill badge-primary px-2") #{key} + |   + div(class="row") + div(class="col-9") + p(class="card-text") #{item.desc} + div(class="col-3") + svg(class="bi bi-chevron-right", width="32", height="32", viewBox="0 0 20 20", fill="currentColor", xmlns="http://www.w3.org/2000/svg") + | + |
+ + // jQuery + script(src="https://code.jquery.com/jquery-3.3.1.min.js") + script(src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js", integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1", crossorigin="anonymous") + // Bootstrap + script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous") + // Header + script(src="https://transfer.hft-stuttgart.de/js/headfoot.js") + script. + function searchFunction() { + var input = document.getElementById("searchInput") + var filter = input.value.toUpperCase() + + var cardsCol = document.getElementsByClassName("col-sm") + var cardTitle, cardText, titleValue, textValue + + var i + var counterBlock = 0 + for (i = 0; i < cardsCol.length; i++) { + cardTitle = cardsCol[i].getElementsByClassName("card-title-bottom-left"); + cardBody = cardsCol[i].getElementsByClassName("card-body"); + cardText = cardsCol[i].getElementsByClassName("card-text"); + + titleValue = cardTitle[0].textContent || cardTitle[0].innerText; + bodyValue = cardBody[0].textContent || cardBody[0].innerText; + textValue = cardText[0].textContent || cardText[0].innerText; + + if (titleValue.toUpperCase().indexOf(filter) > -1 || bodyValue.toUpperCase().indexOf(filter) > -1 || textValue.toUpperCase().indexOf(filter) > -1) { + cardsCol[i].style.display = "block" + counterBlock++ + } else { + cardsCol[i].style.display = "none" + } + } + + document.getElementById("pagesCounter").innerHTML = counterBlock+" Projektinformationen werden angezeigt" + } \ No newline at end of file diff --git a/views/DE/project/projectList.pug b/views/DE/project/projectList.pug index 5c69acd..b783304 100644 --- a/views/DE/project/projectList.pug +++ b/views/DE/project/projectList.pug @@ -1,7 +1,7 @@ doctype html html(lang="de") head - title= "Project List" + title= "Projektdaten" meta(charset="UTF-8") meta(name="viewport", content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no") link(rel="stylesheet", type="text/css", href="https://transfer.hft-stuttgart.de/css/bootstrap.min.css") @@ -34,37 +34,11 @@ html(lang="de") div(class="form-group col-md-2") select(class="form-control") option uncategorized - h3(class="mb-3 font-weight-bold") Projektinformationen - p(class="font-italic") Hier finden Sie Informationen zu den bei uns gehosteten Projekten, wie z.B. Projektbeschreibungen, Projektwebseiten, Visualisierungen, Demonstrationen. - - div(class="container") - //p#pagesCounter #{pages.length} Projektinformationen werden angezeigt - |
- for item in pages - div(class="py-4 col-sm") - div(class="card", style="width: 18rem;") - div(class="title-container") - h5(class="card-title-bottom-left") #{item.name} - img(class="card-img-top", src=item.logo) - div(class="card-body") - div(class="row") - each key in item.keywords - h6 - span(class="badge badge-pill badge-primary px-2") #{key} - |   - div(class="row") - div(class="col-9") - p(class="card-text") #{item.desc} - div(class="col-3") - svg(class="bi bi-chevron-right", width="32", height="32", viewBox="0 0 20 20", fill="currentColor", xmlns="http://www.w3.org/2000/svg") - | - |
- h3(class="mb-3 font-weight-bold") Projektdaten p(class="font-italic") Hier finden Sie den direkten Zugang zu den Inalten der bei uns gehosteten Projekte. div(class="container") - //p#projectCounter #{project.length} Projektdaten werden angezeigt + p#projectCounter #{project.length} Projektdaten werden angezeigt |
for item in project div(class="py-4 col-sm") @@ -120,6 +94,5 @@ html(lang="de") } } - //document.getElementById("pagesCounter").innerHTML = counterBlock+" Projekte werden angezeigt" - //document.getElementById("projectCounter").innerHTML = counterBlock+" Projekte werden angezeigt" + document.getElementById("projectCounter").innerHTML = counterBlock+" Projektdaten werden angezeigt" } \ No newline at end of file -- GitLab