Fix nginx/certificates search query

This commit is contained in:
Ivan Kristianto 2022-02-12 12:46:06 +07:00
parent 29c0fcbad6
commit 366fcf0bed

View File

@ -388,7 +388,7 @@ const internalCertificate = {
zipFiles(source, out) { zipFiles(source, out) {
const archive = archiver('zip', { zlib: { level: 9 } }); const archive = archiver('zip', { zlib: { level: 9 } });
const stream = fs.createWriteStream(out); const stream = fs.createWriteStream(out);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
source source
.map((fl) => { .map((fl) => {
@ -399,7 +399,7 @@ const internalCertificate = {
archive archive
.on('error', (err) => reject(err)) .on('error', (err) => reject(err))
.pipe(stream); .pipe(stream);
stream.on('close', () => resolve()); stream.on('close', () => resolve());
archive.finalize(); archive.finalize();
}); });
@ -477,7 +477,7 @@ const internalCertificate = {
// Query is used for searching // Query is used for searching
if (typeof search_query === 'string') { if (typeof search_query === 'string') {
query.where(function () { query.where(function () {
this.where('name', 'like', '%' + search_query + '%'); this.where('nice_name', 'like', '%' + search_query + '%');
}); });
} }
@ -1140,7 +1140,7 @@ const internalCertificate = {
if (domains.length === 0) { if (domains.length === 0) {
throw new error.InternalValidationError('No domains provided'); throw new error.InternalValidationError('No domains provided');
} }
// Create a test challenge file // Create a test challenge file
const testChallengeDir = '/data/letsencrypt-acme-challenge/.well-known/acme-challenge'; const testChallengeDir = '/data/letsencrypt-acme-challenge/.well-known/acme-challenge';
const testChallengeFile = testChallengeDir + '/test-challenge'; const testChallengeFile = testChallengeDir + '/test-challenge';
@ -1215,7 +1215,7 @@ const internalCertificate = {
// Remove the test challenge file // Remove the test challenge file
fs.unlinkSync(testChallengeFile); fs.unlinkSync(testChallengeFile);
return results; return results;
} }
}; };