Telegram Web K with changes to work inside I2P
https://web.telegram.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.9 KiB
71 lines
1.9 KiB
/* |
|
* https://github.com/morethanwords/tweb |
|
* Copyright (C) 2019-2021 Eduard Kuzmenko |
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE |
|
* |
|
* Originally from: |
|
* https://github.com/zhukov/webogram |
|
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com> |
|
* https://github.com/zhukov/webogram/blob/master/LICENSE |
|
*/ |
|
|
|
|
|
/* export function base64ToBlob(base64str: string, mimeType: string) { |
|
var sliceSize = 1024; |
|
var byteCharacters = atob(base64str); |
|
var bytesLength = byteCharacters.length; |
|
var slicesCount = Math.ceil(bytesLength / sliceSize); |
|
var byteArrays = new Array(slicesCount); |
|
|
|
for(var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) { |
|
var begin = sliceIndex * sliceSize; |
|
var end = Math.min(begin + sliceSize, bytesLength); |
|
|
|
var bytes = new Array(end - begin); |
|
for(var offset = begin, i = 0; offset < end; ++i, ++offset) { |
|
bytes[i] = byteCharacters[offset].charCodeAt(0); |
|
} |
|
byteArrays[sliceIndex] = new Uint8Array(bytes); |
|
} |
|
|
|
return blobConstruct(byteArrays, mimeType); |
|
} |
|
|
|
export function dataUrlToBlob(url: string) { |
|
// var name = 'b64blob ' + url.length |
|
// console.time(name) |
|
var urlParts = url.split(','); |
|
var base64str = urlParts[1]; |
|
var mimeType = urlParts[0].split(':')[1].split(';')[0]; |
|
var blob = base64ToBlob(base64str, mimeType); |
|
// console.timeEnd(name) |
|
return blob; |
|
} */ |
|
|
|
export {}; |
|
|
|
/* export function bytesFromBigInt(bigInt: BigInteger, len?: number) { |
|
var bytes = bigInt.toByteArray(); |
|
|
|
if(len && bytes.length < len) { |
|
var padding = []; |
|
for(var i = 0, needPadding = len - bytes.length; i < needPadding; i++) { |
|
padding[i] = 0; |
|
} |
|
if(bytes instanceof ArrayBuffer) { |
|
bytes = bufferConcat(padding, bytes); |
|
} else { |
|
bytes = padding.concat(bytes); |
|
} |
|
} else { |
|
while (!bytes[0] && (!len || bytes.length > len)) { |
|
bytes = bytes.slice(1); |
|
} |
|
} |
|
|
|
return bytes; |
|
} */ |
|
|
|
|
|
|
|
|
|
|