Skip to content

Commit a0bb6e2

Browse files
authored
String Transform (#42)
* string transform * move release job execution to pr
1 parent 85511f2 commit a0bb6e2

File tree

10 files changed

+30
-55
lines changed

10 files changed

+30
-55
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,14 @@ jobs:
5555
env:
5656
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
5757
run: heroku container:release web -a manga-spring
58+
59+
- name: Create Github Pre-Release tag
60+
uses: "marvinpinto/action-automatic-releases@latest"
61+
with:
62+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
63+
automatic_release_tag: "pre-release"
64+
prerelease: true
65+
title: "Manga-Spring"
66+
files: |
67+
LICENSE.txt
68+
*.jar

.github/workflows/release.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/main/java/com/mangasite/domain/Manga.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ public Manga(MangaChangeRequest request) {
5959

6060
ld =
6161
request.updateDateStr() != null
62-
? LocalDate.parse(request.updateDateStr())
62+
? request
63+
.updateDateStr()
64+
.transform(LocalDate::parse)
6365
.atStartOfDay(ZoneId.systemDefault())
6466
.toEpochSecond()
6567
: request.updateDateint();

src/main/java/com/mangasite/services/MangaService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public Flux<Manga> findPopular() {
9595
repo.sample(7)
9696
.filter(m -> m.getId() != 3 && m.getId() != 4)
9797
.take(5)
98-
.sort(Comparator.comparingInt(Manga::getH)))
98+
.sort(Comparator.comparingInt(Manga::getH).reversed()))
9999
.andWriteWith(
100100
(k, signals) ->
101101
Mono.fromRunnable(
@@ -131,7 +131,9 @@ public Mono<Manga> postNewManga(MangaChangeRequest request) {
131131

132132
System.out.println("Populating Database");
133133

134-
return repo.getByTitle(request.title())
134+
return request
135+
.title()
136+
.transform(repo::getByTitle)
135137
.hasElement()
136138
.flatMap(b -> b ? Mono.empty() : Mono.just(request))
137139
.map(Manga::new)

src/main/java/com/mangasite/services/TokenService.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.springframework.web.reactive.function.server.ServerRequest;
1515
import org.springframework.web.reactive.function.server.ServerResponse;
1616

17-
import io.jsonwebtoken.Claims;
1817
import io.jsonwebtoken.Jwts;
1918
import io.rsocket.exceptions.RejectedSetupException;
2019
import reactor.core.publisher.Mono;
@@ -52,12 +51,16 @@ public Mono<ServerResponse> getToken(ServerRequest request) {
5251
}
5352

5453
public Mono<Authentication> authenticateToken(Authentication authentication) {
55-
final var jwt = authentication.getCredentials().toString();
56-
final var parser = Jwts.parser().setSigningKey(key);
5754

58-
return Mono.fromSupplier(parser.parseClaimsJws(jwt)::getBody)
59-
.map(Claims::getSubject)
60-
.flatMap(userService::findByUsername)
55+
final var parser = key.transform(Jwts.parser()::setSigningKey);
56+
57+
return authentication
58+
.getCredentials()
59+
.toString()
60+
.transform(parser::parseClaimsJws)
61+
.getBody()
62+
.getSubject()
63+
.transform(userService::findByUsername)
6164
.switchIfEmpty(Mono.error(new RejectedSetupException("User Doesn't Exist")))
6265
.map(
6366
user ->

src/main/resources/static/frontend/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<title>Manga-Spring</title>
44
<base href="/">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6-
<meta name="description" content="State of the art site for reading manga. I built this site to show off my tech skill.">
76
<link rel="icon" type="image/x-icon" href="./assets/imageedit_11_3620823692.png">
87
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
98
<style type="text/css">@font-face{font-family:'Roboto';font-style:normal;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmSU5fBBc-.woff) format('woff');}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu4mxM.woff) format('woff');}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmEU9fBBc-.woff) format('woff');}@font-face{font-family:'Roboto';font-style:normal;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmSU5fCRc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}@font-face{font-family:'Roboto';font-style:normal;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmSU5fABc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}@font-face{font-family:'Roboto';font-style:normal;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmSU5fCBc4AMP6lbBP.woff2) format('woff2');unicode-range:U+1F00-1FFF;}@font-face{font-family:'Roboto';font-style:normal;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmSU5fBxc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0370-03FF;}@font-face{font-family:'Roboto';font-style:normal;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmSU5fCxc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;}@font-face{font-family:'Roboto';font-style:normal;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmSU5fChc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;}@font-face{font-family:'Roboto';font-style:normal;font-weight:300;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmSU5fBBc4AMP6lQ.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:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu5mxKKTU1Kvnz.woff2) format('woff2');unicode-range:U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu7mxKKTU1Kvnz.woff2) format('woff2');unicode-range:U+1F00-1FFF;}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu4WxKKTU1Kvnz.woff2) format('woff2');unicode-range:U+0370-03FF;}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu7WxKKTU1Kvnz.woff2) format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu7GxKKTU1Kvnz.woff2) format('woff2');unicode-range:U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.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:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmEU9fCRc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmEU9fABc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmEU9fCBc4AMP6lbBP.woff2) format('woff2');unicode-range:U+1F00-1FFF;}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmEU9fBxc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0370-03FF;}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmEU9fCxc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmEU9fChc4AMP6lbBP.woff2) format('woff2');unicode-range:U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;font-display:swap;src:url(https://fonts.gstatic.com/s/roboto/v27/KFOlCnqEu92Fr1MmEU9fBBc4AMP6lQ.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;}</style>
@@ -16,7 +15,7 @@
1615
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
1716
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
1817
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
19-
<script src="runtime-es2015.e7e9063e4dd37b02b292.js" type="module"></script><script src="runtime-es5.e7e9063e4dd37b02b292.js" nomodule defer></script><script src="polyfills-es5.d5fbc6135963eace7c9c.js" nomodule defer></script><script src="polyfills-es2015.146f8ad57445c5b82cbd.js" type="module"></script><script src="main-es2015.8782e37cb2c675f540d4.js" type="module"></script><script src="main-es5.8782e37cb2c675f540d4.js" nomodule defer></script>
18+
<script src="runtime-es2015.e7e9063e4dd37b02b292.js" type="module"></script><script src="runtime-es5.e7e9063e4dd37b02b292.js" nomodule defer></script><script src="polyfills-es5.d5fbc6135963eace7c9c.js" nomodule defer></script><script src="polyfills-es2015.146f8ad57445c5b82cbd.js" type="module"></script><script src="main-es2015.448971f255015bbfce4f.js" type="module"></script><script src="main-es5.448971f255015bbfce4f.js" nomodule defer></script>
2019

2120

2221
</body></html>

src/main/resources/static/frontend/main-es2015.448971f255015bbfce4f.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/static/frontend/main-es2015.8782e37cb2c675f540d4.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/main/resources/static/frontend/main-es5.448971f255015bbfce4f.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/static/frontend/main-es5.8782e37cb2c675f540d4.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)