File tree Expand file tree Collapse file tree 1 file changed +0
-28
lines changed
Expand file tree Collapse file tree 1 file changed +0
-28
lines changed Original file line number Diff line number Diff line change @@ -15,34 +15,6 @@ public void Configure(IWebHostBuilder builder) => builder
1515 context . Configuration . GetSection ( nameof ( AppConfig ) ) . Bind ( AppConfig . Instance ) ;
1616 services . AddSingleton ( AppConfig . Instance ) ;
1717 } ) ;
18-
19- public override void Configure ( )
20- {
21- AppConfig . Instance . GitPagesBaseUrl ??= ResolveGitBlobBaseUrl ( ContentRootDirectory ) ;
22-
23- SetConfig ( new HostConfig
24- {
25- AllowFileExtensions = { "cast" }
26- } ) ;
27- }
28-
29- private string ? ResolveGitBlobBaseUrl ( IVirtualDirectory contentDir )
30- {
31- var srcDir = new DirectoryInfo ( contentDir . RealPath ) ;
32- var gitConfig = new FileInfo ( Path . Combine ( srcDir . Parent ! . FullName , ".git" , "config" ) ) ;
33- if ( gitConfig . Exists )
34- {
35- var txt = gitConfig . ReadAllText ( ) ;
36- var pos = txt . IndexOf ( "url = " , StringComparison . Ordinal ) ;
37- if ( pos >= 0 )
38- {
39- var url = txt [ ( pos + "url = " . Length ) ..] . LeftPart ( ".git" ) . LeftPart ( '\n ' ) . Trim ( ) ;
40- var gitBaseUrl = url . CombineWith ( $ "blob/main/{ srcDir . Name } ") ;
41- return gitBaseUrl ;
42- }
43- }
44- return null ;
45- }
4618}
4719
4820public class AppConfig
You can’t perform that action at this time.
0 commit comments