mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Some minor changes to JSON game log (#4587).
This commit is contained in:
parent
15602cdfb3
commit
51c68842aa
5 changed files with 68 additions and 80 deletions
|
|
@ -31,11 +31,7 @@ import java.awt.event.KeyEvent;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.*;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.client.remote.S3Uploader;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
|
|
@ -53,7 +49,6 @@ import mage.interfaces.callback.CallbackClient;
|
|||
import mage.interfaces.callback.ClientCallback;
|
||||
import mage.remote.ActionData;
|
||||
import mage.remote.Session;
|
||||
import mage.remote.SessionImpl;
|
||||
import mage.utils.CompressUtil;
|
||||
import mage.view.*;
|
||||
import mage.view.ChatMessage.MessageType;
|
||||
|
|
@ -410,6 +405,7 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ActionData appendJsonEvent(String name, UUID gameId, Object value) {
|
||||
Session session = SessionHandler.getSession();
|
||||
ActionData actionData = new ActionData(name, gameId);
|
||||
|
|
@ -417,6 +413,7 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
session.appendJsonLog(actionData);
|
||||
return actionData;
|
||||
}
|
||||
|
||||
private void createChatStartMessage(ChatPanelBasic chatPanel) {
|
||||
chatPanel.setStartMessageDone(true);
|
||||
ChatPanelBasic usedPanel = chatPanel;
|
||||
|
|
|
|||
|
|
@ -1,27 +1,26 @@
|
|||
package mage.client.remote;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.amazonaws.AmazonClientException;
|
||||
import com.amazonaws.auth.BasicAWSCredentials;
|
||||
import com.amazonaws.services.s3.transfer.TransferManager;
|
||||
import com.amazonaws.services.s3.transfer.Upload;
|
||||
import java.io.File;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.xml.crypto.Data;
|
||||
|
||||
|
||||
public class S3Uploader {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(S3Uploader.class);
|
||||
|
||||
public static Boolean upload(String filePath, String keyName) throws Exception {
|
||||
String existingBucketName = System.getenv("S3_BUCKET") != null ? System.getenv("S3_BUCKET")
|
||||
: "xmage-game-logs-dev";
|
||||
: "xmage-game-logs-dev";
|
||||
|
||||
String accessKeyId = System.getenv("AWS_ACCESS_ID");
|
||||
String secretKeyId = System.getenv("AWS_SECRET_KEY");
|
||||
|
||||
if(accessKeyId == "" || secretKeyId == "" || existingBucketName == "") {
|
||||
if (accessKeyId == null || "".equals(accessKeyId)
|
||||
|| secretKeyId == null || "".equals(secretKeyId)
|
||||
|| existingBucketName == null || "".equals(existingBucketName)) {
|
||||
logger.info("Aborting json log sync.");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -39,8 +38,7 @@ public class S3Uploader {
|
|||
new File(path);
|
||||
return true;
|
||||
} catch (AmazonClientException amazonClientException) {
|
||||
System.out.println("Unable to upload file, upload was aborted.");
|
||||
amazonClientException.printStackTrace();
|
||||
logger.fatal("Unable to upload file, upload was aborted.", amazonClientException);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue