Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit e9fc5fe

Browse files
authored
Merge pull request #26 from ploiu/jlink_issues
2 parents e256bd3 + 629bed3 commit e9fc5fe

File tree

9 files changed

+145
-91
lines changed

9 files changed

+145
-91
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ bin/
4141
### Mac OS ###
4242
.DS_Store
4343

44-
app.properties
44+
app.properties
45+
file_server_cert.pem

.idea/workspace.xml

Lines changed: 87 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
# file-server-ui
22

33
A client frontend for [ploiu/file_server](https://github.com/ploiu/file_server), written in java
4+
5+
## Building
6+
1. make sure you have the server certificate in the same directory as this README, and make sure it's named `file_server_cert.pem`
7+
2. run `./gradlew jpackage`
8+
9+
## Installing
10+
the built installer is located in `./build/file-server-installer`. For linux, you will need to write your own .desktop file until I can figure out how to get the jlink plugin to work with automatic start menu installation. For windows, you will need to navigate to `C:\Program Files\ploiu-file-server` and manually add `ploiu-file-server.exe` to the start menu for the same reason.

build.gradle

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.apache.tools.ant.taskdefs.condition.Os
2+
13
buildscript {
24
dependencies {
35
classpath 'org.openjfx:javafx-plugin:0.0.13'
@@ -8,15 +10,15 @@ plugins {
810
id 'idea'
911
id 'application'
1012
id 'org.openjfx.javafxplugin' version '0.0.13'
11-
id 'org.beryx.jlink' version '2.25.0'
13+
id 'org.beryx.jlink' version '2.26.0'
1214
}
1315

1416
def versions = [
15-
junit : '5.9.2',
16-
mockito : '4.11.0',
17-
lombok : '1.18.24',
18-
jackson : '2.14.0',
19-
slf4j : '2.0.5',
17+
junit : '5.10.0',
18+
mockito : '5.4.0',
19+
lombok : '1.18.28',
20+
jackson : '2.15.2',
21+
slf4j : '2.0.7',
2022
wiremock: '3.0.0-beta-7'
2123
]
2224

@@ -28,7 +30,7 @@ sourceCompatibility = 17
2830
targetCompatibility = 17
2931

3032
group 'ploiu'
31-
version '1.0-SNAPSHOT'
33+
version '1.0'
3234

3335
repositories {
3436
mavenCentral()
@@ -41,7 +43,7 @@ dependencies {
4143
implementation "com.fasterxml.jackson.core:jackson-core:$versions.jackson"
4244
implementation "com.fasterxml.jackson.core:jackson-databind:$versions.jackson"
4345
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$versions.jackson"
44-
implementation 'org.jetbrains:annotations:23.1.0'
46+
implementation 'org.jetbrains:annotations:24.0.1'
4547
implementation 'com.google.inject:guice:5.1.0'
4648
// because apparently I can't properly build a multipart form to save my life
4749
implementation 'org.apache.httpcomponents.client5:httpclient5:5.2.1'
@@ -79,4 +81,35 @@ jlink {
7981
launcher {
8082
name = 'Ploiu File Server'
8183
}
84+
mergedModule {
85+
additive = true
86+
requires 'org.slf4j'
87+
requires 'jdk.crypto.ec'
88+
}
89+
90+
jpackage {
91+
imageName = 'ploiu-file-server'
92+
skipInstaller = false
93+
if (Os.isFamily(Os.FAMILY_UNIX)) {
94+
installerType = 'deb'
95+
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
96+
installerType = 'exe'
97+
}
98+
installerOutputDir = file("$buildDir/file-server-installer")
99+
}
100+
101+
}
102+
103+
tasks.jpackageImage.doFirst {
104+
println 'Installing cert to custom runtime...'
105+
def flags = ['-importcert', '-cacerts', '-file', './file_server_cert.pem', '-noprompt', '-storepass', 'changeit']
106+
// TODO platform-based command
107+
exec {
108+
if(Os.isFamily(Os.FAMILY_UNIX)) {
109+
commandLine('./build/image/bin/keytool', *flags)
110+
} else if(Os.isFamily(Os.FAMILY_WINDOWS)) {
111+
commandLine('build/image/bin/keytool.exe', *flags)
112+
}
113+
114+
}
82115
}

src/main/java/module-info.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
module file.server.ui.main {
1+
// open is required to let the application access everything in src/main/resources
2+
open module file.server.ui.main {
3+
24
requires static lombok;
35

46
requires java.net.http;
@@ -15,12 +17,6 @@
1517
requires org.apache.httpcomponents.client5.httpclient5;
1618
requires org.apache.httpcomponents.core5.httpcore5;
1719

18-
opens ploiu.model to com.fasterxml.jackson.databind;
19-
opens ploiu.module to com.google.guice;
20-
opens ploiu.ui to javafx.fxml;
21-
opens ploiu.event to javafx.fxml;
22-
opens ploiu to javafx.graphics;
23-
2420
exports ploiu.ui to javafx.fxml, javafx.graphics;
2521
exports ploiu.event to javafx.fxml, javafx.graphics;
2622
exports ploiu to javafx.graphics;

src/main/resources/ui/components/ConfirmDialog/ConfirmDialog.css

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
@import "../../theme.css";
1+
@import "../../styles.css";
22

33
.confirm-dialog-root {
44
-fx-pref-width: 400;
55
-fx-pref-height: 200;
66
-fx-background-color: -background;
77
}
88

9-
.confirm-button, .cancel-button {
10-
-fx-background-color: -primary;
11-
-fx-text-fill: -text;
12-
-fx-cursor: hand;
13-
}
14-
159
.body-text {
1610
-fx-text-fill: -error;
1711
-fx-font-weight: bold;

src/main/resources/ui/components/ConfirmDialog/ConfirmDialog.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
styleClass="body-text" text="$bodyText"/>
1111
<HBox AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.bottomAnchor="50" alignment="CENTER"
1212
styleClass="button-wrapper">
13-
<Button fx:id="cancelButton" styleClass="cancel-button"
13+
<Button fx:id="cancelButton" styleClass="btn,btn-secondary"
1414
text="$cancelText"/>
15-
<Button fx:id="confirmButton" styleClass="confirm-button"
15+
<Button fx:id="confirmButton" styleClass="btn,btn-primary"
1616
text="$confirmText"/>
1717
</HBox>
1818
</fx:root>

src/main/resources/ui/components/TextInputDialog/TextInputDialog.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "../../theme.css";
1+
@import "../../styles.css";
22

33
.text-input-dialog-root {
44
-fx-pref-width: 400;

src/main/resources/ui/components/TextInputDialog/TextInputDialog.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<TextField fx:id="textBox" layoutX="37.0" layoutY="88.0" prefHeight="24.0" prefWidth="328.0"
1313
styleClass="text-box"/>
1414
<VBox AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.bottomAnchor="50" alignment="CENTER">
15-
<Button fx:id="actionButton" styleClass="submit-button"
15+
<Button fx:id="actionButton" styleClass="btn,btn-primary"
1616
text="$confirmText"/>
1717
</VBox>
1818
</fx:root>

0 commit comments

Comments
 (0)