2
0
Luke Pulverenti 9 жил өмнө
parent
commit
3ba5000b0d

+ 21 - 5
MediaBrowser.WebDashboard/Api/DashboardService.cs

@@ -340,11 +340,9 @@ namespace MediaBrowser.WebDashboard.Api
                 CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "headroom.js", "dist", "headroom.min.js"), Path.Combine(path, "bower_components", "headroom.js", "dist", "headroom.min.js"));
                 CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "isMobile", "isMobile.min.js"), Path.Combine(path, "bower_components", "isMobile", "isMobile.min.js"));
             }
-            
-            MinifyCssDirectory(Path.Combine(path, "css"));
-            MinifyJsDirectory(Path.Combine(path, "scripts"));
-            MinifyJsDirectory(Path.Combine(path, "apiclient"));
-            MinifyJsDirectory(Path.Combine(path, "voice"));
+
+            MinifyCssDirectory(path);
+            MinifyJsDirectory(path);
 
             await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion);
             await DumpJs(creator.DashboardUIPath, path, mode, culture, appVersion);
@@ -358,6 +356,15 @@ namespace MediaBrowser.WebDashboard.Api
         {
             foreach (var file in Directory.GetFiles(path, "*.css", SearchOption.AllDirectories))
             {
+                if (file.IndexOf(".min.", StringComparison.OrdinalIgnoreCase) != -1)
+                {
+                    continue;
+                }
+                if (file.IndexOf("bower_", StringComparison.OrdinalIgnoreCase) != -1)
+                {
+                    continue;
+                }
+
                 try
                 {
 					var text = _fileSystem.ReadAllText(file, Encoding.UTF8);
@@ -385,6 +392,15 @@ namespace MediaBrowser.WebDashboard.Api
         {
             foreach (var file in Directory.GetFiles(path, "*.js", SearchOption.AllDirectories))
             {
+                if (file.IndexOf(".min.", StringComparison.OrdinalIgnoreCase) != -1)
+                {
+                    continue;
+                }
+                if (file.IndexOf("bower_", StringComparison.OrdinalIgnoreCase) != -1)
+                {
+                    continue;
+                }
+
                 try
                 {
 					var text = _fileSystem.ReadAllText(file, Encoding.UTF8);

+ 2 - 27
MediaBrowser.WebDashboard/Api/PackageCreator.cs

@@ -65,14 +65,14 @@ namespace MediaBrowser.WebDashboard.Api
                 }
                 else if (IsFormat(path, "js"))
                 {
-                    if (path.IndexOf("thirdparty", StringComparison.OrdinalIgnoreCase) == -1 && path.IndexOf("bower_components", StringComparison.OrdinalIgnoreCase) == -1)
+                    if (path.IndexOf(".min.", StringComparison.OrdinalIgnoreCase) == -1 && path.IndexOf("bower_components", StringComparison.OrdinalIgnoreCase) == -1)
                     {
                         resourceStream = await ModifyJs(resourceStream, enableMinification).ConfigureAwait(false);
                     }
                 }
                 else if (IsFormat(path, "css"))
                 {
-                    if (path.IndexOf("thirdparty", StringComparison.OrdinalIgnoreCase) == -1 && path.IndexOf("bower_components", StringComparison.OrdinalIgnoreCase) == -1)
+                    if (path.IndexOf(".min.", StringComparison.OrdinalIgnoreCase) == -1 && path.IndexOf("bower_components", StringComparison.OrdinalIgnoreCase) == -1)
                     {
                         resourceStream = await ModifyCss(resourceStream, enableMinification).ConfigureAwait(false);
                     }
@@ -461,31 +461,6 @@ namespace MediaBrowser.WebDashboard.Api
             return builder.ToString();
         }
 
-        /// <summary>
-        /// Appends the resource.
-        /// </summary>
-        /// <param name="outputStream">The output stream.</param>
-        /// <param name="path">The path.</param>
-        /// <param name="newLineBytes">The new line bytes.</param>
-        /// <returns>Task.</returns>
-        private async Task AppendResource(Stream outputStream, string path, byte[] newLineBytes)
-        {
-            path = GetDashboardResourcePath(path);
-
-            using (var fs = _fileSystem.GetFileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, true))
-            {
-                using (var streamReader = new StreamReader(fs))
-                {
-                    var text = await streamReader.ReadToEndAsync().ConfigureAwait(false);
-                    var bytes = Encoding.UTF8.GetBytes(text);
-                    await outputStream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
-                }
-            }
-
-            await outputStream.WriteAsync(newLineBytes, 0, newLineBytes.Length).ConfigureAwait(false);
-        }
-
-
         /// <summary>
         /// Gets all CSS.
         /// </summary>

+ 6 - 3
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -245,6 +245,9 @@
     <Content Include="dashboard-ui\components\prompt.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="dashboard-ui\components\requirecss.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\components\tvguide\tvguide.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -528,6 +531,9 @@
     <Content Include="dashboard-ui\thirdparty\jquerymobile-1.4.5\jqm.checkbox.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="dashboard-ui\thirdparty\jquerymobile-1.4.5\jqm.widget.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\thirdparty\jquerymobile-1.4.5\jquery.mobile.custom.icons.css">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
@@ -1249,9 +1255,6 @@
     <Content Include="dashboard-ui\apiclient\store.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="dashboard-ui\thirdparty\cast_sender.js">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\thirdparty\jquery.unveil-custom.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>