Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
329 changes: 329 additions & 0 deletions extensions/community/IPRetriever.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,329 @@
{
"author": "",
"category": "Network",
"extensionNamespace": "",
"fullName": "IPRetriever",
"gdevelopVersion": "",
"helpPath": "",
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI1LDEzYzAsOC05LDE1LTksMTVzLTktNy05LTE1YzAtNSw0LTksOS05UzI1LDgsMjUsMTN6Ii8+DQo8Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIxNiIgY3k9IjEzIiByPSIzIi8+DQo8L3N2Zz4NCg==",
"name": "IPRetriever",
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Maps and Navigation/ad277c3633357d2dbadf29e04f9b4c38d22e1cf43eef6206c15130f556e2c117_Maps and Navigation_location_pin.svg",
"shortDescription": "Adds a way to get the user's IP address by sending a web request and extracting the result.",
"version": "1.0.1",
"description": [
"This extension gets the user's public IP address via a web request to ipify.",
"",
"**⚠️ Important:** Before storing any IP address in a database, it is strongly recommended to hash it. This helps protect user privacy and prevents unauthorized access to raw IP addresses. ⚠️",
"",
"## Instructions (how to use it)",
"",
"### Actions",
"- Call `IP_Adress::GetIP` to fetch the IP.",
"",
"### Conditions",
"- Use `IP Adress is ready` to check if the IP has been retrieved.",
"- Use `Failed to get the user's IP Adress` to check if the action has failed.",
"",
"### Expressions",
"- Use `IP_Adress::Adress()` to get the parsed IP as a string.",
"- Use `IP_Adress::Error()` to get the error message if an error occurred.",
"",
"**Example:** ",
"When combined with a database system such as Firebase Realtime Database, this extension can be used to implement IP-based bans. This allows developers to prevent users from rejoining a multiplayer lobby after engaging in fraudulent or disruptive behavior, ensuring a safer and more secure gameplay environment."
],
"tags": [
"IP",
"Network",
"Web Requests"
],
"authorIds": [
"15O5wfq5PBMlNvG7m04ZZx7ecgv1"
],
"dependencies": [],
"globalVariables": [],
"sceneVariables": [
{
"name": "__RequestValues",
"type": "structure",
"children": [
{
"name": "Adress",
"type": "structure",
"children": []
},
{
"name": "Error",
"type": "string",
"value": "None"
},
{
"name": "Response",
"type": "string",
"value": "None"
}
]
}
],
"eventsFunctions": [
{
"description": "Send a web request to get the user's IP address and store the response values in variables.",
"fullName": "Get the user's public IP address",
"functionType": "Action",
"name": "GetIP",
"sentence": "Get the user's IP address",
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "SetStringVariable"
},
"parameters": [
"__RequestValues.Adress",
"=",
"\"\""
]
},
{
"type": {
"value": "SetStringVariable"
},
"parameters": [
"__RequestValues.Error",
"=",
"\"None\""
]
},
{
"type": {
"value": "SetStringVariable"
},
"parameters": [
"__RequestValues.Response",
"=",
"\"None\""
]
},
{
"type": {
"await": true,
"value": "SendAsyncRequest"
},
"parameters": [
"\"https://api.ipify.org?format=json\"",
"\"\"",
"\"GET\"",
"\"\"",
"__RequestValues.Response",
"__RequestValues.Error"
]
},
{
"type": {
"value": "JSONToVariableStructure2"
},
"parameters": [
"__RequestValues.Response",
"__RequestValues.Adress"
]
}
]
}
],
"parameters": [],
"objectGroups": []
},
{
"description": "Return the IP address of the current user.",
"fullName": "IP address of the user",
"functionType": "StringExpression",
"name": "Adress",
"sentence": "",
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "SetReturnString"
},
"parameters": [
"__RequestValues.Adress[\"ip\"]"
]
}
]
}
],
"expressionType": {
"type": "string"
},
"parameters": [],
"objectGroups": []
},
{
"description": "Errors if there are any.",
"fullName": "Displays any errors",
"functionType": "StringExpression",
"name": "Error",
"sentence": "",
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "SetReturnString"
},
"parameters": [
"__RequestValues.Error"
]
}
]
}
],
"expressionType": {
"type": "string"
},
"parameters": [],
"objectGroups": []
},
{
"description": "Check if the extension failed to get the user's IP address.",
"fullName": "Failed to get the user's IP address",
"functionType": "Condition",
"name": "HasFailed",
"sentence": "IP address could not be retrieved",
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [
{
"type": {
"value": "StringVariable"
},
"parameters": [
"__RequestValues.Error",
"!=",
"\"None\""
]
}
],
"actions": [
{
"type": {
"value": "SetStringVariable"
},
"parameters": [
"__RequestValues.Error",
"=",
"\"Error: Failed to get the user's IP Adress.\""
]
},
{
"type": {
"value": "SetReturnBoolean"
},
"parameters": [
"True"
]
}
]
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [
{
"type": {
"value": "StringVariable"
},
"parameters": [
"__RequestValues.Error",
"=",
"\"None\""
]
}
],
"actions": [
{
"type": {
"value": "SetReturnBoolean"
},
"parameters": [
"False"
]
}
]
}
],
"parameters": [],
"objectGroups": []
},
{
"description": "Check if the IP address is ready to be used.",
"fullName": "IP address is ready",
"functionType": "Condition",
"name": "IsReady",
"sentence": "IP address is ready to be used",
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [
{
"type": {
"value": "StringVariable"
},
"parameters": [
"__RequestValues.Adress[\"ip\"]",
"!=",
"\"\""
]
}
],
"actions": [
{
"type": {
"value": "SetReturnBoolean"
},
"parameters": [
"True"
]
}
]
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [
{
"type": {
"value": "StringVariable"
},
"parameters": [
"__RequestValues.Adress[\"ip\"]",
"=",
"\"\""
]
}
],
"actions": [
{
"type": {
"value": "SetReturnBoolean"
},
"parameters": [
"False"
]
}
]
}
],
"parameters": [],
"objectGroups": []
}
],
"eventsBasedBehaviors": [],
"eventsBasedObjects": []
}