local-cmd-runner 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-cmd-runner",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Run local shell commands from a web page",
5
5
  "homepage": "https://github.com/codewoow/local_cmd#readme",
6
6
  "bugs": {
package/public/app.js CHANGED
@@ -1,4 +1,4 @@
1
- const socket = io();
1
+ const socket = io({ path: '/cmd/socket.io' });
2
2
 
3
3
  const cmdInput = document.getElementById('cmdInput');
4
4
  const runBtn = document.getElementById('runBtn');
package/public/index.html CHANGED
@@ -45,7 +45,7 @@
45
45
  </div>
46
46
  </div>
47
47
 
48
- <script src="/socket.io/socket.io.js"></script>
48
+ <script src="/cmd/socket.io/socket.io.js"></script>
49
49
  <script src="app.js"></script>
50
50
  </body>
51
51
 
package/server.js CHANGED
@@ -7,11 +7,12 @@ const os = require('os');
7
7
 
8
8
  const app = express();
9
9
  const httpServer = createServer(app);
10
- const io = new Server(httpServer);
10
+ const io = new Server(httpServer, { path: '/cmd/socket.io' });
11
11
 
12
12
  const PORT = process.env.PORT || 3500;
13
13
 
14
- app.use(express.static(path.join(__dirname, 'public')));
14
+ app.use('/cmd', express.static(path.join(__dirname, 'public')));
15
+ app.get('/', (req, res) => res.redirect('/cmd/'));
15
16
 
16
17
  io.on('connection', (socket) => {
17
18
  console.log('Client connected');
@@ -46,7 +47,7 @@ io.on('connection', (socket) => {
46
47
  });
47
48
 
48
49
  httpServer.listen(PORT, () => {
49
- const url = `http://localhost:${PORT}`;
50
+ const url = `http://localhost:${PORT}/cmd/`;
50
51
  console.log(`Server is running at ${url}`);
51
52
 
52
53
  // Use platform-specific command to open the browser