Skip to content

Commit

Permalink
Format GDScript files using Razoric's formatter + manual review
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronfranke committed Aug 27, 2022
1 parent a165c7a commit 9b196bb
Show file tree
Hide file tree
Showing 33 changed files with 582 additions and 488 deletions.
232 changes: 117 additions & 115 deletions addons/godot-firebase/auth/auth.gd

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions addons/godot-firebase/auth/auth_provider.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ tool
class_name AuthProvider
extends Reference


var redirect_uri: String = ""
var access_token_uri: String = ""
var provider_id: String = ""
Expand All @@ -19,14 +20,18 @@ var should_exchange: bool = false
func set_client_id(client_id: String) -> void:
self.params.client_id = client_id


func set_client_secret(client_secret: String) -> void:
self.client_secret = client_secret


func get_client_id() -> String:
return self.params.client_id


func get_client_secret() -> String:
return self.client_secret


func get_oauth_params() -> String:
return ""
7 changes: 3 additions & 4 deletions addons/godot-firebase/auth/providers/facebook.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
class_name FacebookProvider
class_name FacebookProvider
extends AuthProvider


func _init(client_id: String, client_secret: String) -> void:
randomize()
set_client_id(client_id)
set_client_secret(client_secret)

self.redirect_uri = "https://www.facebook.com/v13.0/dialog/oauth?"
self.access_token_uri = "https://graph.facebook.com/v13.0/oauth/access_token"
self.provider_id = "facebook.com"
Expand All @@ -17,5 +18,3 @@ func _init(client_id: String, client_secret: String) -> void:
else:
self.should_exchange = true
self.params.response_type = "code"


3 changes: 2 additions & 1 deletion addons/godot-firebase/auth/providers/github.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class_name GitHubProvider
class_name GitHubProvider
extends AuthProvider


func _init(client_id: String, client_secret: String) -> void:
randomize()
set_client_id(client_id)
Expand Down
1 change: 1 addition & 0 deletions addons/godot-firebase/auth/providers/google.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class_name GoogleProvider
extends AuthProvider


func _init(client_id: String, client_secret: String) -> void:
set_client_id(client_id)
set_client_secret(client_secret)
Expand Down
26 changes: 14 additions & 12 deletions addons/godot-firebase/auth/providers/twitter.gd
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
class_name TwitterProvider
class_name TwitterProvider
extends AuthProvider


var request_token_endpoint: String = "https://api.twitter.com/oauth/access_token?oauth_callback="

var oauth_header: Dictionary = {
oauth_callback="",
oauth_consumer_key="",
oauth_nonce="",
oauth_signature="",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="",
oauth_version="1.0"
oauth_callback = "",
oauth_consumer_key = "",
oauth_nonce = "",
oauth_signature = "",
oauth_signature_method = "HMAC-SHA1",
oauth_timestamp = "",
oauth_version = "1.0"
}


func _init(client_id: String, client_secret: String) -> void:
randomize()
set_client_id(client_id)
set_client_secret(client_secret)

self.oauth_header.oauth_consumer_key = client_id
self.oauth_header.oauth_nonce = OS.get_ticks_usec()
self.oauth_header.oauth_timestamp = OS.get_ticks_msec()



self.should_exchange = true
self.redirect_uri = "https://twitter.com/i/oauth2/authorize?"
self.access_token_uri = "https://api.twitter.com/2/oauth2/token"
Expand All @@ -32,8 +33,9 @@ func _init(client_id: String, client_secret: String) -> void:
self.params.scope = "users.read"
self.params.state = str(rand_range(0, 1))


func get_oauth_params() -> String:
var params: PoolStringArray = []
for key in self.oauth.keys():
params.append(key+"="+self.oauth.get(key))
params.append(key + "=" + self.oauth.get(key))
return params.join("&")
30 changes: 17 additions & 13 deletions addons/godot-firebase/auth/user_data.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ tool
class_name FirebaseUserData
extends Reference

var local_id : String = "" # The uid of the current user.
var email : String = ""
var email_verified := false # Whether or not the account's email has been verified.
var password_updated_at : float = 0 # The timestamp, in milliseconds, that the account password was last changed.
var last_login_at : float = 0 # The timestamp, in milliseconds, that the account last logged in at.
var created_at : float = 0 # The timestamp, in milliseconds, that the account was created at.
var provider_user_info : Array = []

var provider_id : String = ""
var display_name : String = ""
var photo_url : String = ""

func _init(p_userdata : Dictionary) -> void:

var local_id: String = "" # The uid of the current user.
var email: String = ""
var email_verified := false # Whether or not the account's email has been verified.
var password_updated_at: float = 0 # The timestamp, in milliseconds, that the account password was last changed.
var last_login_at: float = 0 # The timestamp, in milliseconds, that the account last logged in at.
var created_at: float = 0 # The timestamp, in milliseconds, that the account was created at.
var provider_user_info: Array = []

var provider_id: String = ""
var display_name: String = ""
var photo_url: String = ""


func _init(p_userdata: Dictionary) -> void:
local_id = p_userdata.get("localId", "")
email = p_userdata.get("email", "")
email_verified = p_userdata.get("emailVerified", false)
Expand All @@ -32,9 +34,11 @@ func _init(p_userdata : Dictionary) -> void:
photo_url = provider_user_info[0].get("photoUrl", "")
display_name = provider_user_info[0].get("displayName", "")


func as_text() -> String:
return _to_string()


func _to_string() -> String:
var txt = "local_id : %s\n" % local_id
txt += "email : %s\n" % email
Expand Down
32 changes: 18 additions & 14 deletions addons/godot-firebase/database/database.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,49 @@ tool
class_name FirebaseDatabase
extends Node

var _base_url : String = ""

var _config : Dictionary = {}
var _base_url: String = ""

var _auth : Dictionary = {}
var _config: Dictionary = {}

func _set_config(config_json : Dictionary) -> void:
var _auth: Dictionary = {}


func _set_config(config_json: Dictionary) -> void:
_config = config_json
_check_emulating()


func _check_emulating() -> void :
func _check_emulating() -> void:
## Check emulating
if not Firebase.emulating:
_base_url = _config.databaseURL
else:
var port : String = _config.emulators.ports.realtimeDatabase
var port: String = _config.emulators.ports.realtimeDatabase
if port == "":
Firebase._printerr("You are in 'emulated' mode, but the port for Realtime Database has not been configured.")
else:
_base_url = "http://localhost"



func _on_FirebaseAuth_login_succeeded(auth_result : Dictionary) -> void:
func _on_FirebaseAuth_login_succeeded(auth_result: Dictionary) -> void:
_auth = auth_result

func _on_FirebaseAuth_token_refresh_succeeded(auth_result : Dictionary) -> void:

func _on_FirebaseAuth_token_refresh_succeeded(auth_result: Dictionary) -> void:
_auth = auth_result


func _on_FirebaseAuth_logout() -> void:
_auth = {}

func get_database_reference(path : String, filter : Dictionary = {}) -> FirebaseDatabaseReference:
var firebase_reference : FirebaseDatabaseReference = FirebaseDatabaseReference.new()
var pusher : HTTPRequest = HTTPRequest.new()
var listener : Node = Node.new()

func get_database_reference(path: String, filter: Dictionary = {}) -> FirebaseDatabaseReference:
var firebase_reference: FirebaseDatabaseReference = FirebaseDatabaseReference.new()
var pusher: HTTPRequest = HTTPRequest.new()
var listener: Node = Node.new()
listener.set_script(load("res://addons/http-sse-client/HTTPSSEClient.gd"))
var store : FirebaseDatabaseStore = FirebaseDatabaseStore.new()
var store: FirebaseDatabaseStore = FirebaseDatabaseStore.new()
firebase_reference.set_db_path(path, filter)
firebase_reference.set_auth_and_config(_auth, _config)
firebase_reference.set_pusher(pusher)
Expand Down
Loading

0 comments on commit 9b196bb

Please sign in to comment.