mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-23 22:40:20 +08:00
fix: configuration for browser launch
Makes browser launch on startup configurable. Also, by default, users of Arch Linux will not be subjected to this behavior (they won't like it).
This commit is contained in:
parent
960a9ec9ee
commit
791f7748c7
@ -110,6 +110,35 @@ config.contact_email = 'hey@' + config.domain;
|
||||
// details to follow in a future announcement.
|
||||
config.legacy_token_migrate = true;
|
||||
|
||||
// === OS Information ===
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
config.os = {};
|
||||
config.os.platform = os.platform();
|
||||
|
||||
if ( config.os.platform === 'linux' ) {
|
||||
try {
|
||||
const osRelease = fs.readFileSync('/etc/os-release').toString();
|
||||
// CONTRIBUTORS: If this is the behavior you expect, please add your
|
||||
// Linux distro here.
|
||||
if ( osRelease.includes('ID=arch') ) {
|
||||
config.os.distro = 'arch';
|
||||
config.os.archbtw = true;
|
||||
}
|
||||
} catch (_) {
|
||||
// We don't care if we can't read this file;
|
||||
// we'll just assume it's not a Linux distro.
|
||||
}
|
||||
}
|
||||
|
||||
// config.os.refined specifies if Puter is running within a host environment
|
||||
// where a higher level of user configuration and control is expected.
|
||||
config.os.refined = config.os.archbtw;
|
||||
|
||||
if ( config.os.refined ) {
|
||||
config.no_browser_launch = true;
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
||||
// NEW_CONFIG_LOADING
|
||||
|
@ -129,7 +129,7 @@ class WebServerService extends BaseService {
|
||||
|
||||
// Open the browser to the URL of Puter
|
||||
// (if we are in development mode only)
|
||||
if(config.env === 'dev') {
|
||||
if(config.env === 'dev' && ! config.no_browser_launch) {
|
||||
try{
|
||||
const openModule = await import('open');
|
||||
openModule.default(url);
|
||||
@ -496,6 +496,9 @@ class WebServerService extends BaseService {
|
||||
const txt = lines.join('\n');
|
||||
console.log('\n\x1B[34;1m' + txt + '\x1B[0m\n');
|
||||
}
|
||||
if ( config.os.archbtw ) {
|
||||
console.log('\x1B[34;1mPuter is running on Arch btw\x1B[0m');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user