diff --git a/CHANGELOG.md b/CHANGELOG.md index 0840b3848..4dde961bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ see wiki for more information: [wiki](https://github.com/thmarx/cms/wiki) * **FEATURE** Add redirect support for aliases [454](https://github.com/CondationCMS/cms-server/issues/454) * **FEATURE** Signature for modules and themes [471](https://github.com/CondationCMS/cms-server/issues/471) * **FEATURE** Switch password has to secure algorithm [472](https://github.com/CondationCMS/cms-server/issues/472) +* **FEATURE** Add spa mode for sites [476](https://github.com/CondationCMS/cms-server/issues/476) ### Developer experience diff --git a/cms-api/src/main/java/com/condation/cms/api/SiteProperties.java b/cms-api/src/main/java/com/condation/cms/api/SiteProperties.java index 5e654b2ee..a66c8d807 100644 --- a/cms-api/src/main/java/com/condation/cms/api/SiteProperties.java +++ b/cms-api/src/main/java/com/condation/cms/api/SiteProperties.java @@ -63,4 +63,8 @@ public interface SiteProperties { public String templateEngine(); public List activeModules(); + + public default boolean spaEnabled () { + return false; + } } diff --git a/cms-core/src/main/java/com/condation/cms/core/configuration/properties/ExtendedSiteProperties.java b/cms-core/src/main/java/com/condation/cms/core/configuration/properties/ExtendedSiteProperties.java index a97686568..742c96a3b 100644 --- a/cms-core/src/main/java/com/condation/cms/core/configuration/properties/ExtendedSiteProperties.java +++ b/cms-core/src/main/java/com/condation/cms/core/configuration/properties/ExtendedSiteProperties.java @@ -119,6 +119,11 @@ public boolean cacheContent() { return configuration.getBoolean("cache.content", Constants.DEFAULT_CONTENT_CACHE_ENABLED); } + @Override + public boolean spaEnabled() { + return configuration.getBoolean("spa.enabled", false); + } + @Override public String templateEngine() { return configuration.getString("template.engine"); diff --git a/cms-server/src/main/java/com/condation/cms/server/handler/content/JettyContentHandler.java b/cms-server/src/main/java/com/condation/cms/server/handler/content/JettyContentHandler.java index b0f15cc89..7000f6372 100644 --- a/cms-server/src/main/java/com/condation/cms/server/handler/content/JettyContentHandler.java +++ b/cms-server/src/main/java/com/condation/cms/server/handler/content/JettyContentHandler.java @@ -23,9 +23,11 @@ */ +import com.condation.cms.api.configuration.configs.SiteConfiguration; import com.condation.cms.api.content.ContentResponse; import com.condation.cms.api.content.DefaultContentResponse; import com.condation.cms.api.content.RedirectContentResponse; +import com.condation.cms.api.feature.features.ConfigurationFeature; import com.condation.cms.api.request.RequestContext; import com.condation.cms.api.utils.HTTPUtil; import com.condation.cms.api.utils.RequestUtil; @@ -62,6 +64,14 @@ public boolean handle(Request request, Response response, Callback callback) thr var queryParameters = HTTPUtil.queryParameters(request.getHttpURI().getQuery()); var requestContext = (RequestContext) request.getAttribute(CreateRequestContextFilter.REQUEST_CONTEXT); + // handle enabled spa mode + var spaEnabled = requestContext.get(ConfigurationFeature.class).configuration().get(SiteConfiguration.class).siteProperties().spaEnabled(); + var notFoundContent = "/.technical/404"; + if (spaEnabled) { + uri = ""; + notFoundContent = "/"; + } + try { Optional content = contentResolver.getContent(requestContext); response.setStatus(200); @@ -73,7 +83,7 @@ public boolean handle(Request request, Response response, Callback callback) thr if (content.isEmpty()) { log.debug("content not found {}", uri); try (var errorContext = requestContextFactory.create(request.getContext().getContextPath(), - "/.technical/404", + notFoundContent, queryParameters, Optional.of(request))) { content = contentResolver.getErrorContent(errorContext); response.setStatus(404); diff --git a/test-server/hosts/demo_spa/assets/app.css b/test-server/hosts/demo_spa/assets/app.css new file mode 100644 index 000000000..3f0ac3968 --- /dev/null +++ b/test-server/hosts/demo_spa/assets/app.css @@ -0,0 +1,14 @@ +body { + font-family: sans-serif; + padding: 2rem; +} + +nav a { + margin-right: 1rem; + text-decoration: none; + color: steelblue; +} + +nav a:hover { + text-decoration: underline; +} diff --git a/test-server/hosts/demo_spa/assets/app.js b/test-server/hosts/demo_spa/assets/app.js new file mode 100644 index 000000000..a5314f45d --- /dev/null +++ b/test-server/hosts/demo_spa/assets/app.js @@ -0,0 +1,30 @@ +const routes = { + "/": () => "

Welcome!

This is the starting page.

", + "/about": () => "

About us

We are the team behind CondationCMS.

", + "/contact": () => "

Contact

Send us a message!

", +}; + +function router() { + const path = window.location.pathname; + const content = routes[path] ? routes[path]() : "

404

Seite nicht gefunden

"; + document.getElementById("app").innerHTML = content; +} + +function navigateTo(url) { + history.pushState(null, null, url); + router(); +} + +// Link-Klicks abfangen +document.addEventListener("click", e => { + if (e.target.matches("[data-link]")) { + e.preventDefault(); + navigateTo(e.target.href); + } +}); + +// Popstate (zurück/vor) +window.addEventListener("popstate", router); + +// Initialer Aufruf +document.addEventListener("DOMContentLoaded", router); diff --git a/test-server/hosts/features/assets/favicon.ico b/test-server/hosts/demo_spa/assets/favicon.ico similarity index 100% rename from test-server/hosts/features/assets/favicon.ico rename to test-server/hosts/demo_spa/assets/favicon.ico diff --git a/test-server/hosts/features/config/media.toml b/test-server/hosts/demo_spa/config/media.toml similarity index 100% rename from test-server/hosts/features/config/media.toml rename to test-server/hosts/demo_spa/config/media.toml diff --git a/test-server/hosts/demo_spa/content/index.md b/test-server/hosts/demo_spa/content/index.md new file mode 100644 index 000000000..3582564c3 --- /dev/null +++ b/test-server/hosts/demo_spa/content/index.md @@ -0,0 +1,10 @@ +--- +title: Startseite +template: index.html +search: + index: false +--- + +# Demo Project + +![TestBild!](/media/images/test.jpg?format=small) \ No newline at end of file diff --git a/test-server/hosts/features/content/robots.txt b/test-server/hosts/demo_spa/content/robots.txt similarity index 100% rename from test-server/hosts/features/content/robots.txt rename to test-server/hosts/demo_spa/content/robots.txt diff --git a/test-server/hosts/demo_spa/site-dev.toml b/test-server/hosts/demo_spa/site-dev.toml new file mode 100644 index 000000000..eb2cd86dc --- /dev/null +++ b/test-server/hosts/demo_spa/site-dev.toml @@ -0,0 +1 @@ +hostname = [ "localhost5" ] \ No newline at end of file diff --git a/test-server/hosts/demo_spa/site.toml b/test-server/hosts/demo_spa/site.toml new file mode 100644 index 000000000..ab4abb601 --- /dev/null +++ b/test-server/hosts/demo_spa/site.toml @@ -0,0 +1,7 @@ +id = "demo-spa" +hostname = [ "localhost2" ] +baseurl = "http://localhosts:2020" +language = "en" + +[spa] +enabled = true \ No newline at end of file diff --git a/test-server/hosts/demo_spa/temp/media/images_test_jpg-small.webp b/test-server/hosts/demo_spa/temp/media/images_test_jpg-small.webp new file mode 100644 index 000000000..f7aeb4967 Binary files /dev/null and b/test-server/hosts/demo_spa/temp/media/images_test_jpg-small.webp differ diff --git a/test-server/hosts/demo_spa/templates/index.html b/test-server/hosts/demo_spa/templates/index.html new file mode 100644 index 000000000..dd620c888 --- /dev/null +++ b/test-server/hosts/demo_spa/templates/index.html @@ -0,0 +1,22 @@ + + + + + Mini SPA + + + + + +
+ +
+ + + + + diff --git a/test-server/hosts/features/assets/app-1.js b/test-server/hosts/features/assets/app-1.js deleted file mode 100644 index 232ea4c74..000000000 --- a/test-server/hosts/features/assets/app-1.js +++ /dev/null @@ -1,4 +0,0 @@ -// app.js -document.addEventListener("DOMContentLoaded", () => { - console.log("app loaded") -}) diff --git a/test-server/hosts/features/assets/form-1.css b/test-server/hosts/features/assets/form-1.css deleted file mode 100644 index df4d6dcd0..000000000 --- a/test-server/hosts/features/assets/form-1.css +++ /dev/null @@ -1,3 +0,0 @@ -span#reloadCaptcha:hover { - cursor: pointer; -} \ No newline at end of file diff --git a/test-server/hosts/features/assets/form-1.js b/test-server/hosts/features/assets/form-1.js deleted file mode 100644 index 62f6ec3e1..000000000 --- a/test-server/hosts/features/assets/form-1.js +++ /dev/null @@ -1,50 +0,0 @@ -// form.js -const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; -const generateString = (length) => { - let result = '' - const charactersLength = characters.length - for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)) - } - - return result; -} - -const validateCaptcha = async (event) => { - event.preventDefault(); - let request = { - code: document.getElementById("inputCaptcha").value, - key: document.getElementById("captchaKey").value - } - - const response = await fetch('/module/forms-module/captcha/validate', { - method: 'POST', - body: JSON.stringify(request) - }) - - const validationResponse = await response.json() - - if (!validationResponse.valid) { - alert("captcha code is not valid") - event.preventDefault() - return false - } else { - console.log(event.target) - event.target.submit() - return true - } -} - -document.addEventListener("DOMContentLoaded", () => { - if (document.getElementById("reloadCaptcha")) { - document.getElementById("reloadCaptcha").addEventListener("click", () => { - let href = new URL(document.getElementById("captchaImg").src) - let key = generateString(8) - href.searchParams.set('key', key) - - document.getElementById("captchaKey").value = key - document.getElementById("captchaImg").src = href.toString() - }) - } - -}) diff --git a/test-server/hosts/features/assets/images/test.jpg b/test-server/hosts/features/assets/images/test.jpg deleted file mode 100644 index f6a8d2892..000000000 Binary files a/test-server/hosts/features/assets/images/test.jpg and /dev/null differ diff --git a/test-server/hosts/features/assets/images/test.jpg.meta.yaml b/test-server/hosts/features/assets/images/test.jpg.meta.yaml deleted file mode 100644 index 32da56cd9..000000000 --- a/test-server/hosts/features/assets/images/test.jpg.meta.yaml +++ /dev/null @@ -1 +0,0 @@ -alt: "Schmetterlinge" \ No newline at end of file diff --git a/test-server/hosts/features/assets/styles-1.css b/test-server/hosts/features/assets/styles-1.css deleted file mode 100644 index 8b1378917..000000000 --- a/test-server/hosts/features/assets/styles-1.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test-server/hosts/features/config/auth.yaml b/test-server/hosts/features/config/auth.yaml deleted file mode 100644 index 142a9e00c..000000000 --- a/test-server/hosts/features/config/auth.yaml +++ /dev/null @@ -1,4 +0,0 @@ -paths: - - path: "/search" - realm: "users" - groups: ["eins"] \ No newline at end of file diff --git a/test-server/hosts/features/config/forms.yaml b/test-server/hosts/features/config/forms.yaml deleted file mode 100644 index 397ba8fe3..000000000 --- a/test-server/hosts/features/config/forms.yaml +++ /dev/null @@ -1,15 +0,0 @@ -mail: - smtp: - hostname: 127.0.0.1 - port: 3025 - username: test@example.test - password: password -forms: - - name: contact - to: contact@example.com - subject: Ich suche Kontakt! - fields: [message] - redirects: - success: /forms/contact/success -redirects: - error: /forms/error \ No newline at end of file diff --git a/test-server/hosts/features/config/taxonomy.tags.yaml b/test-server/hosts/features/config/taxonomy.tags.yaml deleted file mode 100644 index 1b7740c30..000000000 --- a/test-server/hosts/features/config/taxonomy.tags.yaml +++ /dev/null @@ -1,9 +0,0 @@ -## YAML Template. ---- -values: - - id: blue - title: Blau - - id: red - title: Rot - - id: orange - title: Orange \ No newline at end of file diff --git a/test-server/hosts/features/config/taxonomy.yaml b/test-server/hosts/features/config/taxonomy.yaml deleted file mode 100644 index 0005133fd..000000000 --- a/test-server/hosts/features/config/taxonomy.yaml +++ /dev/null @@ -1,10 +0,0 @@ -## YAML Template. ---- -taxonomies: - - title: Kategorie - slug: kategorien - field: taxonomy.category - - title: Tags - slug: tags - field: taxonomy.tags - array: true \ No newline at end of file diff --git a/test-server/hosts/features/config/users.realm b/test-server/hosts/features/config/users.realm deleted file mode 100644 index 455472b1c..000000000 --- a/test-server/hosts/features/config/users.realm +++ /dev/null @@ -1 +0,0 @@ -test:2a97516c354b68848cdbd8f54a226a0a55b21ed138e207ad6c5cbb9c00aa5aea:eins,zwei diff --git a/test-server/hosts/features/content/.technical/404.md b/test-server/hosts/features/content/.technical/404.md deleted file mode 100644 index 776ccf043..000000000 --- a/test-server/hosts/features/content/.technical/404.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Leider nichts gefunden -template: error.html ---- -Da haben wir leider nichts gefunden! diff --git a/test-server/hosts/features/content/.technical/test/example.md b/test-server/hosts/features/content/.technical/test/example.md deleted file mode 100644 index b06f805a1..000000000 --- a/test-server/hosts/features/content/.technical/test/example.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Das ist der neue Titel ---- - -Das ist der ganz aktuelle Inhalt \ No newline at end of file diff --git a/test-server/hosts/features/content/blog/2023-09/hello-world.md b/test-server/hosts/features/content/blog/2023-09/hello-world.md deleted file mode 100644 index 045bd47bf..000000000 --- a/test-server/hosts/features/content/blog/2023-09/hello-world.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Hello Word -publish_date: 2023-09-01 -template: blog-entry.html -taxonomy: - tags: [blue, red] ---- - -We are online \ No newline at end of file diff --git a/test-server/hosts/features/content/blog/2023-09/new-post.md b/test-server/hosts/features/content/blog/2023-09/new-post.md deleted file mode 100644 index 9658eddbe..000000000 --- a/test-server/hosts/features/content/blog/2023-09/new-post.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: New post in September -publish_date: 2023-09-10 -template: blog-entry.html -taxonomy: - tags: [blue, orange] ---- - -September post today. \ No newline at end of file diff --git a/test-server/hosts/features/content/blog/2023-10/new-post.md b/test-server/hosts/features/content/blog/2023-10/new-post.md deleted file mode 100644 index bf8e6b196..000000000 --- a/test-server/hosts/features/content/blog/2023-10/new-post.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: First Oktober -publish_date: 2023-10-01 -template: blog-entry.html ---- - -The golgen autumn beginns. \ No newline at end of file diff --git a/test-server/hosts/features/content/blog/index.md b/test-server/hosts/features/content/blog/index.md deleted file mode 100644 index f9c556ced..000000000 --- a/test-server/hosts/features/content/blog/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Our Blog -template: blog.html -menu: - title: The Blog - position: 100 ---- - -Welcome to our blog diff --git a/test-server/hosts/features/content/contact/index.md b/test-server/hosts/features/content/contact/index.md deleted file mode 100644 index 9b3fa7e01..000000000 --- a/test-server/hosts/features/content/contact/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Contact -template: contact.html -menu: - title: Contact - position: 100 ---- - -## Contact \ No newline at end of file diff --git a/test-server/hosts/features/content/content-editing/index.md b/test-server/hosts/features/content/content-editing/index.md deleted file mode 100644 index a18e54ca0..000000000 --- a/test-server/hosts/features/content/content-editing/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Content -template: content.html -menu: - title: Content editing - position: 30 ---- - -## Content \ No newline at end of file diff --git a/test-server/hosts/features/content/content-editing/index.part.01.md b/test-server/hosts/features/content/content-editing/index.part.01.md deleted file mode 100644 index a4a733c93..000000000 --- a/test-server/hosts/features/content/content-editing/index.part.01.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: Header -template: content.part.html ---- - -Frontematter header is default yaml! \ No newline at end of file diff --git a/test-server/hosts/features/content/content-editing/index.part.02.md b/test-server/hosts/features/content/content-editing/index.part.02.md deleted file mode 100644 index 765e3e4d2..000000000 --- a/test-server/hosts/features/content/content-editing/index.part.02.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Content-Files -template: content.part.html ---- - -Content Files contains to areas. The header and the content area. - -The header area is default frontmatter. You can add any valid yaml definition here. - -The content area is default markdown. \ No newline at end of file diff --git a/test-server/hosts/features/content/content-editing/index.part.03.md b/test-server/hosts/features/content/content-editing/index.part.03.md deleted file mode 100644 index bd56a3d88..000000000 --- a/test-server/hosts/features/content/content-editing/index.part.03.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Content sections -template: content.part.html ---- - -### Sections - -Sections are one of the extrem cool parts. -Sections help you manage your content much more efficiently. \ No newline at end of file diff --git a/test-server/hosts/features/content/extending/index.md b/test-server/hosts/features/content/extending/index.md deleted file mode 100644 index 9d1f83d40..000000000 --- a/test-server/hosts/features/content/extending/index.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: Extending -template: start.html -menu: - position: 90 ---- - -## Extensions -Extension are writen in good old JavaScript. - -Put your extension into the _host_**/extensions** folder. -All files with the nameing convention _name_**.extension.js** are loaded ad system startup. - -If you need more, you can use [modules](/modules) - -### Add custom http endpoint - -Attention: Keep in mind, that all http endpoint extensions are loaded unter the endpoint _/extensions_. -What that means is, you can not put content under this url name. - -```javascript -import { UTF_8 } from 'system/charsets.mjs'; -import { $http } from 'system/http.mjs'; - -$http.get("/test", (request, response) => { - response.addHeader("Content-Type", "text/html; charset=utf-8") - response.write("ich bin einen test extension!öäü", UTF_8) -}) -``` - -The endpoint is available at http://your_host:your_port/extensions/test - -### Modules - -To structure your extension code, you can create modules. -But keep in mind, your modules must use the .mjs extension. -Otherwise our js engine will not load your modules correctly. - -### System modules - -cms-server comes with some system modules. -All system modules are in the _systems_ package, so you can not use _system_ as folder name for custom modules. - -#### http - -```javascript -import { header } from 'system/http.mjs'; - -exchange.getResponseHeaders().add(header("Content-Type"), "text/html; charset=utf-8"); -``` - -#### charsets - -```javascript -import { UTF_8, UTF_16, ISO_88591 } from 'system/charsets.mjs'; - -exchange.getResponseSender().send("I'm a test extension!", UTF_8); -``` - -#### logging -```javascript -import { getLogger } from 'system/logging.mjs'; -const logger = getLogger("extensions"); -logger.debug("debug log from test extension"); -``` - -#### template -```javascript -import { $template } from 'system/template.mjs'; - -$template.registerTemplateSupplier( - "myName", - () => "Thorsten" -) - -$template.registerTemplateFunction( - "getHello", - (name) => "Hello " + name + "!" -) -``` -Use template extensions in template -```html -
-

- -
-
-

- -
-``` - -#### files -```javascript -import { $files } from 'system/files.mjs'; - -let content = $files.readContent("extras/products.json") -``` \ No newline at end of file diff --git a/test-server/hosts/features/content/forms/contact/success.md b/test-server/hosts/features/content/forms/contact/success.md deleted file mode 100644 index 1271f3227..000000000 --- a/test-server/hosts/features/content/forms/contact/success.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Form submitted -template: error.html -menu: - visible: false ---- - -## Your request was successfully submitted diff --git a/test-server/hosts/features/content/forms/error.md b/test-server/hosts/features/content/forms/error.md deleted file mode 100644 index b17d5fae2..000000000 --- a/test-server/hosts/features/content/forms/error.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Error sending form -template: error.html -menu: - visible: false ---- - -## Error submitting your request! \ No newline at end of file diff --git a/test-server/hosts/features/content/google/index.md b/test-server/hosts/features/content/google/index.md deleted file mode 100644 index 4f197ffb0..000000000 --- a/test-server/hosts/features/content/google/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Google -template: start.html -menu: - position: 91 -redirect: - status: 301 - location: https://google.de ---- \ No newline at end of file diff --git a/test-server/hosts/features/content/index.md b/test-server/hosts/features/content/index.md deleted file mode 100644 index 41c8505d5..000000000 --- a/test-server/hosts/features/content/index.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Startseite -template: start.html -search: - index: false -seo: - description: "Test site for most features" ---- - -# Demo Project - -![TestBild!](/media/images/test.jpg?format=small "Test Bild") - -> ### block -> block -> block \ No newline at end of file diff --git a/test-server/hosts/features/content/installation/index.md b/test-server/hosts/features/content/installation/index.md deleted file mode 100644 index 9c23c8190..000000000 --- a/test-server/hosts/features/content/installation/index.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Installation & Configuration -template: start.html -featured: true -menu: - position: 10 - title: "Installation" ---- - -## Installation - -Installation is very simple. Just download the current version from https://github.com/thmarx/cms/releases -and extract into desired folder. - -## Configuration - -We have to kinds of configuration, global and per host configurations. - -### Global config - -First there is the server.yaml. -Here you can config the **port** and the **ip** the server will listen on. -Your options for **server.engine** are _undertow_ and _jetty_. -Setting the _dev_ mode to true, will disable most caches. For production you should definitly set this to false. - -**Example server config** -```yaml -server: - port: 1010 - ip: "127.0.0.1" - engine: jetty -dev: true -``` - -### Per host config - -The per host config is not shared between virtual hosts. - -*hostname* is the hostname under witch the virtual host should be reachable. -*tempate.engine* the template engine to be used for this virtual host. -Your options here are currently _freemarker_, _thymeleaf_ and _pebble_. -Default template engine is _freemarker_. -*markdown.engine* the markdown rendering engine used for this virtual host. -Options are _flexmark_ and _markd_. -Default markdown engine is _markd_. - -**Example host config** -```yaml -hostname: localhost -template: - engine: thymeleaf -markdown: - engine: flexmark -modules: - active: - - flexmark-module -``` - -## Starting - -### Linux -```shell -java -Dlog4j2.configurationFile=log4j2.xml -jar cms-server-2.0.0.jar -``` -### Windows -```shell -java "-Dlog4j2.configurationFile=log4j2.xml" -jar cms-server-2.0.0.jar -``` \ No newline at end of file diff --git a/test-server/hosts/features/content/json/index.md b/test-server/hosts/features/content/json/index.md deleted file mode 100644 index 6095494d3..000000000 --- a/test-server/hosts/features/content/json/index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Startseite -template: test.json -content: - type: "application/json" -search: - index: false ---- diff --git a/test-server/hosts/features/content/modules/index.md b/test-server/hosts/features/content/modules/index.md deleted file mode 100644 index 7d2600779..000000000 --- a/test-server/hosts/features/content/modules/index.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: Modules -template: start.html -menu: - position: 15 - title: "Modules" ---- - -## Modules - -Modules are the way to provide functionality without change the core all the time. -Moduels are installed global per server, but activated per host. -If a module stores custom data, each module has a custom data directory per host. - - -**Activate a module** -```yaml -modules: - active: - - example-module - - flexmark-module -``` - diff --git a/test-server/hosts/features/content/navigation/index.md b/test-server/hosts/features/content/navigation/index.md deleted file mode 100644 index f9ee8b2f9..000000000 --- a/test-server/hosts/features/content/navigation/index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Navigation -template: navigation.html -menu: - title: Navigation - position: 31 ---- - -## Navigation - -[SubFolder](/navigation/subfolder) \ No newline at end of file diff --git a/test-server/hosts/features/content/navigation/subfolder/index.md b/test-server/hosts/features/content/navigation/subfolder/index.md deleted file mode 100644 index d508eb479..000000000 --- a/test-server/hosts/features/content/navigation/subfolder/index.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: Sub Navigation -template: navigation.html -menu: - position: 31 ---- - -## Sub Navigation - -## relative linking - -test a [relative link to home](..). - -test a [relative link to parent](.). \ No newline at end of file diff --git a/test-server/hosts/features/content/navigation/subfolder/other.md b/test-server/hosts/features/content/navigation/subfolder/other.md deleted file mode 100644 index 46c0cf471..000000000 --- a/test-server/hosts/features/content/navigation/subfolder/other.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: Other Sub Navigation -template: navigation.html -menu: - position: 31 ---- - -## Sub Navigation - -## relative linking - -test a [relative link to home](..). - -test a [relative link to parent](.). \ No newline at end of file diff --git a/test-server/hosts/features/content/search/index.md b/test-server/hosts/features/content/search/index.md deleted file mode 100644 index d57562de0..000000000 --- a/test-server/hosts/features/content/search/index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Search -template: search.html -menu: - position: 100 - title: "Search" ---- - -## Search - -Hello [[cms:username /]] \ No newline at end of file diff --git a/test-server/hosts/features/content/shortcodes/index.md b/test-server/hosts/features/content/shortcodes/index.md deleted file mode 100644 index bb55a5234..000000000 --- a/test-server/hosts/features/content/shortcodes/index.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Shortcodes -template: start.html -menu: - position: 91 ---- - -## Shortcodes - -[[hello name='Thorsten'/]] - -[[name_age name='Thorsten' age="${40+6+1}" /]] - -Or call a shortcode provided by the default theme - -[[theme_name /]] - -Or call a shortcode provided by a module - -[[example /]] - -\[\[example /\]\] - -## Parent theme - -[[parent_name /]] \ No newline at end of file diff --git a/test-server/hosts/features/content/templating/index.md b/test-server/hosts/features/content/templating/index.md deleted file mode 100644 index c04a41abb..000000000 --- a/test-server/hosts/features/content/templating/index.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Templates & Engines -template: content.html -published: false -menu: - title: Templating - position: 20 ---- - -In cms kann pro Virtual Host die verwendete TemplateEngine konfiguriert werden. - -Aktuell kann zwischen folgenden TemplateEngines zur Verfügung. - -* [Thymeleaf](https://thymeleaf.org) -* [Pebble](https://pebbletemplates.io/) -* [Apache Freemarker](https://freemarker.apache.org/) - -For information about configuration of template engien to be used see the [per host config](/installation#per-host-config) \ No newline at end of file diff --git a/test-server/hosts/features/content/templating/index.part.01.md b/test-server/hosts/features/content/templating/index.part.01.md deleted file mode 100644 index a60da1ef0..000000000 --- a/test-server/hosts/features/content/templating/index.part.01.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: Navigation -template: content.part.html ---- - -Navigation is realy simple. - -```html - -``` \ No newline at end of file diff --git a/test-server/hosts/features/content/templating/index.part.02.md b/test-server/hosts/features/content/templating/index.part.02.md deleted file mode 100644 index 30523f8f6..000000000 --- a/test-server/hosts/features/content/templating/index.part.02.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: List of pages -template: content.part.html ---- - -Whenever you want to print out a list of pages, the nodeListFunction is a tiny little helper. -Keep in mind, that the nodelist function does not return the hole rendered HTML content but just an excerpt of 200 characters. - -```html - -
- -

-

- - goto -
-
-``` - -#### UseCase Blog -Assume, your project has the following content structure for the blog, with the defaults _page = 1_ and _pageSize = 5_ -``` -blog/ ----2023-09/ -------entry1.md -------entry2.md ----2023-10/ -------entry1.md -``` -This nodeList call will return all content nodes in all subfolders of the folder blog/ -```javascript -${nodeList.from("/blog/*").list()} -``` diff --git a/test-server/hosts/features/content/templating/index.part.03.md b/test-server/hosts/features/content/templating/index.part.03.md deleted file mode 100644 index 015ca0063..000000000 --- a/test-server/hosts/features/content/templating/index.part.03.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Content queries -template: content.part.html ---- - -Query nodes. - -```html - -
- -

-

- - goto -
-
-``` - diff --git a/test-server/hosts/features/content/view/index.md b/test-server/hosts/features/content/view/index.md deleted file mode 100644 index 6d070bf07..000000000 --- a/test-server/hosts/features/content/view/index.md +++ /dev/null @@ -1,17 +0,0 @@ -## YAML Template. ---- -template: views/test.html -type: view -meta: - title: Content-Template view -content: - query: - from: "/" - excerpt: 250 - order_by: title - order_direction: asc - conditions: - - name: where - operator: = - key: template - value: content.html \ No newline at end of file diff --git a/test-server/hosts/features/extensions/content.extension.js b/test-server/hosts/features/extensions/content.extension.js deleted file mode 100644 index 05b6d3ba2..000000000 --- a/test-server/hosts/features/extensions/content.extension.js +++ /dev/null @@ -1,21 +0,0 @@ -import { $hooks } from 'system/hooks.mjs'; - - -$hooks.registerAction("system/content/shortcodes", (context) => { - context.arguments().get("shortCodes").put( - "hello", - (params) => `Hello ${params.get("name")}, I'm a TAG!` - ) - return null; -}) - -$hooks.registerAction("system/content/shortcodes", (context) => { - context.arguments().get("shortCodes").put( - "name_age", - (params) => `Hello ${params.get("name")}, your age is ${params.get("age")}!` - ) - return null; -}) - -//$hooks.registerFilter("system/content/filter", (context) => "OH NO!") - diff --git a/test-server/hosts/features/extensions/http.extension.js b/test-server/hosts/features/extensions/http.extension.js deleted file mode 100644 index bb47765e1..000000000 --- a/test-server/hosts/features/extensions/http.extension.js +++ /dev/null @@ -1,43 +0,0 @@ -import { UTF_8 } from 'system/charsets.mjs'; -import { $hooks } from 'system/hooks.mjs'; - -$hooks.registerAction("system/server/http/extension", (context) => { - context.arguments().get("httpExtensions").add( - "GET", - "/test2", - (request, response) => { - response.addHeader("Content-Type", "text/html; charset=utf-8") - response.write("http extension via hook!", UTF_8) - } - ) - return null; -}) - -$hooks.registerAction("system/server/http/route", (context) => { - context.arguments().get("httpRoutes").add( - "GET", - "/hello-route", - (request, response) => { - response.addHeader("Content-Type", "text/html; charset=utf-8") - response.write("route via hook!", UTF_8) - } - ) - return null; -}) - -$hooks.registerAction("system/server/api/route", (context) => { - context.arguments().get("apiRoutes").add( - "GET", - "/hello", - (request, response) => { - - let data = { - "name": "CondationCMS" - } - - response.addHeader("Content-Type", "application/json; charset=utf-8") - response.write(JSON.stringify(data), UTF_8) - } - ) - return null; -}) diff --git a/test-server/hosts/features/extensions/libs/module.mjs b/test-server/hosts/features/extensions/libs/module.mjs deleted file mode 100644 index 32767260b..000000000 --- a/test-server/hosts/features/extensions/libs/module.mjs +++ /dev/null @@ -1,3 +0,0 @@ -export function getString () { - return "öäü" -} \ No newline at end of file diff --git a/test-server/hosts/features/extensions/menu.extension.js b/test-server/hosts/features/extensions/menu.extension.js deleted file mode 100644 index 75d23770d..000000000 --- a/test-server/hosts/features/extensions/menu.extension.js +++ /dev/null @@ -1,8 +0,0 @@ -import { $hooks } from 'system/hooks.mjs'; -import { NavNode } from 'system/navigation.mjs'; - -$hooks.registerFilter("system/navigation/top/list", (context) => { - var nodes = context.value() - nodes.add(2, new NavNode("Hello-Extension", "/hello-route")) - return nodes -}) \ No newline at end of file diff --git a/test-server/hosts/features/extensions/query.extension.js b/test-server/hosts/features/extensions/query.extension.js deleted file mode 100644 index 4a03ec692..000000000 --- a/test-server/hosts/features/extensions/query.extension.js +++ /dev/null @@ -1,11 +0,0 @@ -import { $hooks } from 'system/hooks.mjs'; - -$hooks.registerAction("system/db/query/operations", (context) => { - context.arguments().get("operations").add( - "none", - (fieldValue, value) => { - return false - } - ) - return null; -}) \ No newline at end of file diff --git a/test-server/hosts/features/extensions/template.extension.js b/test-server/hosts/features/extensions/template.extension.js deleted file mode 100644 index 65bb998cd..000000000 --- a/test-server/hosts/features/extensions/template.extension.js +++ /dev/null @@ -1,17 +0,0 @@ -import { $hooks } from 'system/hooks.mjs'; - -$hooks.registerAction("system/template/supplier", (context) => { - context.arguments().get("suppliers").add( - "myName", - () => "My name is CondationCMS" - ) - return null; -}) - -$hooks.registerAction("system/template/function", (context) => { - context.arguments().get("functions").add( - "getHello", - (name) => "Hello " + name + "!!" - ) - return null; -}) diff --git a/test-server/hosts/features/extensions/test.extension.js b/test-server/hosts/features/extensions/test.extension.js deleted file mode 100644 index 9c5519526..000000000 --- a/test-server/hosts/features/extensions/test.extension.js +++ /dev/null @@ -1,7 +0,0 @@ -import { UTF_8 } from 'system/charsets.mjs'; -import { getLogger } from 'system/logging.mjs'; - -const logger = getLogger("extensions"); -if (ENV === "dev"){ - //logger.info("dev debug log from test extension"); -} \ No newline at end of file diff --git a/test-server/hosts/features/extensions/theme.hooks.js b/test-server/hosts/features/extensions/theme.hooks.js deleted file mode 100644 index e223af8b9..000000000 --- a/test-server/hosts/features/extensions/theme.hooks.js +++ /dev/null @@ -1,13 +0,0 @@ -import { $hooks } from 'system/hooks.mjs'; - -$hooks.registerAction( - "theme/header", - (context) => { - return ` - - - - - `; - } -); \ No newline at end of file diff --git a/test-server/hosts/features/extras/products.json b/test-server/hosts/features/extras/products.json deleted file mode 100644 index 05f367ec1..000000000 --- a/test-server/hosts/features/extras/products.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "products": [] -} \ No newline at end of file diff --git a/test-server/hosts/features/messages/labels.properties b/test-server/hosts/features/messages/labels.properties deleted file mode 100644 index 79803d667..000000000 --- a/test-server/hosts/features/messages/labels.properties +++ /dev/null @@ -1,3 +0,0 @@ -contact.form.title={0} Formular -contact.form.button.submit=Abschicken -message.site=Site \ No newline at end of file diff --git a/test-server/hosts/features/site-dev.toml b/test-server/hosts/features/site-dev.toml deleted file mode 100644 index 4751939c1..000000000 --- a/test-server/hosts/features/site-dev.toml +++ /dev/null @@ -1,2 +0,0 @@ -[modules] -active = [ "example-module" ] diff --git a/test-server/hosts/features/site.globals.js b/test-server/hosts/features/site.globals.js deleted file mode 100644 index 0bd31f438..000000000 --- a/test-server/hosts/features/site.globals.js +++ /dev/null @@ -1,31 +0,0 @@ -console.log("global script in featured site") - -$hooks.registerAction("system/scheduler/register", (context) => { - context.arguments().get("scheduler").schedule( - "0/10 * * * * ?", - "test-cron-job-1", - (context) => { - console.log("job 1") - }) -}) -$hooks.registerAction("system/scheduler/register", (context) => { - context.arguments().get("scheduler").schedule( - "0/10 * * * * ?", - "test-cron-job-2", - (context) => { - console.log("job 2") - }) -}) -$hooks.registerAction("system/scheduler/register", (context) => { - context.arguments().get("scheduler").schedule( - "0/10 * * * * ?", - "test-cron-job-3", - (context) => { - console.log("job 3") - }) -}) -$hooks.registerAction("system/scheduler/remove", (arguments) => { - context.arguments().get("scheduler").remove("test-cron-job-1") - context.arguments().get("scheduler").remove("test-cron-job-2") - context.arguments().get("scheduler").remove("test-cron-job-3") -}) \ No newline at end of file diff --git a/test-server/hosts/features/site.toml b/test-server/hosts/features/site.toml deleted file mode 100644 index 124559762..000000000 --- a/test-server/hosts/features/site.toml +++ /dev/null @@ -1,18 +0,0 @@ -id = "feature-site" -hostname = [ "localhost2" ] -baseurl = "http://localhost2:1010" -language = "en" -test = "Hallo" -theme = "test" - -[cache] -content = true - -[query.index] -mode = "PERSISTENT" - -[modules] -active = [ "forms-module" ] - -[api] -enabled = true \ No newline at end of file diff --git a/test-server/hosts/features/templates/contact.html b/test-server/hosts/features/templates/contact.html deleted file mode 100644 index 119996996..000000000 --- a/test-server/hosts/features/templates/contact.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - -
-
-
- - -
-

-
- -
- - -
-
- - -
-
- - - reload -
-
- - -
-
- -
-
-
- - - - - - - - \ No newline at end of file diff --git a/test-server/hosts/features/templates/start.html b/test-server/hosts/features/templates/start.html deleted file mode 100644 index f9e73b518..000000000 --- a/test-server/hosts/features/templates/start.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - -
- -
-
-

DEVELOPMENT

-
-
- -
-
- -
-

Featured

- - - -
- -
-

Featured IN

- - - -
- -
-

custom filter from extension

- - - -
-
-

custom filter from module

- - - -
- -
-

MediaService

- -
- -
-
-
- -
-

- template extension -

-
-

- -
-
-

- -
-
- -
-

Call ShortCode from template

- [(${shortCodes.call('hello', #{'name': 'CondationCMS'})})] -
- -
-

Test mod-Namespace

-

-
- - - - - - - - \ No newline at end of file diff --git a/test-server/hosts/features/templates/taxonomy.html b/test-server/hosts/features/templates/taxonomy.html deleted file mode 100644 index 1ed0d6257..000000000 --- a/test-server/hosts/features/templates/taxonomy.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - -
-

- -
    -
  • - -
  • -
-
- - - - - - - - \ No newline at end of file diff --git a/test-server/hosts/features/templates/taxonomy.single.html b/test-server/hosts/features/templates/taxonomy.single.html deleted file mode 100644 index a7d5e3273..000000000 --- a/test-server/hosts/features/templates/taxonomy.single.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - -
-

- - -
- - - - - - - - \ No newline at end of file diff --git a/test-server/hosts/features/templates/test.json b/test-server/hosts/features/templates/test.json deleted file mode 100644 index 3046e7679..000000000 --- a/test-server/hosts/features/templates/test.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": [[${meta.title}]] -} \ No newline at end of file diff --git a/test-server/hosts/features/templates/views/test.html b/test-server/hosts/features/templates/views/test.html deleted file mode 100644 index 62eeae19e..000000000 --- a/test-server/hosts/features/templates/views/test.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - -
-

Nodes

- - - -
- - - - - - - - - \ No newline at end of file diff --git a/test-server/hosts/features/test/form.http b/test-server/hosts/features/test/form.http deleted file mode 100644 index eee162e02..000000000 --- a/test-server/hosts/features/test/form.http +++ /dev/null @@ -1,5 +0,0 @@ -POST http://localhost:1010/extension/form - -{ - "form": "contact" -} \ No newline at end of file diff --git a/test-server/hosts/features/test/forms-module/send.http b/test-server/hosts/features/test/forms-module/send.http deleted file mode 100644 index af352de03..000000000 --- a/test-server/hosts/features/test/forms-module/send.http +++ /dev/null @@ -1,24 +0,0 @@ -POST http://localhost:1010/module/forms-module/form/submit -Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW - -------WebKitFormBoundary7MA4YWxkTrZu0gW -Content-Disposition: form-data; name="form" - -contact -------WebKitFormBoundary7MA4YWxkTrZu0gW -Content-Disposition: form-data; name="code" - -w274n -------WebKitFormBoundary7MA4YWxkTrZu0gW -Content-Disposition: form-data; name="key" - -test -------WebKitFormBoundary7MA4YWxkTrZu0gW -Content-Disposition: form-data; name="message" - -Hello world! -------WebKitFormBoundary7MA4YWxkTrZu0gW -Content-Disposition: form-data; name="from" - -me@example.org -------WebKitFormBoundary7MA4YWxkTrZu0gW-- diff --git a/test-server/hosts/features/test/ui-module/directory-create.http b/test-server/hosts/features/test/ui-module/directory-create.http deleted file mode 100644 index aec74852a..000000000 --- a/test-server/hosts/features/test/ui-module/directory-create.http +++ /dev/null @@ -1 +0,0 @@ -POST http://localhost:1010/module/ui-module/file-system/create?path=.technical&filename=test&type=folder \ No newline at end of file diff --git a/test-server/hosts/features/test/ui-module/directory-delete.http b/test-server/hosts/features/test/ui-module/directory-delete.http deleted file mode 100644 index bbff6591e..000000000 --- a/test-server/hosts/features/test/ui-module/directory-delete.http +++ /dev/null @@ -1 +0,0 @@ -DELETE http://localhost:1010/module/ui-module/file-system/delete?path=.technical/test \ No newline at end of file diff --git a/test-server/hosts/features/test/ui-module/file-create.http b/test-server/hosts/features/test/ui-module/file-create.http deleted file mode 100644 index f5f80a9d0..000000000 --- a/test-server/hosts/features/test/ui-module/file-create.http +++ /dev/null @@ -1,8 +0,0 @@ -POST http://localhost:1010/module/ui-module/file-system/create?path=.technical/test&filename=example.md&type=file - ---- -title: Das ist der Titel ---- -\# Neue Datei - -Das ist der Inhalt \ No newline at end of file diff --git a/test-server/hosts/features/test/ui-module/file-read.http b/test-server/hosts/features/test/ui-module/file-read.http deleted file mode 100644 index 9f5b6f1ca..000000000 --- a/test-server/hosts/features/test/ui-module/file-read.http +++ /dev/null @@ -1 +0,0 @@ -GET http://localhost:1010/module/ui-module/file-system/read?path=.technical/test/example.md \ No newline at end of file diff --git a/test-server/hosts/features/test/ui-module/file-write.http b/test-server/hosts/features/test/ui-module/file-write.http deleted file mode 100644 index 4503696a4..000000000 --- a/test-server/hosts/features/test/ui-module/file-write.http +++ /dev/null @@ -1,8 +0,0 @@ -PUT http://localhost:1010/module/ui-module/file-system/write?path=.technical/test/example.md - ---- -title: Das ist der neue Titel ---- -# Neuerer Datei - -Das ist der ganz aktuelle Inhalt \ No newline at end of file diff --git a/test-server/hosts/features/test/ui-module/list-files.http b/test-server/hosts/features/test/ui-module/list-files.http deleted file mode 100644 index ed6bc16f5..000000000 --- a/test-server/hosts/features/test/ui-module/list-files.http +++ /dev/null @@ -1 +0,0 @@ -GET http://localhost:1010/module/ui-module/file-system/list?path=.technical \ No newline at end of file diff --git a/test-server/server.toml b/test-server/server.toml index 53040ccf3..ecc9bb46d 100644 --- a/test-server/server.toml +++ b/test-server/server.toml @@ -1,7 +1,7 @@ env = "prod" [server] -port = 1010 +port = 2020 ip = "127.0.0.1" [ipc] diff --git a/test-server/server.yaml b/test-server/server.yaml index 8f86ab796..125fc66ed 100644 --- a/test-server/server.yaml +++ b/test-server/server.yaml @@ -1,5 +1,5 @@ server: - port: 1010 + port: 2020 ip: "127.0.0.1" env: dev ipc: