Umstellung von Beschreibung auf README aus Repository
This commit is contained in:
parent
046cfaeff0
commit
cf4c3cb8ad
22
app.js
22
app.js
|
@ -6,6 +6,8 @@ const nodemailer = require("nodemailer");
|
||||||
const { Pool } = require("pg");
|
const { Pool } = require("pg");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
|
const marked = require("marked");
|
||||||
|
const axios = require("axios");
|
||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
const log = require("node-file-logger");
|
const log = require("node-file-logger");
|
||||||
const QRCode = require("qrcode");
|
const QRCode = require("qrcode");
|
||||||
|
@ -409,12 +411,24 @@ app.get("/project/:id", async (req, res) => {
|
||||||
id,
|
id,
|
||||||
]);
|
]);
|
||||||
const projekt = result.rows[0];
|
const projekt = result.rows[0];
|
||||||
|
console.log(`${projekt.repository_link}/raw/branch/main/README.md`);
|
||||||
|
const url = `${projekt.repository_link}/raw/branch/main/README.md`;
|
||||||
|
|
||||||
|
// Abrufen der Datei
|
||||||
|
// const response = await axios.get(url);
|
||||||
|
|
||||||
|
// Markdown-Inhalt in HTML umwandeln
|
||||||
|
// const htmlContent = marked(response.data);
|
||||||
|
const htmlContent = "Testdata";
|
||||||
if (!projekt) {
|
if (!projekt) {
|
||||||
return res.status(404).send("Projekt nicht gefunden");
|
return res.status(404).send("Projekt nicht gefunden");
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render("project", { projekt, session: req.session });
|
res.render("project", {
|
||||||
|
projekt,
|
||||||
|
session: req.session,
|
||||||
|
content: htmlContent,
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
res.send("Fehler beim Abrufen des Projekts");
|
res.send("Fehler beim Abrufen des Projekts");
|
||||||
|
@ -423,11 +437,11 @@ app.get("/project/:id", async (req, res) => {
|
||||||
|
|
||||||
app.post("/projectedit", async (req, res) => {
|
app.post("/projectedit", async (req, res) => {
|
||||||
req.session.message = ["", "", "none"];
|
req.session.message = ["", "", "none"];
|
||||||
const { id, name, beschreibung } = req.body;
|
const { id, name, beschreibung, repository_link } = req.body;
|
||||||
try {
|
try {
|
||||||
await pool.query(
|
await pool.query(
|
||||||
"UPDATE projects SET name = $1, beschreibung = $2 WHERE id = $3",
|
"UPDATE projects SET name = $1, beschreibung = $2 repository_link =$3 WHERE id = $4",
|
||||||
[name, beschreibung, id]
|
[name, beschreibung, repository_link, id]
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"axios": "^1.7.7",
|
||||||
"bcrypt": "^5.1.1",
|
"bcrypt": "^5.1.1",
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
|
@ -16,6 +17,7 @@
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"express-session": "^1.18.0",
|
"express-session": "^1.18.0",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
|
"marked": "^14.1.2",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"node-file-logger": "^0.9.5",
|
"node-file-logger": "^0.9.5",
|
||||||
"nodemailer": "^6.9.13",
|
"nodemailer": "^6.9.13",
|
||||||
|
@ -196,6 +198,29 @@
|
||||||
"integrity": "sha512-3AungXC4I8kKsS9PuS4JH2nc+0bVY/mjgrephHTIi8fpEeGsTHBUJeosp0Wc1myYMElmD0B3Oc4XL/HVJ4PV2g==",
|
"integrity": "sha512-3AungXC4I8kKsS9PuS4JH2nc+0bVY/mjgrephHTIi8fpEeGsTHBUJeosp0Wc1myYMElmD0B3Oc4XL/HVJ4PV2g==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/axios": {
|
||||||
|
"version": "1.7.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz",
|
||||||
|
"integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.15.6",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
|
"proxy-from-env": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/axios/node_modules/form-data": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/balanced-match": {
|
"node_modules/balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
|
@ -743,6 +768,25 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/follow-redirects": {
|
||||||
|
"version": "1.15.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
|
||||||
|
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/forever-agent": {
|
"node_modules/forever-agent": {
|
||||||
"version": "0.6.1",
|
"version": "0.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||||
|
@ -1193,6 +1237,17 @@
|
||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/marked": {
|
||||||
|
"version": "14.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/marked/-/marked-14.1.2.tgz",
|
||||||
|
"integrity": "sha512-f3r0yqpz31VXiDB/wj9GaOB0a2PRLQl6vJmXiFrniNwjkKdvakqJRULhjFKJpxOchlCRiG5fcacoUZY5Xa6PEQ==",
|
||||||
|
"bin": {
|
||||||
|
"marked": "bin/marked.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/media-typer": {
|
"node_modules/media-typer": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||||
|
@ -1665,6 +1720,11 @@
|
||||||
"node": ">= 0.10"
|
"node": ">= 0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/proxy-from-env": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||||
|
},
|
||||||
"node_modules/psl": {
|
"node_modules/psl": {
|
||||||
"version": "1.9.0",
|
"version": "1.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"axios": "^1.7.7",
|
||||||
"bcrypt": "^5.1.1",
|
"bcrypt": "^5.1.1",
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"express-session": "^1.18.0",
|
"express-session": "^1.18.0",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
|
"marked": "^14.1.2",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"node-file-logger": "^0.9.5",
|
"node-file-logger": "^0.9.5",
|
||||||
"nodemailer": "^6.9.13",
|
"nodemailer": "^6.9.13",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div id="view" class="mt-5">
|
<div id="view" class="mt-5">
|
||||||
<h1><%= projekt.name %></h1>
|
<h1><%= projekt.name %></h1>
|
||||||
<p><%= projekt.kurzbeschreibung %></p>
|
<p><%= projekt.kurzbeschreibung %></p>
|
||||||
<p><%= projekt.beschreibung %></p>
|
<p><%= content %></p>
|
||||||
<p>
|
<p>
|
||||||
<a href="<%= projekt.repository_link %>" target="_blank">Repository Link</a>
|
<a href="<%= projekt.repository_link %>" target="_blank">Repository Link</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in New Issue