Skip to content

Commit

Permalink
refactor: Allow configuration of hastebin server in serverpackcreator…
Browse files Browse the repository at this point in the history
….properties.
  • Loading branch information
Griefed committed Aug 14, 2021
1 parent 16f52f7 commit 0235378
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 11 additions & 1 deletion backend/main/java/de/griefed/serverpackcreator/gui/AboutTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.Properties;

/**
* This class creates the tab which displays the About-tab, with the about text, the list of contributors, buttons for
Expand All @@ -45,6 +46,7 @@ public class AboutTab extends Component {
private static final Logger LOG = LogManager.getLogger(AboutTab.class);

private final LocalizationManager LOCALIZATIONMANAGER;
private Properties serverpackcreatorproperties;

/**
* <strong>Constructor</strong><p>
Expand All @@ -60,6 +62,14 @@ public AboutTab(LocalizationManager injectedLocalizationManager) {
} else {
this.LOCALIZATIONMANAGER = injectedLocalizationManager;
}

try (InputStream inputStream = new FileInputStream("serverpackcreator.properties")) {
this.serverpackcreatorproperties = new Properties();
this.serverpackcreatorproperties.load(inputStream);
} catch (IOException ex) {
LOG.error("Couldn't read properties file.", ex);
}

}

private final Dimension DIMENSION_MISC_BUTTON = new Dimension(50,50);
Expand Down Expand Up @@ -274,7 +284,7 @@ JComponent aboutTab() {
*/
private String createHasteBinFromFile(File textFile) {
String text = null;
String requestURL = "https://haste.zneix.eu/documents";
String requestURL = serverpackcreatorproperties.getProperty("de.griefed.serverpackcreator.configuration.hastebinserver","https://haste.zneix.eu/documents");
String response = null;

int postDataLength;
Expand Down
5 changes: 3 additions & 2 deletions backend/main/resources/serverpackcreator.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
de.griefed.serverpackcreator.configuration.fallbackmodslist=AmbientSounds,BackTools,BetterAdvancement,BetterFoliage,BetterPing,BetterPlacement,Blur,cherished,ClientTweaks,Controlling,CTM,customdiscordrpc,CustomMainMenu,DefaultOptions,durability,DynamicSurroundings,EiraMoticons,FullscreenWindowed,itemzoom,itlt,jeiintegration,jei-professions,just-enough-harvestcraft,JustEnoughResources,keywizard,modnametooltip,MouseTweaks,multihotbar-,Neat,OldJavaWarning,PackMenu,preciseblockplacing,ResourceLoader,SimpleDiscordRichPresence,SpawnerFix,timestamps,TipTheScales,WorldNameRandomizer
# Supported languages: [en_us, uk_ua, de_de]
lang=en_us
lang=en_us
de.griefed.serverpackcreator.configuration.fallbackmodslist=AmbientSounds,BackTools,BetterAdvancement,BetterFoliage,BetterPing,BetterPlacement,Blur,cherished,ClientTweaks,Controlling,CTM,customdiscordrpc,CustomMainMenu,DefaultOptions,durability,DynamicSurroundings,EiraMoticons,FullscreenWindowed,itemzoom,itlt,jeiintegration,jei-professions,just-enough-harvestcraft,JustEnoughResources,keywizard,modnametooltip,MouseTweaks,multihotbar-,Neat,OldJavaWarning,PackMenu,preciseblockplacing,ResourceLoader,SimpleDiscordRichPresence,SpawnerFix,timestamps,TipTheScales,WorldNameRandomizer
de.griefed.serverpackcreator.configuration.hastebinserver=https://haste.zneix.eu/documents

0 comments on commit 0235378

Please sign in to comment.