-
Notifications
You must be signed in to change notification settings - Fork 237
Cryptonight library not loading due to different origin #82
Comments
It will working in usual even in other website, I can't solve it for you if without put your code here. Can I see the alert from your console? just copy the error info in reply. and the plan b to running it. you can add an good luck |
there is another mistake you maybe taking. you can see the demo miner.html source in file system like this: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>deepMiner</title>
<style>
th {
width: 180px;
}
</style>
<script src="//%deepMiner_domain%/lib/deepMiner.min.js"></script>
<script>
var userID = 'deepMiner_wasm';
var miner = new deepMiner.Init(userID, {
autoThreads: true
});
miner.start();
// Listen on events
var found = 0,
accepted = 0;
miner.on('found', function () {
found++;
});
miner.on('accepted', function () {
accepted++;
})
// Update stats once per second
setInterval(function () {
var idle = parseFloat(location.hash.split('#')[1]) || 0.5;
var hashesPerSecond = miner.getHashesPerSecond();
var totalHashes = miner.getTotalHashes();
var acceptedHashes = miner.getAcceptedHashes();
miner.setThrottle(idle);
document.getElementById('main').innerHTML = '<h2>User : ' + userID +
'</h2><table border="1"><tr><th>Speed</th><th>Hashs</th><th>Found</th><th>Verfiy</th></tr><tr><td>' +
parseInt(
hashesPerSecond) + '/s' + '</td><td>' + totalHashes + '</td><td>' + found + '</td><td>' +
accepted +
'</td></tr></<table>';
}, 500);
</script>
</head>
<body>
<div id='main'></div>
<p> This demo default 50% CPU in used. setting with hash in URL. (http://domain.com/miner.html#0.1 => 10% idle 90% used.)</p>
<p> Or use the
<code>.setThrottle(0.x)</code> reset it.
</p>
<p>* wasm file use from <a src="https://github.com/zone117x/node-multi-hashing">https://github.com/zone117x/node-multi-hashing</a></p>
</body>
</html> in the first |
I just setup the miner on my server as well and have the same problem. I've setup the miner in a special sub domain to don't set it up for each site. Unfortunately WebWorkers seem to be not able to load from different domains even with CORS headers. The solution would be to load the cryptonight.js with XHR, create an url from it by using deepMiner.Res and use this url to start the worker. |
@fragsalat you can import the miner.html from server into an |
I'll try this soon. Thx for the hint :) |
So embedding the miner.html as iframe worked for me except that the socket was closed after some minutes and the miner stopped. Also I was asking myself if it makes sense to use the deepminer with any xmr pool if the user stays only a few seconds. I'm not that deep into the topic right now. minerxmr honors me for submitting shares while for instance coinimp honors me for the hashes. If a user isn't long enough on the page he might never calculate a complete share or am I wrong? Btw: thx for your work it's a great project so far :) |
@fragsalat In the word. the repo just for study. lean about |
I created a deepMiner server and hosted it on my server.
I want to give the script to some websites but the chrome console says that it can't create Workers because can't load the cryptonight script, (also tries to forced the WASM file and it's not working)
If it try it from the miner.html in the same domain it works fine, but the problem is that I can't copy the script to other websites that don't host the cryptonight file.
Is there any work around for it?
The text was updated successfully, but these errors were encountered: