mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 08:17:34 -04:00
add license, move folders
This commit is contained in:
parent
185cc74060
commit
271c4a46a1
132 changed files with 21 additions and 0 deletions
32
app/scripts/resources/api_settings.gd
Normal file
32
app/scripts/resources/api_settings.gd
Normal file
|
@ -0,0 +1,32 @@
|
|||
extends Resource
|
||||
class_name ApiSettings
|
||||
|
||||
enum HostType {
|
||||
Local,
|
||||
Remote
|
||||
}
|
||||
|
||||
@export var local_url: String
|
||||
@export var remote_url: String
|
||||
@export var host_type: HostType
|
||||
|
||||
var url: String :
|
||||
get: return local_url if host_type == HostType.Local else remote_url
|
||||
|
||||
var analytics_event: String :
|
||||
get: return url + "/api/analytics_event"
|
||||
|
||||
var create_user_id: String :
|
||||
get: return url + "/api/create_user_id"
|
||||
|
||||
var discover_gate: String :
|
||||
get: return url + "/api/discover_gate"
|
||||
|
||||
var featured_gates: String :
|
||||
get: return url + "/api/featured_gates"
|
||||
|
||||
var search: String :
|
||||
get: return url + "/api/search?query="
|
||||
|
||||
var prompt: String :
|
||||
get: return url + "/api/prompt?query="
|
53
app/scripts/resources/bookmarks.gd
Normal file
53
app/scripts/resources/bookmarks.gd
Normal file
|
@ -0,0 +1,53 @@
|
|||
extends Resource
|
||||
class_name Bookmarks
|
||||
|
||||
signal on_ready()
|
||||
signal on_star(gate: Gate, featured: bool)
|
||||
signal on_unstar(gate: Gate)
|
||||
signal save_image(gate: Gate)
|
||||
|
||||
@export var starred_gates: Array[Gate]
|
||||
|
||||
var is_ready: bool
|
||||
var gates = {}
|
||||
|
||||
|
||||
func ready() -> void:
|
||||
for gate in starred_gates:
|
||||
if gate == null or not Url.is_valid(gate.url): continue
|
||||
gates[gate.url] = gate
|
||||
|
||||
is_ready = true
|
||||
on_ready.emit()
|
||||
|
||||
|
||||
func update(gate: Gate) -> void:
|
||||
if not gates.has(gate.url): return
|
||||
|
||||
var replace = gates[gate.url]
|
||||
|
||||
gates[gate.url] = gate
|
||||
starred_gates.erase(replace)
|
||||
starred_gates.append(gate)
|
||||
|
||||
save_image.emit(gate)
|
||||
|
||||
|
||||
func star(gate: Gate, featured: bool = false) -> void:
|
||||
if gates.has(gate.url): return
|
||||
|
||||
gates[gate.url] = gate
|
||||
starred_gates.append(gate)
|
||||
|
||||
on_star.emit(gate, featured)
|
||||
save_image.emit(gate)
|
||||
|
||||
|
||||
func unstar(gate: Gate) -> void:
|
||||
if not gates.has(gate.url): return
|
||||
|
||||
var erase: Gate = gates[gate.url]
|
||||
gates.erase(erase.url)
|
||||
starred_gates.erase(erase)
|
||||
|
||||
on_unstar.emit(gate)
|
13
app/scripts/resources/command_events.gd
Normal file
13
app/scripts/resources/command_events.gd
Normal file
|
@ -0,0 +1,13 @@
|
|||
extends Resource
|
||||
class_name CommandEvents
|
||||
|
||||
signal send_filehandle(filehandle_path: String)
|
||||
signal set_mouse_mode(mode: int)
|
||||
|
||||
|
||||
func send_filehandle_emit(filehandle_path: String) -> void:
|
||||
send_filehandle.emit(filehandle_path)
|
||||
|
||||
|
||||
func set_mouse_mode_emit(mode: int) -> void:
|
||||
set_mouse_mode.emit(mode)
|
25
app/scripts/resources/gate.gd
Normal file
25
app/scripts/resources/gate.gd
Normal file
|
@ -0,0 +1,25 @@
|
|||
extends Resource
|
||||
class_name Gate
|
||||
|
||||
@export var url: String:
|
||||
set(value): url = Url.fix_gate_url(value)
|
||||
|
||||
@export var title: String
|
||||
@export var description: String
|
||||
@export_file("*.png", "*.jpg") var image: String
|
||||
var resource_pack: String
|
||||
|
||||
# local path where libs downloaded
|
||||
var shared_libs_dir: String
|
||||
|
||||
|
||||
static func create(_url: String, _title: String, _description: String,
|
||||
_image: String, _resource_pack: String, _shared_libs_dir: String) -> Gate:
|
||||
var gate = Gate.new()
|
||||
gate.url = _url
|
||||
gate.title = _title
|
||||
gate.description = _description
|
||||
gate.image = _image
|
||||
gate.resource_pack = _resource_pack
|
||||
gate.shared_libs_dir = _shared_libs_dir
|
||||
return gate
|
72
app/scripts/resources/gate_events.gd
Normal file
72
app/scripts/resources/gate_events.gd
Normal file
|
@ -0,0 +1,72 @@
|
|||
extends Resource
|
||||
class_name GateEvents
|
||||
|
||||
signal search(query: String)
|
||||
signal open_gate(url: String)
|
||||
signal gate_config_loaded(url: String, config: ConfigGate)
|
||||
signal gate_info_loaded(gate: Gate, is_cached: bool)
|
||||
signal gate_loaded(gate: Gate)
|
||||
signal gate_entered
|
||||
signal exit_gate
|
||||
|
||||
signal download_progress(url: String, body_size: int, downloaded_bytes: int)
|
||||
signal gate_error(code: GateError)
|
||||
|
||||
enum GateError
|
||||
{
|
||||
NOT_FOUND,
|
||||
MISSING_PACK,
|
||||
MISSING_LIBS
|
||||
}
|
||||
|
||||
var current_search_query: String
|
||||
var current_gate_url: String
|
||||
var current_gate: Gate
|
||||
|
||||
|
||||
func search_emit(query: String) -> void:
|
||||
current_search_query = query
|
||||
current_gate_url = ""
|
||||
|
||||
search.emit(query)
|
||||
|
||||
|
||||
func open_gate_emit(url: String) -> void:
|
||||
current_gate_url = Url.fix_gate_url(url)
|
||||
current_search_query = ""
|
||||
|
||||
open_gate.emit(current_gate_url)
|
||||
|
||||
|
||||
func gate_config_loaded_emit(url: String, config: ConfigGate) -> void:
|
||||
gate_config_loaded.emit(url, config)
|
||||
|
||||
|
||||
func gate_info_loaded_emit(gate: Gate, is_cached: bool) -> void:
|
||||
current_gate = gate
|
||||
gate_info_loaded.emit(gate, is_cached)
|
||||
|
||||
|
||||
func gate_loaded_emit(gate: Gate) -> void:
|
||||
current_gate = gate
|
||||
gate_loaded.emit(gate)
|
||||
|
||||
|
||||
func gate_entered_emit() -> void:
|
||||
gate_entered.emit()
|
||||
|
||||
|
||||
func exit_gate_emit() -> void:
|
||||
current_search_query = ""
|
||||
current_gate_url = ""
|
||||
current_gate = null
|
||||
|
||||
exit_gate.emit()
|
||||
|
||||
|
||||
func download_progress_emit(url: String, body_size: int, downloaded_bytes: int) -> void:
|
||||
download_progress.emit(url, body_size, downloaded_bytes)
|
||||
|
||||
|
||||
func gate_error_emit(code: GateError) -> void:
|
||||
gate_error.emit(code)
|
22
app/scripts/resources/ui_events.gd
Normal file
22
app/scripts/resources/ui_events.gd
Normal file
|
@ -0,0 +1,22 @@
|
|||
extends Resource
|
||||
class_name UiEvents
|
||||
|
||||
signal ui_mode_changed(mode: UiMode)
|
||||
signal ui_size_changed(size: Vector2)
|
||||
|
||||
enum UiMode
|
||||
{
|
||||
INITIAL,
|
||||
FULL_SCREEN
|
||||
}
|
||||
|
||||
var current_ui_size: Vector2
|
||||
|
||||
|
||||
func ui_mode_changed_emit(mode: UiMode) -> void:
|
||||
ui_mode_changed.emit(mode)
|
||||
|
||||
|
||||
func ui_size_changed_emit(size: Vector2) -> void:
|
||||
current_ui_size = size
|
||||
ui_size_changed.emit(size)
|
Loading…
Add table
Add a link
Reference in a new issue