Morph.Wopi
1.23.6
dotnet add package Morph.Wopi --version 1.23.6
NuGet\Install-Package Morph.Wopi -Version 1.23.6
<PackageReference Include="Morph.Wopi" Version="1.23.6" />
<PackageVersion Include="Morph.Wopi" Version="1.23.6" />
<PackageReference Include="Morph.Wopi" />
paket add Morph.Wopi --version 1.23.6
#r "nuget: Morph.Wopi, 1.23.6"
#:package Morph.Wopi@1.23.6
#addin nuget:?package=Morph.Wopi&version=1.23.6
#tool nuget:?package=Morph.Wopi&version=1.23.6
Morph.Wopi
Morph's editor as a WOPI client, for ASP.NET Core (.NET 10). A WOPI host — one built on OfficeHost, or any other that opens files in a client named by its discovery — opens, edits and saves its Word documents in Morph's editor, and shows its workbooks and decks in Morph's viewer, as it would in Office for the web or Collabora Online.
How it works
- The host reads Morph's discovery,
/hosting/discovery: the actions Morph offers (a.docxto view or edit, an.xlsxor.pptxto view), at which URL, and the key Morph signs its requests with. - To open a file, the host page POSTs an access token to the action URL,
/morph/wopi/editor/morph/wopi/viewwith the file'sWOPISrc, in a frame. Morph answers with the editor's page, the file to open written into it. - The editor, Morph.Blazor's
MorphWopirunning in the browser, gets the file's info and its content, locks it, and saves it back, through/morph/wopi/proxy/{operation}: the request goes from the server to the host's WOPI endpoints, signed with the proof key (MS-WOPI 2.2.1).
The editor is a Blazor WebAssembly app whose root component is MorphWopi, which the same application
serves:
// the WebAssembly app
builder.RootComponents.Add<MorphWopi>("#app");
builder.Services.AddScoped(_ => new HttpClient { BaseAddress = new(builder.HostEnvironment.BaseAddress) });
builder.Services.AddMorph();
// the ASP.NET Core application that serves it
builder.Services.AddMorphWopi(
options =>
{
options.BaseUrl = "https://morph.example.com";
options.TrustedHosts.Add("https://files.example.com");
});
var app = builder.Build();
app.MapStaticAssets();
app.MapMorphWopi();
Then point the host at https://morph.example.com/hosting/discovery. See
the sample for both sides running together.
Options
| Option | Default | |
|---|---|---|
BaseUrl |
the request's | The URL the hosts reach Morph at, which the discovery's action URLs start with. |
TrustedHosts |
none | The hosts Morph opens files for, as origins: a WOPISrc on any other is refused, and only these may frame the editor. |
Page |
index.html |
The page of the web root that runs the editor, which the action URLs answer with. |
ProofKey, OldProofKey |
a key made at startup | The RSA keys requests are signed with, published in the discovery. Set them when the application has several instances, or the hosts should not read the discovery again after a restart. |
MaxFileSize |
25 MB | The largest file a save sends to the host. |
What the editor does with the file
A Word document opened to edit is locked while it is open, the lock refreshed every ten minutes, and Save
(Ctrl+S) puts it back over itself; a lock that lapsed is taken again before a save. A file the user may not
save (UserCanWrite, ReadOnly, SupportsUpdate, SupportsLocks), or that someone else has locked,
opens read only with the reason; so do a workbook, a deck, and a file opened to view. The host's breadcrumb
and CloseUrl go in a bar over the editor, and DisablePrint and DisableExport take Print and Download
away. Leaving the page unlocks the file.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.