pull/1425/head
Jamie.Rees 8 years ago
parent 77780900b7
commit c6534652f1

@ -1,4 +1,6 @@
using Microsoft.EntityFrameworkCore; using System.IO;
using System.Resources;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.ChangeTracking;
using Ombi.Store.Entities; using Ombi.Store.Entities;
@ -15,9 +17,15 @@ namespace Ombi.Store.Context
Database.EnsureCreated(); Database.EnsureCreated();
Database.Migrate(); Database.Migrate();
//#if DEBUG
// var file = File.ReadAllText();
//#else
var file = File.ReadAllText("SqlTables.sql");
//#endif
// Run Script // Run Script
Database.ExecuteSqlCommand(Sql.SqlTables, 0); Database.ExecuteSqlCommand(file, 0);
} }
public DbSet<RequestBlobs> Requests { get; set; } public DbSet<RequestBlobs> Requests { get; set; }

@ -4,6 +4,10 @@
<TargetFramework>netstandard1.6</TargetFramework> <TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="SqlTables.sql" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.1.1" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" />
@ -14,6 +18,11 @@
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" /> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="SqlTables.sql">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" /> <ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
</ItemGroup> </ItemGroup>
@ -26,7 +35,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Update="Sql.resx"> <EmbeddedResource Update="Sql.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Sql.Designer.cs</LastGenOutput> <LastGenOutput>Sql.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>

@ -23,7 +23,7 @@ namespace Ombi.Store {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Sql { public class Sql {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
@ -37,7 +37,7 @@ namespace Ombi.Store {
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { public static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ombi.Store.Sql", typeof(Sql).GetTypeInfo().Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ombi.Store.Sql", typeof(Sql).GetTypeInfo().Assembly);
@ -52,7 +52,7 @@ namespace Ombi.Store {
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { public static global::System.Globalization.CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
@ -80,7 +80,7 @@ namespace Ombi.Store {
/// Type INTEGER NOT NULL, /// Type INTEGER NOT NULL,
/// Relea [rest of string was truncated]&quot;;. /// Relea [rest of string was truncated]&quot;;.
/// </summary> /// </summary>
internal static string SqlTables { public static string SqlTables {
get { get {
return ResourceManager.GetString("SqlTables", resourceCulture); return ResourceManager.GetString("SqlTables", resourceCulture);
} }

@ -125,18 +125,14 @@ var paths = {
dest: './lib/primeng/' dest: './lib/primeng/'
} }
], ],
sass: [ // Simple sass->css compilation sass: // Simple sass->css compilation
{ {
src: ['./Styles/**/*.scss', '!./Styles/primeng/**'], src: ['./Styles/**/*.scss', '!./Styles/primeng/**'],
dest: './css/', dest: './css/',
filter: '**/*.css' filter: '**/*.css'
}, },
{
src: path.join(wwwroot, 'app/**/*.scss'),
dest: './app/',
filter: '**/*.css'
}
],
bundle: { // This is the config for the bundler, you shouldn't need to change this bundle: { // This is the config for the bundler, you shouldn't need to change this
root: './', root: './',
dest: './lib/bundle.js', dest: './lib/bundle.js',
@ -259,18 +255,12 @@ gulp.task('modules', function () {
}) })
gulp.task('sass', function () { gulp.task('sass', function () {
var streams = [] return gulp.src(paths.sass.src)
for (let module of paths.sass) { .pipe(changed(paths.sass.dest))
streams.push( .pipe(gulpif(global.full, sourcemaps.init()))
gulp.src(module.src) .pipe(sass({ outputStyle: global.full ? 'compressed' : 'nested' }).on('error', sass.logError))
.pipe(changed(module.dest, { extension: '.css' })) .pipe(gulpif(global.full, sourcemaps.write('maps')))
.pipe(gulpif(global.full, sourcemaps.init())) .pipe(gulp.dest(path.join(paths.wwwroot, paths.sass.dest)))
.pipe(sass({ outputStyle: global.full ? 'compressed' : 'nested' }).on('error', sass.logError))
.pipe(gulpif(global.full, sourcemaps.write('maps')))
.pipe(gulp.dest(path.join(paths.wwwroot, module.dest)))
);
}
return merge(streams);
}); });

@ -8,12 +8,11 @@ import { IdentityService } from './services/identity.service';
import { ICustomizationSettings } from './interfaces/ISettings'; import { ICustomizationSettings } from './interfaces/ISettings';
import template from './app.component.html';
@Component({ @Component({
selector: 'ombi', selector: 'ombi',
moduleId: module.id, moduleId: module.id,
templateUrl: template templateUrl: './app.component.html'
}) })
export class AppComponent implements OnInit { export class AppComponent implements OnInit {

@ -14,7 +14,7 @@ export class EmbyService extends ServiceHelpers {
} }
logIn(settings: IEmbySettings): Observable<IEmbySettings> { logIn(settings: IEmbySettings): Observable<IEmbySettings> {
return this.http.post(`${this.url}/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); return this.http.post(`${this.url}`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
} }
} }

@ -9,7 +9,7 @@ import { ISonarrRootFolder, ISonarrProfile } from '../../interfaces/ISonarr';
@Injectable() @Injectable()
export class SonarrService extends ServiceAuthHelpers { export class SonarrService extends ServiceAuthHelpers {
constructor(http: AuthHttp) { constructor(http: AuthHttp) {
super(http, '/api/v1/Sonarr/'); super(http, '/api/v1/Sonarr');
} }
getRootFolders(settings: ISonarrSettings): Observable<ISonarrRootFolder[]> { getRootFolders(settings: ISonarrSettings): Observable<ISonarrRootFolder[]> {

@ -21,11 +21,11 @@ export class IdentityService extends ServiceAuthHelpers {
} }
getUsers(): Observable<IUser[]> { getUsers(): Observable<IUser[]> {
return this.http.get(`${this.url}/Users`).map(this.extractData); return this.http.get(`${this.url}Users`).map(this.extractData);
} }
getAllAvailableClaims(): Observable<ICheckbox[]> { getAllAvailableClaims(): Observable<ICheckbox[]> {
return this.http.get(`${this.url}/Claims`).map(this.extractData); return this.http.get(`${this.url}Claims`).map(this.extractData);
} }
createUser(user: IUser): Observable<IUser> { createUser(user: IUser): Observable<IUser> {

@ -15,42 +15,42 @@ export class RequestService extends ServiceAuthHelpers {
} }
requestMovie(movie: ISearchMovieResult): Observable<IRequestEngineResult> { requestMovie(movie: ISearchMovieResult): Observable<IRequestEngineResult> {
return this.http.post(`${this.url}/Movie/`, JSON.stringify(movie), { headers: this.headers }).map(this.extractData); return this.http.post(`${this.url}Movie/`, JSON.stringify(movie), { headers: this.headers }).map(this.extractData);
} }
requestTv(tv: ISearchTvResult): Observable<IRequestEngineResult> { requestTv(tv: ISearchTvResult): Observable<IRequestEngineResult> {
return this.http.post(`${this.url}/TV/`, JSON.stringify(tv), { headers: this.headers }).map(this.extractData); return this.http.post(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers }).map(this.extractData);
} }
getMovieRequests(count: number, position: number): Observable<IMovieRequestModel[]> { getMovieRequests(count: number, position: number): Observable<IMovieRequestModel[]> {
return this.http.get(`${this.url}/movie/${count}/${position}`).map(this.extractData); return this.http.get(`${this.url}movie/${count}/${position}`).map(this.extractData);
} }
searchMovieRequests(search: string): Observable<IMovieRequestModel[]> { searchMovieRequests(search: string): Observable<IMovieRequestModel[]> {
return this.http.get(`${this.url}/movie/search/${search}`).map(this.extractData); return this.http.get(`${this.url}movie/search/${search}`).map(this.extractData);
} }
removeMovieRequest(request: IMovieRequestModel) { removeMovieRequest(request: IMovieRequestModel) {
this.http.delete(`${this.url}/movie/${request.id}`).map(this.extractData).subscribe(); this.http.delete(`${this.url}movie/${request.id}`).map(this.extractData).subscribe();
} }
updateMovieRequest(request: IMovieRequestModel): Observable<IMovieRequestModel> { updateMovieRequest(request: IMovieRequestModel): Observable<IMovieRequestModel> {
return this.http.post(`${this.url}/movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); return this.http.post(`${this.url}movie/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData);
} }
getTvRequests(count: number, position: number): Observable<ITvRequestModel[]> { getTvRequests(count: number, position: number): Observable<ITvRequestModel[]> {
return this.http.get(`${this.url}/tv/${count}/${position}`).map(this.extractData); return this.http.get(`${this.url}tv/${count}/${position}`).map(this.extractData);
} }
searchTvRequests(search: string): Observable<ITvRequestModel[]> { searchTvRequests(search: string): Observable<ITvRequestModel[]> {
return this.http.get(`${this.url}/tv/search/${search}`).map(this.extractData); return this.http.get(`${this.url}tv/search/${search}`).map(this.extractData);
} }
removeTvRequest(request: ITvRequestModel) { removeTvRequest(request: ITvRequestModel) {
this.http.delete(`${this.url}/tv/${request.id}`).map(this.extractData).subscribe(); this.http.delete(`${this.url}tv/${request.id}`).map(this.extractData).subscribe();
} }
updateTvRequest(request: ITvRequestModel): Observable<ITvRequestModel> { updateTvRequest(request: ITvRequestModel): Observable<ITvRequestModel> {
return this.http.post(`${this.url}/tv/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData); return this.http.post(`${this.url}tv/`, JSON.stringify(request), { headers: this.headers }).map(this.extractData);
} }
} }

@ -9,57 +9,58 @@ import { IOmbiSettings, IEmbySettings, IPlexSettings, ISonarrSettings,ILandingPa
@Injectable() @Injectable()
export class SettingsService extends ServiceAuthHelpers { export class SettingsService extends ServiceAuthHelpers {
constructor(public httpAuth: AuthHttp, private nonAuthHttp: Http) { constructor(public httpAuth: AuthHttp, private nonAuthHttp: Http) {
super(httpAuth, '/api/v1/Settings/'); super(httpAuth, '/api/v1/Settings');
} }
getOmbi(): Observable<IOmbiSettings> { getOmbi(): Observable<IOmbiSettings> {
return this.httpAuth.get(`${this.url}/Ombi/`).map(this.extractData); return this.httpAuth.get(`${this.url}/Ombi/`).map(this.extractData).catch(this.handleError)
} }
saveOmbi(settings: IOmbiSettings): Observable<boolean> { saveOmbi(settings: IOmbiSettings): Observable<boolean> {
return this.httpAuth.post(`${this.url}/Ombi/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); return this.httpAuth.post(`${this.url}/Ombi/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError)
} }
getEmby(): Observable<IEmbySettings> { getEmby(): Observable<IEmbySettings> {
return this.httpAuth.get(`${this.url}/Emby/`).map(this.extractData); return this.httpAuth.get(`${this.url}/Emby/`).map(this.extractData).catch(this.handleError)
} }
saveEmby(settings: IEmbySettings): Observable<boolean> { saveEmby(settings: IEmbySettings): Observable<boolean> {
return this.httpAuth.post(`${this.url}/Emby/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); return this.httpAuth.post(`${this.url}/Emby/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError)
} }
getPlex(): Observable<IPlexSettings> { getPlex(): Observable<IPlexSettings> {
return this.httpAuth.get(`${this.url}/Plex/`).map(this.extractData); return this.httpAuth.get(`${this.url}/Plex/`).map(this.extractData).catch(this.handleError)
} }
savePlex(settings: IPlexSettings): Observable<boolean> { savePlex(settings: IPlexSettings): Observable<boolean> {
return this.httpAuth.post(`${this.url}/Plex/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); return this.httpAuth.post(`${this.url}/Plex/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError)
} }
getSonarr(): Observable<ISonarrSettings> { getSonarr(): Observable<ISonarrSettings> {
return this.httpAuth.get(`${this.url}/Sonarr`).map(this.extractData); return this.httpAuth.get(`${this.url}/Sonarr`).map(this.extractData)
.catch(this.handleError);
} }
saveSonarr(settings: ISonarrSettings): Observable<boolean> { saveSonarr(settings: ISonarrSettings): Observable<boolean> {
return this.httpAuth.post(`${this.url}/Sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); return this.httpAuth.post(`${this.url}/Sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError)
} }
// Using http since we need it not to be authenticated to get the landing page settings // Using http since we need it not to be authenticated to get the landing page settings
getLandingPage(): Observable<ILandingPageSettings> { getLandingPage(): Observable<ILandingPageSettings> {
return this.nonAuthHttp.get(`${this.url}/LandingPage`).map(this.extractData); return this.nonAuthHttp.get(`${this.url}/LandingPage`).map(this.extractData).catch(this.handleError)
} }
saveLandingPage(settings: ILandingPageSettings): Observable<boolean> { saveLandingPage(settings: ILandingPageSettings): Observable<boolean> {
return this.httpAuth.post(`${this.url}/LandingPage`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); return this.httpAuth.post(`${this.url}/LandingPage`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError)
} }
// Using http since we need it not to be authenticated to get the customization settings // Using http since we need it not to be authenticated to get the customization settings
getCustomization(): Observable<ICustomizationSettings> { getCustomization(): Observable<ICustomizationSettings> {
return this.nonAuthHttp.get(`${this.url}/customization`).map(this.extractData); return this.nonAuthHttp.get(`${this.url}/customization`).map(this.extractData).catch(this.handleError)
} }
saveCustomization(settings: ICustomizationSettings): Observable<boolean> { saveCustomization(settings: ICustomizationSettings): Observable<boolean> {
return this.httpAuth.post(`${this.url}/customization`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData); return this.httpAuth.post(`${this.url}/customization`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData).catch(this.handleError)
} }

@ -11,6 +11,6 @@ export class StatusService extends ServiceHelpers {
super(http, '/api/v1/status/'); super(http, '/api/v1/status/');
} }
getWizardStatus(): Observable<any> { getWizardStatus(): Observable<any> {
return this.http.get(`${this.url}/Wizard/`, { headers: this.headers }).map(this.extractData); return this.http.get(`${this.url}Wizard/`, { headers: this.headers }).map(this.extractData);
} }
} }
Loading…
Cancel
Save