mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
moved the javascript apiclient to it's own repo and nuget package
This commit is contained in:
parent
a3d37fbca7
commit
937e434ab6
@ -1,59 +0,0 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Server.Implementations.HttpServer;
|
||||
using ServiceStack.ServiceHost;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Api.Javascript
|
||||
{
|
||||
/// <summary>
|
||||
/// Class GetJavascriptApiClient
|
||||
/// </summary>
|
||||
[Route("/JsApiClient.js", "GET")]
|
||||
[ServiceStack.ServiceHost.Api(("Gets an api wrapper written in Javascript"))]
|
||||
public class GetJavascriptApiClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Version identifier for caching
|
||||
/// </summary>
|
||||
/// <value>The v.</value>
|
||||
public string V { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class JavascriptApiClientService
|
||||
/// </summary>
|
||||
public class JavascriptApiClientService : BaseRestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the specified request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public object Get(GetJavascriptApiClient request)
|
||||
{
|
||||
TimeSpan? cacheDuration = null;
|
||||
|
||||
// If there's a version number in the query string we can cache this unconditionally
|
||||
if (!string.IsNullOrEmpty(request.V))
|
||||
{
|
||||
cacheDuration = TimeSpan.FromDays(365);
|
||||
}
|
||||
|
||||
var assembly = GetType().Assembly.GetName();
|
||||
|
||||
return ToStaticResult(assembly.Version.ToString().GetMD5(), null, cacheDuration, MimeTypes.GetMimeType("script.js"), GetStream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the stream.
|
||||
/// </summary>
|
||||
/// <returns>Stream.</returns>
|
||||
private Task<Stream> GetStream()
|
||||
{
|
||||
return Task.FromResult(GetType().Assembly.GetManifestResourceStream("MediaBrowser.Api.Javascript.ApiClient.js"));
|
||||
}
|
||||
}
|
||||
}
|
@ -85,7 +85,6 @@
|
||||
<Compile Include="Images\ImageRequest.cs" />
|
||||
<Compile Include="Images\ImageService.cs" />
|
||||
<Compile Include="Images\ImageWriter.cs" />
|
||||
<Compile Include="Javascript\JavascriptApiClientService.cs" />
|
||||
<Compile Include="Library\LibraryHelpers.cs" />
|
||||
<Compile Include="Library\LibraryService.cs" />
|
||||
<Compile Include="Library\LibraryStructureService.cs" />
|
||||
@ -141,7 +140,6 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Javascript\ApiClient.js" />
|
||||
<Content Include="options.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
|
@ -465,7 +465,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
return item.ScreenshotImagePaths != null && item.ScreenshotImagePaths.Count > 0;
|
||||
}
|
||||
|
||||
if (imageType == ImageType.ChapterImage)
|
||||
if (imageType == ImageType.Chapter)
|
||||
{
|
||||
var video = item as Video;
|
||||
|
||||
|
@ -356,7 +356,7 @@ namespace MediaBrowser.Controller.Drawing
|
||||
return item.ScreenshotImagePaths[imageIndex];
|
||||
}
|
||||
|
||||
if (imageType == ImageType.ChapterImage)
|
||||
if (imageType == ImageType.Chapter)
|
||||
{
|
||||
var video = (Video)item;
|
||||
|
||||
|
@ -678,7 +678,7 @@ namespace MediaBrowser.Controller.Library
|
||||
|
||||
if (!string.IsNullOrEmpty(chapterInfo.ImagePath))
|
||||
{
|
||||
dto.ImageTag = Kernel.Instance.ImageManager.GetImageCacheTag(item, ImageType.ChapterImage, chapterInfo.ImagePath);
|
||||
dto.ImageTag = Kernel.Instance.ImageManager.GetImageCacheTag(item, ImageType.Chapter, chapterInfo.ImagePath);
|
||||
}
|
||||
|
||||
return dto;
|
||||
|
@ -49,6 +49,6 @@ namespace MediaBrowser.Model.Entities
|
||||
/// <summary>
|
||||
/// The chapter image
|
||||
/// </summary>
|
||||
ChapterImage
|
||||
Chapter
|
||||
}
|
||||
}
|
||||
|
54
MediaBrowser.Model/PropertyChanged.xml
Normal file
54
MediaBrowser.Model/PropertyChanged.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>PropertyChanged</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:PropertyChanged.AlsoNotifyForAttribute">
|
||||
<summary>
|
||||
Injects this property to be notified when a dependant property is set.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:PropertyChanged.AlsoNotifyForAttribute.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of <see cref="T:PropertyChanged.DependsOnAttribute"/>.
|
||||
</summary>
|
||||
<param name="property">A property that will be notified for.</param>
|
||||
</member>
|
||||
<member name="M:PropertyChanged.AlsoNotifyForAttribute.#ctor(System.String,System.String[])">
|
||||
<summary>
|
||||
Initializes a new instance of <see cref="T:PropertyChanged.DependsOnAttribute"/>.
|
||||
</summary>
|
||||
<param name="property">A property that will be notified for.</param>
|
||||
<param name="otherProperties">The properties that will be notified for.</param>
|
||||
</member>
|
||||
<member name="T:PropertyChanged.DependsOnAttribute">
|
||||
<summary>
|
||||
Injects this property to be notified when a dependant property is set.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:PropertyChanged.DependsOnAttribute.#ctor(System.String)">
|
||||
<summary>
|
||||
Initializes a new instance of <see cref="T:PropertyChanged.DependsOnAttribute"/>.
|
||||
</summary>
|
||||
<param name="dependency">A property that the assigned property depends on.</param>
|
||||
</member>
|
||||
<member name="M:PropertyChanged.DependsOnAttribute.#ctor(System.String,System.String[])">
|
||||
<summary>
|
||||
Initializes a new instance of <see cref="T:PropertyChanged.DependsOnAttribute"/>.
|
||||
</summary>
|
||||
<param name="dependency">A property that the assigned property depends on.</param>
|
||||
<param name="otherDependencies">The properties that the assigned property depends on.</param>
|
||||
</member>
|
||||
<member name="T:PropertyChanged.DoNotNotifyAttribute">
|
||||
<summary>
|
||||
Exclude a <see cref="T:System.Type"/> or property from notification.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:PropertyChanged.DoNotSetChangedAttribute">
|
||||
<summary>
|
||||
Exclude a <see cref="T:System.Type"/> or property from IsChanged flagging.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using System.Reflection;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller;
|
||||
@ -391,7 +392,6 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
{
|
||||
"http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js",
|
||||
"http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js",
|
||||
"../jsapiclient.js" + versionString,
|
||||
"scripts/all.js" + versionString
|
||||
};
|
||||
|
||||
@ -447,20 +447,27 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
|
||||
var newLineBytes = Encoding.UTF8.GetBytes(Environment.NewLine);
|
||||
|
||||
await AppendResource(assembly, memoryStream, "MediaBrowser.WebDashboard.ApiClient.js", newLineBytes).ConfigureAwait(false);
|
||||
|
||||
foreach (var file in scriptFiles)
|
||||
{
|
||||
using (var stream = assembly.GetManifestResourceStream(resourcePrefix + file))
|
||||
{
|
||||
await stream.CopyToAsync(memoryStream).ConfigureAwait(false);
|
||||
|
||||
await memoryStream.WriteAsync(newLineBytes, 0, newLineBytes.Length).ConfigureAwait(false);
|
||||
}
|
||||
await AppendResource(assembly, memoryStream, resourcePrefix + file, newLineBytes).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
memoryStream.Position = 0;
|
||||
return memoryStream;
|
||||
}
|
||||
|
||||
private async Task AppendResource(Assembly assembly, Stream outputStream, string path, byte[] newLineBytes)
|
||||
{
|
||||
using (var stream = assembly.GetManifestResourceStream(path))
|
||||
{
|
||||
await stream.CopyToAsync(outputStream).ConfigureAwait(false);
|
||||
|
||||
await outputStream.WriteAsync(newLineBytes, 0, newLineBytes.Length).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -403,6 +403,7 @@
|
||||
<EmbeddedResource Include="Html\css\images\mblogotextblack.png" />
|
||||
<EmbeddedResource Include="Html\css\images\mblogotextwhite.png" />
|
||||
<EmbeddedResource Include="Html\css\images\clients\dlna.png" />
|
||||
<EmbeddedResource Include="ApiClient.js" />
|
||||
<Content Include="Html\css\images\stars.png" />
|
||||
<EmbeddedResource Include="Html\scripts\MediaPlayer.js" />
|
||||
</ItemGroup>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.40" targetFramework="net45" />
|
||||
<package id="ServiceStack" version="3.9.38" targetFramework="net45" />
|
||||
<package id="ServiceStack.Common" version="3.9.38" targetFramework="net45" />
|
||||
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.39" targetFramework="net45" />
|
||||
|
Loading…
Reference in New Issue
Block a user