Skip to content

Commit

Permalink
4.0.0 (#146)
Browse files Browse the repository at this point in the history
* start 4.0.0 development

* optimize imports

* #135 update context

* #110 extract all modules into separate repositories

* #80 added view code, ready for refactorings

* #145 remove legacy request based theme stuff

* #80 add views

* #139 new generic way to reload configs

* fix request context issue

* fix request context issue

* #142 add root level routes for modules

* ant script for distribution

* #139 extensions area reloaded now, should not be a problem on fast filesystems. but let's keep an eye on that

* refactoring

* prepare 4.0.0 release

* update readme and build script for first release with no build structure

* update logging to trace and update build

* fix module issue

* update dependencies and fix exception

* add simple k6 tests

---------
  • Loading branch information
thmarx authored Jan 8, 2024
1 parent 708a307 commit 965e05c
Show file tree
Hide file tree
Showing 166 changed files with 1,529 additions and 7,432 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ cms-server/modules/pug-module
cms-server/modules/search-module
cms-server/modules/seo-module
cms-server/modules/forms-module
cms-server/modules/markedj-module
cms-server/modules/markedj-module
/distribution/temp/
/distribution/build/
/distribution/dist/
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ see wiki for more information: [wiki](https://github.com/thmarx/cms/wiki)

# changelog

## 4.0.0

* **MAINTENANCE** remove legacy theme assets [#145](https://github.com/thmarx/cms/issues/145)
* **MAINTENANCE** refactor module context to use features [#135](https://github.com/thmarx/cms/issues/135)
**ATTENTION:** Migration required!!!
* **MAINTENANCE** move modules to separate repositories [#110](https://github.com/thmarx/cms/issues/110)
* **FEATURE** custom http routes [#142](https://github.com/thmarx/cms/issues/142)
* **FEATURE** views introduced [#80](https://github.com/thmarx/cms/issues/80)

## 3.3.0

* **FEATURE** HookSystem [#99](https://github.com/thmarx/cms/issues/99)
Expand Down
4 changes: 2 additions & 2 deletions cms-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.github.thmarx.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>3.3.0</version>
<version>4.0.0</version>
</parent>
<artifactId>cms-api</artifactId>
<packaging>jar</packaging>
Expand All @@ -16,7 +16,7 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.thmarx.cms.modules.framework</groupId>
<groupId>com.github.thmarx.cms.module.framework</groupId>
<artifactId>modules-api</artifactId>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public static class MetaFields {
public static final String REDIRECT_LOCATION = "redirect.location";

public static final String TEMPLATE = "template";

public static final String TYPE = "type";
}

public static class Folders {
Expand All @@ -58,6 +60,11 @@ public static class Folders {
public static final String MODULES = "modules/";
}

public static class NodeType {
public static String VIEW = "view";
public static String PAGE = "page";
}

public static class ContentTypes {
public static String HTML = "text/html";
public static String JSON = "application/json";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public ContentResponse (ContentNode node) {
}

public boolean isRedirect () {
return node.isRedirect();
return node != null && node.isRedirect();
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import com.github.thmarx.cms.api.Constants;
import com.github.thmarx.cms.api.request.RequestContext;
import com.github.thmarx.cms.api.request.ThreadLocalRequestContext;
import com.github.thmarx.cms.api.request.features.IsPreviewFeature;
import com.github.thmarx.cms.api.request.features.SitePropertiesFeature;
import com.github.thmarx.cms.api.feature.features.IsPreviewFeature;
import com.github.thmarx.cms.api.feature.features.SitePropertiesFeature;
import com.github.thmarx.cms.api.utils.MapUtil;
import com.github.thmarx.cms.api.utils.SectionUtil;
import java.time.Instant;
Expand Down Expand Up @@ -58,6 +58,13 @@ public ContentNode(String uri, String name, Map<String, Object> data, LocalDate
this(uri, name, data, false, new HashMap<String, ContentNode>(), lastmodified);
}

public String nodeType () {
return (String)data.getOrDefault(Constants.MetaFields.TYPE, Constants.NodeType.PAGE);
}
public boolean isView () {
return Constants.NodeType.VIEW.equals(nodeType());
}

public String contentType() {
String defaultContentType = Constants.DEFAULT_CONTENT_TYPE;
if (ThreadLocalRequestContext.REQUEST_CONTEXT.get() != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.thmarx.cms.modules.search;
package com.github.thmarx.cms.api.eventbus.events;

/*-
* #%L
* search-module
* cms-server
* %%
* Copyright (C) 2023 Marx-Software
* %%
Expand All @@ -21,11 +21,12 @@
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import com.github.thmarx.cms.api.configuration.Config;
import com.github.thmarx.cms.api.eventbus.Event;

/**
*
* @author t.marx
*/
public record SearchRequest (String query, int page, int size) {

public record ConfigurationFileChanged(Class<? extends Config> clazz) implements Event {
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
*
* @author t.marx
*/
public abstract class JettyHttpHandlerExtensionPoint extends AbstractExtensionPoint {
public abstract class HttpHandlerExtensionPoint extends AbstractExtensionPoint {
abstract public Mapping getMapping();
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.github.thmarx.cms.modules.forms.template;
package com.github.thmarx.cms.api.extensions;

import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Callback;

/*-
* #%L
* forms-module
* cms-api
* %%
* Copyright (C) 2023 Marx-Software
* %%
Expand All @@ -22,23 +26,12 @@
* #L%
*/

import com.github.thmarx.cms.modules.forms.utils.StringUtil;

/**
*
* @author t.marx
*/
public class FormsTemplateModel {

private Captcha captcha = new Captcha();

public Captcha getCaptcha () {
return captcha;
}
public abstract class HttpRouteExtensionPoint extends AbstractExtensionPoint {
abstract public String getRoute ();

public class Captcha {
public String generateKey () {
return StringUtil.random_string();
}
}
abstract public void handle (Request request, Response response, Callback callback);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.request.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.module.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.theme;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand All @@ -22,12 +22,13 @@
* #L%
*/

import com.github.thmarx.cms.api.db.DB;
import com.github.thmarx.cms.api.feature.Feature;

/**
*
* @author t.marx
*/
public interface Assets {
void addCss (final String css);

void addJs (final String js);
public record DBFeature(DB db) implements Feature {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
* cms-api
* %%
* Copyright (C) 2023 Marx-Software
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import com.github.thmarx.cms.api.eventbus.EventBus;
import com.github.thmarx.cms.api.feature.Feature;
import lombok.extern.slf4j.Slf4j;

/**
*
* @author t.marx
*/
@Slf4j
public record EventBusFeature(EventBus eventBus) implements Feature {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.request.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.request.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.request.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.request.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.request.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.thmarx.cms.modules.search;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
* search-module
* cms-api
* %%
* Copyright (C) 2023 Marx-Software
* %%
Expand All @@ -22,20 +22,13 @@
* #L%
*/

import com.github.thmarx.cms.api.ServerProperties;
import com.github.thmarx.cms.api.feature.Feature;

/**
*
* @author thmar
* @author t.marx
*/
public enum SearchField {
TAGS("tags"),;

private final String fieldName;

private SearchField(final String name) {
this.fieldName = name;
}
public record ServerPropertiesFeature(ServerProperties serverProperties) implements Feature {

public String getFieldName() {
return this.fieldName;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.request.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.request.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.thmarx.cms.api.request.features;
package com.github.thmarx.cms.api.feature.features;

/*-
* #%L
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import com.github.thmarx.cms.api.markdown.MarkdownRenderer;
import com.github.thmarx.cms.api.model.ListNode;
import com.github.thmarx.cms.api.request.RequestContext;
import com.github.thmarx.cms.api.request.features.IsPreviewFeature;
import com.github.thmarx.cms.api.request.features.SitePropertiesFeature;
import com.github.thmarx.cms.api.feature.features.IsPreviewFeature;
import com.github.thmarx.cms.api.feature.features.SitePropertiesFeature;
import com.github.thmarx.cms.api.utils.HTTPUtil;
import com.github.thmarx.cms.api.utils.NodeUtil;
import com.github.thmarx.cms.api.utils.PathUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,8 @@
* #L%
*/

import com.github.thmarx.cms.api.ServerProperties;
import com.github.thmarx.cms.api.SiteProperties;
import com.github.thmarx.cms.api.db.DB;
import com.github.thmarx.cms.api.eventbus.EventBus;
import com.github.thmarx.cms.api.feature.FeatureContainer;
import com.github.thmarx.cms.api.theme.Theme;
import com.github.thmarx.modules.api.Context;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
Expand All @@ -38,14 +32,5 @@
*/
@RequiredArgsConstructor
public class CMSModuleContext extends FeatureContainer implements Context {
@Getter
private final SiteProperties siteProperties;
@Getter
private final ServerProperties serverProperties;
@Getter
private final DB db;
@Getter
private final EventBus eventBus;
@Getter
private final Theme theme;

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ public interface Theme {

MessageSource getMessages ();

@Deprecated(since = "3.3.0")
Assets getAssets();

String getName();

Path templatesPath ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*/
import com.github.thmarx.cms.api.SiteProperties;
import com.github.thmarx.cms.api.request.RequestContext;
import com.github.thmarx.cms.api.request.features.IsPreviewFeature;
import com.github.thmarx.cms.api.request.features.SitePropertiesFeature;
import com.github.thmarx.cms.api.feature.features.IsPreviewFeature;
import com.github.thmarx.cms.api.feature.features.SitePropertiesFeature;
import com.google.common.base.Strings;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
Expand Down
Loading

0 comments on commit 965e05c

Please sign in to comment.