some fixes
This commit is contained in:
parent
5aa64caecc
commit
1b87103e02
@ -181,6 +181,11 @@ export default async function wrapDocument({message, withTime, fontWeight, voice
|
||||
middleEllipsisEl.textContent = fileName;
|
||||
// setInnerHTML(middleEllipsisEl, fileName);
|
||||
|
||||
// * new media popup
|
||||
if(!message.mid) {
|
||||
docDiv.classList.add('downloaded');
|
||||
}
|
||||
|
||||
nameDiv.append(middleEllipsisEl);
|
||||
|
||||
if(showSender) {
|
||||
|
@ -68,5 +68,5 @@ export function getFileURL(type: FileURLType, options: DownloadOptions) {
|
||||
const encoded = encodeURIComponent(JSON.stringify(options));
|
||||
// console.log('getFileURL encode:', performance.now() - perf, encoded);
|
||||
|
||||
return '/' + type + '/' + encoded;
|
||||
return /* '/' + */type + '/' + encoded;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ export class AppDownloadManager {
|
||||
// if(downloadOptions.size && downloadOptions.size > MAX_FILE_SAVE_SIZE) {
|
||||
const id = '' + (Math.random() * 0x7FFFFFFF | 0);
|
||||
// const id = 'test';
|
||||
const url = `/download/${id}`;
|
||||
const url = `download/${id}`;
|
||||
options.downloadId = id;
|
||||
|
||||
const promise = this.downloadMedia(options, 'disc');
|
||||
|
@ -285,7 +285,17 @@ class ApiManagerProxy extends MTProtoMessagePort {
|
||||
private async registerCryptoWorker() {
|
||||
const get = (url: string) => {
|
||||
return fetch(url).then((response) => response.text()).then((text) => {
|
||||
text = 'var a = importScripts; importScripts = (url) => {console.log(`wut`, url); return a(url.slice(5));};' + text;
|
||||
const pathnameSplitted = location.pathname.split('/');
|
||||
pathnameSplitted[pathnameSplitted.length - 1] = '';
|
||||
const pre = location.origin + pathnameSplitted.join('/');
|
||||
text = `
|
||||
var originalImportScripts = importScripts;
|
||||
importScripts = (url) => {
|
||||
console.log('importScripts', url);
|
||||
var newUrl = '${pre}' + url.split('/').pop();
|
||||
return originalImportScripts(newUrl);
|
||||
};
|
||||
${text}`;
|
||||
const blob = new Blob([text], {type: 'application/javascript'});
|
||||
return blob;
|
||||
});
|
||||
|
@ -115,7 +115,8 @@ const onFetch = (event: FetchEvent): void => {
|
||||
// #endif
|
||||
|
||||
try {
|
||||
const [, url, scope, params] = /http[:s]+\/\/.*?(\/(.*?)(?:$|\/(.*)$))/.exec(event.request.url) || [];
|
||||
// const [, url, scope, params] = /http[:s]+\/\/.*?(\/(.*?)(?:$|\/(.*)$))/.exec(event.request.url) || [];
|
||||
const [scope, params] = event.request.url.split('/').slice(-2);
|
||||
|
||||
// log.debug('[fetch]:', event);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user