add crude keyboard and paste auth from clipboard

This commit is contained in:
Nitwel 2023-11-21 11:40:06 +01:00
parent 842815b24a
commit dd86310ab8
7 changed files with 140 additions and 56 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:73572171e36cd0fe5a0b2cf38e42d871f16b086b0e5d9c9084db451d88496dd0
size 3271063
oid sha256:8bc1c66cc868d68efe828c304c6ed348136cdfd8b814fe0f243954f328648997
size 3586528

View File

@ -0,0 +1,51 @@
extends Node3D
const button_scene = preload("res://content/ui/components/button/button.tscn")
@onready var keys = $Keys
@onready var caps_button = $Caps
var key_list = [
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "~"],
["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "/"],
["A", "S", "D", "F", "G", "H", "J", "K", "L", ":", "\\"],
["Z", "X", "C", "V", "B", "N", "M", ",", ".", "-"]
]
var caps = false
func _ready():
for row in key_list:
for key in row:
print(key)
var button = create_key(key)
keys.add_child(button)
keys.columns = key_list[0].size()
func _on_click(event):
if event.target == caps_button:
caps = event.active
return
var code = event.target.get_children()[event.target.get_child_count() - 1].text
if caps:
code = code.to_upper()
else:
code = code.to_lower()
Events.typed.emit(code)
print(code)
func create_key(key: String):
var button = button_scene.instantiate()
var label = Label3D.new()
label.text = key
label.pixel_size = 0.001
label.position = Vector3(0, 0.012, 0)
label.rotate_x(deg_to_rad(-90))
button.add_child(label)
return button

View File

@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://lrehk38exd5n"]
[ext_resource type="Script" path="res://content/ui/keyboard/keyboard.gd" id="1_maojw"]
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_xdpwr"]
[ext_resource type="Script" path="res://content/ui/menu/grid.gd" id="3_mx544"]
[node name="Keyboard" type="Node3D"]
script = ExtResource("1_maojw")
[node name="Caps" parent="." instance=ExtResource("1_xdpwr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0668889, 0, 0.03)
toggleable = true
[node name="Label3D" type="Label3D" parent="Caps"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.012, 0)
pixel_size = 0.001
text = "caps"
[node name="Keys" type="Node3D" parent="."]
script = ExtResource("3_mx544")
columns = 1
depth_gap = 0.06
size = Vector3(0.6, 1, 1)

View File

@ -15,6 +15,54 @@
[sub_resource type="BoxMesh" id="BoxMesh_08du6"]
size = Vector3(0.3, 0.01, 0.3)
[sub_resource type="Animation" id="Animation_61md4"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AnimationContainer:scale:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("AnimationContainer:scale:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/2/type = "bezier"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("AnimationContainer:scale:z")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("AnimationContainer:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_lkh72"]
resource_name = "hide_menu"
length = 0.4
@ -98,54 +146,6 @@ tracks/6/keys = {
"values": [true, false]
}
[sub_resource type="Animation" id="Animation_61md4"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AnimationContainer:scale:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("AnimationContainer:scale:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/2/type = "bezier"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("AnimationContainer:scale:z")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("AnimationContainer:visible")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_s30cd"]
_data = {
"RESET": SubResource("Animation_61md4"),

View File

@ -11,3 +11,5 @@ signal on_grab_move(event: Dictionary)
signal on_grab_up(event: Dictionary)
signal on_ray_enter(event: Dictionary)
signal on_ray_leave(event: Dictionary)
signal typed(key: String)

View File

@ -24,7 +24,16 @@ const methods = [
var adapter: Node
func _init(type: ADAPTER_TYPES):
var clipboard := DisplayServer.clipboard_get()
if clipboard != null:
var clip_url = clipboard.split(" ")[0]
var clip_token = clipboard.split(" ")[1]
adapter = adapters[type].new(clip_url, clip_token)
else:
adapter = adapters[type].new()
add_child(adapter)
for method in methods:

View File

@ -5,11 +5,10 @@ var socket := WebSocketPeer.new()
# in seconds
var request_timeout := 10.0
var url := "ws://192.168.33.33:8123/api/websocket"
var token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIzZjQ0ZGM2N2Y3YzY0MDc1OGZlMWI2ZjJlNmIxZjRkNSIsImlhdCI6MTY5ODAxMDcyOCwiZXhwIjoyMDEzMzcwNzI4fQ.K6ydLUC-4Q7BNIRCU1nWlI2s6sg9UCiOu-Lpedw2zJc"
# var url := "wss://8ybjhqcinfcdyvzu.myfritz.net:8123/api/websocket"
# var token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjNjU0ZDE3NDc2ZGM0NzU1OGY5NjIzMmM5ZjdjYzE2YSIsImlhdCI6MTY5OTgyMzcxOCwiZXhwIjoyMDE1MTgzNzE4fQ.XHlfnXUd16HaV9XjYrxzuNg23nFFeoEsIsaMVXwRkd8"
var url := ""
var token := ""
var LOG_MESSAGES := false