From ade74393347ffa66d8cdff0da79c36490a980d6d Mon Sep 17 00:00:00 2001 From: Marak Date: Mon, 18 Apr 2022 20:31:36 -0400 Subject: [PATCH] Switches to using cwd for static Updates ReadMe --- ReadMe.md | 2 ++ bin/server.js | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index a725b54..4242580 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -26,6 +26,8 @@ After downloading My Buddy, double click the application. This will start My Bud You can start using Buddy Pond by visiting `https://localhost` +*Note: It's best to run `mybuddy` from the Terminal or Command Prompt if possible.* + ## Compile My Buddy From source Would rather just run the source? Awesome! diff --git a/bin/server.js b/bin/server.js index ce1c4ee..6db5196 100644 --- a/bin/server.js +++ b/bin/server.js @@ -11,8 +11,8 @@ var privateKey = fs.readFileSync(path.resolve(__dirname + '/../sslcert/key.pem' var certificate = fs.readFileSync(path.resolve(__dirname + '/../sslcert/certificate.pem'), 'utf8'); var credentials = {key: privateKey, cert: certificate}; -let buddyPondPath = path.resolve(__dirname + "/../buddypond") -let appStorePath = path.resolve(__dirname + "/../buddypond-appstore"); +let buddyPondPath = path.join(process.cwd(), 'buddypond'); +let buddyPondAppStorePath = path.join(process.cwd(), 'buddypond-appstore'); const util = require('util'); @@ -32,13 +32,13 @@ const util = require('util'); limit: '12mb' })); - console.log('Mounting appStorePath HTTP path', appStorePath); - app.use('/desktop/apps', express.static(appStorePath)); + console.log('Mounting buddyPondAppStorePath HTTP path', buddyPondAppStorePath); + app.use('/desktop/apps', express.static(buddyPondAppStorePath)); console.log('Mounting static HTTP path', buddyPondPath); app.use(express.static(buddyPondPath, { extensions: ['html', 'htm'] })); - + app.use(function(req, res){ // 404 handler res.end('My Buddy could not find the Buddy Pond source code! There should be a folder named `buddypond` in the same place you started My Buddy from.'); @@ -47,8 +47,8 @@ const util = require('util'); var httpServer = http.createServer(app); var httpsServer = https.createServer(credentials, app); - httpServer.listen(80, () => console.log(`Buddy Pond HTTP Server listening on port 80`)); - httpsServer.listen(443, () => console.log(`Buddy Pond HTTPS Server listening on port 443`)); + httpServer.listen(80, () => console.log(`HTTP Server Started on port 80`)); + httpsServer.listen(443, () => console.log(`Buddy Pond is ready. Visit: https://localhost`)); }); })(); \ No newline at end of file