mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-05 14:35:35 +00:00
Fix updating the server URL in the dashboard not updatinng.
This commit is contained in:
@@ -39,8 +39,9 @@ async function triggerCrontabUpdates() {
|
|||||||
// The agent will detect this and run update-crontab command
|
// The agent will detect this and run update-crontab command
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
|
|
||||||
const serverUrl = process.env.SERVER_URL || 'http://localhost:3001';
|
const settings = await prisma.settings.findFirst();
|
||||||
|
const serverUrl = settings?.server_url || process.env.SERVER_URL || 'http://localhost:3001';
|
||||||
const url = new URL(`${serverUrl}/api/v1/hosts/ping`);
|
const url = new URL(`${serverUrl}/api/v1/hosts/ping`);
|
||||||
const isHttps = url.protocol === 'https:';
|
const isHttps = url.protocol === 'https:';
|
||||||
const client = isHttps ? https : http;
|
const client = isHttps ? https : http;
|
||||||
|
|||||||
@@ -168,12 +168,12 @@ router.get('/check-updates', authenticateToken, requireManageSettings, async (re
|
|||||||
latestVersion,
|
latestVersion,
|
||||||
isUpdateAvailable,
|
isUpdateAvailable,
|
||||||
lastUpdateCheck,
|
lastUpdateCheck,
|
||||||
repositoryType: settings.repo_type || 'public',
|
repositoryType: settings.repository_type || 'public',
|
||||||
latestRelease: {
|
latestRelease: {
|
||||||
tagName: latestVersion ? `v${latestVersion}` : null,
|
tagName: latestVersion ? `v${latestVersion}` : null,
|
||||||
version: latestVersion,
|
version: latestVersion,
|
||||||
repository: settings.github_repo_url ? settings.githubRepoUrl.split('/').slice(-2).join('/') : null,
|
repository: settings.github_repo_url ? settings.github_repo_url.split('/').slice(-2).join('/') : null,
|
||||||
accessMethod: settings.repo_type === 'private' ? 'ssh' : 'api'
|
accessMethod: settings.repository_type === 'private' ? 'ssh' : 'api'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user