repoburg 1.0.42 → 1.0.44
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.
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const express_1 = require("express");
|
|
7
|
+
const stateManager_1 = require("../stateManager");
|
|
8
|
+
const cors_1 = __importDefault(require("cors"));
|
|
9
|
+
const router = (0, express_1.Router)();
|
|
10
|
+
// Enable CORS for all origins for the GET endpoint.
|
|
11
|
+
const corsOptions = {
|
|
12
|
+
origin: '*',
|
|
13
|
+
};
|
|
14
|
+
router.get('/get-active-port', (0, cors_1.default)(corsOptions), (req, res) => {
|
|
15
|
+
const port = stateManager_1.stateManager.getActiveBackendPort();
|
|
16
|
+
res.json({ port });
|
|
17
|
+
});
|
|
18
|
+
router.post('/set-active-port', (req, res) => {
|
|
19
|
+
const { port } = req.body;
|
|
20
|
+
if (typeof port !== 'number' && port !== null) {
|
|
21
|
+
return res.status(400).json({ error: 'Port must be a number or null.' });
|
|
22
|
+
}
|
|
23
|
+
stateManager_1.stateManager.setActiveBackendPort(port);
|
|
24
|
+
res.status(200).json({ message: 'Active port updated.', port });
|
|
25
|
+
});
|
|
26
|
+
exports.default = router;
|
package/daemon/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const cors_1 = __importDefault(require("cors"));
|
|
|
11
11
|
const serviceManager_1 = require("./serviceManager");
|
|
12
12
|
const services_1 = __importDefault(require("./api/services"));
|
|
13
13
|
const auth_1 = __importDefault(require("./api/auth"));
|
|
14
|
+
const registry_1 = __importDefault(require("./api/registry"));
|
|
14
15
|
const PORT = 9998;
|
|
15
16
|
async function main() {
|
|
16
17
|
await serviceManager_1.serviceManager.connect();
|
|
@@ -26,6 +27,7 @@ async function main() {
|
|
|
26
27
|
// API Routers
|
|
27
28
|
app.use('/services', services_1.default);
|
|
28
29
|
app.use('/auth', (0, auth_1.default)(wss));
|
|
30
|
+
app.use('/registry', registry_1.default);
|
|
29
31
|
app.get('/health', (req, res) => {
|
|
30
32
|
res.status(200).json({ status: 'ok' });
|
|
31
33
|
});
|
|
@@ -11,7 +11,7 @@ const REPOBURG_DIR = path_1.default.join(os_1.default.homedir(), '.repoburg');
|
|
|
11
11
|
const STATE_FILE_PATH = path_1.default.join(REPOBURG_DIR, 'services.json');
|
|
12
12
|
class StateManager {
|
|
13
13
|
constructor() {
|
|
14
|
-
this.state = { services: [] };
|
|
14
|
+
this.state = { services: [], activeBackendPort: null };
|
|
15
15
|
this.ensureDirExists();
|
|
16
16
|
this.loadState();
|
|
17
17
|
}
|
|
@@ -28,7 +28,12 @@ class StateManager {
|
|
|
28
28
|
try {
|
|
29
29
|
if (fs_extra_1.default.existsSync(STATE_FILE_PATH)) {
|
|
30
30
|
const fileContent = fs_extra_1.default.readFileSync(STATE_FILE_PATH, 'utf-8');
|
|
31
|
-
|
|
31
|
+
const loadedState = JSON.parse(fileContent);
|
|
32
|
+
this.state = {
|
|
33
|
+
services: [],
|
|
34
|
+
activeBackendPort: null,
|
|
35
|
+
...loadedState,
|
|
36
|
+
};
|
|
32
37
|
}
|
|
33
38
|
else {
|
|
34
39
|
this.saveState(); // Create the file if it doesn't exist
|
|
@@ -36,7 +41,7 @@ class StateManager {
|
|
|
36
41
|
}
|
|
37
42
|
catch (error) {
|
|
38
43
|
console.error('Error loading state from disk:', error);
|
|
39
|
-
this.state = { services: [] };
|
|
44
|
+
this.state = { services: [], activeBackendPort: null };
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
saveState() {
|
|
@@ -81,5 +86,12 @@ class StateManager {
|
|
|
81
86
|
Object.assign(service, updates);
|
|
82
87
|
this.saveState();
|
|
83
88
|
}
|
|
89
|
+
getActiveBackendPort() {
|
|
90
|
+
return this.state.activeBackendPort;
|
|
91
|
+
}
|
|
92
|
+
setActiveBackendPort(port) {
|
|
93
|
+
this.state.activeBackendPort = port;
|
|
94
|
+
this.saveState();
|
|
95
|
+
}
|
|
84
96
|
}
|
|
85
97
|
exports.stateManager = new StateManager();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repoburg",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"description": "A local AI-powered software developer assistant that runs on your own machine.",
|
|
5
5
|
"author": "Celal Ertug",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@nestjs/platform-ws": "^10.3.10",
|
|
40
40
|
"@nestjs/typeorm": "^10.0.0",
|
|
41
41
|
"@nestjs/websockets": "^10.3.10",
|
|
42
|
-
"axios": "^1.
|
|
42
|
+
"axios": "^1.11.0",
|
|
43
43
|
"chalk": "^5.3.0",
|
|
44
44
|
"class-transformer": "^0.5.1",
|
|
45
45
|
"class-validator": "^0.14.0",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"concurrently": "^8.2.2",
|
|
49
49
|
"cors": "^2.8.5",
|
|
50
50
|
"cross-env": "^7.0.3",
|
|
51
|
-
"eta": "^3.5.0",
|
|
52
|
-
"gpt-tokenizer": "^3.0.1",
|
|
53
|
-
"open": "^10.1.0",
|
|
54
|
-
"pm2": "^6.0.8",
|
|
55
51
|
"dotenv": "^16.4.5",
|
|
52
|
+
"eta": "^3.5.0",
|
|
56
53
|
"express": "^4.19.2",
|
|
57
54
|
"fs-extra": "^11.2.0",
|
|
58
55
|
"glob": "^10.3.10",
|
|
56
|
+
"gpt-tokenizer": "^3.0.1",
|
|
59
57
|
"jose": "^5.6.3",
|
|
60
58
|
"libphonenumber-js": "^1.12.10",
|
|
59
|
+
"open": "^10.1.0",
|
|
60
|
+
"pm2": "^6.0.8",
|
|
61
61
|
"reflect-metadata": "^0.1.13",
|
|
62
62
|
"rxjs": "^7.8.1",
|
|
63
63
|
"sqlite3": "^5.1.6",
|