forked from Qortal/qortal
Removed ApiService instance creation in ApplyUpdate as it wasn't really needed, and probably not sensible to instantiate it here.
This commit is contained in:
parent
ff6ec83b1c
commit
6f7c8d96b9
@ -15,7 +15,6 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|||||||
import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider;
|
import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider;
|
||||||
import org.qortal.api.ApiKey;
|
import org.qortal.api.ApiKey;
|
||||||
import org.qortal.api.ApiRequest;
|
import org.qortal.api.ApiRequest;
|
||||||
import org.qortal.api.ApiService;
|
|
||||||
import org.qortal.controller.AutoUpdate;
|
import org.qortal.controller.AutoUpdate;
|
||||||
import org.qortal.settings.Settings;
|
import org.qortal.settings.Settings;
|
||||||
|
|
||||||
@ -74,14 +73,11 @@ public class ApplyUpdate {
|
|||||||
boolean apiKeyNewlyGenerated = false;
|
boolean apiKeyNewlyGenerated = false;
|
||||||
ApiKey apiKey = null;
|
ApiKey apiKey = null;
|
||||||
try {
|
try {
|
||||||
apiKey = ApiService.getInstance().getApiKey();
|
apiKey = new ApiKey();
|
||||||
if (apiKey == null) {
|
if (!apiKey.generated()) {
|
||||||
apiKey = new ApiKey();
|
apiKey.generate();
|
||||||
if (!apiKey.generated()) {
|
apiKeyNewlyGenerated = true;
|
||||||
apiKey.generate();
|
LOGGER.info("Generated API key");
|
||||||
apiKeyNewlyGenerated = true;
|
|
||||||
LOGGER.info("Generated API key");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.info("Error loading API key: {}", e.getMessage());
|
LOGGER.info("Error loading API key: {}", e.getMessage());
|
||||||
@ -135,12 +131,8 @@ public class ApplyUpdate {
|
|||||||
try {
|
try {
|
||||||
LOGGER.info("Removing newly generated API key...");
|
LOGGER.info("Removing newly generated API key...");
|
||||||
|
|
||||||
ApiKey apiKey = ApiService.getInstance().getApiKey();
|
|
||||||
if (apiKey == null) {
|
|
||||||
apiKey = new ApiKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete the API key since it was only generated for this auto update
|
// Delete the API key since it was only generated for this auto update
|
||||||
|
ApiKey apiKey = new ApiKey();
|
||||||
apiKey.delete();
|
apiKey.delete();
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user