Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project tye experiment #105

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="net5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources />
</configuration>
3 changes: 3 additions & 0 deletions WOPI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
LICENSE.txt = LICENSE.txt
NOTICE.txt = NOTICE.txt
.github\workflows\pull_request.yml = .github\workflows\pull_request.yml
NuGet.config = NuGet.config
ORIGINAL_WORK_LICENSE.txt = ORIGINAL_WORK_LICENSE.txt
README.md = README.md
.github\workflows\release.yml = .github\workflows\release.yml
tye.yaml = tye.yaml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.CobaltCore", "Microsoft.CobaltCore", "{F66706B6-D7DD-48FB-963C-870B3D611500}"
Expand Down
10 changes: 6 additions & 4 deletions WopiHost.Web/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;

namespace WopiHost.Web.Controllers
{
Expand All @@ -21,16 +22,18 @@ public class HomeController : Controller
private IOptionsSnapshot<WopiOptions> WopiOptions { get; }
private IWopiStorageProvider StorageProvider { get; }
private IDiscoverer Discoverer { get; }
public IConfiguration Configuration { get; }


//TODO: remove test culture value and load it from configuration SECTION
public WopiUrlBuilder UrlGenerator => _urlGenerator ??= new WopiUrlBuilder(Discoverer, new WopiUrlSettings { UiLlcc = new CultureInfo("en-US") });

public HomeController(IOptionsSnapshot<WopiOptions> wopiOptions, IWopiStorageProvider storageProvider, IDiscoverer discoverer)
public HomeController(IOptionsSnapshot<WopiOptions> wopiOptions, IWopiStorageProvider storageProvider, IDiscoverer discoverer, IConfiguration configuration)
{
WopiOptions = wopiOptions;
StorageProvider = storageProvider;
Discoverer = discoverer;
Configuration = configuration;
}

public async Task<ActionResult> Index()
Expand Down Expand Up @@ -76,10 +79,9 @@ public async Task<ActionResult> Detail(string id, string wopiAction)
//ViewData["access_token_ttl"] = //token.ValidTo

//http://dotnet-stuff.com/tutorials/aspnet-mvc/how-to-render-different-layout-in-asp-net-mvc



var extension = file.Extension.TrimStart('.');
ViewData["urlsrc"] = await UrlGenerator.GetFileUrlAsync(extension, $"{WopiOptions.Value.HostUrl}/wopi/files/{id}", actionEnum);
ViewData["urlsrc"] = await UrlGenerator.GetFileUrlAsync(extension, $"{Configuration.GetServiceUri("wopihost")}wopi/files/{id}", actionEnum);
ViewData["favicon"] = await Discoverer.GetApplicationFavIconAsync(extension);
return View();
}
Expand Down
1 change: 0 additions & 1 deletion WopiHost.Web/Models/WopiOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
public class WopiOptions
{
public string HostUrl { get; set; }
public string ClientUrl { get; set; }
}
}
50 changes: 25 additions & 25 deletions WopiHost.Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52783/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WopiHost": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52783",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WopiHost.Web": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
8 changes: 1 addition & 7 deletions WopiHost.Web/WopiHost.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.4" />
<PackageReference Include="Microsoft.Tye.Extensions.Configuration" Version="0.6.0-alpha.21070.5" />
</ItemGroup>

<ItemGroup>
Expand All @@ -28,11 +29,4 @@
<ProjectReference Include="..\WopiHost.Url\WopiHost.Url.csproj" />
</ItemGroup>

<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="npm install" />
<Exec Command="bower install" />
<Exec Command="gulp clean" />
<Exec Command="gulp min" />
</Target>

</Project>
4 changes: 2 additions & 2 deletions WopiHost.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"StorageProviderOptions": {
"RootPath": "..\\WopiHost\\wwwroot\\wopi-docs"
},
"HostUrl": "http://rocky-ntb:5000",
"ClientUrl": "http://owaserver"
},
"Logging": {
Expand All @@ -13,5 +12,6 @@
"System": "Information",
"Microsoft": "Information"
}
}
},
"AllowedHosts": "*"
}
17 changes: 17 additions & 0 deletions tye.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# tye application configuration file
# read all about it at https://github.com/dotnet/tye
#
# when you've given us a try, we'd love to know what you think:
# https://aka.ms/AA7q20u
#
name: wopi
services:
- name: wopihost
project: WopiHost/WopiHost.csproj
bindings:
- port: 5000
host: DESKTOP-C6H53HB
args: --urls http://*:5000

- name: wopihost-web
project: WopiHost.Web/WopiHost.Web.csproj