aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xapp.js7
-rw-r--r--app/welcome.html2
-rw-r--r--src/files.js5
3 files changed, 6 insertions, 8 deletions
diff --git a/app.js b/app.js
index c0aec52..7d5258f 100755
--- a/app.js
+++ b/app.js
@@ -7,6 +7,8 @@ var express = require('express'),
7 morgan = require('morgan'), 7 morgan = require('morgan'),
8 passport = require('passport'), 8 passport = require('passport'),
9 path = require('path'), 9 path = require('path'),
10 ejs = require('ejs'),
11 fs = require('fs'),
10 compression = require('compression'), 12 compression = require('compression'),
11 session = require('express-session'), 13 session = require('express-session'),
12 bodyParser = require('body-parser'), 14 bodyParser = require('body-parser'),
@@ -25,8 +27,9 @@ router.get('/api/files/*', auth.ldap, files.get);
25router.put('/api/files/*', auth.ldap, multipart, files.put); 27router.put('/api/files/*', auth.ldap, multipart, files.put);
26router.delete('/api/files/*', auth.ldap, files.del); 28router.delete('/api/files/*', auth.ldap, files.del);
27 29
28// healthcheck in case / does not serve up any file yet 30// welcome screen in case / does not serve up any file yet
29router.get('/', function (req, res) { res.sendFile(path.join(__dirname, '/app/welcome.html')); }); 31var appUrl = process.env.HOSTNAME ? 'https://' + process.env.HOSTNAME : 'http://localhost:3000';
32router.get('/', function (req, res) { res.status(200).send(ejs.render(fs.readFileSync(path.join(__dirname, '/app/welcome.html'), 'utf8'), { appUrl: appUrl })); });
30 33
31app.use(morgan('dev')); 34app.use(morgan('dev'));
32app.use(compression()); 35app.use(compression());
diff --git a/app/welcome.html b/app/welcome.html
index 3fd2ed8..9d3fa25 100644
--- a/app/welcome.html
+++ b/app/welcome.html
@@ -17,7 +17,7 @@
17 </p> 17 </p>
18 <pre> 18 <pre>
19npm -g install cloudron-surfer 19npm -g install cloudron-surfer
20surfer login http://test-foobar 20surfer login <%= appUrl %>
21surfer put [file]</pre> 21surfer put [file]</pre>
22 <br/> 22 <br/>
23 <br/> 23 <br/>
diff --git a/src/files.js b/src/files.js
index c725e4b..3b28d3f 100644
--- a/src/files.js
+++ b/src/files.js
@@ -2,7 +2,6 @@
2 2
3var fs = require('fs'), 3var fs = require('fs'),
4 path = require('path'), 4 path = require('path'),
5 ejs = require('ejs'),
6 rm = require('del'), 5 rm = require('del'),
7 debug = require('debug')('files'), 6 debug = require('debug')('files'),
8 mkdirp = require('mkdirp'), 7 mkdirp = require('mkdirp'),
@@ -54,10 +53,6 @@ function copyFile(source, target, cb) {
54 }); 53 });
55} 54}
56 55
57function render(view, options) {
58 return ejs.render(fs.readFileSync(view, 'utf8'), options);
59}
60
61function getAbsolutePath(filePath) { 56function getAbsolutePath(filePath) {
62 var absoluteFilePath = path.resolve(gBasePath, filePath); 57 var absoluteFilePath = path.resolve(gBasePath, filePath);
63 58