@@ -61,7 +61,6 @@ var _response_code : int
6161
6262var id : String
6363
64-
6564func _init (id : String , config : Dictionary ) -> void :
6665 _config = config
6766 self .id = id
@@ -150,7 +149,7 @@ func move(source_path : String, destination_path : String) -> StorageTask:
150149
151150
152151func create_signed_url (object : String , expires_in : int = 60000 , options : Dictionary = {
153- download = false , transform = { format = "origin" , quality = 80 , resize = "cover" , height = 100 , width = 100 }
152+ download = "file" , transform = { format = "origin" , quality = 80 , resize = "cover" , height = 100 , width = 100 }
154153}) -> StorageTask :
155154 var endpoint : String = _config .supabaseUrl + _rest_endpoint + "sign/" + id + "/" + object
156155 var task : StorageTask = StorageTask .new ()
@@ -162,6 +161,7 @@ func create_signed_url(object : String, expires_in : int = 60000, options: Dicti
162161 JSON .stringify ({expiresIn = expires_in , transform = options .get ("transform" , {}) })
163162 )
164163 task .set_meta ("options" , options )
164+ task .set_meta ("base_url" , _config .supabaseUrl + _rest_endpoint .replace ("/object/" , "" ))
165165 _process_task (task )
166166 return task
167167
@@ -191,8 +191,15 @@ func download(object : String, to_path : String = "", private : bool = false) ->
191191 return task
192192
193193
194- func get_public_url (object : String ) -> String :
195- return _config .supabaseUrl + _rest_endpoint + "public/" + id + "/" + object
194+ func get_public_url (object : String , transform : Dictionary = {
195+ height = 100 , width = 100 , format = "origin" , resize = "cover" , quality = 80
196+ } ) -> String :
197+ var url : String = _config .supabaseUrl + _rest_endpoint + "public/" + id + "/" + object
198+ if not transform .keys ().is_empty ():
199+ url += "?"
200+ for key in transform .keys ():
201+ url += "&%s =%s " % [key , transform .get (key )]
202+ return url
196203
197204
198205func remove (objects : PackedStringArray ) -> StorageTask :
0 commit comments