Use server.py from wasm sdk
This commit is contained in:
parent
a1dab5fc06
commit
95adaad77c
|
@ -33,7 +33,6 @@ namespace Ooui.Wasm.Build.Tasks
|
|||
ExtractClientJs ();
|
||||
DiscoverEntryPoint ();
|
||||
GenerateHtml ();
|
||||
GenerateServer ();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
@ -96,6 +95,7 @@ namespace Ooui.Wasm.Build.Tasks
|
|||
Log.LogMessage ($"Runtime {src} -> {dest}");
|
||||
File.Copy (src, dest, true);
|
||||
}
|
||||
File.Copy (Path.Combine (sdkPath, "server.py"), Path.Combine (distPath, "server.py"), true);
|
||||
}
|
||||
|
||||
List<string> linkedAsmPaths;
|
||||
|
@ -288,23 +288,5 @@ namespace Ooui.Wasm.Build.Tasks
|
|||
}
|
||||
Log.LogMessage ($"HTML {htmlPath}");
|
||||
}
|
||||
|
||||
void GenerateServer ()
|
||||
{
|
||||
var server = @"import SimpleHTTPServer
|
||||
import SocketServer
|
||||
PORT = 8000
|
||||
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
pass
|
||||
Handler.extensions_map["".wasm""] = ""application/wasm""
|
||||
httpd = SocketServer.TCPServer(("""", PORT), Handler)
|
||||
print ""serving at port"", PORT
|
||||
httpd.serve_forever()";
|
||||
var serverPath = Path.Combine (distPath, "server.py");
|
||||
using (var w = new StreamWriter (serverPath, false, new UTF8Encoding (false))) {
|
||||
w.WriteLine (server);
|
||||
}
|
||||
Log.LogMessage ($"Server {serverPath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue