Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F996107
core.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
core.js
View Options
var
Sealious
=
require
(
"./main.js"
);
var
path
=
require
(
"path"
);
var
http
=
require
(
"http"
);
var
ConfigManager
=
require
(
"./config/config-manager.js"
);
var
SealiousCore
=
new
function
(){
this
.
check_version
=
function
(
package_info
){
var
pkg
=
require
(
"../package.json"
)
var
pkg_split
=
pkg
.
version
.
split
(
"."
);
var
version
=
pkg_split
[
0
]
+
"."
+
pkg_split
[
1
];
var
url
=
"http://registry.npmjs.org/sealious/"
+
version
;
var
check_request
=
http
.
get
(
url
,
function
(
res
){
res
.
setEncoding
(
'utf8'
);
var
body
=
""
;
res
.
on
(
'data'
,
function
(
chunk
){
body
+=
chunk
.
toString
();
});
res
.
on
(
'end'
,
function
(){
try
{
var
sealious_npm
=
JSON
.
parse
(
body
);
}
catch
(
error
)
{
Sealious
.
Logger
.
error
(
new
Sealious
.
Errors
.
Error
(
"Could not fetch update information from NPM registry."
));
}
var
sealious_npm_array
=
sealious_npm
.
version
.
split
(
"."
);
if
((
sealious_npm
.
version
!==
pkg
.
version
)
&&
(
parseInt
(
sealious_npm_array
[
2
])
>
parseInt
(
pkg_split
[
2
])))
{
Sealious
.
Logger
.
warning
(
"Sealious@"
+
pkg
.
version
+
" - update available. Run `npm install sealious@"
+
sealious_npm
.
version
+
"` to update."
);
}
else
{
Sealious
.
Logger
.
info
(
"Sealious@"
+
pkg
.
version
+
" is up-to-date."
);
}
});
});
check_request
.
on
(
'error'
,
function
(
err
){
Sealious
.
Logger
.
warning
(
"No network connection available! Unable to fetch information about updates to Sealious."
);
});
}
this
.
which_chip_types_to_start_for_layer
=
{
db
:
[
"datastore"
],
biz
:
[
"field_type"
,
"resource_type"
,
"service"
],
web
:
[
"field_type"
,
"resource_type"
,
"channel"
]
}
this
.
config
=
function
(
config_object
){
ConfigManager
.
set_config
(
config_object
);
}
this
.
get_dispatcher
=
function
(
mode
,
layer_name
){
if
(
mode
==
"local"
)
{
var
dispatcher_path
=
"./dispatchers/local/dispatcher-local.js"
;
}
else
{
var
dispatcher_path
=
"./dispatchers/"
+
layer_name
+
"/dispatcher-"
+
layer_name
+
".js"
;
}
return
require
(
dispatcher_path
);
}
}
module
.
exports
=
SealiousCore
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 10:30 (23 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
556294
Default Alt Text
core.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment