easy-devops 1.2.0 → 1.3.0

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 (132) hide show
  1. package/README.md +97 -6
  2. package/dist/ui/assets/index-B6zdwEnG.css +1 -0
  3. package/dist/ui/assets/index-Cy0oNmul.js +442 -0
  4. package/dist/ui/assets/socket-DwLPrgsr.js +1 -0
  5. package/dist/ui/assets/socket-K5ttLD2q.js +65 -0
  6. package/dist/ui/brand/apple-touch-icon.png +0 -0
  7. package/dist/ui/brand/favicon-16.png +0 -0
  8. package/dist/ui/brand/favicon-32.png +0 -0
  9. package/dist/ui/brand/favicon-light-16.png +0 -0
  10. package/dist/ui/brand/favicon-light-32.png +0 -0
  11. package/dist/ui/brand/favicon.ico +0 -0
  12. package/dist/ui/brand/icon-192.png +0 -0
  13. package/dist/ui/brand/icon-48.png +0 -0
  14. package/dist/ui/brand/icon-512.png +0 -0
  15. package/dist/ui/brand/icon-64-light.png +0 -0
  16. package/dist/ui/brand/icon-64.png +0 -0
  17. package/dist/ui/brand/logo-dark.png +0 -0
  18. package/dist/ui/brand/logo-light.png +0 -0
  19. package/dist/ui/brand/mark-dark.png +0 -0
  20. package/dist/ui/brand/mark-light.png +0 -0
  21. package/dist/ui/index.html +71 -0
  22. package/install.ps1 +188 -1
  23. package/install.sh +254 -29
  24. package/package.json +17 -5
  25. package/src/cli/dash.js +110 -0
  26. package/src/cli/index.js +237 -106
  27. package/src/cli/managers/domain-manager.js +60 -40
  28. package/src/cli/managers/ssl-manager.js +47 -330
  29. package/src/cli/menu.js +156 -0
  30. package/src/cli/menus/cleanup.js +205 -0
  31. package/src/cli/menus/dashboard.js +93 -2
  32. package/src/cli/menus/runtime.js +236 -0
  33. package/src/cli/menus/service.js +764 -0
  34. package/src/cli/menus/settings.js +176 -8
  35. package/src/cli/menus/uninstall.js +167 -0
  36. package/src/cli/menus/update.js +221 -65
  37. package/src/core/acme-challenge.js +273 -0
  38. package/src/core/cert-operations.js +189 -0
  39. package/src/{dashboard/lib → core}/cert-reader.js +2 -2
  40. package/src/core/cert-renewal.js +494 -0
  41. package/src/core/channels/discord.js +77 -0
  42. package/src/core/channels/telegram.js +120 -0
  43. package/src/core/cleanup.js +600 -0
  44. package/src/core/config.js +169 -2
  45. package/src/core/daemon/ipc.js +292 -0
  46. package/src/core/daemon/lock.js +294 -0
  47. package/src/core/daemon/run.js +241 -0
  48. package/src/core/daemon/stopRequest.js +162 -0
  49. package/src/core/db.js +44 -8
  50. package/src/core/deploy/apps.js +491 -0
  51. package/src/core/deploy/domainLink.js +200 -0
  52. package/src/core/deploy/engine.js +973 -0
  53. package/src/core/deploy/ezfile.js +361 -0
  54. package/src/core/deploy/github.js +239 -0
  55. package/src/core/deploy/githubApi.js +261 -0
  56. package/src/core/deploy/hookServer.js +325 -0
  57. package/src/core/deploy/hubCommands.js +267 -0
  58. package/src/core/deploy/launcher.js +57 -0
  59. package/src/core/deploy/status.js +91 -0
  60. package/src/core/deploy/store.js +398 -0
  61. package/src/core/domainNotifier.js +364 -0
  62. package/src/core/domains-db.js +234 -0
  63. package/src/core/events.js +222 -0
  64. package/src/core/hub/agent.js +842 -0
  65. package/src/core/hubLink.js +306 -0
  66. package/src/core/hubPermissions.js +430 -0
  67. package/src/core/installSource.js +162 -0
  68. package/src/core/jobs/bus.js +120 -0
  69. package/src/core/jobs/index.js +371 -0
  70. package/src/core/jobs/monitors.js +368 -0
  71. package/src/core/jobs/owner.js +217 -0
  72. package/src/core/jobs/revisionWatcher.js +106 -0
  73. package/src/core/nginx-apply.js +213 -0
  74. package/src/core/nginx-conf-generator.js +253 -17
  75. package/src/{dashboard/lib → core}/nginx-service.js +18 -9
  76. package/src/core/notifications/claim.js +214 -0
  77. package/src/core/notifications/dispatch.js +154 -0
  78. package/src/core/notifier.js +103 -0
  79. package/src/core/passwords.js +172 -0
  80. package/src/core/permissions.js +8 -4
  81. package/src/core/platform.js +709 -2
  82. package/src/core/probeCache.js +258 -0
  83. package/src/core/purge.js +372 -0
  84. package/src/core/runner.js +488 -0
  85. package/src/core/service/acl.js +226 -0
  86. package/src/core/service/dataDir.js +345 -0
  87. package/src/core/service/index.js +1128 -0
  88. package/src/core/service/legacy.js +218 -0
  89. package/src/core/service/runtime.js +446 -0
  90. package/src/core/service/runtimeUpdate.js +800 -0
  91. package/src/core/service/systemd.js +458 -0
  92. package/src/core/service/windowsPersonal.js +530 -0
  93. package/src/core/service/windowsService.js +576 -0
  94. package/src/core/service/winsw.js +260 -0
  95. package/src/core/setupCode.js +331 -0
  96. package/src/core/shell.js +128 -13
  97. package/src/core/ssl-issuer.js +627 -0
  98. package/src/core/updater.js +295 -0
  99. package/src/core/validators.js +99 -0
  100. package/src/dashboard/controllers/authController.js +316 -0
  101. package/src/dashboard/controllers/deploymentsController.js +479 -0
  102. package/src/dashboard/controllers/domainsController.js +403 -0
  103. package/src/dashboard/controllers/hubController.js +135 -0
  104. package/src/dashboard/controllers/nginxController.js +146 -0
  105. package/src/dashboard/controllers/processesController.js +368 -0
  106. package/src/dashboard/controllers/settingsController.js +503 -0
  107. package/src/dashboard/controllers/sslController.js +452 -0
  108. package/src/dashboard/lib/daemonBridge.js +163 -0
  109. package/src/dashboard/lib/localRequest.js +235 -0
  110. package/src/dashboard/lib/loginRateLimit.js +119 -0
  111. package/src/dashboard/lib/requireAuth.js +80 -0
  112. package/src/dashboard/public/img/icon.png +0 -0
  113. package/src/dashboard/public/img/icon_b.png +0 -0
  114. package/src/dashboard/public/js/app.js +595 -19
  115. package/src/dashboard/routes/auth.js +14 -33
  116. package/src/dashboard/routes/deployments.js +46 -0
  117. package/src/dashboard/routes/domains.js +20 -363
  118. package/src/dashboard/routes/hub.js +22 -0
  119. package/src/dashboard/routes/nginx.js +22 -146
  120. package/src/dashboard/routes/processes.js +29 -0
  121. package/src/dashboard/routes/settings.js +25 -232
  122. package/src/dashboard/routes/ssl.js +18 -276
  123. package/src/dashboard/server.js +279 -165
  124. package/src/dashboard/socketManager.js +246 -0
  125. package/src/dashboard/views/index.ejs +1 -0
  126. package/src/dashboard/views/partials/domain-form.ejs +64 -1
  127. package/src/dashboard/views/partials/login.ejs +69 -8
  128. package/src/dashboard/views/partials/processes-panel.ejs +261 -0
  129. package/src/dashboard/views/partials/settings-panel.ejs +549 -118
  130. package/src/dashboard/views/partials/sidebar.ejs +3 -1
  131. package/src/dashboard/lib/domains-db.js +0 -51
  132. /package/src/{dashboard/routes → core/channels}/.gitkeep +0 -0
@@ -1,151 +1,27 @@
1
1
  import express from 'express';
2
- import {
3
- getStatus,
4
- reload,
5
- restart,
6
- start,
7
- stop,
8
- test,
9
- listConfigs,
10
- getConfig,
11
- saveConfig,
12
- getLogs,
13
- NginxNotFoundError,
14
- NginxConfigError,
15
- InvalidFilenameError,
16
- } from '../lib/nginx-service.js';
2
+ import NginxController from '../controllers/nginxController.js';
3
+ import { requireAuth } from '../lib/requireAuth.js';
17
4
 
18
5
  const router = express.Router();
19
-
20
- // ─── Error Handler Helper ─────────────────────────────────────────────────────
21
-
22
- function handleError(err, res) {
23
- if (err instanceof NginxNotFoundError) {
24
- return res.status(503).json({ error: 'nginx not installed' });
25
- }
26
- if (err instanceof NginxConfigError) {
27
- return res.status(400).json({ success: false, output: err.output });
28
- }
29
- if (err instanceof InvalidFilenameError) {
30
- return res.status(400).json({ error: 'Invalid filename' });
31
- }
32
- if (err.code === 'ENOENT') {
33
- return res.status(404).json({ error: 'Config file not found' });
34
- }
35
- return res.status(500).json({ error: 'Internal server error' });
36
- }
37
-
38
- // ─── US1: GET /api/nginx/status ───────────────────────────────────────────────
39
-
40
- router.get('/status', async (req, res) => {
41
- try {
42
- const status = await getStatus();
43
- res.json(status);
44
- } catch (err) {
45
- handleError(err, res);
46
- }
47
- });
48
-
49
- // ─── US2: POST /api/nginx/reload ─────────────────────────────────────────────
50
-
51
- router.post('/reload', async (req, res) => {
52
- try {
53
- const result = await reload();
54
- res.json(result);
55
- } catch (err) {
56
- handleError(err, res);
57
- }
58
- });
59
-
60
- // ─── US2: POST /api/nginx/restart ────────────────────────────────────────────
61
-
62
- router.post('/restart', async (req, res) => {
63
- try {
64
- const result = await restart();
65
- res.json(result);
66
- } catch (err) {
67
- handleError(err, res);
68
- }
69
- });
70
-
71
- // ─── US1: POST /api/nginx/start ──────────────────────────────────────────────
72
-
73
- router.post('/start', async (req, res) => {
74
- try {
75
- const result = await start();
76
- res.json(result);
77
- } catch (err) {
78
- handleError(err, res);
79
- }
80
- });
81
-
82
- // ─── US1: POST /api/nginx/stop ───────────────────────────────────────────────
83
-
84
- router.post('/stop', async (req, res) => {
85
- try {
86
- const result = await stop();
87
- res.json(result);
88
- } catch (err) {
89
- handleError(err, res);
90
- }
91
- });
92
-
93
- // ─── US3: POST /api/nginx/test ───────────────────────────────────────────────
94
-
95
- router.post('/test', async (req, res) => {
96
- try {
97
- const result = await test();
98
- res.json(result);
99
- } catch (err) {
100
- handleError(err, res);
101
- }
102
- });
103
-
104
- // ─── US4: GET /api/nginx/configs ─────────────────────────────────────────────
105
-
106
- router.get('/configs', async (req, res) => {
107
- try {
108
- const configs = await listConfigs();
109
- res.json(configs);
110
- } catch (err) {
111
- handleError(err, res);
112
- }
113
- });
114
-
115
- // ─── US4: GET /api/nginx/config/:filename ────────────────────────────────────
116
-
117
- router.get('/config/:filename', async (req, res) => {
118
- try {
119
- const result = await getConfig(req.params.filename);
120
- res.json(result);
121
- } catch (err) {
122
- handleError(err, res);
123
- }
124
- });
125
-
126
- // ─── US4: POST /api/nginx/config/:filename ───────────────────────────────────
127
-
128
- router.post('/config/:filename', async (req, res) => {
129
- if (typeof req.body.content !== 'string') {
130
- return res.status(400).json({ error: 'content must be a string' });
131
- }
132
- try {
133
- const result = await saveConfig(req.params.filename, req.body.content);
134
- res.json(result);
135
- } catch (err) {
136
- handleError(err, res);
137
- }
138
- });
139
-
140
- // ─── US5: GET /api/nginx/logs ────────────────────────────────────────────────
141
-
142
- router.get('/logs', async (req, res) => {
143
- try {
144
- const result = await getLogs(100);
145
- res.json(result);
146
- } catch (err) {
147
- handleError(err, res);
148
- }
149
- });
6
+ const controller = new NginxController();
7
+
8
+ /**
9
+ * Every route below requires a dashboard session. See lib/requireAuth.js —
10
+ * this is the single gate, and removing it exposes these endpoints to anyone
11
+ * who can reach the dashboard port.
12
+ */
13
+ router.use(requireAuth);
14
+
15
+
16
+ router.get('/status', (req, res, next) => controller.status(req, res, next));
17
+ router.post('/reload', (req, res, next) => controller.reload(req, res, next));
18
+ router.post('/restart', (req, res, next) => controller.restart(req, res, next));
19
+ router.post('/start', (req, res, next) => controller.start(req, res, next));
20
+ router.post('/stop', (req, res, next) => controller.stop(req, res, next));
21
+ router.post('/test', (req, res, next) => controller.test(req, res, next));
22
+ router.get('/configs', (req, res, next) => controller.listConfigs(req, res, next));
23
+ router.get('/config/:filename', (req, res, next) => controller.getConfig(req, res, next));
24
+ router.post('/config/:filename', (req, res, next) => controller.saveConfig(req, res, next));
25
+ router.get('/logs', (req, res, next) => controller.getLogs(req, res, next));
150
26
 
151
27
  export default router;
@@ -0,0 +1,29 @@
1
+ import express from 'express';
2
+ import ProcessesController from '../controllers/processesController.js';
3
+ import { requireAuth } from '../lib/requireAuth.js';
4
+
5
+ const router = express.Router();
6
+ const controller = new ProcessesController();
7
+
8
+ /**
9
+ * These routes can start and stop processes, so they are behind the shared
10
+ * session gate. Do not remove it: without it, anything that can reach the
11
+ * dashboard port could control PM2.
12
+ */
13
+ router.use(requireAuth);
14
+
15
+ // Service status and lifecycle come first so they are not shadowed by /:name.
16
+ //
17
+ // All of them sit behind requireAuth above, exactly like every other route:
18
+ // starting and stopping the background service is as privileged as anything
19
+ // else the dashboard can do.
20
+ router.get('/service', (req, res) => controller.status(req, res));
21
+ router.post('/service/start', (req, res) => controller.start(req, res));
22
+ router.post('/service/stop', (req, res) => controller.stop(req, res));
23
+ router.post('/service/restart', (req, res) => controller.restart(req, res));
24
+
25
+ router.get('/processes', (req, res) => controller.list(req, res));
26
+ router.get('/processes/:name/logs', (req, res) => controller.logs(req, res));
27
+ router.post('/processes/:name/:action', (req, res) => controller.action(req, res));
28
+
29
+ export default router;
@@ -1,237 +1,30 @@
1
1
  import express from 'express';
2
- import { spawn } from 'child_process';
3
- import fs from 'fs/promises';
4
- import path from 'path';
5
- import os from 'os';
6
- import { loadConfig, saveConfig } from '../../core/config.js';
7
- import { validatePort, validateEmail } from '../../core/validators.js';
8
- import { run } from '../../core/shell.js';
9
- import { checkPermissionsConfigured } from '../../core/permissions.js';
10
- import { dbGet, dbSet } from '../../core/db.js';
11
-
12
- // Run a bash command with sudo -S (password read from stdin — no terminal needed)
13
- function runSudoS(bashCmd, password) {
14
- return new Promise((resolve) => {
15
- const child = spawn('sudo', ['-S', 'bash', '-c', bashCmd], {
16
- stdio: ['pipe', 'pipe', 'pipe'],
17
- });
18
- let stdout = '', stderr = '';
19
- child.stdout.on('data', d => { stdout += d; });
20
- child.stderr.on('data', d => { stderr += d; });
21
- child.stdin.write(password + '\n');
22
- child.stdin.end();
23
- child.on('close', code => resolve({ success: code === 0, stdout: stdout.trim(), stderr: stderr.trim() }));
24
- child.on('error', err => resolve({ success: false, stdout: '', stderr: err.message }));
25
- });
26
- }
2
+ import SettingsController from '../controllers/settingsController.js';
3
+ import { requireAuth } from '../lib/requireAuth.js';
27
4
 
28
5
  const router = express.Router();
29
-
30
- // ─── GET /api/settings ─────────────────────────────────────────────────────
31
-
32
- router.get('/settings', (req, res) => {
33
- try {
34
- const config = loadConfig();
35
- // Never return the password (write-only field)
36
- const { dashboardPort, nginxDir, sslDir, acmeEmail } = config;
37
- res.json({
38
- dashboardPort,
39
- nginxDir,
40
- sslDir,
41
- acmeEmail,
42
- platform: process.platform === 'win32' ? 'win32' : 'linux',
43
- });
44
- } catch (err) {
45
- res.status(500).json({ error: 'Internal server error' });
46
- }
47
- });
48
-
49
- // ─── POST /api/settings ────────────────────────────────────────────────────
50
-
51
- router.post('/settings', (req, res) => {
52
- try {
53
- const { dashboardPort, dashboardPassword, nginxDir, sslDir, acmeEmail } = req.body;
54
-
55
- // Validate port if provided
56
- if (dashboardPort !== undefined) {
57
- const portError = validatePort(parseInt(dashboardPort, 10));
58
- if (portError) return res.status(400).json({ error: portError });
59
- }
60
-
61
- // Validate password if provided
62
- if (dashboardPassword !== undefined && typeof dashboardPassword !== 'string') {
63
- return res.status(400).json({ error: 'Password must be a string' });
64
- }
65
-
66
- // Validate directories if provided
67
- if (nginxDir !== undefined && (typeof nginxDir !== 'string' || nginxDir.trim() === '')) {
68
- return res.status(400).json({ error: 'Nginx directory must be a non-empty string' });
69
- }
70
- if (sslDir !== undefined && (typeof sslDir !== 'string' || sslDir.trim() === '')) {
71
- return res.status(400).json({ error: 'SSL directory must be a non-empty string' });
72
- }
73
-
74
- // Validate email if provided
75
- if (acmeEmail !== undefined) {
76
- const emailError = validateEmail(acmeEmail);
77
- if (emailError) return res.status(400).json({ error: emailError });
78
- }
79
-
80
- // Load current config and merge updates
81
- const currentConfig = loadConfig();
82
- const updates = {};
83
-
84
- if (dashboardPort !== undefined) {
85
- updates.dashboardPort = parseInt(dashboardPort, 10);
86
- }
87
- if (dashboardPassword !== undefined) {
88
- updates.dashboardPassword = dashboardPassword;
89
- }
90
- if (nginxDir !== undefined) {
91
- updates.nginxDir = nginxDir.trim();
92
- }
93
- if (sslDir !== undefined) {
94
- updates.sslDir = sslDir.trim();
95
- }
96
- if (acmeEmail !== undefined) {
97
- updates.acmeEmail = acmeEmail.trim();
98
- }
99
-
100
- const newConfig = { ...currentConfig, ...updates };
101
- saveConfig(newConfig);
102
-
103
- res.json({ success: true });
104
- } catch (err) {
105
- res.status(500).json({ error: 'Internal server error' });
106
- }
107
- });
108
-
109
- // ─── GET /api/settings/permissions ────────────────────────────────────────────
110
-
111
- router.get('/settings/permissions', async (req, res) => {
112
- if (process.platform === 'win32') return res.json({ configured: true });
113
- try {
114
- const configured = await checkPermissionsConfigured();
115
- res.json({ configured });
116
- } catch {
117
- res.json({ configured: false });
118
- }
119
- });
120
-
121
- // ─── POST /api/settings/permissions/setup ─────────────────────────────────────
122
-
123
- router.post('/settings/permissions/setup', async (req, res) => {
124
- if (process.platform === 'win32') {
125
- return res.status(400).json({ error: 'Not applicable on Windows' });
126
- }
127
-
128
- const { password } = req.body ?? {};
129
- if (!password || typeof password !== 'string') {
130
- return res.status(400).json({ error: 'Password is required' });
131
- }
132
-
133
- // Resolve nginx binary path
134
- const whichResult = await run('which nginx');
135
- if (!whichResult.success || !whichResult.stdout.trim()) {
136
- return res.status(500).json({ error: 'nginx not found. Is nginx installed?' });
137
- }
138
- const nginxPath = whichResult.stdout.trim().split('\n')[0].trim();
139
- const user = os.userInfo().username;
140
-
141
- // Build sudoers rules with the detected nginx path
142
- const sudoRules = [
143
- '/usr/bin/systemctl start nginx',
144
- '/usr/bin/systemctl stop nginx',
145
- '/usr/bin/systemctl reload nginx',
146
- '/usr/bin/systemctl restart nginx',
147
- '/usr/bin/systemctl',
148
- nginxPath,
149
- `${nginxPath} -t`,
150
- `${nginxPath} -s reload`,
151
- `${nginxPath} -s stop`,
152
- `${nginxPath} -s quit`,
153
- '/usr/bin/certbot',
154
- '/usr/bin/mkdir',
155
- '/usr/bin/cp',
156
- '/usr/bin/chmod',
157
- '/usr/bin/chown',
158
- '/usr/bin/tee',
159
- ].join(', ');
160
-
161
- const sudoersContent = `${user} ALL=(ALL) NOPASSWD: ${sudoRules}\n`;
162
-
163
- // Write content to a temp file (no sudo needed for /tmp)
164
- const tmpFile = path.join('/tmp', `easy-devops-sudoers-${Date.now()}`);
165
- try {
166
- await fs.writeFile(tmpFile, sudoersContent, { mode: 0o600 });
167
- } catch (err) {
168
- return res.status(500).json({ error: 'Failed to write temp file', output: err.message });
169
- }
170
-
171
- // Run all setup steps in a single sudo -S invocation
172
- const setupCmd = [
173
- `mkdir -p /etc/easy-devops /var/log/easy-devops`,
174
- `chown ${user}:${user} /etc/easy-devops /var/log/easy-devops`,
175
- `chown -R ${user}:${user} /etc/nginx/conf.d 2>/dev/null || true`,
176
- `cp '${tmpFile}' /etc/sudoers.d/easy-devops`,
177
- `chmod 440 /etc/sudoers.d/easy-devops`,
178
- ].join(' && ');
179
-
180
- const result = await runSudoS(setupCmd, password);
181
- await fs.unlink(tmpFile).catch(() => {});
182
-
183
- if (!result.success) {
184
- const output = result.stderr || result.stdout;
185
- const wrongPassword = output.includes('incorrect password') || output.includes('Sorry, try again') || output.includes('3 incorrect');
186
- return res.status(wrongPassword ? 401 : 500).json({
187
- error: wrongPassword ? 'Incorrect password' : 'Setup failed',
188
- output,
189
- });
190
- }
191
-
192
- res.json({ success: true });
193
- });
194
-
195
- // ─── GET /api/settings/backup ──────────────────────────────────────────────────
196
-
197
- router.get('/settings/backup', (req, res) => {
198
- try {
199
- const config = loadConfig();
200
- const domains = dbGet('domains') || [];
201
- const { dashboardPassword: _pw, ...safeConfig } = config; // exclude password from export
202
- const backup = {
203
- version: 1,
204
- exportedAt: new Date().toISOString(),
205
- config: safeConfig,
206
- domains,
207
- };
208
- res.setHeader('Content-Disposition', `attachment; filename="easy-devops-backup-${Date.now()}.json"`);
209
- res.setHeader('Content-Type', 'application/json');
210
- res.json(backup);
211
- } catch (err) {
212
- res.status(500).json({ error: 'Export failed' });
213
- }
214
- });
215
-
216
- // ─── POST /api/settings/restore ────────────────────────────────────────────────
217
-
218
- router.post('/settings/restore', (req, res) => {
219
- try {
220
- const { config, domains } = req.body ?? {};
221
- if (!config || typeof config !== 'object') {
222
- return res.status(400).json({ error: 'Invalid backup: missing config' });
223
- }
224
- // Merge imported config with current (preserve password, merge rest)
225
- const current = loadConfig();
226
- const merged = { ...current, ...config, dashboardPassword: current.dashboardPassword };
227
- saveConfig(merged);
228
- if (Array.isArray(domains)) {
229
- dbSet('domains', domains);
230
- }
231
- res.json({ success: true });
232
- } catch (err) {
233
- res.status(500).json({ error: 'Restore failed' });
234
- }
235
- });
6
+ const controller = new SettingsController();
7
+
8
+ /**
9
+ * Every route below requires a dashboard session. See lib/requireAuth.js —
10
+ * this is the single gate, and removing it exposes these endpoints to anyone
11
+ * who can reach the dashboard port.
12
+ */
13
+ router.use(requireAuth);
14
+
15
+
16
+ router.get('/settings', (req, res, next) => controller.get(req, res, next));
17
+ router.post('/settings', (req, res, next) => controller.update(req, res, next));
18
+ router.get('/settings/permissions', (req, res, next) => controller.getPermissions(req, res, next));
19
+ router.post('/settings/permissions/setup', (req, res, next) => controller.setupPermissions(req, res, next));
20
+ router.get('/settings/backup', (req, res, next) => controller.backup(req, res, next));
21
+ router.post('/settings/restore', (req, res, next) => controller.restore(req, res, next));
22
+
23
+ // Notification channel CRUD
24
+ router.get('/settings/channels', (req, res, next) => controller.getChannels(req, res, next));
25
+ router.post('/settings/channels', (req, res, next) => controller.createChannel(req, res, next));
26
+ router.put('/settings/channels/:id', (req, res, next) => controller.updateChannel(req, res, next));
27
+ router.delete('/settings/channels/:id', (req, res, next) => controller.deleteChannel(req, res, next));
28
+ router.post('/settings/channels/:id/test', (req, res, next) => controller.testChannel(req, res, next));
236
29
 
237
30
  export default router;