Skip to content

Commit

Permalink
Ms autoupdate (#84)
Browse files Browse the repository at this point in the history
* added windows specific options to the pom

* MS: Created a WIP launcher using update4j

* MS: Made a launcher service in janus

* MS: providing the service to update4j

* MS: Added a way for the launcher to start the wallet

* MS: Added update4j as dependency

* MS: Started work on update check in the wallet

* MS: fixed conflicts

* MS: Continued work on the look and feel of the bootstrap

* MS: Added classloder to handel start from the launcher

* MS: extraxtion of daemon added

* MS: Added update button to the windowbar, continued work on update handling

* MS: got everything to be in the same CDI container

* MS: reverted some changes that broke the app

* MS: small changes to the bootstrap

* MS: change the path of the zip file

* MS: Changed witch config to read based on os

* MS: Change the pom to creat installer for the bootstrap

* MS: added moduls to module-info and jlink to fix handshake error when running

* MS: change to user.home insted of user.dir

* MS: Added copying of unigridd to AppData/Raoming/unigrid/bin for windows.

* ignore fx/templates/

* fix moving of daemon files after untar on linux and osx

* MS: fixing update button in the wallet

* MS: changed path for the config file

* update search location for local daemon (#82)

merged daemon search location with updated jar search locations

* MS: Changed path for compressed daemon

* fix download location of daemons (#83)

* ignore config xmls

* ignore config xmls correct folder

* remove configs from repo

* update config location to new repo

* set correct locations for all OS's when generating the configs

* setting locations for configs to new repo

* update the unzip method for windows to copy all execs to bin

* update mac directories and mac config location

* update unigrid directory names to match the daemon as uppercase

Co-authored-by: Fim-84 <[email protected]>
Co-authored-by: marcus <[email protected]>
  • Loading branch information
3 people authored Jul 7, 2022
1 parent bb4bcfe commit fdc6793
Show file tree
Hide file tree
Showing 42 changed files with 2,848 additions and 664 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/target/
/fx/target/
fx/templates/
/fx/runtime/
/desktop/target/

Expand All @@ -16,3 +17,8 @@ fx/unigrid-cli.exe
fx/unigridd.exe
fx/unigridd
fx/unigrid-cli
/UpdateBootstrap/target/
/updateBootstrapConfig/target/
/config/UpdateWalletConfig/target/
/config/UpdateWalletConfig/config*

40 changes: 40 additions & 0 deletions UpdateBootstrap/nbactions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>clean</goal>
<goal>javafx:run</goal>
</goals>
</action>
<action>
<actionName>debug</actionName>
<goals>
<goal>clean</goal>
<goal>javafx:run@ide-debug</goal>
</goals>
<properties>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<goals>
<goal>clean</goal>
<goal>javafx:run@ide-profile</goal>
</goals>
</action>
<action>
<actionName>CUSTOM-jlink</actionName>
<displayName>jlink</displayName>
<goals>
<goal>clean</goal>
<!-- compile not needed with javafx-maven-plugin v0.0.5 -->
<goal>compile</goal>
<goal>javafx:jlink</goal>
</goals>
</action>
</actions>
75 changes: 75 additions & 0 deletions UpdateBootstrap/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent</artifactId>
<groupId>org.unigrid.janus</groupId>
<version>1.0.6-SNAPSHOT</version>
</parent>
<groupId>org.unigrid</groupId>
<artifactId>UpdateBootstrap</artifactId>
<version>1.0.6-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<mainClass>org.unigrid.updatebootstrap.App</mainClass>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17-ea+7</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>17-ea+7</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17-ea+7</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>17-ea+7</version>
</dependency>
<dependency>
<groupId>org.update4j</groupId>
<artifactId>update4j</artifactId>
<version>1.5.9</version>
</dependency>
<!--<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.3.0-alpha14</version>
</dependency>-->


</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>org.unigrid.updatebootstrap.App</mainClass>
<commandlineArgs>--ADD-OPENS=org.update4j</commandlineArgs>
</configuration>
<executions>
<execution>
<!-- Default configuration for running -->
<!-- Usage: mvn clean javafx:run -->
<id>default-cli</id>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
21 changes: 21 additions & 0 deletions UpdateBootstrap/src/main/java/org/unigrid/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module org.unigrid.updatebootstrap {
requires javafx.controls;
requires javafx.fxml;
requires java.base;
requires org.update4j;
requires java.instrument;
requires java.sql;
requires jdk.security.auth;
requires transitive java.xml;
requires jdk.zipfs;
requires java.compiler;
requires jdk.crypto.ec;
//requires org.slf4j;
//requires ch.qos.logback.classic;

opens org.unigrid.updatebootstrap to javafx.fxml, org.update4j;
opens org.unigrid.updatebootstrap.controllers to javafx.fxml;

exports org.unigrid.updatebootstrap to org.update4j, javafx.graphics;
exports org.unigrid.updatebootstrap.controllers;
}
109 changes: 109 additions & 0 deletions UpdateBootstrap/src/main/java/org/unigrid/updatebootstrap/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
The Janus Wallet
Copyright © 2021 The Unigrid Foundation
This program is free software: you can redistribute it and/or modify it under the terms of the
addended GNU Affero General Public License as published by the Free Software Foundation, version 3
of the License (see COPYING and COPYING.addendum).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received an addended copy of the GNU Affero General Public License with this program.
If not, see <http://www.gnu.org/licenses/> and <https://github.com/unigrid-project/janus-java>.
*/
package org.unigrid.updatebootstrap;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import org.update4j.Configuration;
import org.update4j.service.Delegate;
import org.update4j.OS;
import javafx.stage.StageStyle;
//import ch.qos.logback.classic.Level;
//import ch.qos.logback.classic.Logger;
//import org.slf4j.LoggerFactory;

public class App extends Application implements Delegate {

private static Scene scene;
private static FXMLLoader loader;

@Override
public void start(Stage stage) throws IOException {

//final Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
//root.setLevel(Level.ALL);

stage.setMinWidth(600);
stage.setMinHeight(300);

URL configUrl = null;
OS os = OS.CURRENT;
if (os.equals(OS.LINUX)) {
configUrl = new URL("https://raw.githubusercontent.com/unigrid-project/unigrid-update/main/config-linux.xml");

} else if (os.equals(OS.WINDOWS)) {
configUrl = new URL("https://raw.githubusercontent.com/unigrid-project/unigrid-update/main/config-windows.xml");
} else if (os.equals(OS.MAC)) {
configUrl = new URL("https://raw.githubusercontent.com/unigrid-project/unigrid-update/main/config-windows.xml");
}
//configUrl = new URL("https://raw.githubusercontent.com/Fim-84/test/main/config.xml");
Configuration config = null;

try ( Reader in = new InputStreamReader(configUrl.openStream(), StandardCharsets.UTF_8)) {
System.out.println("are we getting here??????");
config = Configuration.read(in);
} catch (IOException e) {
System.out.println(e.getMessage());
try ( Reader in = Files.newBufferedReader(Paths.get(System.getProperty("user.home"),"/work/janus-java/config/UpdateWalletConfig/config.xml"))) {
//try ( Reader in = Files.newBufferedReader(Paths.get("/home/marcus/Documents/unigrid/config/UpdateWalletConfig/config.xml"))) {
System.out.println("reading local config xml");
config = Configuration.read(in);
}
}

config.sync();
scene = new Scene(loadFXML("updateView"));
stage.initStyle(StageStyle.UNDECORATED);
stage.centerOnScreen();
stage.setResizable(false);
stage.setScene(scene);
stage.show();
UpdateView.getInstance().setConfig(config, stage);

}

static void setRoot(String fxml) throws IOException {
scene.setRoot(loadFXML(fxml));
}

private static Parent loadFXML(String fxml) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
loader = fxmlLoader;
return fxmlLoader.load();
}

public static void main(String[] args) {
launch();
}

@Override
public void main(List<String> list) throws Throwable {
launch();
}

}
Loading

0 comments on commit fdc6793

Please sign in to comment.