Set up a WebPermission so the edit links are hidden from the exported static site.

This commit is contained in:
Relintai 2023-01-04 00:51:43 +01:00
parent 739c909ad4
commit 8213d3b0aa
4 changed files with 17 additions and 2 deletions

View File

@ -6,6 +6,8 @@ extends WebServer
var StaticWebServerRequest = preload("res://StaticWebServerRequest.gd")
export(WebPermission) var web_permission : WebPermission
func _ready() -> void:
start()
@ -59,6 +61,10 @@ func write_index(n : WebNode, path : String, uri : String, level : int) -> void:
request._parser_path = uri
request._set_server(self)
request._set_web_root(get_web_root())
if web_permission:
web_permission.activate(request)
request.setup_url_stack()
for i in range(level):

View File

@ -1,16 +1,18 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://WebRoot.tscn" type="PackedScene" id=1]
[ext_resource path="res://StaticMain.gd" type="Script" id=2]
[ext_resource path="res://StaticWebServerSimple.gd" type="Script" id=3]
[ext_resource path="res://StaticMainNode.gd" type="Script" id=4]
[ext_resource path="res://WebRoot.gd" type="Script" id=5]
[ext_resource path="res://web_perm_test/webpermission_static_export.tres" type="WebPermission" id=6]
[node name="StaticMain" type="Node"]
script = ExtResource( 4 )
[node name="StaticMain" type="WebServer" parent="."]
script = ExtResource( 2 )
web_permission = ExtResource( 6 )
[node name="WebRoot" parent="StaticMain" instance=ExtResource( 1 )]
www_root_path = "res://www/"

View File

@ -4,4 +4,4 @@
[resource]
script = ExtResource( 1 )
permissions = 15
permissions = 1

View File

@ -0,0 +1,7 @@
[gd_resource type="WebPermission" load_steps=2 format=2]
[ext_resource path="res://web_perm_test/WebPermTest.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )
permissions = 1