Compare commits

..

No commits in common. "218fa6553e3c0e167484f27487438e4309acd638" and "8f2828ea6323520e15e6822b22a8ed43076cebab" have entirely different histories.

16 changed files with 42 additions and 104 deletions

4
.gitignore vendored
View file

@ -1,5 +1,3 @@
docker/deloyment-example/files/library/*
docker/deloyment-example/files/postgresql/*
docker/deloyment-example/files/root/*
postgres/docker-compose.yml
target/
lib/

12
.vscode/launch.json vendored
View file

@ -2,23 +2,13 @@
"configurations": [
{
"type": "java",
"name": "Marinesco DEV",
"name": "Spring Boot-MarinescoApplication<marinesco>",
"request": "launch",
"cwd": "${workspaceFolder}",
"mainClass": "ru.redrise.marinesco.MarinescoApplication",
"projectName": "marinesco",
"args": "",
"envFile": "${workspaceFolder}/.env"
},
{
"type": "java",
"name": "Marinesco PROD",
"request": "launch",
"cwd": "${workspaceFolder}",
"mainClass": "ru.redrise.marinesco.MarinescoApplication",
"projectName": "marinesco",
"args": "--spring.profiles.active=prod",
"envFile": "${workspaceFolder}/.env"
}
]
}

View file

@ -1,5 +0,0 @@
### How to
1. Place `marinesco.jar` to `files/root/`. Rename artifact if needed.
2. Extract `inpx`-file-containing folder into `files/library/`
3. Optionally remove `pgadmin` section from `docker-compose.yml` file
4. Run via `docker compose up`

View file

@ -1,9 +0,0 @@
FROM openjdk:21-jdk-slim
ENV TZ=Europe/Moscow
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
WORKDIR /root
CMD java -jar marinesco.jar

View file

@ -1,34 +0,0 @@
version: '3.1'
services:
marinesco:
build: ./build
image: loper:marinesco
links:
- postgres
ports:
- 80:8080
volumes:
- ./files/root:/root
- ./files/library:/library
environment:
- SPRING_PROFILES_ACTIVE=prod
logging:
driver: syslog
postgres:
image: postgres
volumes:
- ./files/postgresql:/var/lib/postgresql
environment:
- POSTGRES_USER=mari
- POSTGRES_PASSWORD=example
- POSTGRES_DB=marinesco
pgadmin:
image: dpage/pgadmin4
links:
- postgres
ports:
- 3334:80
environment:
- PGADMIN_DEFAULT_EMAIL=root@srv.lan
- PGADMIN_DEFAULT_PASSWORD=example

View file

@ -80,12 +80,6 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>

View file

@ -1,4 +1,4 @@
package ru.redrise.marinesco.library;
package ru.redrise.marinesco;
import java.util.List;
@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import ru.redrise.marinesco.data.AuthorRepository;
import ru.redrise.marinesco.data.BookRepository;
import ru.redrise.marinesco.library.Author;
import ru.redrise.marinesco.library.Book;
@Controller
@RequestMapping("/author")

View file

@ -1,4 +1,4 @@
package ru.redrise.marinesco.library;
package ru.redrise.marinesco;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import ru.redrise.marinesco.data.BookRepository;
import ru.redrise.marinesco.library.Book;
@Controller
@RequestMapping("/book")

View file

@ -5,12 +5,17 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Controller
@RequestMapping("/")
public class RootController {
@GetMapping
public String getPage(@ModelAttribute("search") String text) {
// TODO: SEARCH PAGE + CONTROLLER
log.info(text);
return "root";
}
}

View file

@ -134,23 +134,22 @@ public class InpxScanner implements Runnable {
}
private void parseInp(File inpxFile) throws Exception {
/*
log.warn("REMOVE TEMPORARY SOLUTION - BREAKER");
log.warn("REMOVE TEMPORARY SOLUTION - BREAKER");
log.warn("REMOVE TEMPORARY SOLUTION - BREAKER");
boolean breaker = false;
*/
try (ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(inpxFile))) {
ZipEntry zipEntry = zipInputStream.getNextEntry();
while (zipEntry != null) {
if (zipEntry.getName().toLowerCase().endsWith(".inp")) {
/*
// *
if (breaker) {
zipEntry = zipInputStream.getNextEntry();
continue;
}
breaker = true;
breaker = true;//
// */
byte[] content = inpToByteArray(zipInputStream, zipEntry.getSize());
parseInpContent(content, zipEntry.getName());

View file

@ -1,21 +0,0 @@
spring:
thymeleaf:
cache: true
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://postgres:5432/marinesco
username: mari
password: example
jpa:
properties:
hibernate:
database-platform: org.hibernate.dialect.PostgreSQL94Dialect
hibernate:
ddl-auto: update
logging:
level:
org:
springframework: INFO
marinesco:
library:
filesLocation: "/library"

View file

@ -156,11 +156,12 @@ header {
color: #74bfbd;
}
.header_entry_link:link,
.header_entry_link:link {
color: #74bfbd;
}
.header_entry_link:visited {
color: #74bfbd;
}
.header_entry_link:hover {
color: #b6a795;
}
@ -174,6 +175,10 @@ header {
margin-right: 10px;
}
a.entry {
text-decoration: none;
}
.header_title {
font-size: 1.5em;
}
@ -257,6 +262,9 @@ button:hover {
text-shadow: -1px -1px 0 #1e1e1e, 1px -1px 0 #1e1e1e, -1px 1px 0 #1e1e1e, 1px 1px 0 #1e1e1e;
color: #74bfbd;
}
.copy_link:hover {
color: #b6a795;
}
/* error */
.error {

View file

@ -21,7 +21,7 @@
<a th:href="${'/author/' + author.id}" th:text="${author.authorName}"></a>
</div>
<br />
<span th:each="genre : ${book.genres}" th:text="${((genre.humanReadableDescription == null || genre.humanReadableDescription == '') ? genre.genreId : genre.humanReadableDescription) + '&nbsp;&nbsp;'}"></span>
<span th:each="genre : ${book.genres}" th:text="${(genre.humanReadableDescription == '' ? genre.genreId : genre.humanReadableDescription) + '&nbsp;&nbsp;'}"></span>
<p>
<a th:href="${'/download/?container=' + book.container + '&file=' + book.fsFileName}"
th:text="${'Download ' + book.fileExtension + ' (' + book.fileSizeForHumans + ')'}"></a>

View file

@ -7,8 +7,10 @@
<body>
<div class="footer" th:fragment="footer">
<div class="container">
<footer class="inner_footer copy_link">
<a class="header_entry_link" href="https://redrise.ru">&copy; 2023-2024 Dmitry Isaenko</a>
<footer class="inner_footer">
<a class="entry" href="https://redrise.ru">
<div class="copy_link">&copy; 2023-2024 Dmitry Isaenko</div>
</a>
</footer>
</div>
</div>

View file

@ -14,7 +14,9 @@
<div class="block_inner">
<ul class="ul_right_block">
<li class="li_header_block">
<a class="header_entry header_entry_link" href="/login" th:href="@{/login}">Sign in</a>
<a class="entry" href="/login" th:href="@{/login}">
<span class="header_entry header_entry_link">Sign in</span>
</a>
</li>
</ul>
</div>
@ -51,7 +53,9 @@
<span class="header_entry">|</span>
</li>
<li class="li_header_block">
<a class="header_entry header_entry_link" href="/logout">Logout</a>
<a class="entry" href="/logout">
<span class="header_entry header_entry_link">Logout</span>
</a>
<form style="visibility: hidden" id="form" method="post" action="#" th:action="@{/logout}"></form>
</li>
</ul>

View file

@ -12,7 +12,11 @@
<div class="page">
<div th:replace="~{fragments/header :: ${#authorization.expression('isAuthenticated()')} ? 'header-auth' : 'header-anon'}"></div>
<div class="container base">
Welcome
<br /><a href="/book/59992766">/book/59992766</a>
<br /><a href="/author/1">/author/1</a>
<br /><a href="/h2">H2</a>
<br />
</div>
</div>
<div th:replace="~{fragments/footer :: 'footer'}"></div>