Skip to content

Commit f0fda62

Browse files
authored
101 dashboard (#109)
* feat: Singn in and obtaining JWT-token (#103) * feat: Singn in and obtaining JWT-token * feat: Provide web gui for {list, add, add, update, remove} repository… (#106) * feat: Provide web gui for {list, add, add, update, remove} repository settings * add standard artipie authentication * Start web gui without artipie yaml configuration (#107) feat: start dashboard without config * Remove rest services from frontend (#108) feat: remove rest services from front
1 parent d2ba52b commit f0fda62

163 files changed

Lines changed: 1893 additions & 9798 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ USER 2021:2020
1616

1717
COPY target/dependency /usr/lib/web-service/lib
1818
COPY target/${JAR_FILE} /usr/lib/web-service/app.jar
19-
COPY _config.yml /etc/artipie/artipie.yml
2019

2120
WORKDIR /var/web-service
2221
HEALTHCHECK --interval=10s --timeout=3s \
@@ -28,7 +27,5 @@ CMD [ \
2827
"--add-opens", "java.base/java.util=ALL-UNNAMED", \
2928
"--add-opens", "java.base/java.security=ALL-UNNAMED", \
3029
"-cp", "/usr/lib/web-service/app.jar:/usr/lib/web-service/lib/*", \
31-
"com.artipie.front.Service", \
32-
"--port=8080", \
33-
"--config=/etc/artipie/artipie.yml" \
30+
"com.artipie.front.Service" \
3431
]

_config.yml

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

pom.xml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,21 +152,6 @@ https://github.com/artipie/front/LICENSE.txt
152152
<artifactId>commons-cli</artifactId>
153153
<version>1.5.0</version>
154154
</dependency>
155-
<dependency>
156-
<groupId>software.amazon.awssdk</groupId>
157-
<artifactId>auth</artifactId>
158-
<version>2.14.7</version>
159-
</dependency>
160-
<dependency>
161-
<groupId>software.amazon.awssdk</groupId>
162-
<artifactId>s3</artifactId>
163-
<version>2.14.7</version>
164-
</dependency>
165-
<dependency>
166-
<groupId>io.etcd</groupId>
167-
<artifactId>jetcd-core</artifactId>
168-
<version>0.5.4</version>
169-
</dependency>
170155
<dependency>
171156
<groupId>com.fasterxml.jackson.core</groupId>
172157
<artifactId>jackson-databind</artifactId>

src/main/java/com/artipie/front/AuthFilters.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public enum AuthFilters implements Filter {
2323
*/
2424
AUTHENTICATE(
2525
(req, rsp) -> {
26-
if (req.pathInfo().equals("/signin") || req.pathInfo().equals("/token")) {
26+
if ("/signin".equals(req.pathInfo()) || "/.health".equals(req.pathInfo())) {
2727
return;
2828
}
2929
if (req.session() == null || !req.session().attributes().contains("uid")) {
@@ -43,16 +43,17 @@ public enum AuthFilters implements Filter {
4343
);
4444
if (req.session() == null) {
4545
attrs.values().forEach(attr -> attr.remove(req));
46-
}
47-
attrs.forEach(
48-
(name, attr) -> {
49-
if (req.session().attributes().contains(name)) {
50-
attr.write(req, req.session().attribute(name));
51-
} else {
52-
attr.remove(req);
46+
} else {
47+
attrs.forEach(
48+
(name, attr) -> {
49+
if (req.session().attributes().contains(name)) {
50+
attr.write(req, req.session().attribute(name));
51+
} else {
52+
attr.remove(req);
53+
}
5354
}
54-
}
55-
);
55+
);
56+
}
5657
}
5758
);
5859

@@ -71,8 +72,6 @@ public enum AuthFilters implements Filter {
7172

7273
@Override
7374
public void handle(final Request req, final Response rsp) throws Exception {
74-
if (!req.pathInfo().startsWith("/api")) {
75-
this.func.handle(req, rsp);
76-
}
75+
this.func.handle(req, rsp);
7776
}
7877
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* The MIT License (MIT) Copyright (c) 2022 artipie.com
3+
* https://github.com/artipie/front/LICENSE.txt
4+
*/
5+
package com.artipie.front;
6+
7+
/**
8+
* Repository layout.
9+
*
10+
* @since 1.0
11+
*/
12+
public enum Layout {
13+
/**
14+
* Flat layout.
15+
*/
16+
FLAT("flat"),
17+
/**
18+
* Org layout.
19+
*/
20+
ORG("org");
21+
22+
/**
23+
* Name of layout.
24+
*/
25+
private final String name;
26+
27+
/**
28+
* Ctor.
29+
* @param name Name of layout.
30+
*/
31+
Layout(final String name) {
32+
this.name = name;
33+
}
34+
35+
/**
36+
* The name of the layout.
37+
* @return String name
38+
*/
39+
public String toString() {
40+
return this.name;
41+
}
42+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* The MIT License (MIT) Copyright (c) 2022 artipie.com
3+
* https://github.com/artipie/front/LICENSE.txt
4+
*/
5+
package com.artipie.front;
6+
7+
import com.artipie.ArtipieException;
8+
9+
/**
10+
* Exception should be used in wrong result of rest-invocation.
11+
*
12+
* @since 1.0
13+
* @implNote RestException is unchecked exception, but it's a good
14+
* practice to document it via {@code throws} tag in JavaDocs.
15+
*/
16+
@SuppressWarnings("PMD.OnlyOneConstructorShouldDoInitialization")
17+
public class RestException extends ArtipieException {
18+
private static final long serialVersionUID = 1L;
19+
20+
/**
21+
* Status code.
22+
*/
23+
private final int code;
24+
25+
/**
26+
* New exception with message and base cause.
27+
* @param code Http status code
28+
* @param msg Message
29+
* @param cause Cause
30+
*/
31+
public RestException(final int code, final String msg, final Throwable cause) {
32+
super(msg, cause);
33+
this.code = code;
34+
}
35+
36+
/**
37+
* New exception with base cause.
38+
* @param code Http status code
39+
* @param cause Cause
40+
*/
41+
public RestException(final int code, final Throwable cause) {
42+
super(cause);
43+
this.code = code;
44+
}
45+
46+
/**
47+
* New exception with message.
48+
* @param code Http status code
49+
* @param msg Message
50+
*/
51+
public RestException(final int code, final String msg) {
52+
super(msg);
53+
this.code = code;
54+
}
55+
56+
/**
57+
* Get http status code of rest invocation's result .
58+
* @return Status code.
59+
*/
60+
public int statusCode() {
61+
return this.code;
62+
}
63+
}
64+

0 commit comments

Comments
 (0)