From 3e864c7ebfa1f03573cf6f7c8dd13251142810e6 Mon Sep 17 00:00:00 2001 From: Allan Ritchie Date: Sat, 23 Dec 2023 23:37:19 -0500 Subject: [PATCH] Add apple domain association --- .../.template.config/ide.host.json | 27 ++++++++++------- .../.template.config/template.json | 15 ++++++++-- ProjectTemplates/ShinyAspNet/Program.cs | 14 ++++++++- .../.well-known/apple-app-site-association | 29 +++++++++++++++++++ 4 files changed, 72 insertions(+), 13 deletions(-) create mode 100644 ProjectTemplates/ShinyAspNet/wwwroot/.well-known/apple-app-site-association diff --git a/ProjectTemplates/ShinyAspNet/.template.config/ide.host.json b/ProjectTemplates/ShinyAspNet/.template.config/ide.host.json index d579bc7..1ebe486 100644 --- a/ProjectTemplates/ShinyAspNet/.template.config/ide.host.json +++ b/ProjectTemplates/ShinyAspNet/.template.config/ide.host.json @@ -28,65 +28,72 @@ { "id": "push", "name": { - "text": "Push Notification Management (Shiny.Extensions.Push)" + "text": "Add Push Notification Management (Shiny.Extensions.Push)" }, "isVisible": true }, { "id": "email", "name": { - "text": "Email Templating (Shiny.Extensions.Email)" + "text": "Add Email Templating (Shiny.Extensions.Email)" }, "isVisible": true }, { "id": "signalr", "name": { - "text": "SignalR" + "text": "Add SignalR" }, "isVisible": true }, { "id": "google", "name": { - "text": "Google Authentication" + "text": "Add Google Authentication" }, "isVisible": true }, { "id": "facebook", "name": { - "text": "Facebook Authentication" + "text": "Add Facebook Authentication" }, "isVisible": true }, { "id": "apple", "name": { - "text": "Apple Authentication" + "text": "Add Apple Authentication" }, "isVisible": true }, { "id": "mobileauth", "name": { - "text": "Mobile Authentication Endpoints" + "text": "Add Mobile Authentication Endpoints" }, "isVisible": true }, { "id": "orleans", "name": { - "text": "Microsoft Orleans" + "text": "Add Microsoft Orleans" }, "isVisible": true }, { "id": "swagger", "name": { - "text": "Swagger" + "text": "Add Swagger" }, "isVisible": true - } + }, + { + "id": "appledomain", + "name": { + "text": "Include Apple Domain Association Fil" + }, + "isVisible": true + } ] } \ No newline at end of file diff --git a/ProjectTemplates/ShinyAspNet/.template.config/template.json b/ProjectTemplates/ShinyAspNet/.template.config/template.json index 7bfc6a5..9585362 100644 --- a/ProjectTemplates/ShinyAspNet/.template.config/template.json +++ b/ProjectTemplates/ShinyAspNet/.template.config/template.json @@ -116,7 +116,7 @@ "datatype": "bool", "defaultValue": "true", "description": "Microsoft Orleans", - "displayName": "Microsoft Orleans" + "displayName": "Microsoft Orleans" }, "swagger": { "type": "parameter", @@ -125,6 +125,13 @@ "description": "Swagger", "displayName": "Swagger" }, + "appledomain": { + "type": "parameter", + "datatype": "bool", + "defaultValue": "true", + "description": "Include Apple Domain Association File", + "displayName": "Include Apple Domain Association File" + }, "efsql":{ "type": "computed", "datatype": "bool", @@ -151,7 +158,11 @@ { "condition": "(orleans == false)", "exclude": "Grains/**" - }, + }, + { + "condition": "(appledomain == false)", + "exclude": "wwwroot/**" + }, { "condition": "(signalr == false)", "exclude": "Hubs/**" diff --git a/ProjectTemplates/ShinyAspNet/Program.cs b/ProjectTemplates/ShinyAspNet/Program.cs index 445858c..e62b9cd 100644 --- a/ProjectTemplates/ShinyAspNet/Program.cs +++ b/ProjectTemplates/ShinyAspNet/Program.cs @@ -161,7 +161,7 @@ { ep.PostProcessors(Order.After, new EmptyResponseGlobalPostProcessor()); }); -app.UseExceptionHandler(); +// app.UseExceptionHandler(); //#if (signalr) app.MapHub("/biz"); @@ -174,6 +174,7 @@ .AllowAnyHeader() .AllowAnyMethod() .AllowAnyOrigin() + // .WithOrigins("https://localhost:1234") //.AllowCredentials() ); #endif @@ -201,5 +202,16 @@ }); #endif } +#if (appledomain) +app.UseStaticFiles(new StaticFileOptions +{ + FileProvider = new PhysicalFileProvider( + Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/.well-known") + ), + RequestPath = "/.well-known", + ServeUnknownFileTypes = true, + DefaultContentType = "text/plain" +}); +#endif app.Run(); \ No newline at end of file diff --git a/ProjectTemplates/ShinyAspNet/wwwroot/.well-known/apple-app-site-association b/ProjectTemplates/ShinyAspNet/wwwroot/.well-known/apple-app-site-association new file mode 100644 index 0000000..0b1b186 --- /dev/null +++ b/ProjectTemplates/ShinyAspNet/wwwroot/.well-known/apple-app-site-association @@ -0,0 +1,29 @@ +{ + "applinks": { + "details": [{ + "appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ], + "components": [{ + "#": "no_universal_links", + "exclude": true, + "comment": "Matches any URL with a fragment that equals no_universal_links and instructs the system not to open it as a universal link." + },{ + "/": "/buy/*", + "comment": "Matches any URL with a path that starts with /buy/." + },{ + "/": "/help/website/*", + "exclude": true, + "comment": "Matches any URL with a path that starts with /help/website/ and instructs the system not to open it as a universal link." + },{ + "/": "/help/*", + "?": { "articleNumber": "????" }, + "comment": "Matches any URL with a path that starts with /help/ and that has a query item with name 'articleNumber' and a value of exactly four characters." + }] + }] + }, + "webcredentials": { + "apps": [ "ABCDE12345.com.example.app" ] + }, + "appclips": { + "apps": ["ABCED12345.com.example.MyApp.Clip"] + } +} \ No newline at end of file