mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-07-22 20:26:50 +00:00
add ability to use local node to trade
This commit is contained in:
@@ -49,7 +49,6 @@ document.addEventListener('qortalExtensionRequests', async (event) => {
|
||||
}
|
||||
});
|
||||
} else if (type === 'REQUEST_CONNECTION') {
|
||||
console.log('REQUEST_CONNECTION')
|
||||
const hostname = window.location.hostname
|
||||
chrome?.runtime?.sendMessage({ action: "connection", payload: {
|
||||
hostname
|
||||
@@ -106,8 +105,9 @@ document.addEventListener('qortalExtensionRequests', async (event) => {
|
||||
}
|
||||
|
||||
chrome?.runtime?.sendMessage({ action: "buyOrder", payload: {
|
||||
qortalAtAddress: payload.qortalAtAddress,
|
||||
hostname
|
||||
qortalAtAddresses: payload.qortalAtAddresses,
|
||||
hostname,
|
||||
useLocal: payload?.useLocal
|
||||
|
||||
}, timeout}, (response) => {
|
||||
if (response.error) {
|
||||
@@ -153,6 +153,36 @@ document.addEventListener('qortalExtensionRequests', async (event) => {
|
||||
}));
|
||||
}
|
||||
});
|
||||
} else if(type === 'CHECK_IF_LOCAL'){
|
||||
|
||||
|
||||
const hostname = window.location.hostname
|
||||
const res = await connection(hostname)
|
||||
if(!res){
|
||||
document.dispatchEvent(new CustomEvent('qortalExtensionResponses', {
|
||||
detail: { type: "USER_INFO", data: {
|
||||
error: "Not authorized"
|
||||
}, requestId }
|
||||
}));
|
||||
return
|
||||
}
|
||||
chrome?.runtime?.sendMessage({ action: "checkLocal", payload: {
|
||||
hostname
|
||||
}, timeout }, (response) => {
|
||||
|
||||
if (response.error) {
|
||||
document.dispatchEvent(new CustomEvent('qortalExtensionResponses', {
|
||||
detail: { type: "CHECK_IF_LOCAL", data: {
|
||||
error: response.error
|
||||
}, requestId }
|
||||
}));
|
||||
} else {
|
||||
// Include the requestId in the detail when dispatching the response
|
||||
document.dispatchEvent(new CustomEvent('qortalExtensionResponses', {
|
||||
detail: { type: "CHECK_IF_LOCAL", data: response, requestId }
|
||||
}));
|
||||
}
|
||||
});
|
||||
} else if (type === 'REQUEST_AUTHENTICATION') {
|
||||
const hostname = window.location.hostname
|
||||
const res = await connection(hostname)
|
||||
|
Reference in New Issue
Block a user