Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F21590033
context.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
context.ts
View Options
import
type
{
App
}
from
"./app/app.js"
;
import
type
{
CollectionItem
}
from
"./main.js"
;
export
default
class
Context
{
timestamp
:
number
;
ip
:
string
|
null
;
user_id
:
string
|
null
;
user_data
:
null
|
Promise
<
CollectionItem
>
=
null
;
loading_user_data
:
boolean
;
session_id
:
string
|
null
;
is_super
=
false
;
original_context
:
Context
|
null
;
constructor
(
public
app
:
App
,
timestamp
:
number
=
Date
.
now
(),
user_id
?:
string
|
null
,
session_id
?:
string
|
null
)
{
this
.
original_context
=
this
;
this
.
loading_user_data
=
false
;
this
.
timestamp
=
timestamp
;
this
.
user_id
=
user_id
||
null
;
this
.
session_id
=
session_id
||
null
;
}
async
getUserData
(
app
:
App
)
:
Promise
<
CollectionItem
|
null
>
{
if
(
this
.
user_data
)
{
return
this
.
user_data
;
}
if
(
this
.
user_id
===
null
)
{
return
null
;
}
const
c
=
new
SuperContext
(
this
.
app
);
this
.
user_data
=
app
.
collections
.
users
.
getByID
(
c
,
this
.
user_id
);
return
this
.
user_data
;
}
toDBEntry
()
{
return
{
timestamp
:
this
.
timestamp
,
ip
:
this
.
ip
,
user_id
:
this
.
user_id
,
session_id
:
this
.
session_id
,
};
}
}
export
class
SuperContext
extends
Context
{
is_super
=
true
;
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Mon, Nov 9, 13:44 (5 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1182221
Default Alt Text
context.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline