Update and rework project structure with new pagebuilder concept. (based on RK Architekten and SFU Politik configs and sources)

This commit is contained in:
2022-11-17 16:01:52 +00:00
parent 825dfc18f9
commit 30c05143fe
1421 changed files with 3875 additions and 4975 deletions

View File

@@ -1,11 +0,0 @@
// @ts-check
const { generateArticleSlugUrlString: generateSlugUrlStringByArticle } = require("../lib/helper")
;(function () {
/** @type {import("tibi-types").HookResponse} */
let hookResponse
context.data.article.content.slug = generateSlugUrlStringByArticle(context.data.article)
return hookResponse
})()

View File

@@ -1,11 +0,0 @@
// @ts-check
const { generateArticleSlugUrlString: generateSlugUrlStringByArticle } = require("../lib/helper")
;(function () {
/** @type {import("tibi-types").HookResponse} */
let hookResponse
context.data.article.content.slug = generateSlugUrlStringByArticle(context.data.article)
return hookResponse
})()

View File

@@ -1,22 +1,68 @@
// @ts-check
let utils = require("../lib/utils")
const config = require("../config")
var utils = require("../lib/utils")
const { operatorEmail } = config
// const { objectToText } = require("../lib/helper")
;(function () {
if (utils.isPublicToken(context)) {
// js captcha
var checksum = context.request().query("cs")
var email = context.data.email
if (!email || (email.length * 1000).toString(16) + "x" !== checksum) {
throw {
status: 403,
error: "forbidden data",
}
/** @type {import("tibi-types").HookResponse} */
let hookResponse
const type = context.request().query("type")
if (!type) {
throw {
status: 403,
error: "invalid data",
}
}
if (typeof context.data != "object") {
throw {
status: 400,
error: "invalid body data",
}
}
/** @type {import('tibi-types').HookResponse} */
// @ts-ignore
var response = null
return response
let to = ""
let from = ""
let fromName = ""
let replyTo = ""
let subject
let plainText
let html
if (utils.isPublicToken(context)) {
to = operatorEmail
from = context.data.email
fromName = context.data.name
replyTo = context.data.email
if (type === "contactForm") {
subject = utils.tpl(context, "templates/operator_contact_form_subject.de.txt")
html = utils.tpl(context, "templates/operator_contact_form_body.de.html")
}
}
if ((!plainText && !html) || !subject) {
throw {
status: 403,
error: "invalid mail data",
}
}
context.smtp.sendMail({
to,
from,
fromName,
subject,
html,
// attach: ["attachments/AGB.pdf"],
})
throw {
status: 200,
message: "ok",
}
return hookResponse
})()

View File

@@ -1,34 +0,0 @@
// @ts-check
var config = require("../config")
var utils = require("../lib/utils")
;(function () {
if (utils.isPublicToken(context)) {
var emailFrom = context.data.email
var emailFromName =
(context.data.firstname || "") +
(context.data.firstname && context.data.lastname && " ") +
(context.data.lastname || "")
context.smtp.sendMail({
to: config.operatorEmail,
from: emailFrom,
fromName: emailFromName,
subject: utils.tpl(
context,
"templates/operator_contact_form_subject.de.txt"
),
html: utils.tpl(
context,
"templates/operator_contact_form_body.de.html"
),
// attach: ["attachments/AGB.pdf"],
})
}
/** @type {import('tibi-types').HookResponse} */
// @ts-ignore
var response = null
return response
})()

View File

@@ -1,7 +0,0 @@
// @ts-check
var utils = require("../lib/utils")
;(function () {
utils.clearSSRCache()
})()

View File

@@ -0,0 +1,11 @@
// @ts-check
const { generateUrlString } = require("../lib/helper")
;(function () {
/** @type {import("tibi-types").HookResponse} */
let hookResponse
context.data.path = generateUrlString(context.data.path)
return hookResponse
})()

View File

@@ -1,7 +0,0 @@
// @ts-check
var utils = require("../lib/utils")
;(function () {
utils.clearSSRCache()
})()

View File

@@ -1,7 +0,0 @@
// @ts-check
var utils = require("../lib/utils")
;(function () {
utils.clearSSRCache()
})()

View File

@@ -0,0 +1,11 @@
// @ts-check
const { generateUrlString } = require("../lib/helper")
;(function () {
/** @type {import("tibi-types").HookResponse} */
let hookResponse
context.data.path = generateUrlString(context.data.path)
return hookResponse
})()

View File

@@ -1,17 +1,14 @@
const generateArticleSlugUrlString = (article) => {
let slug = article.content.slug
let title = article.content.title
if (!slug || slug === "") {
slug = title
.replace(/[^a-zA-Z0-9 ]/g, "")
const generateUrlString = (text) => {
if (text) {
return text
.replace(/[^a-zA-Z0-9 \/]/g, "")
.replace(/\s/g, "-")
.toLowerCase()
}
return slug
return ""
}
module.exports = {
generateArticleSlugUrlString,
generateUrlString,
}