예제 #1
0
        public async Task <object> Get(GetDashboardPackage request)
        {
            var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
                                    "webclient-dump");

            try
            {
                Directory.Delete(path, true);
            }
            catch (IOException)
            {
            }

            var creator = GetPackageCreator();

            CopyDirectory(creator.DashboardUIPath, path);

            var culture = "en-US";

            var appVersion = DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture);

            await DumpHtml(creator.DashboardUIPath, path, culture, appVersion);
            await DumpJs(creator.DashboardUIPath, path, culture, appVersion);

            await DumpFile("scripts/all.js", Path.Combine(path, "scripts", "all.js"), culture, appVersion).ConfigureAwait(false);
            await DumpFile("css/all.css", Path.Combine(path, "css", "all.css"), culture, appVersion).ConfigureAwait(false);

            return("");
        }
예제 #2
0
        public async Task <object> Get(GetDashboardPackage request)
        {
            var mode = request.Mode;

            var inputPath = string.IsNullOrWhiteSpace(mode) ?
                            DashboardUIPath
                : "C:\\dev\\emby-web-mobile-master\\dist";

            var targetPath = !string.IsNullOrWhiteSpace(mode) ?
                             inputPath
                : "C:\\dev\\emby-web-mobile\\src";

            var packageCreator = GetPackageCreator(inputPath);

            if (!string.Equals(inputPath, targetPath, StringComparison.OrdinalIgnoreCase))
            {
                try
                {
                    Directory.Delete(targetPath, true);
                }
                catch (IOException)
                {
                }

                CopyDirectory(inputPath, targetPath);
            }

            var appVersion = _appHost.ApplicationVersionString;

            await DumpHtml(packageCreator, inputPath, targetPath, mode, appVersion);

            return("");
        }
예제 #3
0
        public async Task <object> Get(GetDashboardPackage request)
        {
            var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
                                    "webclient-dump");

            try
            {
                _fileSystem.DeleteDirectory(path, true);
            }
            catch (IOException)
            {
            }

            var creator = GetPackageCreator();

            CopyDirectory(creator.DashboardUIPath, path);

            var culture = "en-US";

            var appVersion = _appHost.ApplicationVersion.ToString();

            var mode = request.Mode;

            if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
            {
                // Overwrite certain files with cordova specific versions
                var cordovaVersion = Path.Combine(path, "thirdparty", "cordova", "registrationservices.js");
                File.Copy(cordovaVersion, Path.Combine(path, "scripts", "registrationservices.js"), true);
                File.Delete(cordovaVersion);

                // Delete things that are unneeded in an attempt to keep the output as trim as possible
                Directory.Delete(Path.Combine(path, "css", "images", "tour"), true);
                Directory.Delete(Path.Combine(path, "thirdparty", "apiclient", "alt"), true);

                File.Delete(Path.Combine(path, "thirdparty", "jquerymobile-1.4.5", "jquery.mobile-1.4.5.min.map"));
            }

            MinifyCssDirectory(Path.Combine(path, "css"));
            MinifyJsDirectory(Path.Combine(path, "scripts"));
            MinifyJsDirectory(Path.Combine(path, "thirdparty", "apiclient"));
            MinifyJsDirectory(Path.Combine(path, "voice"));

            await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion);
            await DumpJs(creator.DashboardUIPath, path, mode, culture, appVersion);

            await DumpFile("scripts/all.js", Path.Combine(path, "scripts", "all.js"), mode, culture, appVersion).ConfigureAwait(false);
            await DumpFile("css/all.css", Path.Combine(path, "css", "all.css"), mode, culture, appVersion).ConfigureAwait(false);

            return("");
        }
예제 #4
0
        public async Task <object> Get(GetDashboardPackage request)
        {
            if (!_appConfig.HostWebClient() || DashboardUIPath == null)
            {
                throw new ResourceNotFoundException();
            }

            var mode = request.Mode;

            var inputPath = string.IsNullOrWhiteSpace(mode) ?
                            DashboardUIPath
                : "C:\\dev\\emby-web-mobile-master\\dist";

            var targetPath = !string.IsNullOrWhiteSpace(mode) ?
                             inputPath
                : "C:\\dev\\emby-web-mobile\\src";

            var packageCreator = GetPackageCreator(inputPath);

            if (!string.Equals(inputPath, targetPath, StringComparison.OrdinalIgnoreCase))
            {
                try
                {
                    Directory.Delete(targetPath, true);
                }
                catch (IOException ex)
                {
                    _logger.LogError(ex, "Error deleting {Path}. Do you have the correct permissions?", targetPath);
                }

                CopyDirectory(inputPath, targetPath);
            }

            var appVersion = _appHost.ApplicationVersionString;

            await DumpHtml(packageCreator, inputPath, targetPath, mode, appVersion).ConfigureAwait(false);

            return(string.Empty);
        }
예제 #5
0
        public async Task <object> Get(GetDashboardPackage request)
        {
            var mode = request.Mode;

            var path = !string.IsNullOrWhiteSpace(mode) ?
                       Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath, "webclient-dump")
                : "C:\\dev\\emby-web-mobile\\src";

            try
            {
                _fileSystem.DeleteDirectory(path, true);
            }
            catch (IOException)
            {
            }

            var creator = GetPackageCreator();

            CopyDirectory(creator.DashboardUIPath, path);

            string culture = null;

            var appVersion = _appHost.ApplicationVersion.ToString();

            // Try to trim the output size a bit
            var bowerPath = Path.Combine(path, "bower_components");

            if (!string.IsNullOrWhiteSpace(mode))
            {
                // Delete things that are unneeded in an attempt to keep the output as trim as possible

                DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "roboto");
                _fileSystem.DeleteDirectory(Path.Combine(path, "css", "images", "tour"), true);
            }

            await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion);

            return("");
        }
        public async Task <object> Get(GetDashboardPackage request)
        {
            var mode = request.Mode;

            var path = string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase) ?
                       Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath, "webclient-dump")
                : "C:\\dev\\emby-web-mobile\\src";

            try
            {
                _fileSystem.DeleteDirectory(path, true);
            }
            catch (IOException)
            {
            }

            var creator = GetPackageCreator();

            CopyDirectory(creator.DashboardUIPath, path);

            string culture = null;

            var appVersion = _appHost.ApplicationVersion.ToString();

            // Try to trim the output size a bit
            var bowerPath = Path.Combine(path, "bower_components");

            GetDeployIgnoreExtensions().ForEach(i => DeleteFilesByExtension(bowerPath, i));

            DeleteFilesByExtension(bowerPath, ".json", "strings\\");

            GetDeployIgnoreFilenames().ForEach(i => DeleteFilesByName(bowerPath, i.Item1, i.Item2));

            DeleteFoldersByName(bowerPath, "demo");
            DeleteFoldersByName(bowerPath, "test");
            DeleteFoldersByName(bowerPath, "guides");
            DeleteFoldersByName(bowerPath, "grunt");
            DeleteFoldersByName(bowerPath, "rollups");

            if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
            {
                DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "montserrat");
                DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "opensans");
                DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "roboto");
            }

            _fileSystem.DeleteDirectory(Path.Combine(bowerPath, "jquery", "src"), true);

            DeleteCryptoFiles(Path.Combine(bowerPath, "cryptojslib", "components"));

            DeleteFoldersByName(Path.Combine(bowerPath, "jquery"), "src");
            DeleteFoldersByName(Path.Combine(bowerPath, "jstree"), "src");
            //DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor");
            //DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "st");
            //DeleteFoldersByName(Path.Combine(bowerPath, "Swiper"), "src");

            if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
            {
                // Delete things that are unneeded in an attempt to keep the output as trim as possible
                _fileSystem.DeleteDirectory(Path.Combine(path, "css", "images", "tour"), true);
            }

            await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion);

            await DumpFile("css/all.css", Path.Combine(path, "css", "all.css"), mode, culture, appVersion).ConfigureAwait(false);

            return("");
        }
예제 #7
0
        public async Task <object> Get(GetDashboardPackage request)
        {
            var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
                                    "webclient-dump");

            try
            {
                _fileSystem.DeleteDirectory(path, true);
            }
            catch (IOException)
            {
            }

            var creator = GetPackageCreator();

            CopyDirectory(creator.DashboardUIPath, path);

            string culture = null;

            var appVersion = _appHost.ApplicationVersion.ToString();

            var mode = request.Mode;

            if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
            {
                _fileSystem.DeleteFile(Path.Combine(path, "scripts", "registrationservices.js"));
            }

            // Try to trim the output size a bit
            var bowerPath = Path.Combine(path, "bower_components");

            if (!string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
            {
                var versionedBowerPath = Path.Combine(Path.GetDirectoryName(bowerPath), "bower_components" + _appHost.ApplicationVersion);
                Directory.Move(bowerPath, versionedBowerPath);
                bowerPath = versionedBowerPath;
            }

            DeleteFilesByExtension(bowerPath, ".log");
            DeleteFilesByExtension(bowerPath, ".txt");
            DeleteFilesByExtension(bowerPath, ".map");
            DeleteFilesByExtension(bowerPath, ".md");
            DeleteFilesByExtension(bowerPath, ".json");
            DeleteFilesByExtension(bowerPath, ".gz");
            DeleteFilesByExtension(bowerPath, ".bat");
            DeleteFilesByExtension(bowerPath, ".sh");
            DeleteFilesByName(bowerPath, "copying", true);
            DeleteFilesByName(bowerPath, "license", true);
            DeleteFilesByName(bowerPath, "license-mit", true);
            DeleteFilesByName(bowerPath, "gitignore");
            DeleteFilesByName(bowerPath, "npmignore");
            DeleteFilesByName(bowerPath, "jshintrc");
            DeleteFilesByName(bowerPath, "gruntfile");
            DeleteFilesByName(bowerPath, "bowerrc");
            DeleteFilesByName(bowerPath, "jscsrc");
            DeleteFilesByName(bowerPath, "hero.svg");
            DeleteFilesByName(bowerPath, "travis.yml");
            DeleteFilesByName(bowerPath, "build.js");
            DeleteFilesByName(bowerPath, "editorconfig");
            DeleteFilesByName(bowerPath, "gitattributes");
            DeleteFoldersByName(bowerPath, "demo");
            DeleteFoldersByName(bowerPath, "test");
            DeleteFoldersByName(bowerPath, "guides");
            DeleteFoldersByName(bowerPath, "grunt");
            DeleteFoldersByName(bowerPath, "rollups");

            DeleteCryptoFiles(Path.Combine(bowerPath, "cryptojslib", "components"));

            DeleteFoldersByName(Path.Combine(bowerPath, "jquery"), "src");
            DeleteFoldersByName(Path.Combine(bowerPath, "jstree"), "src");
            DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "meteor");
            DeleteFoldersByName(Path.Combine(bowerPath, "Sortable"), "st");
            DeleteFoldersByName(Path.Combine(bowerPath, "swipebox"), "lib");
            DeleteFoldersByName(Path.Combine(bowerPath, "swipebox"), "scss");

            if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
            {
                // Delete things that are unneeded in an attempt to keep the output as trim as possible
                _fileSystem.DeleteDirectory(Path.Combine(path, "css", "images", "tour"), true);

                _fileSystem.DeleteFile(Path.Combine(path, "thirdparty", "jquerymobile-1.4.5", "jquery.mobile-1.4.5.min.map"));
            }
            else
            {
                MinifyCssDirectory(path);
                MinifyJsDirectory(path);
            }

            await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion);

            await DumpFile("css/all.css", Path.Combine(path, "css", "all.css"), mode, culture, appVersion).ConfigureAwait(false);

            return("");
        }