mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-23 04:36:50 +00:00
Added "GET_QDN_RESOURCE_URL" Q-Apps action, to allow a website/app to programmatically determine the URL to retrieve any QDN resource it needs to access.
Examples: ### Get URL to load a QDN resource ``` let url = await qortalRequest({ action: "GET_QDN_RESOURCE_URL", service: "THUMBNAIL", name: "QortalDemo", identifier: "qortal_avatar" // path: "filename.jpg" // optional - not needed if resource contains only one file }); ``` ### Get URL to load a QDN website ``` let url = await qortalRequest({ action: "GET_QDN_RESOURCE_URL", service: "WEBSITE", name: "QortalDemo", }); ``` ### Get URL to load a specific file from a QDN website ``` let url = await qortalRequest({ action: "GET_QDN_RESOURCE_URL", service: "WEBSITE", name: "AlphaX", path: "/assets/img/logo.png" }); ```
This commit is contained in:
@@ -134,6 +134,10 @@ window.addEventListener("message", (event) => {
|
||||
response = httpGet("/names/" + data.name);
|
||||
break;
|
||||
|
||||
case "GET_QDN_RESOURCE_URL":
|
||||
response = buildResourceUrl(data.service, data.name, data.identifier, data.path);
|
||||
break;
|
||||
|
||||
case "LINK_TO_QDN_RESOURCE":
|
||||
if (data.service == null) data.service = "WEBSITE"; // Default to WEBSITE
|
||||
window.location = buildResourceUrl(data.service, data.name, data.identifier, data.path);
|
||||
|
Reference in New Issue
Block a user