mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Added support for custom UI folder
This commit is contained in:
parent
760469fc5f
commit
98acd0d886
@ -7,6 +7,12 @@ require('./handlebars');
|
|||||||
require('./copy');
|
require('./copy');
|
||||||
|
|
||||||
gulp.task('build', function() {
|
gulp.task('build', function() {
|
||||||
return runSequence('clean',
|
return runSequence('clean', [
|
||||||
['webpack', 'less', 'handlebars', 'copyHtml', 'copyContent', 'copyJs']);
|
'webpack',
|
||||||
|
'less',
|
||||||
|
'handlebars',
|
||||||
|
'copyHtml',
|
||||||
|
'copyContent',
|
||||||
|
'copyJs'
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
@ -4,4 +4,4 @@ module.exports = {
|
|||||||
console.log(error.toString());
|
console.log(error.toString());
|
||||||
this.emit('end');
|
this.emit('end');
|
||||||
}
|
}
|
||||||
}
|
};
|
@ -12,7 +12,10 @@ var paths = require('./paths.js');
|
|||||||
|
|
||||||
gulp.task('handlebars', function() {
|
gulp.task('handlebars', function() {
|
||||||
|
|
||||||
var coreStream = gulp.src([paths.src.templates, '!*/**/*Partial.*'])
|
var coreStream = gulp.src([
|
||||||
|
paths.src.templates,
|
||||||
|
'!*/**/*Partial.*'
|
||||||
|
])
|
||||||
.pipe(stripbom({ showLog : false }))
|
.pipe(stripbom({ showLog : false }))
|
||||||
.pipe(handlebars())
|
.pipe(handlebars())
|
||||||
.pipe(declare({
|
.pipe(declare({
|
||||||
@ -43,7 +46,6 @@ gulp.task('handlebars', function () {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
return streamqueue({ objectMode : true },
|
return streamqueue({ objectMode : true },
|
||||||
partialStream,
|
partialStream,
|
||||||
coreStream
|
coreStream
|
||||||
|
@ -2,7 +2,6 @@ var gulp = require('gulp');
|
|||||||
var print = require('gulp-print');
|
var print = require('gulp-print');
|
||||||
var paths = require('./paths.js');
|
var paths = require('./paths.js');
|
||||||
|
|
||||||
|
|
||||||
gulp.task('imageMin', function() {
|
gulp.task('imageMin', function() {
|
||||||
var imagemin = require('gulp-imagemin');
|
var imagemin = require('gulp-imagemin');
|
||||||
return gulp.src(paths.src.images)
|
return gulp.src(paths.src.images)
|
||||||
|
@ -4,9 +4,11 @@ var stylish = require('jshint-stylish');
|
|||||||
var cache = require('gulp-cached');
|
var cache = require('gulp-cached');
|
||||||
var paths = require('./paths.js');
|
var paths = require('./paths.js');
|
||||||
|
|
||||||
|
|
||||||
gulp.task('jshint', function() {
|
gulp.task('jshint', function() {
|
||||||
return gulp.src([paths.src.scripts, paths.src.exclude.libs])
|
return gulp.src([
|
||||||
|
paths.src.scripts,
|
||||||
|
paths.src.exclude.libs
|
||||||
|
])
|
||||||
.pipe(cache('jshint'))
|
.pipe(cache('jshint'))
|
||||||
.pipe(jshint())
|
.pipe(jshint())
|
||||||
.pipe(jshint.reporter(stylish));
|
.pipe(jshint.reporter(stylish));
|
||||||
|
27
gulp/less.js
27
gulp/less.js
@ -1,13 +1,15 @@
|
|||||||
var gulp = require('gulp');
|
var gulp = require('gulp');
|
||||||
var less = require('gulp-less');
|
var less = require('gulp-less');
|
||||||
var print = require('gulp-print');
|
var print = require('gulp-print');
|
||||||
|
var phantom = require('./phantom');
|
||||||
var livereload = require('gulp-livereload');
|
var livereload = require('gulp-livereload');
|
||||||
|
|
||||||
var paths = require('./paths');
|
var paths = require('./paths');
|
||||||
var errorHandler = require('./errorHandler');
|
var errorHandler = require('./errorHandler');
|
||||||
|
|
||||||
gulp.task('less', function() {
|
gulp.task('less', function() {
|
||||||
return gulp.src([
|
|
||||||
|
var src = [
|
||||||
paths.src.content + 'bootstrap.less',
|
paths.src.content + 'bootstrap.less',
|
||||||
paths.src.content + 'theme.less',
|
paths.src.content + 'theme.less',
|
||||||
paths.src.content + 'overrides.less',
|
paths.src.content + 'overrides.less',
|
||||||
@ -21,7 +23,28 @@ gulp.task('less', function () {
|
|||||||
paths.src.root + 'System/Logs/logs.less',
|
paths.src.root + 'System/Logs/logs.less',
|
||||||
paths.src.root + 'System/Update/update.less',
|
paths.src.root + 'System/Update/update.less',
|
||||||
paths.src.root + 'System/Info/info.less',
|
paths.src.root + 'System/Info/info.less',
|
||||||
])
|
];
|
||||||
|
|
||||||
|
if (phantom) {
|
||||||
|
src = [
|
||||||
|
paths.src.content + 'bootstrap.less',
|
||||||
|
paths.src.content + 'angle.less',
|
||||||
|
paths.src.content + 'sonarr.less',
|
||||||
|
paths.src.content + 'overrides.less',
|
||||||
|
paths.src.root + 'Series/series.less',
|
||||||
|
paths.src.root + 'Activity/activity.less',
|
||||||
|
paths.src.root + 'AddSeries/addSeries.less',
|
||||||
|
paths.src.root + 'Calendar/calendar.less',
|
||||||
|
paths.src.root + 'Cells/cells.less',
|
||||||
|
paths.src.root + 'ManualImport/manualimport.less',
|
||||||
|
paths.src.root + 'Settings/settings.less',
|
||||||
|
paths.src.root + 'System/Logs/logs.less',
|
||||||
|
paths.src.root + 'System/Update/update.less',
|
||||||
|
paths.src.root + 'System/Info/info.less',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
return gulp.src(src)
|
||||||
.pipe(print())
|
.pipe(print())
|
||||||
.pipe(less({
|
.pipe(less({
|
||||||
dumpLineNumbers : 'false',
|
dumpLineNumbers : 'false',
|
||||||
|
@ -9,4 +9,6 @@ process.argv.forEach(function (val, index, array) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('Phantom:', phantom);
|
||||||
|
|
||||||
module.exports = phantom;
|
module.exports = phantom;
|
@ -84,7 +84,7 @@ gulp.task('getSonarr', function () {
|
|||||||
download(package.url, packagePath, function () {
|
download(package.url, packagePath, function () {
|
||||||
extract(packagePath, dirName, function () {
|
extract(packagePath, dirName, function () {
|
||||||
// clean old binaries
|
// clean old binaries
|
||||||
console.log('Cleaning old binaries')
|
console.log('Cleaning old binaries');
|
||||||
del.sync(['./_output/*', '!./_output/UI/']);
|
del.sync(['./_output/*', '!./_output/UI/']);
|
||||||
console.log('copying binaries to target');
|
console.log('copying binaries to target');
|
||||||
gulp.src(dirName + '/NzbDrone/*.*')
|
gulp.src(dirName + '/NzbDrone/*.*')
|
||||||
|
@ -3,17 +3,20 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Frontend.Mappers
|
namespace NzbDrone.Api.Frontend.Mappers
|
||||||
{
|
{
|
||||||
public class FaviconMapper : StaticResourceMapperBase
|
public class FaviconMapper : StaticResourceMapperBase
|
||||||
{
|
{
|
||||||
private readonly IAppFolderInfo _appFolderInfo;
|
private readonly IAppFolderInfo _appFolderInfo;
|
||||||
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
|
|
||||||
public FaviconMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, Logger logger)
|
public FaviconMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider,IConfigFileProvider configFileProvider, Logger logger)
|
||||||
: base(diskProvider, logger)
|
: base(diskProvider, logger)
|
||||||
{
|
{
|
||||||
_appFolderInfo = appFolderInfo;
|
_appFolderInfo = appFolderInfo;
|
||||||
|
_configFileProvider = configFileProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Map(string resourceUrl)
|
public override string Map(string resourceUrl)
|
||||||
@ -27,7 +30,7 @@ public override string Map(string resourceUrl)
|
|||||||
|
|
||||||
var path = Path.Combine("Content", "Images", fileName);
|
var path = Path.Combine("Content", "Images", fileName);
|
||||||
|
|
||||||
return Path.Combine(_appFolderInfo.StartUpFolder, "UI", path);
|
return Path.Combine(_appFolderInfo.StartUpFolder, _configFileProvider.UiFolder, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanHandle(string resourceUrl)
|
public override bool CanHandle(string resourceUrl)
|
||||||
|
@ -36,7 +36,7 @@ public IndexHtmlMapper(IAppFolderInfo appFolderInfo,
|
|||||||
_configFileProvider = configFileProvider;
|
_configFileProvider = configFileProvider;
|
||||||
_analyticsService = analyticsService;
|
_analyticsService = analyticsService;
|
||||||
_cacheBreakProviderFactory = cacheBreakProviderFactory;
|
_cacheBreakProviderFactory = cacheBreakProviderFactory;
|
||||||
_indexPath = Path.Combine(appFolderInfo.StartUpFolder, "UI", "index.html");
|
_indexPath = Path.Combine(appFolderInfo.StartUpFolder, _configFileProvider.UiFolder, "index.html");
|
||||||
|
|
||||||
API_KEY = configFileProvider.ApiKey;
|
API_KEY = configFileProvider.ApiKey;
|
||||||
URL_BASE = configFileProvider.UrlBase;
|
URL_BASE = configFileProvider.UrlBase;
|
||||||
|
@ -12,6 +12,7 @@ namespace NzbDrone.Api.Frontend.Mappers
|
|||||||
public class LoginHtmlMapper : StaticResourceMapperBase
|
public class LoginHtmlMapper : StaticResourceMapperBase
|
||||||
{
|
{
|
||||||
private readonly IDiskProvider _diskProvider;
|
private readonly IDiskProvider _diskProvider;
|
||||||
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
private readonly Func<ICacheBreakerProvider> _cacheBreakProviderFactory;
|
private readonly Func<ICacheBreakerProvider> _cacheBreakProviderFactory;
|
||||||
private readonly string _indexPath;
|
private readonly string _indexPath;
|
||||||
private static readonly Regex ReplaceRegex = new Regex("(?<=(?:href|src|data-main)=\").*?(?=\")", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
private static readonly Regex ReplaceRegex = new Regex("(?<=(?:href|src|data-main)=\").*?(?=\")", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
@ -27,8 +28,9 @@ public LoginHtmlMapper(IAppFolderInfo appFolderInfo,
|
|||||||
: base(diskProvider, logger)
|
: base(diskProvider, logger)
|
||||||
{
|
{
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
|
_configFileProvider = configFileProvider;
|
||||||
_cacheBreakProviderFactory = cacheBreakProviderFactory;
|
_cacheBreakProviderFactory = cacheBreakProviderFactory;
|
||||||
_indexPath = Path.Combine(appFolderInfo.StartUpFolder, "UI", "login.html");
|
_indexPath = Path.Combine(appFolderInfo.StartUpFolder, _configFileProvider.UiFolder, "login.html");
|
||||||
|
|
||||||
URL_BASE = configFileProvider.UrlBase;
|
URL_BASE = configFileProvider.UrlBase;
|
||||||
}
|
}
|
||||||
|
@ -3,24 +3,27 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Frontend.Mappers
|
namespace NzbDrone.Api.Frontend.Mappers
|
||||||
{
|
{
|
||||||
public class RobotsTxtMapper : StaticResourceMapperBase
|
public class RobotsTxtMapper : StaticResourceMapperBase
|
||||||
{
|
{
|
||||||
private readonly IAppFolderInfo _appFolderInfo;
|
private readonly IAppFolderInfo _appFolderInfo;
|
||||||
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
|
|
||||||
public RobotsTxtMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, Logger logger)
|
public RobotsTxtMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, IConfigFileProvider configFileProvider, Logger logger)
|
||||||
: base(diskProvider, logger)
|
: base(diskProvider, logger)
|
||||||
{
|
{
|
||||||
_appFolderInfo = appFolderInfo;
|
_appFolderInfo = appFolderInfo;
|
||||||
|
_configFileProvider = configFileProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Map(string resourceUrl)
|
public override string Map(string resourceUrl)
|
||||||
{
|
{
|
||||||
var path = Path.Combine("Content", "robots.txt");
|
var path = Path.Combine("Content", "robots.txt");
|
||||||
|
|
||||||
return Path.Combine(_appFolderInfo.StartUpFolder, "UI", path);
|
return Path.Combine(_appFolderInfo.StartUpFolder, _configFileProvider.UiFolder, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanHandle(string resourceUrl)
|
public override bool CanHandle(string resourceUrl)
|
||||||
|
@ -2,17 +2,20 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Frontend.Mappers
|
namespace NzbDrone.Api.Frontend.Mappers
|
||||||
{
|
{
|
||||||
public class StaticResourceMapper : StaticResourceMapperBase
|
public class StaticResourceMapper : StaticResourceMapperBase
|
||||||
{
|
{
|
||||||
private readonly IAppFolderInfo _appFolderInfo;
|
private readonly IAppFolderInfo _appFolderInfo;
|
||||||
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
|
|
||||||
public StaticResourceMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, Logger logger)
|
public StaticResourceMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, IConfigFileProvider configFileProvider, Logger logger)
|
||||||
: base(diskProvider, logger)
|
: base(diskProvider, logger)
|
||||||
{
|
{
|
||||||
_appFolderInfo = appFolderInfo;
|
_appFolderInfo = appFolderInfo;
|
||||||
|
_configFileProvider = configFileProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Map(string resourceUrl)
|
public override string Map(string resourceUrl)
|
||||||
@ -20,7 +23,7 @@ public override string Map(string resourceUrl)
|
|||||||
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
|
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
|
||||||
path = path.Trim(Path.DirectorySeparatorChar);
|
path = path.Trim(Path.DirectorySeparatorChar);
|
||||||
|
|
||||||
return Path.Combine(_appFolderInfo.StartUpFolder, "UI", path);
|
return Path.Combine(_appFolderInfo.StartUpFolder, _configFileProvider.UiFolder, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanHandle(string resourceUrl)
|
public override bool CanHandle(string resourceUrl)
|
||||||
|
@ -37,6 +37,7 @@ public interface IConfigFileProvider : IHandleAsync<ApplicationStartedEvent>,
|
|||||||
string ApiKey { get; }
|
string ApiKey { get; }
|
||||||
string SslCertHash { get; }
|
string SslCertHash { get; }
|
||||||
string UrlBase { get; }
|
string UrlBase { get; }
|
||||||
|
string UiFolder { get; }
|
||||||
Boolean UpdateAutomatically { get; }
|
Boolean UpdateAutomatically { get; }
|
||||||
UpdateMechanism UpdateMechanism { get; }
|
UpdateMechanism UpdateMechanism { get; }
|
||||||
String UpdateScriptPath { get; }
|
String UpdateScriptPath { get; }
|
||||||
@ -215,6 +216,14 @@ public string UrlBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string UiFolder
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return GetValue("UiFolder", "UI", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool UpdateAutomatically
|
public bool UpdateAutomatically
|
||||||
{
|
{
|
||||||
get { return GetValueBoolean("UpdateAutomatically", false, false); }
|
get { return GetValueBoolean("UpdateAutomatically", false, false); }
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var stylish = require('jshint-stylish');
|
var stylish = require('jshint-stylish');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
|
var phantom = require('./gulp/phantom');
|
||||||
|
|
||||||
var uglifyJsPlugin = new webpack.optimize.UglifyJsPlugin();
|
var uglifyJsPlugin = new webpack.optimize.UglifyJsPlugin();
|
||||||
|
|
||||||
|
var uiFolder = 'UI';
|
||||||
|
|
||||||
|
if (phantom) {
|
||||||
|
uiFolder = 'UI.Phantom';
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
vendor: 'vendor.js',
|
vendor: 'vendor.js',
|
||||||
main: 'main.js'
|
main: 'main.js'
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
root : path.join(__dirname, 'src', 'UI'),
|
root: path.join(__dirname, 'src', uiFolder),
|
||||||
alias: {
|
alias: {
|
||||||
'vent': 'vent',
|
'vent': 'vent',
|
||||||
'backbone': 'Shims/backbone',
|
'backbone': 'Shims/backbone',
|
||||||
@ -46,8 +53,8 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
filename : '_output/UI/[name].js',
|
filename: '_output/' + uiFolder + '/[name].js',
|
||||||
sourceMapFilename : '_output/UI/[name].map'
|
sourceMapFilename: '_output/' + uiFolder + '/[name].map'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor' })
|
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor' })
|
||||||
|
Loading…
Reference in New Issue
Block a user