Compare commits

..

No commits in common. "2640b0d50dcb9bd87563fdbfe56c0146ba016d18" and "acd1718952302e0a7bd30aae8700bcbaa2cde86e" have entirely different histories.

2 changed files with 4 additions and 9 deletions

View File

@ -97,7 +97,6 @@ function DeleteFile() {
PostData({
file_block: {
transid: Math.floor(Math.random() * 0x7fffffff),
opertype: 2,
part: 0,
parts: 1,

View File

@ -7,10 +7,9 @@ const SHA256_HMAC_KEY = "mykey";
let MessIdCounter = 1;
const BLOCK_SIZE = 5120;
function ReceiveChunk(cur, total, name, namespase, trid) {
function ReceiveChunk(cur, total, name, namespase) {
let data = {
[namespase]: {
transid: trid,
opertype: 1,
part: cur,
parts: total,
@ -38,14 +37,13 @@ async function GetBlockObject(namespase, name, size, buf, verb) {
let partsnum = Math.floor(size / BLOCK_SIZE);
if (size % BLOCK_SIZE)
partsnum++;
let transid = Math.floor(Math.random() * 0x7fffffff);
//console.log(`Found ${partsnum} blocks in file ${name}`)
let i;
let resp, dialog;
if (verb)
dialog = Dialog.create({ message: `File "${name}" downloading...`, progress: true, persistent: true, ok: false, style: 'border: none; box-shadow: none;' })
for (i = 0; i < partsnum; i++) {
resp = await ReceiveChunk(i, partsnum, name, namespase, transid);
resp = await ReceiveChunk(i, partsnum, name, namespase);
if (typeof resp[namespase] === 'string' || resp[namespase] instanceof String) {
if (verb)
dialog.hide();
@ -72,7 +70,7 @@ function ToBase64(bytes) {
return window.btoa(binary);
}
function SendChunk(cur, total, name, namespase, buf, trid) {
function SendChunk(cur, total, name, namespase, buf) {
return new Promise((resolve, reject) => {
let arr;
if (cur == (total - 1))
@ -84,7 +82,6 @@ function SendChunk(cur, total, name, namespase, buf, trid) {
let data = {
[namespase]: {
transid: trid,
opertype: 3,
part: cur,
parts: total,
@ -104,13 +101,12 @@ async function PutBlockObject(namespase, name, size, buf, verb) {
if (size % BLOCK_SIZE)
partsnum++;
//console.log(`Found ${partsnum} blocks in file`)
let transid = Math.floor(Math.random() * 0x7fffffff);
let i;
let resp, dialog;
if (verb)
dialog = Dialog.create({ message: `File "${name}" uploading...`, progress: true, persistent: true, ok: false, style: 'border: none; box-shadow: none;' })
for (i = 0; i < partsnum; i++) {
resp = await SendChunk(i, partsnum, name, namespase, buf, transid);
resp = await SendChunk(i, partsnum, name, namespase, buf);
if (typeof resp[namespase] === 'string' || resp[namespase] instanceof String) {
if (verb)
dialog.hide();