Use Ubot S3 repository for uploading graph files.
This commit is contained in:
parent
1f49026198
commit
b2c8fbd341
1 changed files with 8 additions and 17 deletions
|
|
@ -813,20 +813,14 @@ int BotControl::cmdNodeReleaseEditor () {
|
||||||
}
|
}
|
||||||
|
|
||||||
int BotControl::cmdNodeUpload () {
|
int BotControl::cmdNodeUpload () {
|
||||||
enum args { graph_cmd = 1, cmd, id, max };
|
enum args { graph_cmd = 1, cmd };
|
||||||
|
|
||||||
// adding more args to args array, if not enough passed
|
|
||||||
fixMissingArgs (max);
|
|
||||||
|
|
||||||
if (!hasArg (id)) {
|
|
||||||
return BotCommandResult::BadFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
// do not allow to upload bad graph
|
// do not allow to upload bad graph
|
||||||
if (!graph.checkNodes (false)) {
|
if (!graph.checkNodes (false)) {
|
||||||
msg ("Sorry, unable to upload graph file that contains errors. Please type \"wp check\" to verify graph consistency.");
|
msg ("Sorry, unable to upload graph file that contains errors. Please type \"wp check\" to verify graph consistency.");
|
||||||
return BotCommandResult::BadFormat;
|
return BotCommandResult::BadFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg ("\n");
|
msg ("\n");
|
||||||
msg ("WARNING!");
|
msg ("WARNING!");
|
||||||
msg ("Graph uploaded to graph database in synchronous mode. That means if graph is big enough");
|
msg ("Graph uploaded to graph database in synchronous mode. That means if graph is big enough");
|
||||||
|
|
@ -836,14 +830,10 @@ int BotControl::cmdNodeUpload () {
|
||||||
// six seconds is enough?
|
// six seconds is enough?
|
||||||
http.setTimeout (6);
|
http.setTimeout (6);
|
||||||
|
|
||||||
extern ConVar yb_graph_url;
|
|
||||||
|
|
||||||
// try to upload the file
|
// try to upload the file
|
||||||
if (http.uploadFile (strings.format ("%s/", yb_graph_url.str ()), strings.format ("%sgraph/%s.graph", graph.getDataDirectory (false), game.getMapName ()))) {
|
if (http.uploadFile ("http://upload.ubot.su/", strings.format ("%sgraph/%s.graph", graph.getDataDirectory (false), game.getMapName ()))) {
|
||||||
msg ("Graph file was uploaded and Issue Request has been created for review.");
|
msg ("Graph file was successfully validated and uploaded to the Ubot S3 storage (%s).", product.download);
|
||||||
msg ("As soon as database administrator review your upload request, your graph will");
|
msg ("It will be available for download for all Ubot and YaPB users in a few minutes");
|
||||||
msg ("be available to download for all YaPB users. You can check your issue request at:");
|
|
||||||
msg ("URL: https://github.com/jeefo/yapb-graph/issues");
|
|
||||||
msg ("\n");
|
msg ("\n");
|
||||||
msg ("Thank you.");
|
msg ("Thank you.");
|
||||||
msg ("\n");
|
msg ("\n");
|
||||||
|
|
@ -861,14 +851,15 @@ int BotControl::cmdNodeUpload () {
|
||||||
else {
|
else {
|
||||||
status.assignf ("%d", code);
|
status.assignf ("%d", code);
|
||||||
}
|
}
|
||||||
msg ("Something went wrong with uploading. Come back later. (%s)", status.chars ());
|
msg ("Something went wrong with uploading. Come back later. (%s)", status);
|
||||||
msg ("\n");
|
msg ("\n");
|
||||||
|
|
||||||
if (code == HttpClientResult::Forbidden) {
|
if (code == HttpClientResult::Forbidden) {
|
||||||
msg ("You should create issue-request manually for this graph");
|
msg ("You should create issue-request manually for this graph");
|
||||||
msg ("as it's already exists in database, can't overwrite. Sorry...");
|
msg ("as it's already exists in database, can't overwrite. Sorry...");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msg ("There is an internal error, or somethingis totally wrong with");
|
msg ("There is an internal error, or something is totally wrong with");
|
||||||
msg ("your files, and they are not passed sanity checks. Sorry...");
|
msg ("your files, and they are not passed sanity checks. Sorry...");
|
||||||
}
|
}
|
||||||
msg ("\n");
|
msg ("\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue