mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 17:17:31 -04:00
api add gate
This commit is contained in:
parent
e3d4fcd847
commit
106554a6b4
4 changed files with 28 additions and 2 deletions
|
@ -6,4 +6,4 @@
|
|||
script = ExtResource("1_oiju7")
|
||||
local_url = "http://127.0.0.1:8000"
|
||||
remote_url = "http://95.163.241.188:8000"
|
||||
host_type = 1
|
||||
host_type = 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=15 format=3 uid="uid://ct8gsph3wnepl"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://ct8gsph3wnepl"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/app.gd" id="1_skc7d"]
|
||||
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_cdryv"]
|
||||
|
@ -14,6 +14,7 @@
|
|||
[ext_resource type="Resource" uid="uid://cjcdum6fm4ta0" path="res://resources/backend.tres" id="7_yykjj"]
|
||||
[ext_resource type="Script" path="res://scripts/analytics/analytics_sender_error.gd" id="8_ah58q"]
|
||||
[ext_resource type="Script" path="res://scripts/analytics/analytics_sender_gate.gd" id="9_egxpy"]
|
||||
[ext_resource type="Script" path="res://scripts/api_add_gate.gd" id="14_enhvg"]
|
||||
|
||||
[node name="App" type="Node" node_paths=PackedStringArray("scenes_root")]
|
||||
script = ExtResource("1_skc7d")
|
||||
|
@ -48,6 +49,11 @@ script = ExtResource("8_ah58q")
|
|||
script = ExtResource("9_egxpy")
|
||||
gate_events = ExtResource("2_cdryv")
|
||||
|
||||
[node name="ApiAddGate" type="Node" parent="."]
|
||||
script = ExtResource("14_enhvg")
|
||||
backend = ExtResource("7_yykjj")
|
||||
gate_events = ExtResource("2_cdryv")
|
||||
|
||||
[node name="Menu" parent="." instance=ExtResource("3_o1f7b")]
|
||||
|
||||
[editable path="Debug"]
|
||||
|
|
17
project/scripts/api_add_gate.gd
Normal file
17
project/scripts/api_add_gate.gd
Normal file
|
@ -0,0 +1,17 @@
|
|||
extends Node
|
||||
|
||||
@export var backend: BackendSettings
|
||||
@export var gate_events: GateEvents
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
gate_events.open_gate.connect(send_add_gate)
|
||||
|
||||
|
||||
func send_add_gate(gate_url: String) -> void:
|
||||
var url = backend.add_gate + gate_url.uri_encode()
|
||||
var callback = func(_result, code, _headers, _body):
|
||||
if code != 200: Debug.logclr("Request send_open_gate failed. Code " + str(code), Color.RED)
|
||||
|
||||
var err = await Backend.request(url, callback, {}, HTTPClient.METHOD_POST)
|
||||
if err != HTTPRequest.RESULT_SUCCESS: Debug.logclr("Cannot send request send_open_gate", Color.RED)
|
|
@ -19,5 +19,8 @@ var analytics_event: String :
|
|||
var get_user_id: String :
|
||||
get: return url + "/api/get_user_id?device_id="
|
||||
|
||||
var add_gate: String :
|
||||
get: return url + "/api/add_gate?url="
|
||||
|
||||
var search: String :
|
||||
get: return url + "/api/search?query="
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue