Phase 1: Add ESLint/Prettier config + baseline auto-fixes
This commit is contained in:
@@ -113,7 +113,7 @@ module.exports = function(ctx) {
|
||||
const zone = parts.slice(1).join('.') || ctx.siteConfig.tld.replace(/^\./, '');
|
||||
|
||||
const result = await ctx.dns.call(dnsServer, '/api/zones/records/add', {
|
||||
token: dnsToken, domain, zone, type: 'A', ipAddress: ip, ttl: recordTtl.toString(), overwrite: 'true'
|
||||
token: dnsToken, domain, zone, type: 'A', ipAddress: ip, ttl: recordTtl.toString(), overwrite: 'true',
|
||||
});
|
||||
|
||||
if (result.status === 'ok') {
|
||||
@@ -151,7 +151,7 @@ module.exports = function(ctx) {
|
||||
|
||||
try {
|
||||
const result = await ctx.dns.call(dnsServer, '/api/zones/records/get', {
|
||||
token: dnsToken, domain, zone: ctx.siteConfig.tld.replace(/^\./, ''), listZone: 'true'
|
||||
token: dnsToken, domain, zone: ctx.siteConfig.tld.replace(/^\./, ''), listZone: 'true',
|
||||
});
|
||||
|
||||
if (result.status === 'ok' && result.response && result.response.records) {
|
||||
@@ -218,7 +218,7 @@ module.exports = function(ctx) {
|
||||
const response = await ctx.fetchT(technitiumUrl, {
|
||||
method: 'GET',
|
||||
headers: { 'Accept': 'text/plain' },
|
||||
timeout: 10000
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -232,7 +232,7 @@ module.exports = function(ctx) {
|
||||
server: server,
|
||||
count: 0,
|
||||
logs: [],
|
||||
message: 'No logs available for this server'
|
||||
message: 'No logs available for this server',
|
||||
});
|
||||
}
|
||||
return ctx.errorResponse(res, response.status, ctx.safeErrorMessage(errorJson.errorMessage || errorText));
|
||||
@@ -255,7 +255,7 @@ module.exports = function(ctx) {
|
||||
server: server,
|
||||
count: 0,
|
||||
logs: [],
|
||||
message: 'No logs available for this server'
|
||||
message: 'No logs available for this server',
|
||||
});
|
||||
}
|
||||
// Invalidate cached token on auth errors so next request re-authenticates
|
||||
@@ -287,7 +287,7 @@ module.exports = function(ctx) {
|
||||
class: match[6].trim(),
|
||||
rcode: match[7].trim(),
|
||||
answer: match[8].trim() || null,
|
||||
raw: line
|
||||
raw: line,
|
||||
};
|
||||
}
|
||||
return { raw: line, parsed: false };
|
||||
@@ -299,7 +299,7 @@ module.exports = function(ctx) {
|
||||
server: server,
|
||||
logFile: logFileName,
|
||||
count: parsedLogs.length,
|
||||
logs: parsedLogs
|
||||
logs: parsedLogs,
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
@@ -319,7 +319,7 @@ module.exports = function(ctx) {
|
||||
hasCredentials,
|
||||
hasToken,
|
||||
tokenExpiry: ctx.dns.getTokenExpiry(),
|
||||
isExpired: ctx.dns.getTokenExpiry() ? new Date() > new Date(ctx.dns.getTokenExpiry()) : null
|
||||
isExpired: ctx.dns.getTokenExpiry() ? new Date() > new Date(ctx.dns.getTokenExpiry()) : null,
|
||||
});
|
||||
}, 'dns-token-status'));
|
||||
|
||||
@@ -394,7 +394,7 @@ module.exports = function(ctx) {
|
||||
return res.json({
|
||||
success: anySuccess,
|
||||
message: anySuccess ? 'Credentials saved for one or more servers' : 'All server credential tests failed',
|
||||
results
|
||||
results,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ module.exports = function(ctx) {
|
||||
res.json({
|
||||
success: true,
|
||||
message: 'DNS credentials saved and verified (encrypted)',
|
||||
tokenExpiry: ctx.dns.getTokenExpiry()
|
||||
tokenExpiry: ctx.dns.getTokenExpiry(),
|
||||
});
|
||||
}, 'dns-credentials'));
|
||||
|
||||
@@ -495,7 +495,7 @@ module.exports = function(ctx) {
|
||||
res.json({
|
||||
success: true,
|
||||
message: 'Token refreshed successfully',
|
||||
tokenExpiry: ctx.dns.getTokenExpiry()
|
||||
tokenExpiry: ctx.dns.getTokenExpiry(),
|
||||
});
|
||||
} else {
|
||||
ctx.errorResponse(res, 401, result.error);
|
||||
@@ -529,8 +529,8 @@ module.exports = function(ctx) {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': APP.USER_AGENTS.API
|
||||
}
|
||||
'User-Agent': APP.USER_AGENTS.API,
|
||||
},
|
||||
});
|
||||
|
||||
const text = await response.text();
|
||||
@@ -550,7 +550,7 @@ module.exports = function(ctx) {
|
||||
updateTitle: result.response.updateTitle || null,
|
||||
updateMessage: result.response.updateMessage || null,
|
||||
downloadLink: result.response.downloadLink || null,
|
||||
instructionsLink: result.response.instructionsLink || null
|
||||
instructionsLink: result.response.instructionsLink || null,
|
||||
});
|
||||
} else {
|
||||
ctx.errorResponse(res, 500, result.errorMessage || 'Check failed');
|
||||
@@ -586,7 +586,7 @@ module.exports = function(ctx) {
|
||||
// Check if update is available
|
||||
const checkResponse = await ctx.fetchT(
|
||||
`http://${serverIp}:${dnsPort}/api/user/checkForUpdate?token=${encodeURIComponent(tokenResult.token)}`,
|
||||
{ method: 'GET', headers: { 'Accept': 'application/json' } }
|
||||
{ method: 'GET', headers: { 'Accept': 'application/json' } },
|
||||
);
|
||||
|
||||
const checkText = await checkResponse.text();
|
||||
@@ -604,7 +604,7 @@ module.exports = function(ctx) {
|
||||
success: true,
|
||||
message: 'Already up to date',
|
||||
currentVersion: checkResult.response.currentVersion,
|
||||
updated: false
|
||||
updated: false,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ module.exports = function(ctx) {
|
||||
downloadLink: checkResult.response.downloadLink || null,
|
||||
instructionsLink: checkResult.response.instructionsLink || null,
|
||||
updated: false,
|
||||
manualUpdateRequired: true
|
||||
manualUpdateRequired: true,
|
||||
});
|
||||
} catch (error) {
|
||||
ctx.log.error('dns', 'DNS update error', { error: error.message });
|
||||
|
||||
Reference in New Issue
Block a user