Skip to content

Commit

Permalink
Resolve NeoForge equivalent of 'pcal43#260 ed25519 keys are not suppo…
Browse files Browse the repository at this point in the history
…rt in fasback-forge'

At-least I believe it does. Uploading was failing with a jgit error aboud failing to negotiate the algorithm.
Uploading to gitea and github now work after this change, which indicates to me that this issue is resolved.

However, org.apache.sshd goes missing in development environments, and the SshHacks fix does not work anymore because of the library change.
I've made an issue in architectury-loom for this: architectury/architectury-loom#248

In addition, the error thrown due to org.apache.sshd going missing is now being logged, but will not prevent fastback from loading.
Allowing the development environment to still be used without support for ssh.
  • Loading branch information
stewi1014 committed Nov 20, 2024
1 parent 71d0fbc commit 851213a
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public void warn(String message) {
this.log4j.warn(message);
}

@Override
public void warn(String message, Throwable t) {
this.log4j.warn(message, t);
}

@Override
public void info(String message) {
this.log4j.info(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ default void error(Throwable e) {

void warn(String message);

void warn(String message, Throwable t);

void info(String message);

void debug(String message);
Expand Down
13 changes: 9 additions & 4 deletions common/src/main/java/net/pcal/fastback/mod/ModImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.nio.file.Path;
import java.util.Collection;
import java.util.Map;
import java.util.ServiceConfigurationError;

import static java.nio.file.Files.createTempDirectory;
import static java.util.Objects.requireNonNull;
Expand Down Expand Up @@ -162,10 +163,14 @@ public void onInitialize() {
syslog().info("git-lfs is installed: " + gitLfsVersion);
}
}
if (SshSessionFactory.getInstance() == null) {
syslog().warn("An ssh provider was not initialized for jgit. Operations on a remote repo over ssh will fail.");
} else {
syslog().info("SshSessionFactory: " + SshSessionFactory.getInstance().toString());
try {
if (SshSessionFactory.getInstance() == null) {
syslog().warn("An ssh provider was not initialized for jgit. Operations on a remote repo over ssh will fail.");
} else {
syslog().info("SshSessionFactory: " + SshSessionFactory.getInstance().toString());
}
} catch (Exception | ServiceConfigurationError e) {
syslog().warn("An ssh provider was not initialized for jgit. Operations on a remote repo over ssh will fail.", e);
}
syslog().debug("onInitialize complete");
}
Expand Down
23 changes: 17 additions & 6 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,25 @@ dependencies {
forgeRuntimeLibrary implementation("org.eclipse.jgit:org.eclipse.jgit:${project.jgit_version}") { transitive = false }
shadowCommon("org.eclipse.jgit:org.eclipse.jgit:${project.jgit_version}") { transitive = false }

forgeRuntimeLibrary runtimeOnly("org.eclipse.jgit:org.eclipse.jgit.ssh.jsch:${project.jgit_version}") { transitive = false; }
shadowCommon("org.eclipse.jgit:org.eclipse.jgit.ssh.jsch:${project.jgit_version}") { transitive = false }

forgeRuntimeLibrary runtimeOnly('com.jcraft:jsch:0.1.55')
shadowCommon('com.jcraft:jsch:0.1.55')

forgeRuntimeLibrary runtimeOnly("com.googlecode.javaewah:JavaEWAH:${project.JavaEWAH_version}") { transitive = false }
shadowCommon("com.googlecode.javaewah:JavaEWAH:${project.JavaEWAH_version}") { transitive = false }

// https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit.ssh.apache
forgeRuntimeLibrary runtimeOnly("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:${project.jgit_version}") { transitive = false }
shadowCommon("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:${project.jgit_version}") { transitive = false }

// https://mvnrepository.com/artifact/org.apache.sshd/sshd-core
forgeRuntimeLibrary runtimeOnly("org.apache.sshd:sshd-core:${project.apache_sshd_version}") { transitive = false }
shadowCommon("org.apache.sshd:sshd-core:${project.apache_sshd_version}") { transitive = false }

// https://mvnrepository.com/artifact/org.apache.sshd/sshd-common
forgeRuntimeLibrary runtimeOnly("org.apache.sshd:sshd-common:${project.apache_sshd_version}") { transitive = false }
shadowCommon("org.apache.sshd:sshd-common:${project.apache_sshd_version}") { transitive = false }

// this enables ed25519 support in apache_sshd
// https://github.com/apache/mina-sshd/blob/dfa109b7b535d64e8ee395ddd0419e7696fb24ee/docs/dependencies.md
forgeRuntimeLibrary runtimeOnly("net.i2p.crypto:eddsa:${project.eddsa_version}") { transitive = false }
shadowCommon("net.i2p.crypto:eddsa:${project.eddsa_version}") { transitive = false }
}

processResources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ void onInitialize() {
this.lifecycleListener = MinecraftProvider.register(this);
syslog().debug("registered backup command");
this.lifecycleListener.onInitialize();
SshHacks.ensureSshSessionFactoryIsAvailable();
syslog().info("Fastback initialized");
syslog().warn("------------------------------------------------------------------------------------");
syslog().warn("Thanks for trying the new Forge version of Fastback. For help, go to:");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public void warn(String message) {
this.slf4j.warn(message);
}

@Override
public void warn(String message, Throwable t) {
this.slf4j.warn(message, t);
}

@Override
public void info(String message) {
this.slf4j.info(message);
Expand Down
113 changes: 0 additions & 113 deletions neoforge/src/main/java/net/pcal/fastback/mod/neoforge/SshHacks.java

This file was deleted.

0 comments on commit 851213a

Please sign in to comment.