mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
native sha512 on old iphones
This commit is contained in:
parent
073c130ae6
commit
ed807ee43e
|
@ -418,6 +418,7 @@ a, #files tbody div a:last-child {
|
||||||
padding: .3em .6em;
|
padding: .3em .6em;
|
||||||
border-radius: .3em;
|
border-radius: .3em;
|
||||||
border-width: .15em 0;
|
border-width: .15em 0;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.opbox {
|
.opbox {
|
||||||
background: #2d2d2d;
|
background: #2d2d2d;
|
||||||
|
|
|
@ -18,10 +18,10 @@ function goto_up2k() {
|
||||||
// usually it's undefined but some chromes throw on invoke
|
// usually it's undefined but some chromes throw on invoke
|
||||||
var up2k = null;
|
var up2k = null;
|
||||||
try {
|
try {
|
||||||
crypto.subtle.digest(
|
var cf = window.crypto || window.msCrypto;
|
||||||
'SHA-512', new Uint8Array(1)
|
cf = cf.subtle || cf.webkitSubtle;
|
||||||
).then(
|
cf.digest('SHA-512', new Uint8Array(1)).then(
|
||||||
function (x) { up2k = up2k_init(true) },
|
function (x) { up2k = up2k_init(cf) },
|
||||||
function (x) { up2k = up2k_init(false) }
|
function (x) { up2k = up2k_init(false) }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -401,9 +401,7 @@ function U2pvis(act, btns) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function up2k_init(have_crypto) {
|
function up2k_init(subtle) {
|
||||||
//have_crypto = false;
|
|
||||||
|
|
||||||
// show modal message
|
// show modal message
|
||||||
function showmodal(msg) {
|
function showmodal(msg) {
|
||||||
ebi('u2notbtn').innerHTML = msg;
|
ebi('u2notbtn').innerHTML = msg;
|
||||||
|
@ -431,7 +429,7 @@ function up2k_init(have_crypto) {
|
||||||
|
|
||||||
// upload ui hidden by default, clicking the header shows it
|
// upload ui hidden by default, clicking the header shows it
|
||||||
function init_deps() {
|
function init_deps() {
|
||||||
if (!have_crypto && !window.asmCrypto) {
|
if (!subtle && !window.asmCrypto) {
|
||||||
showmodal('<h1>loading sha512.js</h1><h2>since ' + shame + '</h2><h4>thanks chrome</h4>');
|
showmodal('<h1>loading sha512.js</h1><h2>since ' + shame + '</h2><h4>thanks chrome</h4>');
|
||||||
import_js('/.cpr/deps/sha512.js', unmodal);
|
import_js('/.cpr/deps/sha512.js', unmodal);
|
||||||
|
|
||||||
|
@ -986,8 +984,8 @@ function up2k_init(have_crypto) {
|
||||||
st.todo.handshake.push(t);
|
st.todo.handshake.push(t);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (have_crypto)
|
if (subtle)
|
||||||
crypto.subtle.digest('SHA-512', buf).then(hash_done);
|
subtle.digest('SHA-512', buf).then(hash_done);
|
||||||
else {
|
else {
|
||||||
var hasher = new asmCrypto.Sha512();
|
var hasher = new asmCrypto.Sha512();
|
||||||
hasher.process(new Uint8Array(buf));
|
hasher.process(new Uint8Array(buf));
|
||||||
|
|
|
@ -97,6 +97,7 @@
|
||||||
#u2cards {
|
#u2cards {
|
||||||
padding: 1em 0 .3em 1em;
|
padding: 1em 0 .3em 1em;
|
||||||
margin: 1.5em auto -2.5em auto;
|
margin: 1.5em auto -2.5em auto;
|
||||||
|
white-space: nowrap;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue