Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22397409
app.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
2 KB
Referenced Files
None
Subscribers
None
app.ts
View Options
import
_locreq
from
"locreq"
;
import
{
collectDefaultMetrics
,
Registry
,
Counter
}
from
"prom-client"
;
import
type
{
Context
}
from
"koa"
;
import
type
{
FlatTemplatable
}
from
"tempstream"
;
import
type
{
Context
as
SealiousContext
}
from
"sealious"
;
import
{
App
,
LoggerMailer
,
SMTPMailer
}
from
"sealious"
;
import
type
{
LoggerLevel
}
from
"sealious/@types/src/app/logger.js"
;
import
{
collections
}
from
"./collections/collections.js"
;
import
{
BASE_URL
,
MAILCATCHER_HOST
,
MAILCATCHER_SMTP_PORT
,
MAILER
,
MONGO_DB_NAME
,
MONGO_HOST
,
MONGO_PASSWORD
,
MONGO_PORT
,
MONGO_USERNAME
,
PORT
,
UPLOADS_FS_DIR
,
}
from
"./config.js"
;
import
ADMIN_CREDENTIALS
from
"./default-admin-credentials.js"
;
import
{
TheFileManager
}
from
"./file-manager.js"
;
const
locreq
=
_locreq
(
import
.
meta
.
dirname
);
declare
module
"koa"
{
interface
BaseContext
{
$context
:
SealiousContext
;
$app
:
TheApp
;
$body
:
Record
<
string
,
unknown
>
;
params
:
Record
<
string
,
string
|
undefined
>
;
}
}
declare
module
"@sealcode/sealgen"
{
interface
HTMLOptions
{
preserveScroll
?:
boolean
;
morphing
?:
boolean
;
navbar
?:
(
ctx
:
Context
)
=>
FlatTemplatable
;
autoRefreshCSS
?:
boolean
;
disableCopyEvent
?:
boolean
;
language
?:
string
;
showBanner
?:
boolean
;
canHaveStreams
?:
boolean
;
animateTitle
?:
boolean
;
bodyClasses
?:
string
[];
showFooter
:
boolean
;
showBottomNavbar
:
boolean
;
loadHamburgerMenu
:
boolean
;
loadSearchModal
:
boolean
;
}
}
export
default
class
TheApp
extends
App
{
FileManager
=
TheFileManager
;
config
=
{
upload_path
:
UPLOADS_FS_DIR
,
datastore_mongo
:
{
host
:
MONGO_HOST
,
port
:
MONGO_PORT
,
username
:
MONGO_USERNAME
,
password
:
MONGO_PASSWORD
,
db_name
:
MONGO_DB_NAME
,
},
email
:
{
from_address
:
"sealious-app@example.com"
,
from_name
:
"sealious-app app"
,
},
logger
:
{
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
level
:
"info"
as
LoggerLevel
,
},
"www-server"
:
{
port
:
PORT
,
},
core
:
{
environment
:
<
const
>
"production"
,
// to send the full html emails
},
};
manifest
=
{
name
:
"Configurable HTML Rewriter"
,
logo
:
locreq
.
resolve
(
"assets/logo.png"
),
version
:
"0.0.1"
,
default_language
:
"en"
,
base_url
:
BASE_URL
,
admin_email
:
ADMIN_CREDENTIALS
.
email
,
colors
:
{
primary
:
"#5294a1"
,
},
};
collections
=
collections
;
mailer
=
MAILER
===
"mailcatcher"
?
new
SMTPMailer
({
host
:
MAILCATCHER_HOST
,
port
:
MAILCATCHER_SMTP_PORT
,
user
:
"any"
,
password
:
"any"
,
})
:
new
LoggerMailer
();
metrics_registry
=
new
Registry
();
metrics
=
{
upstream_failed
:
new
Counter
({
name
:
"asset_proxy_upstream_failed"
,
help
:
"Count of failed upstream requests"
,
labelNames
:
[
"url"
],
}),
};
async
start
()
{
collectDefaultMetrics
({
register
:
this
.
metrics_registry
});
for
(
const
metric
of
Object
.
values
(
this
.
metrics
))
{
this
.
metrics_registry
.
registerMetric
(
metric
);
}
await
super
.
start
();
}
async
stop
()
{
await
super
.
stop
();
}
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 17:10 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1224632
Default Alt Text
app.ts (2 KB)
Attached To
Mode
rAPROXY Assetproxy
Attached
Detach File
Event Timeline