commit
e3928bc6c2
14
build.sh
14
build.sh
@ -22,6 +22,7 @@ done
|
|||||||
|
|
||||||
rev="QmPAqM7anxdr1ngPmJz9J9AAxDLinDz2Eh9aAzLF9T7LNa"
|
rev="QmPAqM7anxdr1ngPmJz9J9AAxDLinDz2Eh9aAzLF9T7LNa"
|
||||||
ipfs="no"
|
ipfs="no"
|
||||||
|
cuckoo="no"
|
||||||
_next=""
|
_next=""
|
||||||
# check for build flags
|
# check for build flags
|
||||||
for arg in $@ ; do
|
for arg in $@ ; do
|
||||||
@ -29,6 +30,9 @@ for arg in $@ ; do
|
|||||||
"--ipfs")
|
"--ipfs")
|
||||||
ipfs="yes"
|
ipfs="yes"
|
||||||
;;
|
;;
|
||||||
|
"--cuckoo")
|
||||||
|
cuckoo="yes"
|
||||||
|
;;
|
||||||
"--disable-redis")
|
"--disable-redis")
|
||||||
tags="$tags -tags disable_redis"
|
tags="$tags -tags disable_redis"
|
||||||
;;
|
;;
|
||||||
@ -76,4 +80,14 @@ else
|
|||||||
go get -u -v github.com/majestrate/srndv2
|
go get -u -v github.com/majestrate/srndv2
|
||||||
cp $GOPATH/bin/srndv2 $root
|
cp $GOPATH/bin/srndv2 $root
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "x$cuckoo" == "xyes" ] ; then
|
||||||
|
echo "building cucko miner js"
|
||||||
|
go get -v -u github.com/gopherjs/gopherjs
|
||||||
|
go get -v -u github.com/ZiRo-/cuckgo/miner_js
|
||||||
|
gopherjs -m -v build github.com/ZiRo-/cuckgo/miner_js
|
||||||
|
mv ./miner_js.js ./contrib/static/miner-js.js
|
||||||
|
rm ./miner_js.js.map
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Built"
|
echo "Built"
|
||||||
|
19
contrib/js/cuckoo_miner.js
Normal file
19
contrib/js/cuckoo_miner.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
onready(function(){
|
||||||
|
document.getElementById("start_miner").onclick = function() {
|
||||||
|
var btn = document.getElementById("start_miner");
|
||||||
|
var label = btn.value;
|
||||||
|
btn.value = "..."
|
||||||
|
btn.disabled = true;
|
||||||
|
var worker = new Worker("./static/mineworker.js");
|
||||||
|
worker.onmessage = function(e) {
|
||||||
|
miner_cb(e.data);
|
||||||
|
btn.value=label;
|
||||||
|
btn.disabled = false;
|
||||||
|
worker.terminate();
|
||||||
|
}
|
||||||
|
worker.postMessage(55.0); // Start the worker.
|
||||||
|
};
|
||||||
|
});
|
||||||
|
function miner_cb(s) {
|
||||||
|
document.getElementById("miner_result").value = s;
|
||||||
|
}
|
51
contrib/static/miner-js.js
Normal file
51
contrib/static/miner-js.js
Normal file
File diff suppressed because one or more lines are too long
6
contrib/static/mineworker.js
Normal file
6
contrib/static/mineworker.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
importScripts('./miner-js.js');
|
||||||
|
|
||||||
|
onmessage = function(e) {
|
||||||
|
var s = cuckoo["mine_cuckoo"](e.data);
|
||||||
|
postMessage(s);
|
||||||
|
}
|
@ -619,6 +619,10 @@ function nntpchan_buildpost(parent,j){var post=document.createElement("div");if(
|
|||||||
parent.appendChild(post);}
|
parent.appendChild(post);}
|
||||||
/* local file: ./contrib/js/banner.js */
|
/* local file: ./contrib/js/banner.js */
|
||||||
var banner_count=3;function nntpchan_inject_banners(elem,prefix){var n=Math.floor(Math.random()*banner_count);var banner=prefix+"static/banner_"+n+".jpg";var e=document.createElement("img");e.src=banner;e.id="nntpchan_banner";elem.appendChild(e);}
|
var banner_count=3;function nntpchan_inject_banners(elem,prefix){var n=Math.floor(Math.random()*banner_count);var banner=prefix+"static/banner_"+n+".jpg";var e=document.createElement("img");e.src=banner;e.id="nntpchan_banner";elem.appendChild(e);}
|
||||||
|
/* local file: ./contrib/js/cuckoo_miner.js */
|
||||||
|
onready(function(){document.getElementById("start_miner").onclick=function(){var btn=document.getElementById("start_miner");var label=btn.value;btn.value="..."
|
||||||
|
btn.disabled=true;var worker=new Worker("./static/mineworker.js");worker.onmessage=function(e){miner_cb(e.data);btn.value=label;btn.disabled=false;worker.terminate();}
|
||||||
|
worker.postMessage(55.0);};});function miner_cb(s){document.getElementById("miner_result").value=s;}
|
||||||
/* local file: ./contrib/js/expand-image.js */
|
/* local file: ./contrib/js/expand-image.js */
|
||||||
function filenameIsImage(fname){return/\.(gif|jpeg|jpg|png|webp)/.test(fname.toLowerCase());}
|
function filenameIsImage(fname){return/\.(gif|jpeg|jpg|png|webp)/.test(fname.toLowerCase());}
|
||||||
function setupInlineImage(thumb,url){if(thumb.inlineIsSetUp)return;thumb.inlineIsSetUp=true;var img=thumb.querySelector("img.thumbnail");var expanded=false;var oldurl=img.src;thumb.onclick=function(){if(expanded){img.setAttribute("class","thumbnail");img.src=oldurl;expanded=false;}else{img.setAttribute("class","expanded-thumbnail");img.src=url;expanded=true;}
|
function setupInlineImage(thumb,url){if(thumb.inlineIsSetUp)return;thumb.inlineIsSetUp=true;var img=thumb.querySelector("img.thumbnail");var expanded=false;var oldurl=img.src;thumb.onclick=function(){if(expanded){img.setAttribute("class","thumbnail");img.src=oldurl;expanded=false;}else{img.setAttribute("class","expanded-thumbnail");img.src=url;expanded=true;}
|
||||||
|
@ -77,6 +77,14 @@
|
|||||||
<input type="text" name="captcha" autocomplete="off" id="captcha_solution" />
|
<input type="text" name="captcha" autocomplete="off" id="captcha_solution" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{{#i18n.Translations}}{{cuckoo_pow}}{{/i18n.Translations}}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="pow" autocomplete="off" id="miner_result" /><input id="start_miner" type="button" value="{{#i18n.Translations}}{{start_mining}}{{/i18n.Translations}}"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -171,3 +171,6 @@ secretkey_name=Secret key
|
|||||||
key_install_title=A new keypair has been generated for you. Please keep it safe and don't share it with anyone, as this is used to login to the mod panel
|
key_install_title=A new keypair has been generated for you. Please keep it safe and don't share it with anyone, as this is used to login to the mod panel
|
||||||
#'
|
#'
|
||||||
|
|
||||||
|
cuckoo_pow=Proof of Work
|
||||||
|
start_mining=Mine!
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user