Compare commits

...

26 Commits

Author SHA1 Message Date
a5fd5444da Fix a typo 2025-07-07 19:22:10 +00:00
b4df31a31a Add linux packaging instructions 2025-07-06 20:47:47 -07:00
4881a135f2 Update readme 2025-07-06 16:02:41 -07:00
ca502fd411 Remove schedule test buttons 2025-07-05 18:18:36 -07:00
c8a1128e11 Widen default help window size 2025-07-05 17:47:49 -07:00
b9a2202c68 Make version field full-width 2025-07-05 17:47:30 -07:00
671844723f Don't error if station doesn't have dir when deleted 2025-07-05 17:47:18 -07:00
7a0ce063f1 Add deletion of station schedule info when station is removed
Task scheduler entry for Windows, cron entry for *nix
2025-07-05 17:46:56 -07:00
62bfbb1923 Add log path to settings load error
Since they wouldn't be able to run the application to see the log path.

Also make no the default option
2025-07-05 17:44:49 -07:00
2992572651 Remove some unnecessary printlns 2025-07-05 13:47:51 -07:00
b25fea4549 Remove jitter todo from settings page 2025-06-08 12:28:57 -07:00
a45ffdd864 Remove todo on captureProcessOutput() 2025-06-07 21:44:42 -07:00
c918d98a3c Fix tab order 2025-06-07 21:20:55 -07:00
afb02dcb3d Add accessibility text for all fields 2025-06-07 20:50:49 -07:00
1c7069c737 Add linux schedule management functions 2025-05-29 00:45:41 -07:00
bf754c79d6 Update crontab call 2025-05-26 21:51:12 -07:00
d5e33d2a39 Add alert for unsupported OS 2025-05-26 21:51:11 -07:00
456348d520 Remove TODOs 2025-05-26 21:51:11 -07:00
769f80ec72 Remove testing statement 2025-05-26 21:41:42 -07:00
b6a6ec5e3a Add setting reinitialization if loading fails 2025-05-26 21:41:01 -07:00
392d10c587 Add git version to log and --version output 2025-05-25 23:37:01 -07:00
430b89bdda Remove some testing logs 2025-05-25 23:37:01 -07:00
2a7f9813a1 Fix log statement 2025-05-25 23:37:00 -07:00
553edc8b6c Add external program timeout as station setting
Leaving it without a UI implementation for now
2025-05-25 23:35:47 -07:00
645b1f2414 Fix bug when trying to remove station & none selected 2025-05-21 22:49:05 -07:00
306f169d08 Combine schedule start date/time fields into a single time-zoned field 2025-05-21 22:48:39 -07:00
19 changed files with 407 additions and 294 deletions

View File

@ -1,144 +1,139 @@
For sending secret messages and dummy messages regularly. It is meant to be used in conjunction with one-time pads. One-time pads provide perfect security for the message itself (if they are handled properly), but adversaries can still tell that messages are being sent, and when they are being sent. To avoid this, dummy messages are uploaded to a website on a regular basis. The messages can also be hidden using steganography.
This application should not be considered secure, and no sensitive information should be entered into it.
Baseline is that the number station will generate a dummy random message, optionally obscure it via steganography, then upload it to an (s)ftp/scp server.
The random message generation actually happens last, so that, next time it is run, the existing message will be uploaded. This way a real message can be generated in the meantime and the next upload time the real message will be uploaded. Because the real message looks random to anyone without the corresponding one-time pad, it cannot be distinguished from the dummy messages.
# Number Station Listener
This application periodically checks a site for numbers and stores them so the user can check whether the message matches any pads.
# Notes
Should have sane defaults, but be built to be part of a more extensible system. Should be able to run other commands for message generation / upload.
Need to be able to support multiple profiles for each.
## Tech
- Installers: JPackage
- Notifications: https://github.com/sshtools/two-slices/blob/master/README.md
- Post to wordpress: https://github.com/ashri/java-wordpress-api/tree/master
## Security considerations
If someone were to take any part of the number station (this software, the server, or intercepting on the way to the recipient), then they could make sure no messages get through (though they couldn't spoof messages without access to the one-time pads).
This weakness is true of nearly all communication methods though. The only way to be certain a message was received is to receive an acknowledgement back.
# Settings/State Format
$XDG_CONFIG_HOME/numbers-station/main-settings.xml
$XDG_CONFIG_HOME/numbers-station/listener-settings.xml
$XDG_STATE_HOME/numbers-station/main.log
$XDG_STATE_HOME/numbers-station/listener.log
$XDG_STATE_HOME/numbers-station/<station-id>-main/next-message.txt
$XDG_STATE_HOME/numbers-station/<station-id>-main/20250114T091633.txt
$XDG_STATE_HOME/numbers-station/<station-id>-listener/20250114T091735.txt
$XDG_STATE_HOME/numbers-station/<station-id>-listener/20250114T091748-read.txt
XDG dirs:
https://superuser.com/a/1767882
On Windows:
https://stackoverflow.com/questions/43853548/xdg-basedir-directories-for-windows
Library to use:
https://github.com/dirs-dev/directories-jvm
# TODO
- [ ] Undo/Redo in message editing
- [ ] Disable/commandeer right-click menu items for message text (otherwise you can wreck the formatting).
- [ ] Make sure numpad works in message editing
And in prefix editing
- [x] Catch and log all exceptions
- [ ] Add a check that the way we set up the scheduler to run the application will actually work. (need a flag argument that will output something particular we can look for).
- [x] Be able to narrow message area so that columns can match whatever message format you're using (minimum window width would keep you from doing that).
- [x] When station is removed/renamed, need to also remove/rename the scheduled task and the corresponding state directory.
- [x] Check for duplicate station names when creating or renaming
- [ ] Test task scheduler task creation for a windows user not on a domain (author needs to include domain when on domain e.g. EI\nathanm)
- [x] Station names with quotes shouldn't be allowed (or we'll need to do escaping for the launch command)
- [ ] Need to be able to handle case where application is open and the scheduled task runs. There's at least contention for the log file (maybe? doesn't seem to mind if multiple instances of the application are running)
- [ ] In all controllers, error handling should be 1. log error 2. Pop up dialog to warn user
- [x] Settings external schedule management should remove the scheduled task
- [ ] Add tests for generateMessage()
- [x] Load message from next-message
- [x] When making changes to the message, show the changes as unsaved until saved.
- [ ] Ensure all GUI elements have accessibility text
- [ ] Embed versioning info
- [ ] Factor out scheduling into a wrapper class that handles all the os-specific stuff internally.
- [ ] If a station name is run which doesn't exist in settings, but has associated files, then prompt the user to delete the files.
- [ ] Fix behavior when settings file is empty
- [ ] Store schedule time with time zone
- [ ] Add tests for StationSettings.nextSendTime()
Note on jars and javafx: https://stackoverflow.com/a/23121897
# 2025-01-27 JAR packaging
```
$modulePath = "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib"
$modules = $(
"com.fasterxml.jackson.annotation",
"com.fasterxml.jackson.core",
"com.fasterxml.jackson.dataformat.xml",
"com.fasterxml.jackson.datatype.jsr310",
"result",
"javafx.controls",
"javafx.fxml",
"org.apache.commons.cli"
)
$addModules = $modules -join ","
java/>jar --create --file numbers-station.jar --manifest .\manifest.txt -C out .
java/>java --module-path $modulePath --add-modules $addModules -jar .\numbers-station.jar
```
TODO: package lib jars with this jar
also:
```
jpackage --input . --name numbers-station --main-jar .\numbers-station.jar --main-class name.nathanmcrae.numbersstation.Main --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml,com.fasterxml.jackson.datatype.jsr310 --type exe
```
# 2025-02-16
Tried to compile a jfx hello world using the openjdk and openjfx packaged in guix, but ran into issues. It looks like more up-to-date versions of openjfx are not available guix.
Might be the next best step is to depend on a binary release of openjfx and see if I can compile on linux like that. Could even have a custom guix package which depends on the openjfx binary release if needed.
# 2025-03-03
Tried some more packaging, but was getting a lot of "Error: automatic module cannot be used with jlink" issues. Not sure if I just wasn't getting those before or what, but the jpackage command above doesn't work now.
The issue seems to be with having non-modular dependencies. This page has some notes at the bottom about packaging non-modular applications: https://openjfx.io/openjfx-docs/#modular
# 2025-03-09
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=lib/wordpress-xmlrpc-client-1.1-SNAPSHOT.jar -DgroupId=com.tearsofaunicorn.wordpress -DartifactId=wordpress-xmlrpc-client -Dversion=1.1 -Dpackaging=jar -DlocalRepositoryPath=mvn-repo
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=lib/xmlrpc-client-3.1.3.jar -DgroupId=wordpress -DartifactId=xmlrpc-client -Dversion=3.1.3 -Dpackaging=jar -DlocalRepositoryPath=mvn-repo
# 2025-03-17
Appears to work. Launch is extremely slow
jpackage --input . --name numbers-station --main-jar .\target\numbersstation-1.0-SNAPSHOT.jar --main-class name.nathanmcrae.numbersstation.MainRun --type app-image --dest $HOME/temp/20250316T153044
Failed to generate msi this time :(
numbers-station/>jpackage --input . --name numbers-station --main-jar .\target\numbersstation-1.0-SNAPSHOT.jar --main-class name.nathanmcrae.numbersstation.MainRun --type exe --dest $HOME/temp/20250317T200941
java.io.IOException: Command [C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe, -nologo, C:\Users\nathanm\AppData\Local\Temp\jdk.jpackage911481192111528806\config\bundle.wxf, -ext, WixUtilExtension, -arch, x64, -out, C:\Users\nathanm\AppData\Local\Temp\jdk.jpackage911481192111528806\wixobj\bundle.wixobj] in C:\Users\nathanm\AppData\Local\Temp\jdk.jpackage911481192111528806\images\win-msi.image\numbers-station exited with 1 code
# 2025-03-22
Did a clean clone and build and it worked.
jpackage --input . --name numbers-station --main-jar .\target\numbersstation-1.0-SNAPSHOT.jar --main-class name.nathanmcrae.numbersstation.MainRun --type exe --win-menu --win-per-user-install --win-shortcut --win-shortcut-prompt --win-upgrade-uuid 956c711b-01f1-46a2-9355-4a6b63ec1ec9 --icon "P:\personal_root\projects\numbers-station\icon.ico" --description "Tool to periodically upload encrypted messages to a website/blog"
---
2025-03-22T20:50:38.212-07:00 INFO name.nathanmcrae.numbersstation.Main main Executable Path: C:\Users\nathanm\AppData\Local\numbers-station\numbers-station.exe
For sending secret messages and dummy messages regularly. It is meant to be used in conjunction with one-time pads. One-time pads provide perfect security for the message itself (if they are handled properly), but adversaries can still tell that messages are being sent, and when they are being sent. To avoid this, dummy messages are uploaded to a website on a regular basis.
This application should not be considered secure, and no sensitive information should be entered into it.
# Building
Building requires JDK 23.0.1 and javafx SDK 23.0.1, and Maven (I used version 3.9.9)
The JAVA_HOME environment variable must be set to the JDK installation directory e.g. `C:\Program Files\Java\jdk-23.0.1\bin\java.exe`. `$JAVA_HOME/bin` must be included in you PATH variable. PATH_TO_FX must be set to the JavaFX lib directory e.g. `$HOME/openjfx-23.0.1_windows-x64_bin-sdk/javafx-sdk-23.0.1/lib`.
To build, run `mvn package`, the output .jar should be in ./target
To run without installing: `java -jar target/numbersstation-1.0-SNAPSHOT-shaded.jar`
# Packaging
Packaging is done via jpackage, which is included with the JDK version used to build.
jpackage seems to pull in the entire working directory unnecessarily. To avoid bloat, packaging should be done in a clean subdirectory.
## Windows
``` sh
> mkdir packaging
> cp target/numbersstation-1.0-SNAPSHOT-shaded.jar packaging
> cd packaging
> jpackage --input . --name "Numbers Station" --main-jar numbersstation-1.0-SNAPSHOT-shaded.jar --main-class name.nathanmcrae.numbersstation.MainRun --type exe --win-menu --win-per-user-install --win-shortcut --win-shortcut-prompt --win-upgrade-uuid 956c711b-01f1-46a2-9355-4a6b63ec1ec9 --icon "../icon.ico" --description "Tool to periodically upload encrypted messages to a website/blog"
```
## Linux
``` sh
> mkdir packaging
> cp target/numbersstation-1.0-SNAPSHOT.jar packaging
> cd packaging
> jpackage --input . --name numbers-station --main-jar numbersstation-1.0-SNAPSHOT.jar --main-class name.nathanmcrae.numbersstation.MainRun --type deb --icon ../icon.ico --description "Tool to periodically upload encrypted messages to a website/blog"
```
# TODO
- [ ] Undo/Redo in message editing
- [ ] Disable/commandeer right-click menu items for message text (otherwise you can wreck the formatting).
- [ ] Make sure numpad works in message editing
And in prefix editing
- [x] Catch and log all exceptions
- [ ] Add a check that the way we set up the scheduler to run the application will actually work. (need a flag argument that will output something particular we can look for).
- [x] Be able to narrow message area so that columns can match whatever message format you're using (minimum window width would keep you from doing that).
- [x] When station is removed/renamed, need to also remove/rename the scheduled task and the corresponding state directory.
- [x] Check for duplicate station names when creating or renaming
- [ ] Test task scheduler task creation for a windows user not on a domain (author needs to include domain when on domain e.g. EI\nathanm)
- [x] Station names with quotes shouldn't be allowed (or we'll need to do escaping for the launch command)
- [ ] Need to be able to handle case where application is open and the scheduled task runs. There's at least contention for the log file (maybe? doesn't seem to mind if multiple instances of the application are running)
- [ ] In all controllers, error handling should be 1. log error 2. Pop up dialog to warn user
- [x] Settings external schedule management should remove the scheduled task
- [ ] Add tests for generateMessage()
- [x] Load message from next-message
- [x] When making changes to the message, show the changes as unsaved until saved.
- [x] Ensure all GUI elements have accessibility text
- [x] Embed versioning info
- [ ] Factor out scheduling into a wrapper class that handles all the os-specific stuff internally.
- [ ] If a station name is run which doesn't exist in settings, but has associated files, then prompt the user to delete the files.
- [ ] Fix behavior when settings file is empty
- [x] Store schedule time with time zone
- [ ] Add tests for StationSettings.nextSendTime()
- [ ] When changing number of digits for a station, we may want to regenerate a new message of the specified length. We'll need to prompt the user to overwrite the existing message (in case it's a real message).
- [ ] Add a button to post message manually (With dialog warning)
- Add description in help quickstart for how to use this
- [ ] 'Next message will be sent' should reflect when external schedule management is turned on
- [x] Have a way to show executable location (since you need to know that to manage schedule externally)
- [ ] When launching help, re-navigate to help page
- [x] When can't load settings, give option to re-initialize (with confirmation)
# Devlog
# 2025-01-27 JAR packaging
```
$modulePath = "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib"
$modules = $(
"com.fasterxml.jackson.annotation",
"com.fasterxml.jackson.core",
"com.fasterxml.jackson.dataformat.xml",
"com.fasterxml.jackson.datatype.jsr310",
"result",
"javafx.controls",
"javafx.fxml",
"org.apache.commons.cli"
)
$addModules = $modules -join ","
java/>jar --create --file numbers-station.jar --manifest .\manifest.txt -C out .
java/>java --module-path $modulePath --add-modules $addModules -jar .\numbers-station.jar
```
TODO: package lib jars with this jar
also:
```
jpackage --input . --name numbers-station --main-jar .\numbers-station.jar --main-class name.nathanmcrae.numbersstation.Main --module-path "$Env:PATH_TO_FX;P:\personal_root\projects\number-station\lib" --add-modules javafx.controls,javafx.fxml,com.fasterxml.jackson.annotation,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat.xml,com.fasterxml.jackson.datatype.jsr310 --type exe
```
# 2025-02-16
Tried to compile a jfx hello world using the openjdk and openjfx packaged in guix, but ran into issues. It looks like more up-to-date versions of openjfx are not available guix.
Might be the next best step is to depend on a binary release of openjfx and see if I can compile on linux like that. Could even have a custom guix package which depends on the openjfx binary release if needed.
# 2025-03-03
Tried some more packaging, but was getting a lot of "Error: automatic module cannot be used with jlink" issues. Not sure if I just wasn't getting those before or what, but the jpackage command above doesn't work now.
The issue seems to be with having non-modular dependencies. This page has some notes at the bottom about packaging non-modular applications: https://openjfx.io/openjfx-docs/#modular
# 2025-03-09
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=lib/wordpress-xmlrpc-client-1.1-SNAPSHOT.jar -DgroupId=com.tearsofaunicorn.wordpress -DartifactId=wordpress-xmlrpc-client -Dversion=1.1 -Dpackaging=jar -DlocalRepositoryPath=mvn-repo
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=lib/xmlrpc-client-3.1.3.jar -DgroupId=wordpress -DartifactId=xmlrpc-client -Dversion=3.1.3 -Dpackaging=jar -DlocalRepositoryPath=mvn-repo
# 2025-03-17
Appears to work. Launch is extremely slow
jpackage --input . --name numbers-station --main-jar .\target\numbersstation-1.0-SNAPSHOT.jar --main-class name.nathanmcrae.numbersstation.MainRun --type app-image --dest $HOME/temp/20250316T153044
Failed to generate msi this time :(
numbers-station/>jpackage --input . --name numbers-station --main-jar .\target\numbersstation-1.0-SNAPSHOT.jar --main-class name.nathanmcrae.numbersstation.MainRun --type exe --dest $HOME/temp/20250317T200941
java.io.IOException: Command [C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe, -nologo, C:\Users\nathanm\AppData\Local\Temp\jdk.jpackage911481192111528806\config\bundle.wxf, -ext, WixUtilExtension, -arch, x64, -out, C:\Users\nathanm\AppData\Local\Temp\jdk.jpackage911481192111528806\wixobj\bundle.wixobj] in C:\Users\nathanm\AppData\Local\Temp\jdk.jpackage911481192111528806\images\win-msi.image\numbers-station exited with 1 code
# 2025-03-22
Did a clean clone and build and it worked.
jpackage --input . --name "Numbers Station" --main-jar .\target\numbersstation-1.0-SNAPSHOT.jar --main-class name.nathanmcrae.numbersstation.MainRun --type exe --win-menu --win-per-user-install --win-shortcut --win-shortcut-prompt --win-upgrade-uuid 956c711b-01f1-46a2-9355-4a6b63ec1ec9 --icon "P:\personal_root\projects\numbers-station\icon.ico" --description "Tool to periodically upload encrypted messages to a website/blog"
---
2025-03-22T20:50:38.212-07:00 INFO name.nathanmcrae.numbersstation.Main main Executable Path: C:\Users\nathanm\AppData\Local\numbers-station\numbers-station.exe

View File

@ -48,7 +48,7 @@ public class AboutController {
try {
properties.load(getClass().getClassLoader().getResourceAsStream("git.properties"));
} catch (IOException e) {
logger.log(Level.SEVERE, "Failed to load main view", e);
logger.log(Level.SEVERE, "Failed to load git information", e);
}
versionTextField.setText(String.valueOf(properties.get("git.commit.id.full")));

View File

@ -13,9 +13,7 @@ public class HelpController {
@FXML
public void initialize() throws Exception {
logger.info("20250407T222451");
String url = HelpController.class.getResource("/help-index.html").toExternalForm();
webView.getEngine().load(url);
logger.info("20250407T222456");
}
}

View File

@ -11,6 +11,8 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -25,8 +27,7 @@ public class LinuxScheduler {
try {
String taskName = "numbers-station-main_" + settings.getName();
// TODO: assume it's on the PATH
Process listProcess = new ProcessBuilder("/usr/bin/crontab", "-l").start();
Process listProcess = new ProcessBuilder("crontab", "-l").start();
if (!listProcess.waitFor(5, TimeUnit.SECONDS)) {
String message = "Failed to query " + taskName + " task: process timed out";
logger.log(Level.SEVERE, message);
@ -59,6 +60,10 @@ public class LinuxScheduler {
matcher.appendReplacement(sb, "");
}
if (foundMultiple) {
logger.log(Level.WARNING, "Found multiple instances of '" + taskName + "' prior to replacement");
}
matcher.appendTail(sb);
} else {
sb.append(currentCrontab);
@ -67,8 +72,7 @@ public class LinuxScheduler {
String newCrontab = sb.toString();
// TODO: assume it's on the PATH
Process addProcess = new ProcessBuilder("/usr/bin/crontab", "-").start();
Process addProcess = new ProcessBuilder("crontab", "-").start();
Writer w = new OutputStreamWriter(addProcess.getOutputStream(), "UTF-8");
System.out.println(newCrontab);
w.write(newCrontab);
@ -92,22 +96,104 @@ public class LinuxScheduler {
return Results.failure(message);
}
// Path cronDPath = Paths.get("/etc/cron.d");
// if (!Files.exists(cronDPath)) {
// String message = "/etc/cron.d does not exist, cannot create cron entry. Select 'Manage schedule externally' and set up scheduling as desired.";
// logger.log(Level.SEVERE, message);
// return Results.failure(message);
// }
return Results.success(true);
}
// Path cronPath = cronDPath.resolve(settings.safeName());
public static Result<Boolean, String> scheduleExists(StationSettings settings) {
try {
String taskName = "numbers-station-main_" + settings.getName();
// try {
// Files.write(cronPath, cronEntry(settings).getBytes(StandardCharsets.UTF_8));
// } catch (Exception e) {
// String message = "Failed to write cron file at '" + cronPath.toString() + "'";
// logger.log(Level.SEVERE, message, e);
// return Results.failure(message);
// }
Process listProcess = new ProcessBuilder("crontab", "-l").start();
if (!listProcess.waitFor(5, TimeUnit.SECONDS)) {
String message = "Failed to query " + taskName + " task: process timed out";
logger.log(Level.SEVERE, message);
return Results.failure(message);
}
Pair<String, String> output = WindowsScheduler.captureProcessOutput(listProcess);
if(listProcess.exitValue() != 0) {
String message = "Failed to get user id. Exit code: " + listProcess.exitValue() + ". stdout: " + output.getKey() + "\n\tstderr: " + output.getValue();
logger.log(Level.SEVERE, message);
return Results.failure(message);
}
String currentCrontab = output.getKey();
String cronEntry = "# " + taskName + "\n" + cronExpression(settings) + "\n\n";
Pattern pattern = Pattern.compile("# " + taskName + "\\n[^\\n]+\\n\\n");
Matcher matcher = pattern.matcher(currentCrontab);
if (matcher.find()) {
return Results.success(true);
} else {
return Results.success(true);
}
} catch (CronExpressionException | IOException | InterruptedException e) {
String message = "Exception while checking for schedule";
logger.log(Level.SEVERE, message, e);
return Results.failure(message);
}
}
public static Result<Boolean, String> removeSchedule(StationSettings settings) {
try {
String taskName = "numbers-station-main_" + settings.getName();
Process listProcess = new ProcessBuilder("crontab", "-l").start();
if (!listProcess.waitFor(5, TimeUnit.SECONDS)) {
String message = "Failed to query " + taskName + " task: process timed out";
logger.log(Level.SEVERE, message);
return Results.failure(message);
}
Pair<String, String> output = WindowsScheduler.captureProcessOutput(listProcess);
if(listProcess.exitValue() != 0) {
String message = "Failed to get user id. Exit code: " + listProcess.exitValue() + ". stdout: " + output.getKey() + "\n\tstderr: " + output.getValue();
logger.log(Level.SEVERE, message);
return Results.failure(message);
}
String currentCrontab = output.getKey();
String cronEntry = "# " + taskName + "\n" + cronExpression(settings) + "\n\n";
Pattern pattern = Pattern.compile("# " + taskName + "\\n[^\\n]+\\n\\n");
Matcher matcher = pattern.matcher(currentCrontab);
StringBuilder sb = new StringBuilder();
while (matcher.find()) {
matcher.appendReplacement(sb, "");
}
String newCrontab = sb.toString();
Process addProcess = new ProcessBuilder("crontab", "-").start();
Writer w = new OutputStreamWriter(addProcess.getOutputStream(), "UTF-8");
System.out.println(newCrontab);
w.write(newCrontab);
w.flush();
w.close();
if (!addProcess.waitFor(5, TimeUnit.SECONDS)) {
String message = "Failed to register " + taskName + " task: process timed out";
logger.log(Level.SEVERE, message);
return Results.failure(message);
}
if(addProcess.exitValue() != 0) {
Pair<String, String> addOutput = WindowsScheduler.captureProcessOutput(addProcess);
String message = "Failed to get user id. Exit code: " + addProcess.exitValue() + ". stdout: " + addOutput.getKey() + ". stderr: " + addOutput.getValue();
logger.log(Level.SEVERE, message);
return Results.failure(message);
}
} catch (CronExpressionException | IOException | InterruptedException e) {
String message = "Exception while removing schedule";
logger.log(Level.SEVERE, message, e);
return Results.failure(message);
}
return Results.success(true);
}
@ -122,10 +208,12 @@ public class LinuxScheduler {
* minute (059)
*/
public static String cronExpression(StationSettings settings) throws CronExpressionException {
String minute = Integer.toString(settings.getScheduleStartTime().getMinute());
String hour = Integer.toString(settings.getScheduleStartTime().getHour());
String dayOfMonth = Integer.toString(settings.getScheduleStartDate().getDayOfMonth());
String dayOfWeek = Integer.toString(settings.getScheduleStartDate().getDayOfMonth());
LocalDateTime scheduleDateTime = settings.getScheduleStart().withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime();
String minute = Integer.toString(scheduleDateTime.getMinute());
String hour = Integer.toString(scheduleDateTime.getHour());
String dayOfMonth = Integer.toString(scheduleDateTime.getDayOfMonth());
String dayOfWeek = Integer.toString(scheduleDateTime.getDayOfMonth());
String scheduleString = "";
switch(settings.getMessagePeriod()) {

View File

@ -36,6 +36,7 @@ import java.util.logging.FileHandler;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.Optional;
import java.util.Properties;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
@ -50,8 +51,6 @@ public class Main extends Application {
public record StartParameters (Optional<NotificationController.NotificationParameters> notification) {}
private static final Logger logger = Logger.getLogger(Main.class.getName());
// TODO: get git info
private static final String VERSION = "0.0.1";
private static Path configPath = null;
private static Path statePath = null;
@ -130,6 +129,14 @@ public class Main extends Application {
primaryStage.titleProperty().bindBidirectional(controller.windowTitle);
primaryStage.show();
logger.info("Application started");
Properties properties = new Properties();
try {
properties.load(getClass().getClassLoader().getResourceAsStream("git.properties"));
logger.info("Application version: " + String.valueOf(properties.get("git.commit.id.full")));
} catch (IOException e) {
logger.log(Level.SEVERE, "Failed to load git information", e);
}
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Failed to load main view", e);
@ -167,7 +174,13 @@ public class Main extends Application {
}
if (parsedArgs.getVersionFlag()) {
System.out.println("Numbers Station version " + VERSION);
Properties properties = new Properties();
try {
properties.load(Main.class.getClassLoader().getResourceAsStream("git.properties"));
System.out.println(String.valueOf(properties.get("git.commit.id.full")));
} catch (IOException e) {
System.out.println("Failed to get git information");
}
System.exit(0);
}
@ -270,8 +283,8 @@ public class Main extends Application {
switch (loadedStation.getMessageMethod()) {
case StationSettings.MessageMethod.EXTERNAL_PROGRAM:
Process process = new ProcessBuilder(loadedStation.getExternalProgramCommand(), nextMessagePath.toString()).start();
// TODO: make timeout a setting
if (!process.waitFor(5, TimeUnit.SECONDS)) {
if (!process.waitFor(loadedStation.getExternalProgramTimeout().getSeconds(), TimeUnit.SECONDS)) {
throw new StationRunException("Timeout while running external program " + loadedStation.getExternalProgramCommand());
}

View File

@ -25,6 +25,7 @@ import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
@ -181,22 +182,37 @@ public class MainController implements Initializable {
stationNameField.textProperty().bindBidirectional(selectedStationName);
nextSendTimeLabel.textProperty().bind(nextSendTime);
nextSendTime.set("sup brah");
Result<MainSettings, Exception> result = MainSettings.load();
if (!result.hasSuccess()) {
// TODO: on failure, prompt user to re-initialize settings
Alert alert = new Alert(Alert.AlertType.ERROR);
String logPath = Main.getStatePath().resolve("main.log").toString();
String message = "Unable to load settings file. See log file at " + logPath + " for details. Reinitialize settings? This may overwrite existing settings.";
Alert alert = new Alert(Alert.AlertType.ERROR, message, ButtonType.NO, ButtonType.YES);
alert.setTitle("Settings load error");
alert.setHeaderText(null);
alert.setContentText("Unable to load settings file");
alert.showAndWait();
return;
//Deactivate Defaultbehavior for yes-Button:
Button yesButton = (Button) alert.getDialogPane().lookupButton( ButtonType.YES );
yesButton.setDefaultButton( false );
//Activate Defaultbehavior for no-Button:
Button noButton = (Button) alert.getDialogPane().lookupButton( ButtonType.NO );
noButton.setDefaultButton( true );
Optional<ButtonType> promptResult = alert.showAndWait();
if (!promptResult.isPresent()) {
System.exit(1);
}
if (promptResult.get() == ButtonType.NO) {
System.exit(1);
}
settings = new MainSettings();
} else {
settings = result.getSuccess().get();
}
settings = result.getSuccess().get();
selectedStationName.set(settings.getSelectedStationName());
if (selectedStationName.get() == null || selectedStationName.get() == "") {
@ -209,8 +225,6 @@ public class MainController implements Initializable {
.findFirst()
.orElse(null);
// TODO: if there are no stations, then create a default station and select that
if (selectedStation == null) {
logger.log(Level.SEVERE, "Selected station '" + selectedStationName.get() + "' not found");
selectedStation = settings.getStations().get(0);
@ -315,8 +329,6 @@ public class MainController implements Initializable {
settings.save();
// TODO: Load message from file
// If the message we're overwriting is different from its file, then prompt to confirm
Path nextMessagePath = selectedStation.stationPath().resolve("next-message.txt");
String messageText;

View File

@ -100,6 +100,7 @@ public class MainSettings {
XmlMapper xmlMapper = new XmlMapper();
xmlMapper.registerModule(new JavaTimeModule());
xmlMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
xmlMapper.configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false);
xmlMapper.enable(SerializationFeature.INDENT_OUTPUT);
try {
Path filePath = getSettingsFilePath();

View File

@ -112,6 +112,9 @@ public class StationSelectionController {
@FXML
private void handleRemoveButtonPress(ActionEvent event) {
int selectedIndex = stationListView.getSelectionModel().getSelectedIndex();
if (selectedIndex < 0) {
return;
}
StationSettings station = stationList.get(selectedIndex);
String stationName = station.toString();
@ -135,14 +138,12 @@ public class StationSelectionController {
while (change.next()) {
if (change.wasAdded()) {
for (StationSettings addedStation : change.getAddedSubList()) {
System.out.println("Added: " + addedStation.getName());
}
}
if (change.wasRemoved()) {
for (StationSettings removedStation : change.getRemoved()) {
System.out.println("Removed: " + removedStation.getName());
try {
StationSettings.deleteStationData(removedStation.getName());
removedStation.deleteDir();
} catch (IOException e) {
logger.log(Level.SEVERE, "Exception when removing station directory", e);
@ -167,7 +168,6 @@ public class StationSelectionController {
if (selectedStation != null) {
stage.setUserData(selectedStation.getName());
System.out.println("Selected Station: " + selectedStation.getName());
}
stage.close();
}

View File

@ -10,8 +10,11 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.security.SecureRandom;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.LocalTime;
import java.time.Period;
import java.util.ArrayList;
@ -25,6 +28,7 @@ public class StationSettings {
private String address;
private int digitsPerGroup;
private String externalProgramCommand;
private Duration externalProgramTimeout;
private boolean manageScheduleExternally;
private int messageLength;
private MessageMethod messageMethod;
@ -32,8 +36,7 @@ public class StationSettings {
private String name;
private String password;
private ArrayList<String> prefixes;
private LocalDate scheduleStartDate;
private LocalTime scheduleStartTime;
private ZonedDateTime scheduleStart;
private String username;
public enum MessageMethod {
@ -52,21 +55,21 @@ public class StationSettings {
prefixes = new ArrayList<String>();
digitsPerGroup = 4;
messageLength = 100;
externalProgramTimeout = Duration.ofSeconds(5);
messageMethod = MessageMethod.SFTP;
messagePeriod = MessagePeriod.DAILY;
scheduleStartDate = LocalDate.now();
scheduleStartTime = LocalTime.now();
scheduleStart = ZonedDateTime.now();
}
public StationSettings(String newName) {
name = newName;
prefixes = new ArrayList<String>();
digitsPerGroup = 4;
externalProgramTimeout = Duration.ofSeconds(5);
messageLength = 100;
messageMethod = MessageMethod.SFTP;
messagePeriod = MessagePeriod.DAILY;
scheduleStartDate = LocalDate.now();
scheduleStartTime = LocalTime.now();
scheduleStart = ZonedDateTime.now();
}
public static void deleteStationData(String stationName) throws IOException {
@ -78,8 +81,7 @@ public class StationSettings {
if (osName.contains("win")) {
WindowsScheduler.removeSchedule(temp);
} else if (osName.contains("nix") || osName.contains("nux") || osName.contains("aix")) {
// TODO: linux
logger.log(Level.SEVERE, "Unsupported OS " + osName);
LinuxScheduler.removeSchedule(temp);
} else {
logger.log(Level.SEVERE, "Unsupported OS " + osName);
}
@ -98,8 +100,10 @@ public class StationSettings {
return true;
}
} else if (osName.contains("nix") || osName.contains("nux") || osName.contains("aix")) {
// TODO: linux
logger.log(Level.SEVERE, "Unsupported OS " + osName);
Result<Boolean, String> result = LinuxScheduler.scheduleExists(temp);
if (result.hasSuccess() && result.getSuccess().get()) {
return true;
}
} else {
logger.log(Level.SEVERE, "Unsupported OS " + osName);
}
@ -108,6 +112,10 @@ public class StationSettings {
}
public void deleteDir() throws IOException {
if (!Files.exists(stationPath())) {
return;
}
Files.walkFileTree(stationPath(), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
@ -184,42 +192,43 @@ public class StationSettings {
}
public LocalDateTime nextSendTime() throws StationSettingsException {
Period sinceScheduleStart = Period.between(scheduleStartDate , LocalDate.now());
LocalDate startDate = scheduleStart.withZoneSameInstant(ZoneId.systemDefault()).toLocalDate();
LocalTime startTime = scheduleStart.withZoneSameInstant(ZoneId.systemDefault()).toLocalTime();
Period sinceScheduleStart = Period.between(startDate, LocalDate.now());
// If this period's time has not yet passed, then show that time.
// Otherwise, show the next period's time.
switch (messagePeriod) {
case DAILY:
if (LocalTime.now().isBefore(scheduleStartTime)) {
return LocalDate.now().atTime(scheduleStartTime);
if (LocalTime.now().isBefore(startTime)) {
return LocalDate.now().atTime(startTime);
} else {
return LocalDate.now().plusDays(1).atTime(scheduleStartTime);
return LocalDate.now().plusDays(1).atTime(startTime);
}
case WEEKLY:
int weekdayDifference = scheduleStartDate.getDayOfWeek().getValue() - LocalDate.now().getDayOfWeek().getValue();
System.out.println("weekdayDifference: " + weekdayDifference);
int weekdayDifference = startDate.getDayOfWeek().getValue() - LocalDate.now().getDayOfWeek().getValue();
if (weekdayDifference > 0) {
return LocalDate.now().plusDays(weekdayDifference).atTime(scheduleStartTime);
return LocalDate.now().plusDays(weekdayDifference).atTime(startTime);
} else if (weekdayDifference == 0){
if (LocalTime.now().isBefore(scheduleStartTime)) {
return LocalDate.now().atTime(scheduleStartTime);
if (LocalTime.now().isBefore(startTime)) {
return LocalDate.now().atTime(startTime);
} else {
return LocalDate.now().plusWeeks(1).atTime(scheduleStartTime);
return LocalDate.now().plusWeeks(1).atTime(startTime);
}
} else {
return LocalDate.now().plusDays(7 + weekdayDifference).atTime(scheduleStartTime);
return LocalDate.now().plusDays(7 + weekdayDifference).atTime(startTime);
}
case MONTHLY:
int monthdayDifference = scheduleStartDate.getDayOfMonth() - LocalDate.now().getDayOfMonth();
int monthdayDifference = startDate.getDayOfMonth() - LocalDate.now().getDayOfMonth();
if (monthdayDifference > 0) {
return LocalDate.now().plusDays(monthdayDifference).atTime(scheduleStartTime);
return LocalDate.now().plusDays(monthdayDifference).atTime(startTime);
} else if (monthdayDifference == 0) {
if (LocalTime.now().isBefore(scheduleStartTime)) {
return LocalDate.now().atTime(scheduleStartTime);
if (LocalTime.now().isBefore(startTime)) {
return LocalDate.now().atTime(startTime);
} else {
return LocalDate.now().plusMonths(1).atTime(scheduleStartTime);
return LocalDate.now().plusMonths(1).atTime(startTime);
}
} else {
return LocalDate.now().plusMonths(1).plusDays(monthdayDifference).atTime(scheduleStartTime);
return LocalDate.now().plusMonths(1).plusDays(monthdayDifference).atTime(startTime);
}
default:
throw new StationSettingsException("Invalid period value: " + messagePeriod);
@ -250,6 +259,14 @@ public class StationSettings {
externalProgramCommand = newExternalProgramCommand;
}
public Duration getExternalProgramTimeout() {
return externalProgramTimeout;
}
public void setExternalProgramTimeout(Duration newExternalProgramTimeout) {
externalProgramTimeout = newExternalProgramTimeout;
}
public boolean getManageScheduleExternally() {
return manageScheduleExternally;
}
@ -305,20 +322,12 @@ public class StationSettings {
return prefixes;
}
public LocalDate getScheduleStartDate() {
return scheduleStartDate;
public ZonedDateTime getScheduleStart() {
return scheduleStart;
}
public void setScheduleStartDate(LocalDate newScheduleStartDate) {
scheduleStartDate = newScheduleStartDate;
}
public LocalTime getScheduleStartTime() {
return scheduleStartTime;
}
public void setScheduleStartTime(LocalTime newScheduleStartTime) {
scheduleStartTime = newScheduleStartTime;
public void setScheduleStart(ZonedDateTime newScheduleStart) {
scheduleStart = newScheduleStart;
}
public String getUsername() {

View File

@ -15,6 +15,9 @@ import java.nio.file.Path;
import java.time.format.DateTimeFormatter;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
@ -433,7 +436,6 @@ public class StationSettingsController {
settings.setPassword(password.get());
settings.getPrefixes().clear();
settings.getPrefixes().addAll(prefixListView.getItems());
settings.setScheduleStartDate(scheduleStartDatePicker.getValue());
settings.setUsername(username.get());
try {
@ -447,7 +449,9 @@ public class StationSettingsController {
try {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
LocalTime startTime = LocalTime.parse(scheduleStartTimeField.getText(), formatter);
settings.setScheduleStartTime(startTime);
ZonedDateTime scheduleStart = ZonedDateTime.of(scheduleStartDatePicker.getValue(), startTime, ZoneId.systemDefault());
settings.setScheduleStart(scheduleStart.withZoneSameInstant(ZoneOffset.UTC));
} catch (Exception ex) {
logger.log(Level.SEVERE, "Error parsing schedule start time", ex);
}
@ -458,8 +462,14 @@ public class StationSettingsController {
} else if (osName.contains("nix") || osName.contains("nux") || osName.contains("aix")) {
LinuxScheduler.registerSchedule(settings);
} else {
logger.log(Level.SEVERE, "Unsupported OS " + osName);
// TODO: Alert
String message = "Unsupported OS " + osName;
logger.log(Level.SEVERE, message);
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle(message);
alert.setHeaderText(null);
alert.setContentText(message);
alert.showAndWait();
}
Node node = (Node) e.getSource();
@ -523,16 +533,6 @@ public class StationSettingsController {
}
}
@FXML
private void handleTestRegisterScheduleButtonPress() {
WindowsScheduler.registerSchedule(settings);
}
@FXML
private void handleTestRunScheduleButtonPress() {
WindowsScheduler.runSchedule(settings);
}
public StringProperty stationAddressProperty() {
return stationAddress;
}
@ -555,11 +555,10 @@ public class StationSettingsController {
messagePeriod.set(settings.getMessagePeriod());
username.set(settings.getUsername());
password.set(settings.getPassword());
System.out.println(settings.getPrefixes());
prefixListView.getItems().addAll(settings.getPrefixes());
scheduleStartDate.set(settings.getScheduleStartDate());
scheduleStartDate.set(settings.getScheduleStart().withZoneSameInstant(ZoneId.systemDefault()).toLocalDate());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
LocalTime startTime = settings.getScheduleStartTime();
LocalTime startTime = settings.getScheduleStart().withZoneSameInstant(ZoneId.systemDefault()).toLocalTime();
if (startTime == null) {
startTime = LocalTime.now();
}

View File

@ -16,7 +16,9 @@ import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.time.format.DateTimeFormatter;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import javafx.util.Pair;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@ -44,7 +46,7 @@ public class WindowsScheduler {
rootElement.setAttribute("xmlns", "http://schemas.microsoft.com/windows/2004/02/mit/task");
doc.appendChild(rootElement);
LocalDateTime scheduleDateTime = station.getScheduleStartDate().atTime(station.getScheduleStartTime());
LocalDateTime scheduleDateTime = station.getScheduleStart().withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime();
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
// RegistrationInfo element
@ -107,7 +109,8 @@ public class WindowsScheduler {
Element daysOfMonth = doc.createElement("DaysOfMonth");
scheduleByMonth.appendChild(daysOfMonth);
Element day = doc.createElement("Day");
day.appendChild(doc.createTextNode(String.valueOf(station.getScheduleStartDate().getDayOfMonth())));
LocalDate startDate = station.getScheduleStart().withZoneSameInstant(ZoneId.systemDefault()).toLocalDate();
day.appendChild(doc.createTextNode(String.valueOf(startDate.getDayOfMonth())));
daysOfMonth.appendChild(day);
Element months = doc.createElement("Months");
@ -225,7 +228,6 @@ public class WindowsScheduler {
logger.info("Executable Path: " + executablePath);
Element command = doc.createElement("Command");
// TODO: need to figure out the real invocation
command.appendChild(doc.createTextNode(executablePath.toString()));
exec.appendChild(command);
@ -435,7 +437,7 @@ public class WindowsScheduler {
/**
* @return (stdout contents, stderr contents)
* TODO: don't assume that process has exited yet. If it does we don't want to hang.
* Note that caller should check that process has exited
*/
public static Pair<String, String> captureProcessOutput(Process process) throws IOException {
StringBuilder output = new StringBuilder();

View File

@ -12,15 +12,15 @@
<Font size="18.0" />
</font>
</Label>
<Label layoutX="20.0" layoutY="110.0" text="Application executable: " AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="110.0" />
<Label layoutX="20.0" layoutY="50.0" text="Homepage:" AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="50.0" />
<Label layoutX="20.0" layoutY="140.0" text="Config directory: " AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="140.0" />
<TextField fx:id="homepageURLTextField" accessibleText="Homepage URL field" editable="false" layoutX="89.0" layoutY="46.0" prefHeight="25.0" prefWidth="501.0" text="asefa" AnchorPane.leftAnchor="89.0" AnchorPane.rightAnchor="10.0" />
<Label layoutX="20.0" layoutY="80.0" text="Version:" AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="80.0" />
<TextField fx:id="versionTextField" editable="false" layoutX="72.0" layoutY="76.0" text="asefa" />
<TextField fx:id="executableTextField" editable="false" layoutX="153.0" layoutY="106.0" prefHeight="25.0" prefWidth="403.0" text="sflejk" AnchorPane.leftAnchor="153.0" AnchorPane.rightAnchor="10.0" />
<TextField fx:id="directoryTextField" editable="false" layoutX="118.0" layoutY="136.0" prefHeight="25.0" prefWidth="437.0" text="afseijl" AnchorPane.leftAnchor="118.0" AnchorPane.rightAnchor="10.0" />
<TextField fx:id="versionTextField" accessibleText="Application version field" editable="false" layoutX="72.0" layoutY="76.0" text="asefa" AnchorPane.leftAnchor="89.0" AnchorPane.rightAnchor="10.0" />
<Label layoutX="20.0" layoutY="110.0" text="Application executable: " AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="110.0" />
<TextField fx:id="executableTextField" accessibleText="Application executable path field" editable="false" layoutX="153.0" layoutY="106.0" prefHeight="25.0" prefWidth="403.0" text="sflejk" AnchorPane.leftAnchor="153.0" AnchorPane.rightAnchor="10.0" />
<Label layoutX="20.0" layoutY="140.0" text="Config directory: " AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="140.0" />
<TextField fx:id="directoryTextField" accessibleText="Configuration directory path field" editable="false" layoutX="118.0" layoutY="136.0" prefHeight="25.0" prefWidth="437.0" text="afseijl" AnchorPane.leftAnchor="118.0" AnchorPane.rightAnchor="10.0" />
<Label layoutX="20.0" layoutY="168.0" text="Log file: " AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="170.0" />
<TextField fx:id="logPathTextField" editable="false" layoutX="70.0" layoutY="166.0" prefHeight="25.0" prefWidth="485.0" text="afseijl" AnchorPane.leftAnchor="70.0" AnchorPane.rightAnchor="10.0" />
<TextField fx:id="homepageURLTextField" editable="false" layoutX="89.0" layoutY="46.0" prefHeight="25.0" prefWidth="501.0" text="asefa" AnchorPane.leftAnchor="89.0" AnchorPane.rightAnchor="10.0" />
<TextField fx:id="logPathTextField" accessibleText="Log file path field" editable="false" layoutX="70.0" layoutY="166.0" prefHeight="25.0" prefWidth="485.0" text="afseijl" AnchorPane.leftAnchor="70.0" AnchorPane.rightAnchor="10.0" />
</children>
</AnchorPane>

View File

@ -11,13 +11,13 @@
<children>
<AnchorPane prefHeight="200.0" prefWidth="312.0">
<children>
<Button fx:id="okButton" layoutX="89.0" layoutY="67.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="65.0" text="OK" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="89.0" />
<Button fx:id="cancelButton" layoutX="169.0" layoutY="67.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="65.0" text="Cancel" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="9.0" />
<Label layoutX="14.0" layoutY="14.0" text="Enter a message prefix / identifier:">
<font>
<Font name="Liberation Sans" size="13.0" />
</font></Label>
<TextField fx:id="prefixField" layoutX="216.0" layoutY="10.0" prefHeight="25.0" prefWidth="86.0" AnchorPane.leftAnchor="216.0" AnchorPane.rightAnchor="10.0" />
<TextField fx:id="prefixField" accessibleText="Prefix field" layoutX="216.0" layoutY="10.0" prefHeight="25.0" prefWidth="86.0" AnchorPane.leftAnchor="216.0" AnchorPane.rightAnchor="10.0" />
<Button fx:id="okButton" layoutX="89.0" layoutY="67.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="65.0" text="OK" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="89.0" />
<Button fx:id="cancelButton" layoutX="169.0" layoutY="67.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="65.0" text="Cancel" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="9.0" />
</children>
</AnchorPane>
</children>

View File

@ -3,4 +3,4 @@
<?import javafx.scene.web.WebView?>
<WebView fx:id="webView" prefHeight="391.0" prefWidth="440.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.numbersstation.HelpController" />
<WebView fx:id="webView" prefHeight="597.0" prefWidth="652.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.numbersstation.HelpController" />

View File

@ -65,7 +65,7 @@
<children>
<Button layoutX="228.0" layoutY="1.0" mnemonicParsing="false" onAction="#handleSelectStationButtonPress" text="Select Station" />
<Label alignment="CENTER_RIGHT" layoutY="5.0" prefHeight="17.0" prefWidth="60.0" text="Station: " textAlignment="RIGHT" />
<TextField fx:id="stationNameField" editable="false" layoutX="68.0" prefHeight="25.0" prefWidth="153.0" style="-fx-background-color: #EEEEEE; -fx-border-color: #AAAAAA;" text="My Station" />
<TextField id="teststationnamefield" fx:id="stationNameField" accessibleText="Station name field" editable="false" layoutX="68.0" prefHeight="25.0" prefWidth="153.0" style="-fx-background-color: #EEEEEE; -fx-border-color: #AAAAAA;" text="My Station" />
<Button layoutX="602.0" layoutY="1.0" mnemonicParsing="false" onAction="#handleHelpButtonPress" text="Help" AnchorPane.rightAnchor="0.0" />
<Button layoutX="516.0" layoutY="1.0" mnemonicParsing="false" onAction="#handleAboutButtonPress" text="About" AnchorPane.rightAnchor="52.0" />
</children>
@ -90,7 +90,7 @@
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<TextArea fx:id="messageTextArea" prefHeight="270.0" text="0239 0480 2938 0928&#10;3093 2298 3923 8933" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<TextArea fx:id="messageTextArea" accessibleText="Next message editor" prefHeight="270.0" text="0239 0480 2938 0928&#10;3093 2298 3923 8933" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<font>
<Font name="Liberation Mono" size="30.0" />
</font>

View File

@ -40,18 +40,18 @@
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="250.0" prefWidth="395.0" stylesheets="@css/application.css" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="name.nathanmcrae.numbersstation.NotificationController">
<children>
<Label fx:id="titleLabel" layoutX="86.0" layoutY="24.0" text="Notification title (this sure is a title)">
<font>
<Font name="Liberation Sans Bold" size="16.0" />
</font>
</Label>
<Button fx:id="dismissButton" layoutX="325.0" layoutY="139.0" mnemonicParsing="false" onAction="#handleDismissButtonPressed" text="Dismiss" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="14.0" />
<Button fx:id="openButton" layoutX="270.0" layoutY="139.0" mnemonicParsing="false" onAction="#handleOpenButtonPressed" text="Open" visible="false" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="79.5" />
<Label fx:id="iconLabel" alignment="CENTER" contentDisplay="CENTER" layoutX="14.0" layoutY="5.0" prefHeight="60.0" prefWidth="65.0" text="⚠" textAlignment="CENTER" textFill="RED">
<font>
<Font size="42.0" />
</font>
</Label>
<TextArea fx:id="descriptionTextArea" editable="false" layoutX="14.0" layoutY="67.0" prefHeight="62.0" prefWidth="367.0" style="-fx-background-color: EEEEEE;" text="Quidem repellendus perferendis quos ipsum. Nihil nobis esse aperiam. Modi optio quia repudiandae quaerat fugit accusamus. Qui sint qui cupiditate rerum quisquam aspernatur illum. Deleniti voluptatum nam alias fugiat.Ab in iste dolores. Ad nostrum quia quisquam deleniti dolorum sequi. Est ut id et enim.Repellat nemo velit modi sunt provident neque neque. Est consequatur est beatae voluptates tempore commodi voluptas. Dicta asperiores deserunt veritatis quia officia. Reiciendis et qui placeat est minus." wrapText="true" AnchorPane.bottomAnchor="49.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="67.0" />
<Label fx:id="titleLabel" layoutX="86.0" layoutY="24.0" text="Notification title (this sure is a title)">
<font>
<Font name="Liberation Sans Bold" size="16.0" />
</font>
</Label>
<TextArea fx:id="descriptionTextArea" accessibleText="Notification text field" editable="false" layoutX="14.0" layoutY="67.0" prefHeight="62.0" prefWidth="367.0" style="-fx-background-color: EEEEEE;" text="Quidem repellendus perferendis quos ipsum. Nihil nobis esse aperiam. Modi optio quia repudiandae quaerat fugit accusamus. Qui sint qui cupiditate rerum quisquam aspernatur illum. Deleniti voluptatum nam alias fugiat.Ab in iste dolores. Ad nostrum quia quisquam deleniti dolorum sequi. Est ut id et enim.Repellat nemo velit modi sunt provident neque neque. Est consequatur est beatae voluptates tempore commodi voluptas. Dicta asperiores deserunt veritatis quia officia. Reiciendis et qui placeat est minus." wrapText="true" AnchorPane.bottomAnchor="49.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="67.0" />
<Button fx:id="openButton" layoutX="270.0" layoutY="139.0" mnemonicParsing="false" onAction="#handleOpenButtonPressed" text="Open" visible="false" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="79.5" />
<Button fx:id="dismissButton" layoutX="325.0" layoutY="139.0" mnemonicParsing="false" onAction="#handleDismissButtonPressed" text="Dismiss" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="14.0" />
</children>
</AnchorPane>

View File

@ -13,9 +13,9 @@
<Font size="20.0" />
</font>
</Label>
<Button layoutX="358.0" layoutY="17.0" mnemonicParsing="false" onAction="#handleAddButtonPress" prefHeight="25.0" prefWidth="26.0" text="+" AnchorPane.rightAnchor="55.0" AnchorPane.topAnchor="17.0" />
<Button layoutX="391.0" layoutY="17.0" mnemonicParsing="false" onAction="#handleRemoveButtonPress" prefHeight="25.0" prefWidth="25.0" text="-" AnchorPane.rightAnchor="21.0" AnchorPane.topAnchor="17.0" />
<ListView fx:id="stationListView" layoutX="14.0" layoutY="57.0" prefHeight="301.0" prefWidth="409.0" AnchorPane.bottomAnchor="42.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="57.0" />
<Button accessibleText="Add new station button" layoutX="358.0" layoutY="17.0" mnemonicParsing="false" onAction="#handleAddButtonPress" prefHeight="25.0" prefWidth="26.0" text="+" AnchorPane.rightAnchor="55.0" AnchorPane.topAnchor="17.0" />
<Button accessibleText="Remove selected station button" layoutX="391.0" layoutY="17.0" mnemonicParsing="false" onAction="#handleRemoveButtonPress" prefHeight="25.0" prefWidth="25.0" text="-" AnchorPane.rightAnchor="21.0" AnchorPane.topAnchor="17.0" />
<ListView fx:id="stationListView" accessibleText="Station selection list" layoutX="14.0" layoutY="57.0" prefHeight="301.0" prefWidth="409.0" AnchorPane.bottomAnchor="42.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="57.0" />
<Button layoutX="293.0" layoutY="366.0" mnemonicParsing="false" onAction="#handleSelectButtonPress" text="Select" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="85.0" />
<Button layoutX="370.0" layoutY="365.0" mnemonicParsing="false" onAction="#handleCancelButtonPress" text="Cancel" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="15.5" />
</children>

View File

@ -27,7 +27,7 @@
<FlowPane alignment="CENTER_LEFT" prefHeight="41.0" prefWidth="640.0">
<children>
<Label alignment="CENTER_RIGHT" prefHeight="17.0" prefWidth="58.0" text="Station: " />
<TextField fx:id="stationNameField" style="-fx-border-color: #AAAAAA;" text="My Station">
<TextField fx:id="stationNameField" accessibleText="Station name field" style="-fx-border-color: #AAAAAA;" text="My Station">
<FlowPane.margin>
<Insets right="10.0" />
</FlowPane.margin>
@ -47,7 +47,7 @@
<Insets right="10.0" />
</FlowPane.margin>
</Label>
<Spinner fx:id="digitsPerGroupSpinner" editable="true" prefHeight="25.0" prefWidth="96.0" />
<Spinner fx:id="digitsPerGroupSpinner" accessibleText="Digit group size field" editable="true" prefHeight="25.0" prefWidth="96.0" />
</children>
</FlowPane>
<FlowPane alignment="CENTER_LEFT" layoutX="244.0" layoutY="7.0" prefHeight="63.0" prefWidth="216.0">
@ -57,7 +57,7 @@
<Insets right="10.0" />
</FlowPane.margin>
</Label>
<Spinner fx:id="messageLengthSpinner" editable="true" prefHeight="25.0" prefWidth="96.0" />
<Spinner fx:id="messageLengthSpinner" accessibleText="Message length field" editable="true" prefHeight="25.0" prefWidth="96.0" />
</children>
</FlowPane>
</children>
@ -70,8 +70,8 @@
<Font size="14.0" />
</font>
</Label>
<Label layoutX="170.0" layoutY="39.0" text="Numbers station address:" />
<TextField fx:id="stationAddressField" layoutX="188.0" layoutY="63.0" prefHeight="25.0" prefWidth="390.0" AnchorPane.leftAnchor="188.0" AnchorPane.rightAnchor="0.0" />
<Label fx:id="connectionTestStatusLabel" accessibleText="Test connection result" alignment="CENTER_RIGHT" layoutX="136.0" layoutY="11.0" prefHeight="17.0" prefWidth="317.0" textAlignment="RIGHT" AnchorPane.leftAnchor="136.0" AnchorPane.rightAnchor="125.0" />
<Button fx:id="testConnectionButton" layoutX="464.0" layoutY="7.0" mnemonicParsing="false" onAction="#handleTestConnectionButtonPress" text="Test connection" AnchorPane.rightAnchor="0.0" />
<RadioButton fx:id="sftpRadioButton" layoutX="16.0" layoutY="42.0" mnemonicParsing="false" text="SFTP">
<toggleGroup>
<ToggleGroup fx:id="messageMethodGroup" />
@ -87,13 +87,13 @@
<fx:reference source="messageMethodGroup" />
</toggleGroup>
</RadioButton>
<Label layoutX="170.0" layoutY="39.0" text="Numbers station address:" />
<TextField fx:id="stationAddressField" accessibleText="Number station address field" layoutX="189.0" layoutY="63.0" prefHeight="25.0" prefWidth="390.0" AnchorPane.leftAnchor="189.0" AnchorPane.rightAnchor="-1.0" />
<Label layoutX="182.0" layoutY="99.0" text="Username:" AnchorPane.rightAnchor="340.0" />
<TextField fx:id="usernameField" accessibleText="Numbers station username field" layoutX="245.0" layoutY="95.0" prefHeight="25.0" prefWidth="124.0" AnchorPane.rightAnchor="209.0" />
<Label layoutX="380.0" layoutY="99.0" text="Password:" AnchorPane.rightAnchor="142.0" />
<TextField fx:id="usernameField" layoutX="245.0" layoutY="95.0" prefHeight="25.0" prefWidth="124.0" AnchorPane.rightAnchor="209.0" />
<PasswordField fx:id="passwordField" layoutX="444.0" layoutY="95.0" prefHeight="25.0" prefWidth="135.0" AnchorPane.rightAnchor="0.0" />
<TextField fx:id="externalProgramCommandField" layoutX="-2.0" layoutY="131.0" prefHeight="25.0" prefWidth="580.0" AnchorPane.leftAnchor="-2.0" AnchorPane.rightAnchor="0.0" />
<Button fx:id="testConnectionButton" layoutX="464.0" layoutY="7.0" mnemonicParsing="false" onAction="#handleTestConnectionButtonPress" text="Test connection" AnchorPane.rightAnchor="0.0" />
<Label fx:id="connectionTestStatusLabel" alignment="CENTER_RIGHT" layoutX="136.0" layoutY="11.0" prefHeight="17.0" prefWidth="317.0" textAlignment="RIGHT" AnchorPane.leftAnchor="136.0" AnchorPane.rightAnchor="125.0" />
<PasswordField fx:id="passwordField" accessibleText="Numbers station password field" layoutX="444.0" layoutY="95.0" prefHeight="25.0" prefWidth="135.0" AnchorPane.rightAnchor="0.0" />
<TextField fx:id="externalProgramCommandField" accessibleText="Numbers station external program field" layoutX="-2.0" layoutY="131.0" prefHeight="25.0" prefWidth="580.0" AnchorPane.leftAnchor="-2.0" AnchorPane.rightAnchor="0.0" />
</children>
<VBox.margin>
@ -108,14 +108,14 @@
<Font size="14.0" />
</font>
</Label>
<Button layoutX="520.5" layoutY="4.0" mnemonicParsing="false" onAction="#handleAddPrefixButtonPress" text="+" AnchorPane.rightAnchor="33.0" />
<Button layoutX="552.0" layoutY="4.0" mnemonicParsing="false" onAction="#handleRemovePrefixButtonPress" prefHeight="25.0" prefWidth="25.0" text="-" AnchorPane.rightAnchor="1.0" />
<Button accessibleText="Add prefix field" layoutX="520.5" layoutY="4.0" mnemonicParsing="false" onAction="#handleAddPrefixButtonPress" text="+" AnchorPane.rightAnchor="33.0" />
<Button accessibleText="Remove selected prefix button" layoutX="552.0" layoutY="4.0" mnemonicParsing="false" onAction="#handleRemovePrefixButtonPress" prefHeight="25.0" prefWidth="25.0" text="-" AnchorPane.rightAnchor="1.0" />
</children>
<VBox.margin>
<Insets bottom="10.0" />
</VBox.margin>
</AnchorPane>
<ListView fx:id="prefixListView" prefHeight="103.0" prefWidth="578.0" />
<ListView fx:id="prefixListView" accessibleText="Prefix list" prefHeight="103.0" prefWidth="578.0" />
<Separator prefWidth="200.0">
<VBox.margin>
<Insets bottom="10.0" top="10.0" />
@ -144,12 +144,9 @@
<fx:reference source="messagePeriodGroup" />
</toggleGroup>
</RadioButton>
<DatePicker fx:id="scheduleStartDatePicker" disable="${manageScheduleExternallyCheckBox.selected}" layoutX="115.0" layoutY="34.0" />
<Label layoutX="115.0" layoutY="8.0" text="Starting from:" />
<TextField fx:id="scheduleStartTimeField" disable="${manageScheduleExternallyCheckBox.selected}" layoutX="115.0" layoutY="64.0" text="23:24:49" />
<Label layoutX="48.0" layoutY="102.0" text="TODO: Jitter" />
<Button layoutX="377.0" layoutY="73.0" mnemonicParsing="false" onAction="#handleTestRegisterScheduleButtonPress" text="Test register scheduled task" />
<Button layoutX="377.0" layoutY="107.0" mnemonicParsing="false" onAction="#handleTestRunScheduleButtonPress" text="Test running scheduled task" />
<DatePicker fx:id="scheduleStartDatePicker" accessibleText="Message schedule start date" disable="${manageScheduleExternallyCheckBox.selected}" layoutX="115.0" layoutY="34.0" />
<TextField fx:id="scheduleStartTimeField" accessibleText="Message schedule start time" disable="${manageScheduleExternallyCheckBox.selected}" layoutX="115.0" layoutY="64.0" text="23:24:49" />
</children>
</AnchorPane>

View File

@ -108,7 +108,6 @@
<li>
Set other options (See application reference for details)
</li>
<li>TODO: test post</li>
</ol>
<h3>