mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Improve boot script
This commit is contained in:
parent
a655b94aba
commit
e3fa252cf2
17 changed files with 2595 additions and 125 deletions
62
dev/Storage/RainLoop.jsx
Normal file
62
dev/Storage/RainLoop.jsx
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
import window from 'window';
|
||||
|
||||
const STORAGE_KEY = '__rlA';
|
||||
|
||||
class RainLoopStorage
|
||||
{
|
||||
s = null;
|
||||
t = null;
|
||||
|
||||
constructor()
|
||||
{
|
||||
this.s = window.sessionStorage || null;
|
||||
this.t = window.top || window;
|
||||
}
|
||||
|
||||
getHash() {
|
||||
let result = null;
|
||||
if (this.s)
|
||||
{
|
||||
result = this.s.getItem(STORAGE_KEY) || null;
|
||||
}
|
||||
else if (this.t && JSON)
|
||||
{
|
||||
const data = this.t.name && '{' === this.t.name.toString().substr(0, 1) ? JSON.parse(this.t.name.toString()) : null;
|
||||
result = data ? (data[STORAGE_KEY] || null) : null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
setHash() {
|
||||
const
|
||||
key = 'AuthAccountHash',
|
||||
appData = window.rainloopAppData
|
||||
;
|
||||
if (this.s)
|
||||
{
|
||||
this.s.setItem(STORAGE_KEY, appData && appData[key] ? appData[key] : '');
|
||||
}
|
||||
else if (this.t && JSON)
|
||||
{
|
||||
let data = {};
|
||||
data[STORAGE_KEY] = appData && appData[key] ? appData[key] : '';
|
||||
|
||||
this.t.name = JSON.stringify(data);
|
||||
}
|
||||
}
|
||||
|
||||
clearHash() {
|
||||
if (this.s)
|
||||
{
|
||||
this.s.setItem(STORAGE_KEY, '');
|
||||
}
|
||||
else if (this.t)
|
||||
{
|
||||
this.t.name = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new RainLoopStorage();
|
||||
Loading…
Add table
Add a link
Reference in a new issue