mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
!wip integrated with the layer#cake repo. Just need to do the UI
This commit is contained in:
parent
c8f00c4e8a
commit
b1d59452ef
10 changed files with 38 additions and 24 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Ombi.Api.Github.Models;
|
||||
|
@ -15,11 +16,12 @@ namespace Ombi.Api.Github
|
|||
private readonly IApi _api;
|
||||
private const string BaseUrl = "https://api.github.com/";
|
||||
|
||||
public async Task<CakeThemesContainer> GetCakeThemes()
|
||||
public async Task<List<CakeThemes>> GetCakeThemes()
|
||||
{
|
||||
var request = new Request("repos/leram84/layer.Cake/contents/Themes", BaseUrl, HttpMethod.Get);
|
||||
|
||||
return await _api.Request<CakeThemesContainer>(request);
|
||||
var request = new Request("repos/leram84/layer.Cake/contents/ombi/themes", BaseUrl, HttpMethod.Get);
|
||||
request.AddHeader("Accept", "application/vnd.github.v3+json");
|
||||
request.AddHeader("User-Agent", "Ombi");
|
||||
return await _api.Request<List<CakeThemes>>(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Ombi.Api.Github.Models;
|
||||
|
||||
namespace Ombi.Api.Github
|
||||
{
|
||||
public interface IGithubApi
|
||||
{
|
||||
Task<CakeThemesContainer> GetCakeThemes();
|
||||
Task<List<CakeThemes>> GetCakeThemes();
|
||||
}
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
namespace Ombi.Api.Github.Models
|
||||
{
|
||||
public class CakeThemesContainer
|
||||
{
|
||||
public CakeThemes[] Themes { get; set; }
|
||||
}
|
||||
|
||||
public class CakeThemes
|
||||
{
|
||||
public string name { get; set; }
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using Newtonsoft.Json;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Newtonsoft.Json;
|
||||
using Ombi.Helpers;
|
||||
|
||||
namespace Ombi.Settings.Settings.Models
|
||||
{
|
||||
|
@ -7,8 +9,13 @@ namespace Ombi.Settings.Settings.Models
|
|||
public string ApplicationName { get; set; }
|
||||
public string ApplicationUrl { get; set; }
|
||||
public string CustomCssLink { get; set; }
|
||||
public string Logo { get; set; }
|
||||
|
||||
//public string PresetTheme { get; set; }
|
||||
public string PresetThemeName { get; set; }
|
||||
public string PresetThemeContent { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public bool HasPresetTheme => PresetThemeName.HasValue() || PresetThemeContent.HasValue();
|
||||
|
||||
public void AddToUrl(string part)
|
||||
{
|
||||
|
@ -27,6 +34,5 @@ namespace Ombi.Settings.Settings.Models
|
|||
}
|
||||
ApplicationUrl = ApplicationUrl + part;
|
||||
}
|
||||
public string Logo { get; set; }
|
||||
}
|
||||
}
|
|
@ -96,6 +96,13 @@ export interface ICustomizationSettings extends ISettings {
|
|||
customCssLink: string;
|
||||
}
|
||||
|
||||
export interface IThemes {
|
||||
fullName: string;
|
||||
displayName: string;
|
||||
version: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface IAuthenticationSettings extends ISettings {
|
||||
|
||||
allowExternalUsersToAuthenticate: boolean;
|
||||
|
|
|
@ -23,6 +23,7 @@ import {
|
|||
ISlackNotificationSettings,
|
||||
ISonarrSettings,
|
||||
ITelegramNotifcationSettings,
|
||||
IThemes,
|
||||
IUpdateSettings,
|
||||
IUserManagementSettings,
|
||||
} from "../interfaces";
|
||||
|
@ -122,6 +123,10 @@ export class SettingsService extends ServiceAuthHelpers {
|
|||
.map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
public getThemes(): Observable<IThemes[]> {
|
||||
return this.httpAuth.get(`${this.url}/themes`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
||||
public getEmailNotificationSettings(): Observable<IEmailNotificationSettings> {
|
||||
return this.httpAuth.get(`${this.url}/notifications/email`).map(this.extractData).catch(this.handleError);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, OnInit } from "@angular/core";
|
||||
|
||||
import { ICustomizationSettings } from "../../interfaces";
|
||||
import { ICustomizationSettings, IThemes } from "../../interfaces";
|
||||
import { NotificationService } from "../../services";
|
||||
import { SettingsService } from "../../services";
|
||||
|
||||
|
@ -10,12 +10,13 @@ import { SettingsService } from "../../services";
|
|||
export class CustomizationComponent implements OnInit {
|
||||
|
||||
public settings: ICustomizationSettings;
|
||||
public themes: IThemes[];
|
||||
|
||||
constructor(private settingsService: SettingsService, private notificationService: NotificationService) { }
|
||||
|
||||
public ngOnInit() {
|
||||
|
||||
this.settingsService.getCustomization().subscribe(x => this.settings = x);
|
||||
this.settingsService.getThemes().subscribe(x => this.themes = x);
|
||||
}
|
||||
|
||||
public save() {
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace Ombi.Controllers
|
|||
public async Task<IEnumerable<PresetThemeViewModel>> GetThemes()
|
||||
{
|
||||
var themes = await _githubApi.GetCakeThemes();
|
||||
var cssThemes = themes.Themes.Where(x => x.name.Contains(".css", CompareOptions.IgnoreCase)
|
||||
var cssThemes = themes.Where(x => x.name.Contains(".css", CompareOptions.IgnoreCase)
|
||||
&& x.type.Equals("file", StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
// 001-theBlur-leram84-1.0.css
|
||||
|
@ -238,7 +238,8 @@ namespace Ombi.Controllers
|
|||
{
|
||||
DisplayName = parts[1],
|
||||
FullName = theme.name,
|
||||
Version = parts[3].Replace(".css",string.Empty, StringComparison.CurrentCultureIgnoreCase)
|
||||
Version = parts[3].Replace(".css",string.Empty, StringComparison.CurrentCultureIgnoreCase),
|
||||
Url = theme.download_url
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
public string FullName { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
5
src/Ombi/package-lock.json
generated
5
src/Ombi/package-lock.json
generated
|
@ -3679,11 +3679,6 @@
|
|||
"resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz",
|
||||
"integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA="
|
||||
},
|
||||
"intro.js-mit": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/intro.js-mit/-/intro.js-mit-3.0.0.tgz",
|
||||
"integrity": "sha1-vMQHKQrn4FT68+uImVumyTfZRVA="
|
||||
},
|
||||
"invert-kv": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue