File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
dotnet/RAWebServer/src/modules Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -155,12 +155,24 @@ public void ProcessRequest(HttpContext context) {
155155 // read file
156156 var html = File . ReadAllText ( _fullPath , Encoding . UTF8 ) ;
157157
158+ // check for inject/index.css and inject/index.js
159+ var injectDir = context . Server . MapPath ( "~/App_Data/inject/" ) ;
160+ var cssPath = Path . Combine ( injectDir , "index.css" ) ;
161+ var jsPath = Path . Combine ( injectDir , "index.js" ) ;
162+ var injectBuilder = new StringBuilder ( ) ;
163+ if ( File . Exists ( cssPath ) ) {
164+ injectBuilder . AppendLine ( "<link rel=\" stylesheet\" type=\" text/css\" href=\" " + VirtualPathUtility . ToAbsolute ( "~/inject/index.css" ) + "\" />" ) ;
165+ }
166+ if ( File . Exists ( jsPath ) ) {
167+ injectBuilder . AppendLine ( "<script type=\" text/javascript\" src=\" " + VirtualPathUtility . ToAbsolute ( "~/inject/index.js" ) + "\" ></script>" ) ;
168+ }
169+
158170 // token replacement
159171 var machineDisplayName =
160172 new AliasResolver ( ) . Resolve ( Environment . MachineName ) ;
161173 html = html . Replace ( "%raweb.servername%" , machineDisplayName ) ;
162174 html = html . Replace ( "%raweb.basetag%" , "<base href=\" " + VirtualPathUtility . ToAbsolute ( "~/" ) + "\" />" ) ;
163- html = html . Replace ( "%raweb.overrides%" , "" ) ;
175+ html = html . Replace ( "%raweb.overrides%" , injectBuilder . ToString ( ) ) ;
164176
165177 context . Response . ContentType = "text/html; charset=utf-8" ;
166178 context . Response . Write ( html ) ;
You can’t perform that action at this time.
0 commit comments