]> insang Git - ZipProject.git/commitdiff
퍼블리시 환경 재 세팅 및 컨트롤러에 STATIC 메소드 정의
authorjocloud <dhkq92@icloud.com>
Thu, 21 May 2020 13:35:41 +0000 (13:35 +0000)
committerjocloud <dhkq92@icloud.com>
Thu, 21 May 2020 13:35:41 +0000 (13:35 +0000)
13 files changed:
ZipProject/Controllers/WebZipController.cs
ZipProject/Models/LanguagePack.cs
ZipProject/Program.cs
ZipProject/Startup.cs
ZipProject/Views/Shared/_Layout.cshtml
ZipProject/Views/Shared/_Navbar.cshtml
ZipProject/Views/WebZip/Index.cshtml
ZipProject/Views/WebZip/partial_zip.cshtml
ZipProject/nohup.out [new file with mode: 0644]
ZipProject/wwwroot/lib/bootstrap/dist/css/bootstrap.css
buildrelease [deleted file]
nohup.out [new file with mode: 0644]
release_publish [new file with mode: 0755]

index 02eac2901ca13b2f0e06a6068f947a91260bca42..b37a0be55464aaed8d96a116497cdf715cb08f4f 100644 (file)
@@ -13,78 +13,128 @@ using Microsoft.AspNetCore.Mvc;
 using Newtonsoft.Json.Linq;
 using ZipProject.Models;
 
-namespace ZipProject.Controllers {
-  public class WebZipController : Controller {
+namespace ZipProject.Controllers
+{
+  public class WebZipController : Controller
+  {
     private readonly ISession session;
 
-    public WebZipController (IHttpContextAccessor httpContextAccessor) {
+    public WebZipController(IHttpContextAccessor httpContextAccessor)
+    {
       this.session = httpContextAccessor.HttpContext.Session;
     }
 
     // GET: /<controller>/
-    public IActionResult Index (string partial_name) {
-      if (string.IsNullOrEmpty (HttpContext.Session.GetString ("lang"))) {
-        session.SetString ("lang", "kr");
+    public IActionResult Index(string partial_name)
+    {
+      if (string.IsNullOrEmpty(HttpContext.Session.GetString("lang")))
+      {
+        session.SetString("lang", "kr");
       }
 
-      if (string.IsNullOrEmpty (partial_name))
+      if (string.IsNullOrEmpty(partial_name))
         ViewData["partial_page"] = "partial_zip";
       else
         ViewData["partial_page"] = partial_name;
-      return View ();
+      return View();
     }
 
-    public IActionResult En () {
-      session.SetString ("lang", "en");
-      return Redirect ("/");
+    public IActionResult En()
+    {
+      session.SetString("lang", "en");
+      return Redirect("/");
     }
 
-    public IActionResult Kr () {
-      session.SetString ("lang", "kr");
-      return Redirect ("/");
+    public IActionResult Kr()
+    {
+      session.SetString("lang", "kr");
+      return Redirect("/");
     }
 
     //파일업로드 사이즈 3GB (3(GB) * 1024(MB) * 1024(KB) * 1024(byte))
-    [RequestSizeLimit (3221225472)]
-    public ActionResult FileUpload (string dirList, List<IFormFile> files, string fileKeyPair, string format, string uuid) {
-      JObject keyPair_FileDir = JObject.Parse (fileKeyPair);
+    [RequestSizeLimit(3221225472)]
+    public ActionResult FileUpload(string dirList, List<IFormFile> files, string fileKeyPair, string format, string uuid)
+    {
+      JObject keyPair_FileDir = JObject.Parse(fileKeyPair);
       Console.WriteLine(dirList);
-      Dictionary<string, object> data = new Dictionary<string, object> ();
-      ZipModel zipModel = new ZipModel ();
+      Dictionary<string, object> data = new Dictionary<string, object>();
+      ZipModel zipModel = new ZipModel();
 
-      Dictionary<string, string> test= new Dictionary<string, string> ();
+      Dictionary<string, string> test = new Dictionary<string, string>();
 
-      string[] listDir = dirList.Split (',');
+      string[] listDir = dirList.Split(',');
       string filename = listDir[0] + "." + format;
 
-      zipModel.SetParam (keyPair_FileDir, listDir, files, uuid, uuid);
-      zipModel.MakeZip ();
+      zipModel.SetParam(keyPair_FileDir, listDir, files, uuid, uuid);
+      zipModel.MakeZip();
 
-      return Json ("");
+      return Json("");
     }
 
-    public async Task<ActionResult> FileUploadProgress (string uuid) {
-      SimpleLongPolling longPolling = new SimpleLongPolling (uuid);
-      var msg = await longPolling.WaitAsync ();
-      return Json (msg);
+    public async Task<ActionResult> FileUploadProgress(string uuid)
+    {
+      SimpleLongPolling longPolling = new SimpleLongPolling(uuid);
+      var msg = await longPolling.WaitAsync();
+      return Json(msg);
     }
 
-    public ActionResult DownloadZip (string uuid) {
-      string path = Environment.CurrentDirectory + "/wwwroot/zipfiles/" + uuid + ".zip";
-      byte[] file = System.IO.File.ReadAllBytes (path);
-      System.IO.File.Delete (path);
-      return File (file, "application/zip");
+    public ActionResult DownloadZip(string uuid)
+    {
+      string path;
+#if !DEBUG
+      path = Environment.CurrentDirectory + "/release/netcoreapp2.1/publish/wwwroot/zipfiles/" + uuid + ".zip";
+#else
+      path = Environment.CurrentDirectory + "/wwwroot/zipfiles/" + uuid + ".zip";
+#endif
+      byte[] file = System.IO.File.ReadAllBytes(path);
+      System.IO.File.Delete(path);
+      return File(file, "application/zip");
     }
 
-    public ActionResult tst () {
+    public ActionResult tst()
+    {
       double now = 1;
       double per = 1;
-      now = now + (int) 1;
-      return Json (per == (int) 1);
+      now = now + (int)1;
+      return Json(per == (int)1);
     }
 
-    public ActionResult Error () {
-      return View (new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
+    public ActionResult Error()
+    {
+      return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
+    }
+
+    [HttpGet("/static/{name}")]
+    public IActionResult Static(string name)
+    {
+      string path;
+      string re_name = name.Replace(":", "/");
+      string type = re_name.Split('.')[re_name.Split('.').Count() - 1];
+      string content_type;
+      Dictionary<string, string> pair = new Dictionary<string, string>(){
+        {"css", "text/css"},
+        {"js", "text/javascript"},
+        {"json", "application/json"},
+        {"etc", "Multipart/related"}
+      };
+
+      try
+      {
+        content_type = pair[type];
+      }
+      catch (KeyNotFoundException)
+      {
+        content_type = pair["etc"];
+      }
+
+#if !DEBUG
+      path = Environment.CurrentDirectory + "/release/netcoreapp2.1/publish/wwwroot/" + re_name;
+#else
+      path = Environment.CurrentDirectory + "/wwwroot/" + re_name;
+#endif
+
+      byte[] file = System.IO.File.ReadAllBytes(path);
+      return File(file, content_type, "StaticFile");
     }
 
   }
index 9549928d5285d5b1e5e603e50905473a84141f4b..6c8babd73e040183f42fd3187313c1d1ca04c2b8 100644 (file)
@@ -8,11 +8,11 @@ namespace ZipProject.Models {
     public static string GetText (string lang, string id) {
 
       #if !DEBUG
-        string path = Environment.CurrentDirectory + "release/netcoreapp2.1/publish/wwwroot/Language/" + lang + ".json";
+        string path = Environment.CurrentDirectory + "/release/netcoreapp2.1/publish/wwwroot/Language/" + lang + ".json";
       #else
         string path = Environment.CurrentDirectory + "/wwwroot/Language/" + lang + ".json";
       #endif
-      
+
       string json = File.OpenText (path).ReadToEnd ();
 
       dynamic result = JsonConvert.DeserializeObject<dynamic> (json);
index 8a75a99e05d9a89959a126be70445bbc0bad159a..acc4dc89ee58366baf45e00f36224885a8ce864d 100644 (file)
@@ -8,20 +8,23 @@ using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.Configuration;\r
 using Microsoft.Extensions.Logging;\r
 \r
-namespace ZipProject {\r
-  public class Program {\r
-    public static void Main (string[] args) {\r
+namespace ZipProject\r
+{\r
+  public class Program\r
+  {\r
+    public static void Main(string[] args)\r
+    {\r
       string port;\r
-      #if !DEBUG //published\r
-        port= "5001";\r
-      #else //debug\r
-        port= "9999";\r
-      #endif\r
-      CreateWebHostBuilder (args).UseUrls ("http://localhost:" + port).Build ().Run ();\r
+#if !DEBUG //published\r
+      port= "5001";\r
+#else //debug\r
+      port = "9999";\r
+#endif\r
+      CreateWebHostBuilder(args).UseUrls("http://localhost:" + port).Build().Run();\r
     }\r
 \r
-    public static IWebHostBuilder CreateWebHostBuilder (string[] args) =>\r
-      WebHost.CreateDefaultBuilder (args)\r
-      .UseStartup<Startup> ();\r
+    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>\r
+      WebHost.CreateDefaultBuilder(args)\r
+      .UseStartup<Startup>();\r
   }\r
 }
\ No newline at end of file
index 231c93514a33ce9bb502d6b055d7030e4ba6ef9c..9cb0b5931e5b6e7138c75e1ede9b2b5d766b8c1f 100644 (file)
@@ -46,11 +46,15 @@ namespace ZipProject {
       app.UseCookiePolicy ();\r
       app.UseSession ();\r
       app.UseStatusCodePages ("text/plain", "status code page, status code: {0}");\r
-\r
       app.UseMvc (routes => {\r
         routes.MapRoute (\r
           name: "default",\r
-          template: "{controller=WebZip}/{action=Index}/{id?}");\r
+          template: "{controller=WebZip}/{action=Index}/{id?}"\r
+        );\r
+        // routes.MapRoute(\r
+        //   name: "static",\r
+        //   template: "static/{controller=WebZip}/{action=Static}/{name?}"\r
+        // );\r
       });\r
 \r
     }\r
index 3019ee374bb32ab9a126d927f2e87bec058ed0f1..6e2fea8159e53f26644fc17cdc527efd55de72f1 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>\r
+<!DOCTYPE html>\r
 <html>\r
 <head>\r
   <meta charset="utf-8" />\r
   <link rel="canonical" href="https://wabiey.com">\r
   <title>@ViewData["Title"]</title>\r
 \r
-  <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />\r
-  <link rel="stylesheet" href="~/css/site.css" asp-append-version="true"/>\r
+  <link rel="stylesheet" href="/static/lib:bootstrap:dist:css:bootstrap.css" />\r
+  <link rel="stylesheet" href="/static/css:site.css" asp-append-version="true"/>\r
   <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous" asp-append-version="true">\r
   <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"\r
-        asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"\r
+        asp-fallback-href="/static/lib:bootstrap:dist:css:bootstrap.min.css"\r
         asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />\r
 \r
 \r
   <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.3.1.min.js"\r
-          asp-fallback-src="~/lib/jquery/dist/jquery.min.js"\r
+          asp-fallback-src="/static/lib:jquery:dist:jquery.min.js"\r
           asp-fallback-test="window.jQuery"\r
           crossorigin="anonymous"\r
           integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT">\r
   </script>\r
   <script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"\r
-          asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"\r
+          asp-fallback-src="/static/lib:bootstrap:dist:js:bootstrap.min.js"\r
           asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"\r
           crossorigin="anonymous"\r
           integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">\r
   </script>\r
-  <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>\r
-  <script src="~/js/site.js" asp-append-version="true"></script>\r
+  \r
+  <script src="/static/lib:bootstrap:dist:js:bootstrap.js"></script>\r
+  <script src="/static/js:site.js" asp-append-version="true"></script>\r
   <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>\r
   <style>\r
     .navbar-default {\r
@@ -50,7 +51,7 @@
     var _Language;\r
     $.ajax({\r
       type: "get",\r
-      url: "/Language/"+lang+".json",\r
+      url: "/static/Language:"+lang+".json",\r
       async: false,\r
       cache: false\r
     }).done(function(data){\r
@@ -66,7 +67,7 @@
     });\r
   </script>\r
 </head>\r
-<body>\r
+<body oncontextmenu= "return false;" onselectstart= "return false;" ondragstart= "return false;">\r
 \r
   <!-- navbar -->\r
   <partial name="_Navbar" />\r
index f2db693587460692acf1eaaf7c8869e5861ee15c..4939700cd5087fcaf526a41d9ce16224279de65c 100644 (file)
@@ -14,7 +14,7 @@
         <span class="icon-bar"></span>\r
       </button>\r
       <span class="navbar-brand" style="padding: 4px;">\r
-        <a href=""><img src="~/images/logo.png" class="webzip-navlogo" alt="logo"/></a>\r
+        <a href=""><img src="/static/images:logo.png" class="webzip-navlogo" alt="logo"/></a>\r
       </span>\r
     </div>\r
     <div class="collapse navbar-collapse webzip-navbar">\r
index 6d8c9cd11545782c7fee62604a7233c150197d5b..0edb0f537002c101d0ea4fb16e00e0fd51e87443 100644 (file)
@@ -48,7 +48,7 @@
     var partial_page= "@ViewData["partial_page"]";\r
 </script>\r
   \r
-  <script src="~/js/Zip/Index.js" asp-append-version="true"></script>\r
+  <script src="/static/js:Zip:Index.js" asp-append-version="true"></script>\r
 \r
 <!-- #region 모바일 클릭, 더블클릭, 드래그(메뉴소환) 이벤트 -->\r
   <script>\r
index 007dcf0f1a0195cd44fbcf5eaea2b248921f1d51..d20bdc6bbd5b0584fc82f00f37ded5b040c36806 100644 (file)
@@ -10,7 +10,7 @@
     display: none;\r
     z-index:    2000;\r
     background: rgba( 255, 255, 255, .8 )\r
-    url('/images/spinner.gif')\r
+    url('/static/images:spinner.gif')\r
     50% 50%\r
     no-repeat;\r
     text-align: center;\r
   var folder_open= "▼";\r
   var folder= "▶";\r
 </script>\r
-<script src="~/js/Zip/partial_zip.js" asp-append-version="true"></script>
\ No newline at end of file
+<script src="/static/js:Zip:partial_zip.js" asp-append-version="true"></script>
\ No newline at end of file
diff --git a/ZipProject/nohup.out b/ZipProject/nohup.out
new file mode 100644 (file)
index 0000000..be56767
--- /dev/null
@@ -0,0 +1,32 @@
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+  * You misspelled a built-in dotnet command.\r
+  * You intended to execute a .NET Core program, but dotnet-release/netcoreapp2.1/ZipProject.dll does not exist.\r
+  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+  * You misspelled a built-in dotnet command.\r
+  * You intended to execute a .NET Core program, but dotnet-release/netcoreapp2.1/ZipProject.dll does not exist.\r
+  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+  * You misspelled a built-in dotnet command.\r
+  * You intended to execute a .NET Core program, but dotnet-/home/dhkq92/.nicezip/release/netcoreapp2.1/ZipProject.dll does not exist.\r
+  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+  * You misspelled a built-in dotnet command.\r
+  * You intended to execute a .NET Core program, but dotnet-/home/dhkq92/.nicezip/release/netcoreapp2.1/ZipProject.dll does not exist.\r
+  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+  * You misspelled a built-in dotnet command.\r
+  * You intended to execute a .NET Core program, but dotnet-/home/dhkq92/.nicezip/release/netcoreapp2.1/ZipProject.dll does not exist.\r
+  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+
+Unhandled Exception: System.ArgumentException: The content root '/home/dhkq92/.publish/nicezip/nicezip_sources/ZipProject/release/netcoreapp2.1/publish/wwwroot' does not exist.
+Parameter name: contentRootPath
+   at Microsoft.AspNetCore.Hosting.Internal.HostingEnvironmentExtensions.Initialize(IHostingEnvironment hostingEnvironment, String contentRootPath, WebHostOptions options)
+   at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
+   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
+   at ZipProject.Program.Main(String[] args) in /home/dhkq92/.publish/nicezip/nicezip_sources/ZipProject/Program.cs:line 26
index d08d771a85860184d29da19a0c0bc75e4b2fa5cc..7f6eaa98d7f4fa9e92cbb1c053ff9f4024a5a2ae 100644 (file)
@@ -8189,4 +8189,3 @@ button.close {
         display: none !important;\r
     }\r
 }\r
-/*# sourceMappingURL=bootstrap.css.map */\r
diff --git a/buildrelease b/buildrelease
deleted file mode 100755 (executable)
index c92721a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-cd ZipProject
-dotnet publish --configuration ../../../nicezip/release
diff --git a/nohup.out b/nohup.out
new file mode 100644 (file)
index 0000000..1a5b7e6
--- /dev/null
+++ b/nohup.out
@@ -0,0 +1,5 @@
+Could not execute because the specified command or file was not found.\r
+Possible reasons for this include:\r
+  * You misspelled a built-in dotnet command.\r
+  * You intended to execute a .NET Core program, but dotnet-release/netcoreapp2.1/ZipProject.dll does not exist.\r
+  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
diff --git a/release_publish b/release_publish
new file mode 100755 (executable)
index 0000000..105be8c
--- /dev/null
@@ -0,0 +1,5 @@
+
+cd ZipProject
+dotnet publish --configuration ../../../release
+cd ../../
+./runserver