Basic implementation for files app
This commit is contained in:
@@ -6,6 +6,12 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "nbs-cloud.web-container")
|
||||
@ComponentScan("de.nbscloud.webcontainer.shared")
|
||||
@ComponentScan("de.nbscloud.files")
|
||||
@ComponentScan("de.nbscloud.notes")
|
||||
@ComponentScan("de.nbscloud.pastebin")
|
||||
@ComponentScan("de.nbscloud.bookmarks")
|
||||
@ComponentScan("de.nbscloud.todo")
|
||||
@ComponentScan("de.nbscloud.dashboard")
|
||||
public class WebContainerConfig {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package de.nbscloud.webcontainer.controller;
|
||||
|
||||
import de.nbscloud.webcontainer.registry.App;
|
||||
import de.nbscloud.webcontainer.registry.AppRegistry;
|
||||
import de.nbscloud.webcontainer.shared.config.WebContainerSharedConfig;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
public class WebContainerController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(WebContainerController.class);
|
||||
|
||||
@Autowired
|
||||
private WebContainerSharedConfig webContainerSharedConfig;
|
||||
|
||||
@Autowired
|
||||
private AppRegistry appRegistry;
|
||||
|
||||
@GetMapping("/")
|
||||
public String landing(Model model) {
|
||||
logger.info("NBSCloud started - apps available: {}", this.appRegistry.getAll().stream().map(App::getId)
|
||||
.collect(Collectors.joining(", ")));
|
||||
|
||||
return "redirect:dashboard";
|
||||
}
|
||||
|
||||
@GetMapping("/toggleDarkMode")
|
||||
public String toggleDarkMode(Model model, HttpServletRequest httpServletRequest) {
|
||||
String navigateTo = "/";
|
||||
|
||||
try {
|
||||
final String fullPath = new URL(httpServletRequest.getHeader("referer")).toURI().getPath();
|
||||
// FIXME - will break if the app is deployed on http://host/a/b/financer instead of http://host/financer
|
||||
final String tmpPath = StringUtils.removeStart(fullPath, "/");
|
||||
navigateTo = tmpPath.substring(tmpPath.indexOf("/"));
|
||||
} catch (MalformedURLException | URISyntaxException | StringIndexOutOfBoundsException e) {
|
||||
// TODO
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.webContainerSharedConfig.setDarkMode(!this.webContainerSharedConfig.isDarkMode());
|
||||
|
||||
return "redirect:" + navigateTo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
### This is the main configuration file of the application.
|
||||
### Filtering of the @...@ values happens via the maven-resource-plugin. The execution of the plugin is configured in
|
||||
### the Spring Boot parent POM.
|
||||
spring.profiles.active=@activeProfiles@
|
||||
|
||||
info.app.name=NoBullShit Cloud - web container
|
||||
info.app.description=Aggregator for web projects
|
||||
info.build.group=@project.groupId@
|
||||
info.build.artifact=@project.artifactId@
|
||||
info.build.version=@project.version@
|
||||
|
||||
spring.messages.basename=i18n/container_messages,i18n/files_messages
|
||||
|
||||
spring.servlet.multipart.max-file-size=-1
|
||||
spring.servlet.multipart.max-request-size=-1
|
||||
|
||||
logging.level.de.nbscloud=DEBUG
|
||||
logging.file=nbscloud.log
|
||||
logging.file.max-history=7
|
||||
logging.file.max-size=50MB
|
||||
@@ -0,0 +1,3 @@
|
||||
nbscloud.show-actions=...
|
||||
nbscloud.footer.changelog=Changelog
|
||||
nbscloud.footer.toggleDarkMode=Toggle dark mode
|
||||
@@ -0,0 +1,3 @@
|
||||
nbscloud.show-actions=...
|
||||
nbscloud.footer.changelog=\u00C4nderungshistorie
|
||||
nbscloud.footer.toggleDarkMode=Dark Mode umschalten
|
||||
2
web-container/src/main/resources/static/changelog.txt
Normal file
2
web-container/src/main/resources/static/changelog.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
v1:
|
||||
- Initial
|
||||
@@ -0,0 +1,12 @@
|
||||
/* Color definitions for dark mode */
|
||||
:root {
|
||||
--error-color: #D30000;
|
||||
--text-color: #7f7f7f;
|
||||
--background-color: #1d1f21;
|
||||
--link-color: #87ab63;
|
||||
--hover-color: #1f1f2f;
|
||||
--border-color: #7f7f7f;
|
||||
--background-brightness: 1.5;
|
||||
--good-color: #479A37;
|
||||
}
|
||||
/* --------------------- */
|
||||
@@ -0,0 +1,12 @@
|
||||
/* Color definitions for light mode */
|
||||
:root {
|
||||
--error-color: #D30000;
|
||||
--text-color: #000000;
|
||||
--background-color: #FFFFFF;
|
||||
--link-color: #0000EE;
|
||||
--hover-color: lightgrey;
|
||||
--border-color: #ddd;
|
||||
--background-brightness: 0.5;
|
||||
--good-color: #479A37;
|
||||
}
|
||||
/* --------------------- */
|
||||
95
web-container/src/main/resources/static/css/main.css
Normal file
95
web-container/src/main/resources/static/css/main.css
Normal file
@@ -0,0 +1,95 @@
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(../font/SourceCodePro_Regular_400.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Source Code Pro';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-display: swap;
|
||||
src: url(../font/SourceCodePro_Bold_600.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Material Icons';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(../font/Material_Icons.woff2) format('woff2');
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-family: 'Material Icons';
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
body {
|
||||
color: var(--text-color);
|
||||
background-color: var(--background-color);
|
||||
font-family: 'Source Code Pro', monospace;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: 'Source Code Pro', monospace;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--link-color);
|
||||
}
|
||||
|
||||
tr:hover {
|
||||
background-color: var(--hover-color);
|
||||
}
|
||||
|
||||
#footer-container {
|
||||
margin-top: 1em;
|
||||
}
|
||||
#footer-container > hr,
|
||||
#footer-container > div {
|
||||
display: block;
|
||||
}
|
||||
#footer-container > hr {
|
||||
width: 100%;
|
||||
}
|
||||
#footer-container > div {
|
||||
text-align: center;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.errorMessage {
|
||||
color: var(--error-color);
|
||||
}
|
||||
|
||||
.menu-entry {
|
||||
display: inline;
|
||||
padding-right: 6em;
|
||||
}
|
||||
|
||||
#main-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 3em;
|
||||
padding-right: 3em;
|
||||
padding-top: 3em;
|
||||
padding-bottom: 3em;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 450px) {
|
||||
.no-mobile {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#main-container {
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
padding-top: 1em;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.menu-entry {
|
||||
display: inline;
|
||||
padding-right: 1em;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
<div id="footer-container" th:fragment="footer">
|
||||
<hr>
|
||||
<div>
|
||||
<span th:text="'nbs-cloud v' + ${nbsVersion}"/>
|
||||
(<a th:href="@{/changelog.txt}" th:text="#{nbscloud.footer.changelog}" />,
|
||||
<a th:href="@{/toggleDarkMode}" th:text="#{nbscloud.footer.toggleDarkMode}" />)
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div id="header-container" th:fragment="header">
|
||||
<div th:each="app : ${apps}" class="menu-entry">
|
||||
<a th:href="@{/} + ${app.startPath}" th:text="${app.id}"/>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user