From 177e63e383d43a9e974ed9ac2ed56acbda2129ac Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 4 May 2024 14:54:07 +0200 Subject: [PATCH] Set up simple host test project. --- _tools/pdocs/.gitignore | 3 +++ _tools/pdocs/Main.tscn | 30 ++++++++++++++++++++++++++ _tools/pdocs/WebRoot.gd | 34 ++++++++++++++++++++++++++++++ _tools/pdocs/default_env.tres | 7 +++++++ _tools/pdocs/icon.png | Bin 0 -> 3238 bytes _tools/pdocs/icon.png.import | 35 +++++++++++++++++++++++++++++++ _tools/pdocs/project.pandemonium | 25 ++++++++++++++++++++++ 7 files changed, 134 insertions(+) create mode 100644 _tools/pdocs/.gitignore create mode 100644 _tools/pdocs/Main.tscn create mode 100644 _tools/pdocs/WebRoot.gd create mode 100644 _tools/pdocs/default_env.tres create mode 100644 _tools/pdocs/icon.png create mode 100644 _tools/pdocs/icon.png.import create mode 100644 _tools/pdocs/project.pandemonium diff --git a/_tools/pdocs/.gitignore b/_tools/pdocs/.gitignore new file mode 100644 index 0000000..cb12c8c --- /dev/null +++ b/_tools/pdocs/.gitignore @@ -0,0 +1,3 @@ + +www/ +.import/ diff --git a/_tools/pdocs/Main.tscn b/_tools/pdocs/Main.tscn new file mode 100644 index 0000000..7707580 --- /dev/null +++ b/_tools/pdocs/Main.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=2 format=3] + +[ext_resource path="res://WebRoot.gd" type="Script" id=1] + +[node name="Main" type="Node"] + +[node name="PanelContainer" type="PanelContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="CC" type="CenterContainer" parent="PanelContainer"] +margin_left = 7.0 +margin_top = 7.0 +margin_right = 1017.0 +margin_bottom = 593.0 + +[node name="LinkButton" type="LinkButton" parent="PanelContainer/CC"] +margin_left = 437.0 +margin_top = 286.0 +margin_right = 573.0 +margin_bottom = 300.0 +text = "http://127.0.0.1:8080" +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/" +script = ExtResource( 1 ) diff --git a/_tools/pdocs/WebRoot.gd b/_tools/pdocs/WebRoot.gd new file mode 100644 index 0000000..0731bd2 --- /dev/null +++ b/_tools/pdocs/WebRoot.gd @@ -0,0 +1,34 @@ +extends WebRoot + +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) + + if fabs == "": + request.send_error(HTTPServerEnums.HTTP_STATUS_CODE_404_NOT_FOUND) + return + + var f : File = File.new() + if f.open(fabs, File.READ) != OK: + request.send_error(HTTPServerEnums.HTTP_STATUS_CODE_404_NOT_FOUND) + return + + request.body += markdown_renderer.render(f.get_as_text()) + + f.close() + + 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: + markdown_renderer = MarkdownRenderer.new() diff --git a/_tools/pdocs/default_env.tres b/_tools/pdocs/default_env.tres new file mode 100644 index 0000000..8419635 --- /dev/null +++ b/_tools/pdocs/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment3D" load_steps=2 format=3] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/_tools/pdocs/icon.png b/_tools/pdocs/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..5eaa3d1ad38ef8667b54c5ae78ec23c708023ae7 GIT binary patch literal 3238 zcmV;X3|aGuP)Px>U`a$lRCt`-n|pBF*Hyvm$tcH&MlOwxf#49O%W zO`rif1P5@ZO$wy#5N4SE1!>Y^lBQuW$+(Y%QYbYLAc4j$xFNOku;YhfS;n$0*?PaV zTJ7#{f4_VAVLTzyN*zgi-rs7Pc41^>WQH!LKZL_!fZYPVE`(Tq^;Ny{P)bc8#FHrXH-ke%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