diff --git a/_tools/pdocs/WebRoot.gd b/_tools/pdocs/BrowsableFolderServeWebPage.gd similarity index 87% rename from _tools/pdocs/WebRoot.gd rename to _tools/pdocs/BrowsableFolderServeWebPage.gd index 0731bd2..3aad457 100644 --- a/_tools/pdocs/WebRoot.gd +++ b/_tools/pdocs/BrowsableFolderServeWebPage.gd @@ -1,11 +1,11 @@ -extends WebRoot +extends BrowsableFolderServeWebPage var markdown_renderer : MarkdownRenderer = null func serve_md(request: WebServerRequest) -> void: var path : String = request.get_path_full() - var fabs : String = www_root_file_cache.wwwroot_get_file_abspath(path) + var fabs : String = get_file_cache().wwwroot_get_file_abspath(path) if fabs == "": request.send_error(HTTPServerEnums.HTTP_STATUS_CODE_404_NOT_FOUND) @@ -23,11 +23,11 @@ func serve_md(request: WebServerRequest) -> void: request.compile_and_send_body() func _handle_request_main(request: WebServerRequest) -> void: - + if request.get_path_full().ends_with(".md"): serve_md(request) return - + ._handle_request_main(request) func _ready() -> void: diff --git a/_tools/pdocs/Main.tscn b/_tools/pdocs/Main.tscn index 7707580..c8b4409 100644 --- a/_tools/pdocs/Main.tscn +++ b/_tools/pdocs/Main.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3] -[ext_resource path="res://WebRoot.gd" type="Script" id=1] +[ext_resource path="res://BrowsableFolderServeWebPage.gd" type="Script" id=1] [node name="Main" type="Node"] @@ -25,6 +25,7 @@ uri = "http://127.0.0.1:8080" [node name="WebServerSimple" type="WebServerSimple" parent="."] start_on_ready = true -[node name="WebRoot" type="WebRoot" parent="WebServerSimple"] -www_root_path = "res://www/" +[node name="BrowsableFolderServeWebPage" type="BrowsableFolderServeWebPage" parent="WebServerSimple"] +uri_segment = "/" +serve_folder = "res://www/" script = ExtResource( 1 )