1
0

Stuff all over the place

This commit is contained in:
2020-07-23 23:47:12 +02:00
parent f59ece1fc0
commit 3ad259651c
14 changed files with 353 additions and 2 deletions

View File

@@ -5,6 +5,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* This whole application is basically just a thin layer around the webpush-java lib
*/
@SpringBootApplication
public class PushServiceApplication extends SpringBootServletInitializer {
public static void main(String[] args) {

View File

@@ -6,18 +6,26 @@ import de.pushservice.server.decorator.MessageDecorator;
import de.pushservice.server.decorator.SubscriptionDecorator;
import nl.martijndwars.webpush.Notification;
import nl.martijndwars.webpush.PushService;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.security.Security;
@RestController
public class PushServiceController {
private static final Logger LOGGER = LoggerFactory.getLogger(PushServiceController.class);
static {
Security.addProvider(new BouncyCastleProvider());
}
@PostMapping
public ResponseEntity notify(NotificationRequestDto notificationRequestDto) {
public ResponseEntity notify(@RequestBody NotificationRequestDto notificationRequestDto) {
try {
final SubscriptionDecorator subscription = SubscriptionDecorator
.fromDto(notificationRequestDto.getSubscriptionDto());

View File

@@ -0,0 +1,13 @@
server.servlet.context-path=/push-service-server
server.port=8077
info.app.name=PushService server
info.app.description=A simple server for webpush
info.build.group=@project.groupId@
info.build.artifact=@project.artifactId@
info.build.version=@project.version@
logging.level.de.pushservice=DEBUG
logging.file=push-service-server.log
logging.file.max-history=7
logging.file.max-size=50MB