-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,237 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
using System.Diagnostics; | ||
using System.Text.Json.Nodes; | ||
|
||
using Umbraco.Cms.Core.Composing; | ||
using Umbraco.Cms.Core.DependencyInjection; | ||
using Umbraco.Cms.Core.Manifest; | ||
using Umbraco.Cms.Core.Semver; | ||
using Umbraco.Cms.Infrastructure.Manifest; | ||
using Umbraco.Extensions; | ||
|
||
namespace uSync.Backoffice.Management.Client; | ||
|
||
public class uSyncManifestComposer : IComposer | ||
{ | ||
public void Compose(IUmbracoBuilder builder) | ||
{ | ||
builder.Services.AddSingleton<IPackageManifestReader, uSyncManifestReader>(); | ||
} | ||
} | ||
|
||
internal sealed class uSyncManifestReader : IPackageManifestReader | ||
{ | ||
public Task<IEnumerable<PackageManifest>> ReadPackageManifestsAsync() | ||
{ | ||
var entrypoint = JsonObject.Parse(@"{""name"": ""usync.entrypoint"", | ||
""alias"": ""uSync.EntryPoint"", | ||
""type"": ""entryPoint"", | ||
""js"": ""/App_Plugins/uSync/usync.js""}"); | ||
|
||
List<PackageManifest> manifest = [ | ||
new PackageManifest | ||
{ | ||
Id = "uSync", | ||
Name = "uSync", | ||
AllowTelemetry = true, | ||
Version = GetuSyncVersion(), | ||
Extensions = [ entrypoint!], | ||
Importmap = new PackageManifestImportmap | ||
{ | ||
Imports = new Dictionary<string, string> | ||
{ | ||
{ "@jumoo/uSync", "/App_Plugins/uSync/usync.js" }, | ||
{ "@jumoo/uSync/external/signalr", "/App_Plugins/uSync/usync.js" } | ||
} | ||
} | ||
} | ||
]; | ||
|
||
return Task.FromResult(manifest.AsEnumerable()); | ||
} | ||
|
||
private string GetuSyncVersion() | ||
{ | ||
var assembly = typeof(uSyncManifestReader).Assembly; | ||
try | ||
{ | ||
var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.GetAssemblyFile().FullName); | ||
var productVersion = SemVersion.Parse(fileVersionInfo.ProductVersion ?? assembly.GetName()?.Version?.ToString(3) ?? "14.2.0"); | ||
return productVersion.ToSemanticStringWithoutBuild(); | ||
} | ||
catch | ||
{ | ||
return assembly.GetName()?.Version?.ToString(3) ?? "14.0.0"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
uSync.Backoffice.Management.Client/usync-assets/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
uSync.Backoffice.Management.Client/usync-assets/public/umbraco-package.json
This file was deleted.
Oops, something went wrong.
24 changes: 16 additions & 8 deletions
24
uSync.Backoffice.Management.Client/usync-assets/src/api/core/ApiRequestOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
export type ApiRequestOptions = { | ||
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; | ||
readonly url: string; | ||
readonly path?: Record<string, unknown>; | ||
export type ApiRequestOptions<T = unknown> = { | ||
readonly body?: any; | ||
readonly cookies?: Record<string, unknown>; | ||
readonly errors?: Record<number | string, string>; | ||
readonly formData?: Record<string, unknown> | any[] | Blob | File; | ||
readonly headers?: Record<string, unknown>; | ||
readonly query?: Record<string, unknown>; | ||
readonly formData?: Record<string, unknown>; | ||
readonly body?: any; | ||
readonly mediaType?: string; | ||
readonly method: | ||
| 'DELETE' | ||
| 'GET' | ||
| 'HEAD' | ||
| 'OPTIONS' | ||
| 'PATCH' | ||
| 'POST' | ||
| 'PUT'; | ||
readonly path?: Record<string, unknown>; | ||
readonly query?: Record<string, unknown>; | ||
readonly responseHeader?: string; | ||
readonly errors?: Record<number, string>; | ||
readonly responseTransformer?: (data: unknown) => Promise<T>; | ||
readonly url: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.