instbyte 1.9.2 → 1.9.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.
Files changed (2) hide show
  1. package/package.json +8 -4
  2. package/server/server.js +16 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instbyte",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "A self-hosted LAN sharing utility for fast, frictionless file, link, and snippet exchange across devices — no cloud required.",
5
5
  "main": "bin/instbyte.js",
6
6
  "bin": {
@@ -13,7 +13,9 @@
13
13
  ],
14
14
  "scripts": {
15
15
  "start": "node bin/instbyte.js",
16
- "dev": "nodemon bin/instbyte.js"
16
+ "dev": "nodemon bin/instbyte.js",
17
+ "test": "vitest run",
18
+ "test:watch": "vitest"
17
19
  },
18
20
  "keywords": [
19
21
  "lan",
@@ -46,6 +48,8 @@
46
48
  "sqlite3": "^5.1.6"
47
49
  },
48
50
  "devDependencies": {
49
- "nodemon": "^3.1.0"
51
+ "nodemon": "^3.1.0",
52
+ "supertest": "^7.2.2",
53
+ "vitest": "^2.1.8"
50
54
  }
51
- }
55
+ }
package/server/server.js CHANGED
@@ -823,19 +823,23 @@ const localIP = getLocalIP();
823
823
 
824
824
  let PORT;
825
825
 
826
- findFreePort(PREFERRED).then(p => {
827
- PORT = p;
828
- server.listen(PORT, () => {
829
- console.log("\nInstbyte running");
830
- console.log("Local: http://localhost:" + PORT);
831
- console.log("Network: http://" + localIP + ":" + PORT);
832
- if (PORT !== PREFERRED) {
833
- console.log(`(port ${PREFERRED} was busy, switched to ${PORT})`);
834
- }
835
- console.log("");
836
- scanOrphans(); // clean up any pre-v1.9.1 ghost files
826
+ if (require.main === module) {
827
+ findFreePort(PREFERRED).then(p => {
828
+ PORT = p;
829
+ server.listen(PORT, () => {
830
+ console.log("\nInstbyte running");
831
+ console.log("Local: http://localhost:" + PORT);
832
+ console.log("Network: http://" + localIP + ":" + PORT);
833
+ if (PORT !== PREFERRED) {
834
+ console.log(`(port ${PREFERRED} was busy, switched to ${PORT})`);
835
+ }
836
+ console.log("");
837
+ scanOrphans();
838
+ });
837
839
  });
838
- });
840
+ }
841
+
842
+ module.exports = { app, server, sessions };
839
843
 
840
844
 
841
845
  // ========================