Update _default.js for deployment purposes

This commit is contained in:
KernelDeimos 2024-05-16 18:55:59 -04:00
parent 6fe126ad5a
commit 5031cea040
2 changed files with 8 additions and 6 deletions

View File

@ -62,6 +62,8 @@ config.thumb_width = 80;
config.thumb_height = 80;
config.app_max_icon_size = 5*1024*1024;
config.defaultjs_asset_path = '../../';
// config.origin = config.protocol + '://' + config.domain;
// config.api_base_url = config.protocol + '://api.' + config.domain;
// config.social_card = `${config.origin}/assets/img/screenshot.png`;

View File

@ -46,7 +46,7 @@ router.all('*', async function(req, res, next) {
// cloud.js must be accessible globally regardless of subdomain
// --------------------------------------
else if (path === '/cloud.js') {
return res.sendFile(_path.join(__dirname, '../../puter.js/alpha.js'), function (err) {
return res.sendFile(_path.join(__dirname, config.defaultjs_asset_path, 'puter.js/alpha.js'), function (err) {
if (err && err.statusCode) {
return res.status(err.statusCode).send('Error /cloud.js')
}
@ -56,14 +56,14 @@ router.all('*', async function(req, res, next) {
// /puter.js/v1 must be accessible globally regardless of subdomain
// --------------------------------------
else if (path === '/puter.js/v1' || path === '/puter.js/v1/') {
return res.sendFile(_path.join(__dirname, '../../puter.js/v1.js'), function (err) {
return res.sendFile(_path.join(__dirname, config.defaultjs_asset_path, 'puter.js/v1.js'), function (err) {
if (err && err.statusCode) {
return res.status(err.statusCode).send('Error /puter.js')
}
});
}
else if (path === '/puter.js/v2' || path === '/puter.js/v2/') {
return res.sendFile(_path.join(__dirname, '../../puter.js/v2.js'), function (err) {
return res.sendFile(_path.join(__dirname, config.defaultjs_asset_path, 'puter.js/v2.js'), function (err) {
if (err && err.statusCode) {
return res.status(err.statusCode).send('Error /puter.js')
}
@ -74,14 +74,14 @@ router.all('*', async function(req, res, next) {
// --------------------------------------
else if( subdomain === 'js'){
if (path === '/v1' || path === '/v1/') {
return res.sendFile(_path.join(__dirname, '../../puter.js/v1.js'), function (err) {
return res.sendFile(_path.join(__dirname, config.defaultjs_asset_path, 'puter.js/v1.js'), function (err) {
if (err && err.statusCode) {
return res.status(err.statusCode).send('Error /puter.js')
}
});
}
if (path === '/v2' || path === '/v2/') {
return res.sendFile(_path.join(__dirname, '../../puter.js/v2.js'), function (err) {
return res.sendFile(_path.join(__dirname, config.defaultjs_asset_path, 'puter.js/v2.js'), function (err) {
if (err && err.statusCode) {
return res.status(err.statusCode).send('Error /puter.js')
}
@ -364,7 +364,7 @@ router.all('*', async function(req, res, next) {
subdomain === 'draw' || subdomain === 'camera' || subdomain === 'recorder' ||
subdomain === 'dev-center' || subdomain === 'terminal'){
let root = _path.join(__dirname, '../../apps/', subdomain);
let root = _path.join(__dirname, config.defaultjs_asset_path, 'apps', subdomain);
if ( subdomain === 'docs' ) root += '/dist';
root = _path.normalize(root);