DannyChi commited on
Commit
a36260e
·
verified ·
1 Parent(s): 331aa49

Upload Program.cs

Browse files
Files changed (1) hide show
  1. Program.cs +7 -11
Program.cs CHANGED
@@ -31,7 +31,6 @@ builder.Services.AddHttpClient("VideoProcessingClient")
31
  });
32
 
33
  // Add services to the container.
34
-
35
  builder.Services.AddControllers();
36
 
37
  // �]�w�̤j�ШD��j�p�]�Ҧp�A1 GB�^
@@ -45,7 +44,6 @@ builder.WebHost.ConfigureKestrel(options =>
45
  //});
46
  });
47
 
48
-
49
  var app = builder.Build();
50
 
51
  // �ϥ� CORS
@@ -57,26 +55,24 @@ var provider = new FileExtensionContentTypeProvider();
57
  provider.Mappings[".wasm"] = "application/wasm"; // �� WebAssembly �K�[ MIME ����
58
  provider.Mappings[".data"] = "application/data"; // �� WebAssembly �K�[ MIME ����
59
 
60
- // �����R�A���A�èϥΦۭq MIME �������Ѫ
 
 
 
61
  app.UseStaticFiles(new StaticFileOptions
62
  {
63
  ContentTypeProvider = provider,
64
  OnPrepareResponse = ctx =>
65
  {
66
  Console.WriteLine($"Serving file: {ctx.File.PhysicalPath}");
 
 
 
67
  }
68
  });
69
 
70
- // �����R�A���
71
- app.UseDefaultFiles(); // �|�M�� index.html
72
- app.UseStaticFiles();
73
-
74
  // Configure the HTTP request pipeline.
75
-
76
  app.UseHttpsRedirection();
77
-
78
  app.UseAuthorization();
79
-
80
  app.MapControllers();
81
-
82
  app.Run();
 
31
  });
32
 
33
  // Add services to the container.
 
34
  builder.Services.AddControllers();
35
 
36
  // �]�w�̤j�ШD��j�p�]�Ҧp�A1 GB�^
 
44
  //});
45
  });
46
 
 
47
  var app = builder.Build();
48
 
49
  // �ϥ� CORS
 
55
  provider.Mappings[".wasm"] = "application/wasm"; // �� WebAssembly �K�[ MIME ����
56
  provider.Mappings[".data"] = "application/data"; // �� WebAssembly �K�[ MIME ����
57
 
58
+ // �ϥ� DefaultFiles ������M�� index.html
59
+ app.UseDefaultFiles();
60
+
61
+ // �����R�A���A�èϥΦۭq�� MIME �������Ѫ̻P���Y
62
  app.UseStaticFiles(new StaticFileOptions
63
  {
64
  ContentTypeProvider = provider,
65
  OnPrepareResponse = ctx =>
66
  {
67
  Console.WriteLine($"Serving file: {ctx.File.PhysicalPath}");
68
+ // �[�J COOP �P COEP ���Y
69
+ ctx.Context.Response.Headers["Cross-Origin-Opener-Policy"] = "same-origin";
70
+ ctx.Context.Response.Headers["Cross-Origin-Embedder-Policy"] = "require-corp";
71
  }
72
  });
73
 
 
 
 
 
74
  // Configure the HTTP request pipeline.
 
75
  app.UseHttpsRedirection();
 
76
  app.UseAuthorization();
 
77
  app.MapControllers();
 
78
  app.Run();