-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
167 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ http.createServer(function (req, res) { | |
res.end(); | ||
}); | ||
|
||
}).listen(8080); | ||
}).listen(process.env.PORT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<system.webServer> | ||
<webSocket enabled="false" /> | ||
<handlers> | ||
<add name="iisnode" path="index.js" verb="*" modules="iisnode"/> | ||
</handlers> | ||
<rewrite> | ||
<rules> | ||
<!-- Do not interfere with requests for node-inspector debugging --> | ||
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"> | ||
<match url="^index.js\/debug[\/]?" /> | ||
</rule> | ||
|
||
<!-- First we consider whether the incoming URL matches a physical file in the /public folder --> | ||
<rule name="StaticContent"> | ||
<action type="Rewrite" url="public{REQUEST_URI}"/> | ||
</rule> | ||
|
||
<!-- All other URLs are mapped to the node.js site entry point --> | ||
<rule name="DynamicContent"> | ||
<conditions> | ||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/> | ||
</conditions> | ||
<action type="Rewrite" url="index.js"/> | ||
</rule> | ||
</rules> | ||
</rewrite> | ||
|
||
<security> | ||
<requestFiltering> | ||
<hiddenSegments> | ||
<remove segment="bin"/> | ||
</hiddenSegments> | ||
</requestFiltering> | ||
</security> | ||
|
||
<httpErrors existingResponse="PassThrough" /> | ||
|
||
<iisnode watchedFiles="web.config;*.js"/> | ||
</system.webServer> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace StormworksLuaExtract.Helpers | ||
{ | ||
public static class ConsoleHelper | ||
{ | ||
public static void WriteWarning(object value) | ||
{ | ||
var previousForegroundColor = Console.ForegroundColor; | ||
|
||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.WriteLine(value); | ||
Console.ForegroundColor = previousForegroundColor; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Net.Http; | ||
using System.Text; | ||
using StormworksLuaExtract.Helpers; | ||
using StormworksLuaExtract.Models; | ||
|
||
namespace StormworksLuaExtract.Services | ||
{ | ||
public class MinifyLuaService | ||
{ | ||
public string Minify(string script) | ||
{ | ||
using (var httpClient = new HttpClient()) | ||
{ | ||
var httpContent = new StringContent(script, Encoding.UTF8); | ||
using (var response = httpClient.PostAsync(Constants.MinifyLuaApiEndpoint, httpContent).Result) | ||
{ | ||
if (!response.IsSuccessStatusCode) | ||
{ | ||
ConsoleHelper.WriteWarning("Failed to minify lua script."); | ||
return null; | ||
} | ||
|
||
var minifiedScript = response.Content.ReadAsStringAsync().Result; | ||
return minifiedScript; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters