mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-03 05:22:26 +08:00
Common/Base64.js not needed, see simple Remote/User/Ajax.js urlsafeArray()
Although unescape() is "deprecated" it is still ECMAScript defined, and TextEncoder not supported by Edge.
This commit is contained in:
parent
578925c904
commit
5d402f6405
2 changed files with 32 additions and 29 deletions
14
README.md
14
README.md
|
@ -80,23 +80,23 @@ Things might work in Edge 18, Firefox 50-62 and Chrome 54-68 due to one polyfill
|
|||
|
||||
|js/* |1.14.0 |native |
|
||||
|----------- |--------: |--------: |
|
||||
|admin.js |2.130.942 |1.056.416 |
|
||||
|app.js |4.184.455 |2.727.475 |
|
||||
|admin.js |2.130.942 |1.056.405 |
|
||||
|app.js |4.184.455 |2.712.755 |
|
||||
|boot.js | 671.522 | 43.856 |
|
||||
|libs.js | 647.614 | 317.218 |
|
||||
|polyfills.js | 325.834 | 0 |
|
||||
|TOTAL |7.960.367 |4.144.965 |
|
||||
|TOTAL |7.960.367 |4.130.234 |
|
||||
|
||||
|js/min/* |1.14.0 |native |gzip 1.14 |gzip |
|
||||
|--------------- |--------: |--------: |--------: |--------: |
|
||||
|admin.min.js | 252.147 | 144.091 | 73.657 | 41.256 |
|
||||
|app.min.js | 511.202 | 365.966 |140.462 | 96.362 |
|
||||
|admin.min.js | 252.147 | 144.090 | 73.657 | 41.258 |
|
||||
|app.min.js | 511.202 | 364.533 |140.462 | 95.741 |
|
||||
|boot.min.js | 66.007 | 5.579 | 22.567 | 2.328 |
|
||||
|libs.min.js | 572.545 | 300.771 |176.720 | 92.928 |
|
||||
|polyfills.min.js | 32.452 | 0 | 11.312 | 0 |
|
||||
|TOTAL |1.434.353 | 816.407 |424.718 |232.874 |
|
||||
|TOTAL |1.434.353 | 814.973 |424.718 |232.255 |
|
||||
|
||||
617.946 bytes (191.844 gzip) is not much, but it feels faster.
|
||||
619.380 bytes (192.463 gzip) is not much, but it feels faster.
|
||||
|
||||
|
||||
|css/* |1.14.0 |native |
|
||||
|
|
|
@ -17,7 +17,6 @@ import {
|
|||
} from 'Common/Cache';
|
||||
|
||||
import { subQueryPrefix } from 'Common/Links';
|
||||
import * as Base64 from 'Common/Base64';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import AppStore from 'Stores/User/App';
|
||||
|
@ -27,6 +26,14 @@ import { getApp } from 'Helper/Apps/User';
|
|||
|
||||
import { AbstractAjaxRemote } from 'Remote/AbstractAjax';
|
||||
|
||||
//const toUTF8 = window.TextEncoder
|
||||
// ? text => String.fromCharCode(...new TextEncoder().encode(text))
|
||||
// : text => unescape(encodeURIComponent(text)),
|
||||
const urlsafeArray = array => btoa(unescape(encodeURIComponent(array.join(0x00).replace(/\r\n/g, '\n'))))
|
||||
.replace('+', '-')
|
||||
.replace('/', '_')
|
||||
.replace('=', '');
|
||||
|
||||
class RemoteUserAjax extends AbstractAjaxRemote {
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -315,19 +322,17 @@ class RemoteUserAjax extends AbstractAjaxRemote {
|
|||
'MessageList/' +
|
||||
subQueryPrefix() +
|
||||
'/' +
|
||||
Base64.urlsafe_encode(
|
||||
[
|
||||
sFolderFullNameRaw,
|
||||
iOffset,
|
||||
iLimit,
|
||||
sSearch,
|
||||
AppStore.projectHash(),
|
||||
folderHash,
|
||||
inboxUidNext,
|
||||
useThreads ? 1 : 0,
|
||||
useThreads ? sThreadUid : ''
|
||||
].join(String.fromCharCode(0))
|
||||
),
|
||||
urlsafeArray([
|
||||
sFolderFullNameRaw,
|
||||
iOffset,
|
||||
iLimit,
|
||||
sSearch,
|
||||
AppStore.projectHash(),
|
||||
folderHash,
|
||||
inboxUidNext,
|
||||
useThreads ? 1 : 0,
|
||||
useThreads ? sThreadUid : ''
|
||||
]),
|
||||
bSilent ? [] : ['MessageList']
|
||||
);
|
||||
}
|
||||
|
@ -384,14 +389,12 @@ class RemoteUserAjax extends AbstractAjaxRemote {
|
|||
'Message/' +
|
||||
subQueryPrefix() +
|
||||
'/' +
|
||||
Base64.urlsafe_encode(
|
||||
[
|
||||
sFolderFullNameRaw,
|
||||
iUid,
|
||||
AppStore.projectHash(),
|
||||
AppStore.threadsAllowed() && SettingsStore.useThreads() ? 1 : 0
|
||||
].join(String.fromCharCode(0))
|
||||
),
|
||||
urlsafeArray([
|
||||
sFolderFullNameRaw,
|
||||
iUid,
|
||||
AppStore.projectHash(),
|
||||
AppStore.threadsAllowed() && SettingsStore.useThreads() ? 1 : 0
|
||||
]),
|
||||
['Message']
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue